
////////////////////////////////////////////////////////////////
// * FunÃ§Ãµes de swap image
///////////////////////////////////////////////////////////////
function trocaImgVoltar() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function PreCarregarImagens() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=PreCarregarImagens.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function ProcurarObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=ProcurarObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function trocarImagem() { //v3.0
  var i,j=0,x,a=trocarImagem.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=ProcurarObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function carrinhoAtualiza(id,qtde,origem) {
	//alert(id +" - "+ qtde);
	window.location='../app/CarrinhoAtualiza.php?id_prod='+id+'&qtde='+qtde+'&origem='+origem;
}
function carrinhoFilme(id,qtde,origem) {
	//alert(id +" - "+ qtde);
	window.location='../app/CarrinhoFilme.php?id_prod='+id+'&qtde='+qtde+'&origem='+origem;
}
  function limpaCarrinho(origem){
     
	 window.location='../app/limpasessao.php?origem='+origem; 
	 
  }

function number_format( number, decimals, dec_point, thousands_sep ) {
    // http://kevin.vanzonneveld.net
    // +   original by: Jonas Raoni Soares Silva (http://www.jsfromhell.com)
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +     bugfix by: Michael White (http://crestidg.com)
    // +     bugfix by: Benjamin Lupton
    // +     bugfix by: Allan Jensen (http://www.winternet.no)
    // +    revised by: Jonas Raoni Soares Silva (http://www.jsfromhell.com)
    // +     bugfix by: Howard Yeend
    // *     example 1: number_format(1234.5678, 2, '.', '');
    // *     returns 1: 1234.57

    var n = number, c = isNaN(decimals = Math.abs(decimals)) ? 2 : decimals;
    var d = dec_point == undefined ? "." : dec_point;
    var t = thousands_sep == undefined ? "," : thousands_sep, s = n < 0 ? "-" : "";
    var i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", j = (j = i.length) > 3 ? j % 3 : 0;

    return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");
}





<!--
// Use 
// OnKeyUp="criaMascara(this, '##.###.###-#');"
// em seu INPUT
  function criaMascara(_RefObjeto, _Modelo){
  
    var valorAtual = _RefObjeto.value;        
    var valorNumerico = '';
    var nIndexModelo = 0;
    var nIndexString = 0;
    var valorFinal = '';
    var adicionarValor = true;
    
     
      // limpa a string valor atual para verificar 
      // se todos os caracteres são números
      for (i=0;i<_Modelo.length;i++){
        if (_Modelo.substr(i,1) != '#'){
          valorAtual = valorAtual.replace(_Modelo.substr(i,1),'');
      }}
      
      // verifica se todos os caracteres são números
      for (i=0;i<valorAtual.length;i++){
        if (!isNaN(parseFloat(valorAtual.substr(i,1)))){
          valorNumerico = valorNumerico + valorAtual.substr(i,1);
      }}
      
      // aplica a máscara ao campo informado usando
      // o modelo de máscara informado no script
      for (i=0;i<_Modelo.length;i++){
        
        if (_Modelo.substr(i,1) == '#'){
          if (valorNumerico.substr(nIndexModelo,1) != ''){
            valorFinal = valorFinal + valorNumerico.substr(nIndexModelo,1);
            nIndexModelo++;nIndexString++;
          } 
            else {
              adicionarValor = false;
        }}
          
          else {
            if (adicionarValor && valorNumerico.substr(nIndexModelo,1) != ''){
            valorFinal = valorFinal + _Modelo.substr(nIndexString,1)
            nIndexString++;
          }}
      }
    
      //alert(valorFinal)
      _RefObjeto.value = valorFinal 

  }
  
var browserName;
var browserVersion;
var browserVersionDecimal = 0;
var browserPlatform;
var tempVersion;

if (navigator.appName.toLowerCase().indexOf("netscape") != -1)
{
    browserName = "NS";
    browserVersion = parseInt(navigator.appVersion.charAt(0));
}
else if (navigator.appName.toLowerCase().indexOf("microsoft") != -1)
{
    browserName = "MSIE";
    tempVersion = parseInt(navigator.appVersion.charAt(0));
    if (tempVersion < 4)
      browserVersion = tempVersion;
    else {
      browserVersion = parseInt(navigator.appVersion.substr((navigator.appVersion.indexOf("MSIE ") + 5),1));
      browserVersionDecimal = parseInt(navigator.appVersion.substr((navigator.appVersion.indexOf("MSIE ") + 7),1));
    }

}
else
{
    browserName = "?";
    browserVersion = parseInt(navigator.appVersion.charAt(0));
}

if ((browserName == "NS") && (browserVersion < 4))
  browserPlatform = "WINDOWS"
else
{
  if (navigator.platform.toLowerCase().indexOf("win") != -1)
      browserPlatform = "WINDOWS";
  else if (navigator.platform.toLowerCase().indexOf("mac") != -1)
      browserPlatform = "MAC";
  else
      browserPlatform = "?";
}






// Função utilizada para validação de CPF e CNPJ
function modulo(str) {

   	soma=0;
   	ind=2;
   	for(pos=str.length-1;pos>-1;pos=pos-1) {
   		soma = soma + (parseInt(str.charAt(pos)) * ind);
   		ind++;
   		if(str.length>11) {
   			if(ind>9) ind=2;
   		}
	}
   	resto = soma - (Math.floor(soma / 11) * 11);
   	if(resto < 2) {
    	return 0
   	}
   	else {
   		return 11 - resto
   	}
}




// Função para validação do CPF
function IsCPF(valor) {
	valor = valor.replace('.','');
	valor = valor.replace('.','');
	valor = valor.replace('-','');

	primeiro=valor.substr(1,1);
	falso=true;
	size=valor.length;
	if (size!=11){
		return false;
	}
	size--;
	for (i=2; i<size-1; ++i){
		proximo=(valor.substr(i,1));
		if (primeiro!=proximo) {
			falso=false
		}
	}
	if (falso){
		return false;
	}
   	if(modulo(valor.substring(0,valor.length - 2)) + "" + modulo(valor.substring(0,valor.length - 1)) != valor.substring(valor.length - 2,valor.length)) {
   		return false;
   	}
   	return true
}




// Função para validação do cnpj
function IsCNPJ(valor) {

	while (valor.indexOf('.')>-1 ) valor = valor.replace('.','');
	while (valor.indexOf('-')>-1 ) valor = valor.replace('-','');
	while (valor.indexOf('/')>-1 ) valor = valor.replace('/','');

	primeiro=valor.substr(1,1);
	falso=true;
	size=valor.length;
	if (size!=14){
		return false;
	}
	size--;
	for (i=2; i<size-1; ++i){
		proximo=(valor.substr(i,1));
		if (primeiro!=proximo) {
			falso=false
		}
	}
	
	if (falso){
		return;
	}
	
   	if(modulo(valor.substring(0,valor.length - 2)) + "" + modulo(valor.substring(0,valor.length - 1)) !=valor.substring(valor.length - 2,valor.length)) {
   		return false;
   	}
   	return true
}




function isEmail(pVal)
{
	var reTipo = /^[\w-]+(\.[\w-]+)*@(([A-Za-z\d][A-Za-z\d-]{0,61}[A-Za-z\d]\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/;
	return reTipo.test(pVal);
}




function IsNumeric(pNum){

	if (pNum==''){
		return false;
	}
	for (var i = 0; i < pNum.length; i++){
		var ch = pNum.substring(i, i + 1);
		if (ch < '0' || '9' < ch){
			return false;
		}
	}
	return true;
}





// return the value of the radio button that is checked
// return an empty string if none are checked, or
// there are no radio buttons
function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}

// set the radio button with the given value as being checked
// do nothing if there are no radio buttons
// if the given value does not exist, all the radio buttons
// are reset to unchecked
function setCheckedValue(radioObj, newValue) {
	if(!radioObj)
		return;
	var radioLength = radioObj.length;
	if(radioLength == undefined) {
		radioObj.checked = (radioObj.value == newValue.toString());
		return;
	}
	for(var i = 0; i < radioLength; i++) {
		radioObj[i].checked = false;
		if(radioObj[i].value == newValue.toString()) {
			radioObj[i].checked = true;
		}
	}
}








<!-- Autor: Francisco C Paulino - Tofinha --> 
<!-- Data: 08/11/2002 - 11:55hs --> 
<!-- Script que formata Valores em reais ao digitar --> 
<!-- Início da Função FormataDinheiro --> 
function FormataDinheiro(fld, milSep, decSep, e) { 

	var sep = 0; 
	var key = ''; 
	var i = j = 0; 
	var len = len2 = 0; 
	var strCheck = '0123456789'; 
	var aux = aux2 = ''; 
	if (e != null) {
		var whichCode = (window.Event) ? e.which : e.keyCode; 
		if (whichCode == 13) return true; 
		key = String.fromCharCode(whichCode);// Valor para o código da Chave 
		if (strCheck.indexOf(key) == -1) return false; // Chave inválida 
	}
	len = fld.value.length; 
	for(i = 0; i < len; i++) 
	if ((fld.value.charAt(i) != '0') && (fld.value.charAt(i) != decSep)) break; 
	aux = ''; 
	for(; i < len; i++) 
	if (strCheck.indexOf(fld.value.charAt(i))!=-1) aux += fld.value.charAt(i); 
	aux += key; 
	len = aux.length; 
	if (len == 0) fld.value = ''; 
	if (len == 1) fld.value = '0'+ decSep + '0' + aux; 
	if (len == 2) fld.value = '0'+ decSep + aux; 
	if (len > 2) { 
	aux2 = ''; 
	for (j = 0, i = len - 3; i >= 0; i--) { 
	if (j == 3) { 
	aux2 += milSep; 
	j = 0; 
	} 
	aux2 += aux.charAt(i); 
	j++; 
	} 
	fld.value = ''; 
	len2 = aux2.length; 
	for (i = len2 - 1; i >= 0; i--) 
	fld.value += aux2.charAt(i); 
	fld.value += decSep + aux.substr(len - 2, len); 
	} 
	
	return false; 

} 











