function restoreDef(who,defValue){
		if(who.value==''){who.value=defValue;}
}

function mostraFlash(src, larg, alt, wmode){
	var flash = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+ larg +'" height="'+ alt +'">';
	flash += '<param name="movie" value="'+ src +'" />';	
	flash += '<param name="menu" value="false" />';	
	flash += '<param name="wmode" value="'+ wmode +'" />';	
	flash += '<embed src="'+ src +'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+ larg +'" height="'+ alt +'" menu = "false" wmode = "'+ wmode +'"></embed>';
	flash += '</object>';	
	
	document.write(flash);
}

function volta(){
	history.go(-1);	
}



function verifyCarac(field, numtotal, idioma){
	
	var campo = document.getElementById(field);
	var valorCampo = document.getElementById('fieldMsg').value.length;
	var labelRestam = document.getElementById('rextamX');
		
	if (valorCampo > numtotal){
		campo.value = campo.value.substring(0, numtotal);
	}else{
		x = numtotal-valorCampo;
		if(idioma=='pt'){
			labelRestam.innerHTML = "Restam <b>"+x+"</b> caracteres";
		}else if(idioma=='en'){
			labelRestam.innerHTML = "<b>"+x+"</b> characters left";
		}else if(idioma=='es'){
			labelRestam.innerHTML = "<b>"+x+"</b> caracteres disponibles";
		}
	}
}

function abreProdCat(idCat){
	var cat = document.getElementById("INI_cat"+idCat);
	var catex = document.getElementById("EX_cat"+idCat);
	var prods = document.getElementById("prods"+idCat);
	cat.style.display='none';
	catex.style.display='';
	prods.style.display='';
	
}
function fechaProdCat(idCat){
	var cat = document.getElementById("INI_cat"+idCat);
	var catex = document.getElementById("EX_cat"+idCat);
	var prods = document.getElementById("prods"+idCat);
	cat.style.display='';
	catex.style.display='none';
	prods.style.display='none';
}

function checaCampos(form){  //verifica o preenchimento obrigatorios dos campos antes de enviá-los
	if(!form){return false;}
	var element,enviar=true;
	for(var i=0;i<form.elements.length;i++){
		element=form.elements[i];
		if(element.className.indexOf('email')>=0){  //campo tipo email
			if(!checkEmail(element.value)){
				alert('Favor escreva um e-mail válido.');
				element.focus();
				enviar=false;
				break;
			}
		}
		if(element.className.indexOf('required')>=0){  //campo requerido
			if(element.value.length<=0){  //nao preenchido
				alert('Favor preencha o campo corretamente');
				element.focus();
				enviar=false;
				break;
			}
		}
	}
	return enviar;
}