var message="";
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if 
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers) 
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
document.oncontextmenu=new Function("return false")

function checkfrmPgto() {
	selected = "";
	for (i=0;i<document.frmPgto.formaPgto.length;i++) {
		if (document.frmPgto.formaPgto[i].checked)
			selected = document.frmPgto.formaPgto[i].value;
	}
	if (selected=='2')//Cartões Mastercard
		window.alert('\nSeu Mastercard foi emitido no exterior?\n\nEntão é necessário selecionar outra forma de pagamento: Visa, American Express ou depósito bancário.\n\n---\nIs your Mastercard from outside Brazil?\n\nIf so, please, choose other payment method.');
	if (selected=='3')//Cartões Mastercard
		window.alert('\nSeu Dinners foi emitido no exterior?\n\nEntão é necessário selecionar outra forma de pagamento: Visa, American Express ou depósito bancário.\n\n---\nIs your Dinners from outside Brazil?\n\nIf so, please, choose other payment method.');

	/*
	if (selected=='6')
		document.getElementById('parcelasid').style.display='block';
	else
		document.getElementById('parcelasid').style.display='none';
	*/
}

function checkfrmPgto_new() {
	selected = "";
	var radioButton;
	var indice;
	for (i=0;i<document.frmPgto.formaPgto.length;i++) {
		if (document.frmPgto.formaPgto[i].checked){
			selected = document.frmPgto.formaPgto[i].value;
			radioButton= document.frmPgto.formaPgto[i];
			indice= i;
		}
	}
	
	if (selected=='2')//Cartões Mastercard
		if (!confirm('\nSeu Mastercard foi emitido no exterior?\n\nEntão é necessário selecionar outra forma de pagamento: Visa, American Express ou depósito bancário.\n\n---\nIs your Mastercard from outside Brazil?\n\nIf so, please, choose other payment method.\n\n Você deseja continuar? \ Do you want to continue?')){
			radioButton.checked= false;
			return;
		}
	if (selected=='3')//Cartões Mastercard
		if (!confirm('\nSeu Dinners foi emitido no exterior?\n\nEntão é necessário selecionar outra forma de pagamento: Visa, American Express ou depósito bancário.\n\n---\nIs your Dinners from outside Brazil?\n\nIf so, please, choose other payment method.\n\n Você deseja continuar? \ Do you want to continue?')){
			radioButton.checked= false;
			return;
		}

	document.frmPgto.submit();
}

function getX(imagename){
	theImg= document.getElementById(imagename);
	return getOffsetLeft(theImg);
}

function getY(imagename){
	theImg= document.getElementById(imagename);
	return getOffsetTop(theImg);
}

function getOffsetTop (el) {
	var ol = el.offsetTop;
	while ((el = el.offsetParent) != null)
	  ol += el.offsetTop;
	return ol;
}

function getOffsetLeft (el) {
	var ol = el.offsetLeft;
	while ((el = el.offsetParent) != null)
	  ol += el.offsetLeft;
	return ol;
}
  
function MM_formtCep(e,src,mask) {
	if(window.event) { _TXT = e.keyCode; }
	else if(e.which) { _TXT = e.which; }
	if(_TXT > 47 && _TXT < 58) {
		var i = src.value.length; var saida = mask.substring(0,1); var texto = mask.substring(i)
		if (texto.substring(0,1) != saida) { src.value += texto.substring(0,1); }
		return true;
	} else {
		if (_TXT != 8) { return false; }
		else { return true; }
	}
}

function MM_findObj(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=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_swapImgRestore() { //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 MM_preloadImages() { //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=MM_preloadImages.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 checkFieldSize(size,cep1,cep2) {
   if(document.getElementById(cep1).value.length >=size)
      document.getElementById(cep2).focus();
}
function checkCepFields(cep1,cep2) {
   if ((document.getElementById(cep1).value.length >=5) && (document.getElementById(cep2).value.length >=3))
      document.frmCart.submit();
}
function cleanCepField() {
	document.getElementById('cep1').value = '';
	document.getElementById('cep2').value = '';
	document.getElementById('cep1').focus();
}
function showHideAlerts(idAlert) {
	if (document.getElementById(idAlert).style.display == 'block')
		document.getElementById(idAlert).style.display = 'none';
	else
		document.getElementById(idAlert).style.display = 'block';
}
