//apagar texto
function eraseBox(obj){
	if (obj.value == 'E-MAIL')
		obj.value='';
}

//recolocar texto quando tira o foco
function changeValue(obj, oldValue, newValue){
	if ( (obj.value.length == 0) || (obj.value == oldValue) )
		obj.value = newValue;
}

// trocar a imagem do movie details
function changeImg( objId, newSrc) {
  window.document.getElementById(objId).src = newSrc;
}

//Procurar pelo filme
function searchMovie() {
  //value = window.document.forms[0].txtSearch.Text;
  value = window.document.forms[0].txtSearch.value;
  window.location.href = "/site/category.aspx?search=" + value;
}

//ShopCart Adicionar item
function scAddItem(itemId) {
  window.location.href = "/site/shopcart.aspx?add=" + itemId;
}

//ShopCart Remover item
function scDelItem(itemId) {
  window.location.href = "/site/shopcart.aspx?del=" + itemId;
}

//Payment verificar Termo
function chkTermClientValidation(source, args) { 
     args.IsValid = document.all["chkTerm"].checked; 
} 

// Abre o popup do Live Support
function openLiveSupport() {
     return openPopUp(453, 307, 'http://chat.fetish4real.com/');
}

// Abre uma popup qualquer
function openPopUp(width, height, url) {
    return window.open(url, removeToken(removeToken(removeToken(url, '/'), ':'), '.'), "topmargin=0, leftmargin=0, marginheight=0, marginwidth=0,status=no, width=" + width + ", height=" + height)
}


function removeToken(s, t) {
  /*
  **  Remove all occurrences of a token in a string
  **    s  string to be processed
  **    t  token to be removed
  **  returns new string
  */
  i = s.indexOf(t);
  r = "";
  if (i == -1) return s;
  r += s.substring(0,i) + removeToken(s.substring(i + t.length), t);
  return r;
  }
