// JavaScript Document

function closeAdPub()
{
	window.setTimeout('doClose()',100);
}
function doClose()
{
	//document.getElementById('banner-gg').style.display='block'; 
	//document.getElementById('banner-gg-pre').style.display='none';
	document.getElementById('bannerFlutuante').style.visibility='hidden';
}
function doVerificarAd()
{
	/*if(document.cookie.indexOf('CF_FeAds=')==-1)
	{
		document.getElementById('bannerFlutuante').style.visibility='visible';
		document.getElementById('banner-gg').style.visibility='hidden';
	}*/
	if ( LerCookie('CF_FeAds') != '1' ) {
		document.getElementById('bannerFlutuante').style.visibility='visible';
		//document.getElementById('banner-gg').style.display='none'; 
		//document.getElementById('banner-gg-pre').style.display='block';   
	}
}
//Quando atingir sua meta
function aMt()
{
	//document.cookie='CF_FeAds=1';
	GerarCookie('CF_FeAds', '1', 1);
}
/*  TRABALHAR COM COOKIES */
/*
    Exemplo:
    - Cria o cookie 'CookieTeste' com o valor 'HellowWorld!' que irá expirar quando o browser for fechado.
    GerarCookie('CookieTeste', 'HellowWorld!', 0);
    - Lê o conteúdo armazenado no cookie.
    LerCookie('CookieTeste');
    - Exclúi o cookie.
    ExcluirCookie('CookieTeste');
*/

// Função para criar o cookie.
// Para que o cookie seja destruído quando o brawser for fechado, basta passar 0 no parametro lngDias.
function GerarCookie(strCookie, strValor, lngDias)
{
    var dtmData = new Date();

    if(lngDias)
    {
        dtmData.setTime(dtmData.getTime() + (lngDias * 24 * 60 * 60 * 1000));
        var strExpires = "; expires=" + dtmData.toGMTString();
    }
    else
    {
        var strExpires = "";
    }
    document.cookie = strCookie + "=" + strValor + strExpires + "; path=/";
}

// Função para ler o cookie.
function LerCookie(strCookie)
{
    var strNomeIgual = strCookie + "=";
    var arrCookies = document.cookie.split(';');

    for(var i = 0; i < arrCookies.length; i++)
    {
        var strValorCookie = arrCookies[i];
        while(strValorCookie.charAt(0) == ' ')
        {
            strValorCookie = strValorCookie.substring(1, strValorCookie.length);
        }
        if(strValorCookie.indexOf(strNomeIgual) == 0)
        {
            return strValorCookie.substring(strNomeIgual.length, strValorCookie.length);
        }
    }
    return null;
}

// Função para excluir o cookie desejado.
function ExcluirCookie(strCookie)
{
    GerarCookie(strCookie, '', -1);
}

/**/

<!--
// Validar form login assinante

function FormLoginDataCheck(f)
{
//var login = document.loginform.log.value;
//var pass = document.loginform.pwd.value;
var login = f.log.value;
var pass = f.pwd.value;
var returnval;

if ((login != "") && (pass != "")) 
   returnval = true;
else
   {
   alert("Por favor, entre seus dados de login de acesso.");
   returnval = false;
   }

return returnval;
}
// -->


function loadPage() {
	document.getElementById('wrap').click();
	
/*
	if ( LerCookie('EdsjC24h') != '1' ) {
		popUnderC24h();                                           
	}
	GerarCookie('EdsjC24h', '1', 1);
	
*/	

	// ==== Inicio Promo Siga-nos no Twitter e ganhe um ebook  ==== \\
	//if ( LerCookie('EdsjAdPromo') != '1' ) {
	//	window.setTimeout('exibeMerchanAdPromo()',15000);                                           
	//}
	//GerarCookie('EdsjAdPromo', '1', 1);
	// ==== Fim Promo   ==== \\
	


	//doVerificarAd();
}

function unloadPage(){
	// ==== Inicio Site Under Link Promoção  ==== \\
	//if ( LerCookie('EdsjPopUnLP') != '1' ) {
//		popUnderLinkPromocao();                                           
//	}
//	GerarCookie('EdsjPopUnLP', '1', 1);
	// ==== Fim Site Under Link Promoção  ==== \\
}

function popUnderC24h(){
   var winPopup = window.open('http://www.exceldoseujeito.com.br/c24hPop', 'winPopupC24h', 'toolbar=no,scrollbars=yes,width=1000,height=580');		
   winPopup.blur();
   window.focus();
				
}

function popUnderLinkPromocao(){
   var winPopup = window.open('http://www.linkpromocao.com.br/site/', 'winPopupLinkPromocao', 'toolbar=yes,scrollbars=yes,resizable=yes,width=1000,height=580');		
   winPopup.blur();
   window.focus();
}

function exibeMerchanAdPromo(e) {
	//$("#bannerPromo").fadeIn(1500);
	//e.preventDefault();
		//alert (e);
		var id = $("#bannerPromo");
	
		var maskHeight = $(document).height();
		var maskWidth = $(window).width();
	
		$('#mask').css({'width':maskWidth,'height':maskHeight});
		$('#mask').fadeIn(100);	
		$('#mask').fadeTo(10,0.8);	
	
		//Get the window height and width
		var winH = $(window).height();
		var winW = $(window).width();
              
		$(id).css('top',  winH/2-$(id).height()/2);
		$(id).css('left', winW/2-$(id).width()/2);
		
		$(id).stop().animate({
			top:$(window).scrollTop() + ($(id).height()/2)
		});
	
		$(id).fadeIn(1500);
}

/*
JQUERY BANNER SCROLL
*/


