
function get_cookie(Name) {
  var search = Name + "="
  var returnvalue = "";
  if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search)
    if (offset != -1) { // se existir cookie
      offset += search.length
      // pegando o inicio do valor
      end = document.cookie.indexOf(";", offset);
      // pegando o fim do valor
      if (end == -1)
         end = document.cookie.length;
      returnvalue=unescape(document.cookie.substring(offset, end))
      }
   }
  return returnvalue;
}

function save_cookie(){
	expireDate = new Date;
	expireDate.setMonth(expireDate.getMonth()+6);
	document.cookie = 'cadNews=1;expires=' + expireDate.toGMTString();
}

function openPopUpInicial(){
  if (get_cookie('cadNews')=='' && get_cookie('popupinicial')==''){
    popInicialPoderPessoal = window.open('/popup.asp?flag=0','popInicialPoderPessoal','width=375,height=218');
    document.cookie="popupinicial=yes";
	popInicialPoderPessoal.focus();
  }
}

function openPopUpFinal(){

/*
 if ((get_cookie('popupinicial')=='' || get_cookie('pgcompra')=='yes') && get_cookie('popupfinal')=='')
 {
	popFinalPoderPessoal = window.open('/popup.asp?flag=1','popFinalPoderPessoal','width=450,height=334');
	document.cookie="popupfinal=yes";
	popFinalPoderPessoal.focus();
 }
*/

 
}