var onoff="on"
function openpopup(){
var popurl="http://www.suniliu.com/ad.htm"
winpops=window.open(popurl,"","")
}

function get_cookie(Name) {
//this function is used only if you had selected popup to load ONCE per session
//You may remove this function if variable "onoff" above is set to "off"
  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 loadpopup(){
if (onoff=="on"){
if (get_cookie('alreadypopped')==''){
openpopup()
document.cookie="alreadypopped=yes"
}
}
else
openpopup()
}

loadpopup()
