function adicionarValor(q,prod){	
	obj = document.getElementById(prod);
	v = Number(obj.value) + Number(q);
	if(v<0){v=0;}
	obj.value = v;
}

function participar_promocao0(codigo,cupom){window.location='/default.asp?cmd=promocao&codprod='+codigo;}

function participar_promocao_old(codigo,cupom){
	var nomecampo = 'id_cupom';
	document.frmcesta[nomecampo].value=cupom;
	comprar(codigo);
}

function regulamento(tipo){
	if (tipo=="hp"){
		window.open ('/catalogo/regulamento.html','regulamento','scrollbars=yes,width=640,height=400');	
	}else if(tipo =="epson"){
		window.open ('/catalogo/regulamentoepson2.htm','regulamento','scrollbars=yes,width=640,height=400');	
	}else if(tipo =="oki"){
		window.open ('/catalogo/regulamentooki.htm','regulamento','scrollbars=yes,width=640,height=400');	
	}else{
		window.open ('/catalogo/regulamentoEpson.html','regulamento','scrollbars=yes,width=640,height=400');
	}
}

function diaconsumidor(){
	window.open ('/catalogo/consumidorGimba.htm','consumidor','scrollbars=yes,width=490,height=415');	
}

function lojagimba(){
	window.open ('/catalogo/lojagimba.htm','lojagimba','scrollbars=no,resizable=no,width=490,height=520');	
}


function regulamentoMotorola(){window.open ('/catalogo/regulamentoMotorola.htm','regulamento','scrollbars=yes,width=680,height=400');}

function participar_promocao(codigo,cupom)
{
  window.location='/default.asp?cmd=promocao&codprod=' + codigo;
}

function REG(){window.open ('/catalogo/regulamentoepson2.htm','regulamento','scrollbars=yes,width=680,height=400');}

function REGHPSHOW(){window.open ('/catalogo/regulamentohp2.htm','regulamento','scrollbars=yes,width=680,height=400');}

if (navigator.appName == "Netscape"){
        layerStyleRef="layer.";
        layerRef="document.layers";
        styleSwitch="";
        visibleVar="show";
}else{
        layerStyleRef="layer.style";
        layerRef="document.all";
        styleSwitch=".style";
        visibleVar="visible";
}

function sL(layerName){
        eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="visible"');
}

function hL(layerName){
        eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"');
}

function menu(obj){
		sites.style.visibility = "hidden"
		dados.style.visibility = "hidden"		

		if (obj == "sites") sites.style.visibility = "visible"
		if (obj == "dados") dados.style.visibility = "visible"		
}

function trocaCSS(whichElement, whichStyle){
	var block;
	block = eval("document.all." + whichElement);
	block.className = whichStyle;
}

function comprar(codprod){
	var nomecampo = 'prd'+codprod;
	if (document.frmcesta[nomecampo].value=='')
		document.frmcesta[nomecampo].value=1;
	document.frmcesta.submit()
}

function abreIndisponivel(codprod){
	window.open('/Telas/indisponivel.asp?codprod=' + codprod,'remote','width=450,height=350,top=100,left=150,resizable=no,scrollbars=no');
	//window.open('http://www.nccserver.com/Gimba382/Chat4/cliente/frm_login.asp?IDArea=1&sel=HomePage', 'remote','width=320,height=450,top=0,resizable=no,scrollbars=no')
}

function abrePersonalizado(){
	window.open('/bic/gimba.asp','BicGraphic','scrollbars=yes,toolbar=no');
	//window.open('http://www.nccserver.com/Gimba382/Chat4/cliente/frm_login.asp?IDArea=1&sel=HomePage', 'remote','width=320,height=450,top=0,resizable=no,scrollbars=no')
}

function MM_openBrWindow(theURL,winName,features){
  window.open(theURL,winName,features);
}

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 fechar(){document.all['LayBanner'].style.visibility = 'hidden';}

function abreAjuda(){
	window.open('http://www.nccserver.com/Gimba382/Chat4/cliente/frm_login.asp?IDArea=1&sel=HomePage','remote','width=320,height=450,top=0,resizable=no,scrollbars=no');
	//window.open('http://www.nccserver.com/Gimba382/Chat4/cliente/frm_login.asp?IDArea=1&sel=HomePage', 'remote','width=320,height=450,top=0,resizable=no,scrollbars=no')
}

