var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }

  if (navigator.appVersion.indexOf('4') != -1) {
 // Vars for centering the new window on Version 4 Browsers
 left = screen.width/2 - (width/2);
 top = screen.height/2 - (height/2);
 popUpWin = open(URLStr,'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+',top='+top+',screenX='+left+',screenY='+top+'');
 } else {
 left =150;
 top = 200;
 popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
 }
}

function golink2(linkname) {
    if (window.opener && !window.opener.closed) {
		window.opener.location.href=linkname;
		window.opener.focus();
		}
    else {
        var AdWin = window.open(linkname,'');
        // set opener to new window:
        window.opener = AdWin;
  	  }
}

function golink3(linkname) {
        var AdWin = window.open(linkname,'');
}

//Specify URLs to randomly select from and popup/popunder:
var popurls=new Array()
popurls[0]="pop_zb_ban.html"

function get_cookie(Name) {
  var search = Name + "="
  var returnvalue = "";
  if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search)
    if (offset != -1) { // if cookie exists
      offset += search.length
      // set index of beginning of value
      end = document.cookie.indexOf(";", offset);
      // set index of end of cookie value
      if (end == -1)
         end = document.cookie.length;
      returnvalue=unescape(document.cookie.substring(offset, end))
      }
   }
  return returnvalue;
}

function loadpop(){
if (get_cookie('bpopup')==''){
popUpWindow(popurls[Math.floor(Math.random()*(popurls.length))],0,0,728,90)
document.cookie="bpopup=yes"
}
}
