var popurls=new Array()
popurls[0]="http://www.music77.net/"
popurls[1]="http://www.newarb.com/"

function openpopup(popurl){
var winpops=window.open(popurl,"","width=600,height=500,toolbar,location,directories,status,scrollbars,menubar,resizable")
winpops.blur()
window.focus()
}

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

popfrequency="5"

function resetcookie(){
var expireDate = new Date()
expireDate.setMinutes(expireDate.getMinutes()-10)
document.cookie = "jkpopunder=;path=/;expires=" + expireDate.toGMTString()
}

function loadornot(){
if (get_cookie('jkpopunder')==''){
openpopup(popurls[Math.floor(Math.random()*(popurls.length))])
var expireDate = new Date()
expireDate.setMinutes(expireDate.getMinutes()+parseInt(popfrequency))
document.cookie = "jkpopunder="+parseInt(popfrequency)+";path=/;expires=" + expireDate.toGMTString()
}
}

if (get_cookie('jkpopunder')!=parseInt(popfrequency))
resetcookie()
loadornot()