// JavaScript Document
function verificaDestino(obj){
	var cpVal = document.getElementById("recipient").value;
	if(cpVal == "none"){
		alert("Escolha um Depto. para contato!");
		document.getElementById("recipient").focus();
		return false;	
	}else{
		return enviaBusca(obj,'fecha');	
	}
}

//Funções que controlam o layout
function trocaImgs(img){

	if(img){
		document.getElementById("imagemProdsDest").src="admin/arquivos/"+img;
		document.getElementById("imagensProdutosDest").style.display="block";
	}
	

	//document.getElementById("divConteudo").style.width="100%";

}
function hideFlashHome(){
	document.getElementById("imagensProdutosDest").style.display="none";
	document.getElementById("flashConteudoAlterna").style.display="none";
	//document.getElementById("divConteudo").style.width="530px";
}
function showFlashHome(){
	document.getElementById("flashConteudoAlterna").style.display="block";
	//document.getElementById("divConteudo").style.width="100%";
}
	
//função para recuperar a senha
function recuperaSenha(){
	if( !document.forms[0].elements['login'].value && !document.forms[1].elements['login'].value ){
		document.forms[0].elements['login'].focus();
		alert('Informe seu login!');
	}else{
		if( document.forms[0].elements['login'].value){
			i = 0;
		}else{
			i = 1;
		}
		
		document.forms[i].elements['esqueciminhasenha'].value = 1;
		document.forms[i].target = 'iframeRecuperaSenha';
		document.forms[i].submit();
		document.forms[i].elements['esqueciminhasenha'].value = 0;
	}
	return false;
}


//função para abrir um popup
//recebe como parametros: nomeDoArquivo,Larg.janela, Alt.Janela
function abrePopup(arquivo,largura,altura){

	atributos = "width="+largura+",height="+altura;
	atributos = atributos + ",left=20, top=20, toolbar=0, directories=0, resizable=no, status=1, scrollbars=1";
	
	window.open(arquivo,"winPopup",atributos);	
}

//abre janelinha
function abrejanelinha(imagem, largura, altura){
	try{ janelinha.close(); }catch(e){}
	alturascr = window.screen.availHeight;
	largurascr = window.screen.availWidth;
	pontoesq = parseInt(largurascr/2) - parseInt(largura/2);
	pontotop = parseInt(alturascr/2) - parseInt(altura/2);
	janelinha = window.open('','janelinha','width=' + largura + ',height=' + altura + ',top=' + pontotop + ',left=' + pontoesq );
	janelinha.document.open();
	janelinha.document.writeln('<body style=margin:0px;>');
	janelinha.document.writeln('<img galleryimg="no" src="' + imagem + '">');
	janelinha.document.writeln('</body>');
	janelinha.document.close();
	janelinha.document.onblur = function(){janelinha.close();}
	janelinha.document.onclick = function(){janelinha.close();}
	janelinha.document.focus();
}


//gerado pelo DW.
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
	document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

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 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];}
}
		