//Aviso home (todas as lojas)
//showAvisoCorreios();

//BuscaGoogle (logo)
//showBuscaGoogle();

//Chamada para GHTML ESPORTES E LAZER - 25/11/2008
//Loja 711: ( IDLOJA , id_do_body , class_do_body , nome_peca )
//getDHTML("661" , "home" , "" , "Dhtml");


//Lojas SGR: ( IDLOJA , id_do_body , class_do_body , nome_peca )
getDHTMLSGR("661" , "home" , "" , "dhtm_sgr");
getDHTMLSGR("784" , "home" , "" , "dhtm_sgr");
getDHTMLSGR("728" , "home" , "" , "dhtm_sgr");
getDHTMLSGR("711" , "home" , "" , "dhtm_sgr");
getDHTMLSGR("721" , "home" , "" , "dhtm_sgr");
getDHTMLSGR("1033" , "home" , "" , "dhtm_sgr");
getDHTMLSGR("997" , "home" , "" , "dhtm_sgr");
getDHTMLSGR("1243" , "home" , "" , "dhtm_sgr");
getDHTMLSGR("1686" , "home" , "" , "dhtm_sgr");
getDHTMLSGR("1241" , "home" , "" , "dhtm_sgr");


// Lojas Credicard
getDHTML("1826" , "home" , "" , "dhtml");
getDHTML("1828" , "home" , "" , "dhtml");
getDHTML("1829" , "home" , "" , "dhtml");
getDHTML("1831" , "home" , "" , "dhtml");

// Lojas Abril
getDHTML("363" , "brinde" , "" , "dhtml");
getDHTML("1018" , "brinde" , "" , "dhtml");


//Ped.corp
pedCorp();

/***********************************************************************************/
/***********************************************************************************/
/***********************************************************************************/


/* 
LOGOMARCA NATAL 

if (getIdLoja() == 59 || getIdLoja() == 433) {
	var obj = getFlash( "2102", "", '265', '83', 'transparent');
	monta_swf = "";
	monta_swf += "<object type=\"application/x-shockwave-flash\"  data=\"https://www.comprafacil.com.br/css/img/59/natal_59/images/logoAnimado.swf\" width=\"265\" height=\"83\">";
	monta_swf += "<param name=\"allowScriptAccess\" value=\"comprafacil.com.br\" />";
	monta_swf += "<param name=\"movie\"   value=\"https://www.comprafacil.com.br/css/img/59/natal_59/images/logoAnimado.swf\" />";
	monta_swf += "<param name=\"quality\" value=\"high\" />";
	monta_swf += "<param name=\"wmode\"   value=\"transparent\" />";
	monta_swf += "<param name=\"menu\"    value=\"0\" />";
	monta_swf += "</object>";
	var h1 = document.getElementsByTagName("H1");
	h1[0].innerHTML = monta_swf;
} */


function showBuscaGoogle() {
	var lj = getIdLoja();		
		
		var seloGG =  '<span id="seloGoogle">';
		    seloGG += '<object height="22" width="52" data="https://www.comprafacil.com.br/css/img/seloGoogle.swf" type="application/x-shockwave-flash">';
		    seloGG += '<param value="comprafacil.com.br" name="allowScriptAccess"/>';
			seloGG += '<param value="https://www.comprafacil.com.br/css/img/seloGoogle.swf" name="movie"/>';
			seloGG += '<param value="high" name="quality"/>';
			seloGG += '<param value="transparent" name="wmode"/>';
			seloGG += '<param value="0" name="menu"/>';
			seloGG += '</object>';
			seloGG += '</span>';
		
		$("formBuscaCF:botaoBusca").insert( { after: seloGG } );
		
}

// ************************************ D H T M L ***************************************************


// DHTML
// Fun��o para chamar o DHTML - 28/11/2008
 function getDHTML(lojaId, idPg, classPg, swf) {
	if( lojaId=="" || ( lojaId!="" && getIdLoja() && getIdLoja()==lojaId ) ) {		
			if( idPg=="" || (idPg!="" && getIdPg() && getIdPg()==idPg) ) {			
					if( classPg=="" || ( classPg=!"" && getClassPg() && getClassPg()==classPg )  ) {			
									var f  = '<div id="banner_dhtml">';
									    f += '<object width="400" height="400" data="http://www.comprafacil.com.br/css/img/' + lojaId + '/' + swf + '.swf" type="application/x-shockwave-flash"><param value="comprafacil.com.br" name="allowScriptAccess"/><param value="http://www.comprafacil.com.br/css/img/' + lojaId + '/' + swf + '.swf" name="movie"/><param value="high" name="quality"/><param value="transparent" name="wmode"/><param value="0" name="menu"/></object>';     	    	
								    	f += '</div>';										
									document.write(f);								
					} else return false;								
			} else return false;	
	} else return false;
}