function FecharLayer(){
  Fecha='S';
  clearTimeout(TempoLayer);
  document.all.MoveLayer.style.visibility = 'hidden';
}

function Parar(){clearTimeout(TempoLayer);}

function Continuar() {
	if(Fecha=='N'){TempoLayer = setTimeout("MoverLayer('"+rPt+"','"+numT+"','"+rPl+"','"+numL+"')",60);}
}

function showlayer(){document.getElementById('LayBanner').style.display='block';}
function hidelayer(){
	document.getElementById('LayBanner').style.display='none';
	//document.getElementById("displayC").style.display='block';
}

function soNum(e){
	if (document.all) // Internet Explorer
		var tecla = event.keyCode;
	else if(document.layers) // Nestcape
		var tecla = e.which;

		if (tecla > 47 && tecla < 58){ // numeros de 0 a 9
			// if (tecla < 47 || tecla > 58) // letras de A a Z
			return true;
		}else{
			if (tecla != 8){
				event.keyCode=0;
			}
		}
}
function indique_prod(codprod,descr,resumo){
	window.open ('/produto/indique_produto.asp?cod='+ codprod +'&desc='+ descr+'&descres='+resumo ,'NewWin','scrollbars=no,width=423,height=350');
}

function submitEnter(campo,e)
{
	var keycode;
	if (window.event) keycode = window.event.keyCode;
	else if (e) keycode = e.which;
	else return true;
	
	if (keycode == 13)
	   {
	   campo.form.submit();
	   return false;
	   }
	else
	   return true;
}

	/*
	TempoLayer = new Object();
	var rPt ;
	var numT ;
	var rPl ;
	var numL ;
	var Fecha = 'N';

	function randomizar() {
		var num = parseInt(Math.random() * 10);
		num = eval(num == 0) ? 10 : num;
		if (parseInt(num / 2) != parseFloat(num / 2)) {
			num = num + 1;
		}
		num = num / 2;
		return num;
	}


	function MoverLayer(Pt, Nt, Pl, Nl) {
		document.getElementById('MoveLayer').style.visibility = 'visible';
		document.getElementById('MoveLayer').style.left = eval(Pl == 'Soma') ? parseInt(document.getElementById('MoveLayer').style.left) + parseInt(Nl) : parseInt(document.getElementById('MoveLayer').style.left) - parseInt(Nl);
		document.getElementById('MoveLayer').style.top = eval(Pt == 'Soma') ? parseInt(document.getElementById('MoveLayer').style.top) + parseInt(Nt) : parseInt(document.getElementById('MoveLayer').style.top) - parseInt(Nt);

		if (parseInt(document.getElementById('MoveLayer').style.top) + parseInt(document.getElementById('MoveLayer').style.height) >= document.body.clientHeight) {
			rPt = 'Reduz';
			numT = randomizar();
		}
		else if (parseInt(document.getElementById('MoveLayer').style.top) <= 200) {
			rPt = 'Soma';
			numT = randomizar();
		}
		else {
			rPt = Pt;
			numT = Nt;
		}

		if (parseInt(document.getElementById('MoveLayer').style.left) + parseInt(document.getElementById('MoveLayer').style.width) >= (parseInt(document.body.clientWidth) - 160)) {
			rPl = 'Reduz';
			numL = randomizar();
		}
		else if (parseInt(document.getElementById('MoveLayer').style.left) <= 230) {
			rPl = 'Soma';
			numL = randomizar();
		}
		else {
			rPl = Pl;
			numL = Nl;
		}
		TempoLayer = setTimeout("MoverLayer('" + rPt + "','" + numT + "','" + rPl + "','" + numL + "')", 60);
	}

	function FecharLayer() {
		Fecha = 'S';
		clearTimeout(TempoLayer);
		document.getElementById('MoveLayer').style.visibility = 'hidden';
	}

	function Parar() {
		clearTimeout(TempoLayer);
	}

	function Continuar() {
		if (Fecha == 'N') {
			TempoLayer = setTimeout("MoverLayer('" + rPt + "','" + numT + "','" + rPl + "','" + numL + "')", 60);
		}
	}
	*/