// Func para DHTML campanha SGR - 25/02/2010
 function getDHTMLSGR(lojaId, idPg, classPg, swf) {
	if( lojaId=="" || ( lojaId!="" && getIdLoja() && getIdLoja()==lojaId ) ) {		
			if( idPg=="" || (idPg!="" && getIdPg() && getIdPg()==idPg) ) {			
					if( classPg=="" || ( classPg=!"" && getClassPg() && getClassPg()==classPg )  ) {			
									var f  = '<div id="banner_dhtml" style="width:300px; height:300px; top:220px !important;">';
									    f += '<object width="300" height="300" data="http://www.comprafacil.com.br/css/img/661/' + swf + '.swf" type="application/x-shockwave-flash"><param value="comprafacil.com.br" name="allowScriptAccess"/><param value="http://www.comprafacil.com.br/css/img/' + lojaId + '/' + swf + '.swf" name="movie"/><param value="high" name="quality"/><param value="transparent" name="wmode"/><param value="0" name="menu"/></object>';     	    	
								    	f += '</div>';										
									document.write(f);								
					} else return false;								
			} else return false;	
	} else return false;
}


function closeDHTML() { 
	if( $("banner_dhtml") ) {$("banner_dhtml").style.display = "none";} 
} 


 function getIdLoja() {	
	var links  = document.getElementsByTagName("link");		
	if(links!=null) {
			for(i=0; i<links.length; i++) {
				if(links[i].href.match("global")) {				
					lojaId = links[i].href.split("css/"); 
					return lojaId[1].substring( 0, lojaId[1].indexOf("/global") );		
				}	
			}
	} else return false;	
} 

// *********************************** D H T M L ***************************************************


function getIdPg() { return (document.body.id ? document.body.id : false); }
function getClassPg() { return (document.body.className ? document.body.className : false); }



function showAvisoCorreios(n) {
	
	if( $("home") ) {
		if(getIdLoja() && getIdLoja()!="827" && getIdLoja()!="853" ) {
			if(n==null) {
					var c  = '<div id="aviso_correios">';
					    c += '<a href="javascript: showAvisoCorreios(0)">Fechar</a>';
					    c += '<p>Comunicado! Prezado cliente, nossos prazos de entrega EST�O MANTIDOS apesar da greve dos Correios, pois estamos utilizando transportadoras privadas. Equipe Comprafacil.com</p>';     	    	
				    	c += '</div>';
			    	document.write(c);    	
			    
			    	var t = setTimeout("showAvisoCorreios(0)",60000);
		    }
	    	else $("aviso_correios").style.display = "none";   
		}	
    } 
}


function pedCorp() {
	if( $("solucoes_corp") ) {
		document.getElementById("cfForm:fax").disabled = "true";
		document.getElementById("cfForm:fax").style.background = "#FFF";
		document.getElementById("cfForm:fax").style.margin = "0 0 0 -40px";
		document.getElementById("cfForm:fax").style.border = "0";
	}
}


function windowTV(url,janela,L,A,Centro,STbar,SCbar,Rsize,Mbar) { 
		var hor;
		var ver;
		if (Centro==true) {
			hor = L;
			hor = (screen.width - hor) / 2;
			ver = A;
			ver = (screen.height - ver) / 2;
		}
		else if (Centro=='full') {
			hor = 1;
			ver = 1;
			L = (parseInt(screen.width)-9);
			A = (parseInt(screen.height)-9);
		}
		else { hor = 20; ver = 20;}
		var acertos = 'width='+ L +', height='+ A +',left='+ hor +', top='+ ver +', screenx='+ hor +', screeny='+ ver +', status='+ STbar +', scrollbars='+ SCbar +', resizable='+ Rsize +', menubar='+ Mbar;
		window.open(url,janela,acertos);
}
