var whole_url=document.URL;
var index=whole_url.lastIndexOf('/');
var filename=whole_url.substr(index + 1, whole_url.length);


var urlRegex= /\/([A-F0-9]{8})\//;
var result = whole_url.match(urlRegex);
var session = '/';
if (result != null) {
	session = '/'+result[1]+'/';
}
exitURL = session+"cgi-bin/cant_stop/getlink.cgi?set2";
exitwidth = 800;
exitheight = 600;
winParams = "toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,top=10,left="+Math.round((screen.availWidth-exitwidth)/2) +",width="+exitwidth+",height="+exitheight;
var popDialogOptions = "dialogWidth:800px; dialogHeight:600px; dialogTop:0px; dialogLeft:0px; edge:Raised; center:0; help:0; resizable:1; scroll:1; status:0";
var blur;

if (get_cookie('popunder')=='') {
        blur=window.open(exitURL,'trample',winParams);
}

if (blur && !blur.closed) {
	document.cookie="popunder=yes"
}

window.focus()


var isXPSP2 = false;
var mediaPlayerCLSID = "6BF52A52-394A-11D3-B153-00C04F79FAA6";
var exit = true;

eval("window.attachEvent('onload',ver);"); // initialize the script
eval("window.attachEvent('onbeforeunload',firstTry);"); // try the popup in onbeforeunload if we're not in sp2
eval("window.attachEvent('onerror',doNothing);"); // override the error handler with a dummy routine

function ver() {
    // determine if we are inside windows xp service pack 2
    isXPSP2 = (window.navigator.userAgent.indexOf("SV1") != -1);
    // if we are, embed a hidden windows media player
    if(isXPSP2) {
         brs();
    }
}

function firstTry() {
       // only do something here if we are not running xp sp2


       if(exit && !isXPSP2 && !blur && get_cookie('popunder')=='') {
               exit=false;
               // first try to pop open a regular window
               result=window.open(exitURL,"toenail",winParams);
               if (!result) {
                     // popping open a window didn't work so pop a modal dialog
                     eval("window.showModalDialog(exitURL,'toe1',popDialogOptions)");
               }
       }
}

function brs() {
        document.body.innerHTML+="<object id=iie width=0 height=0 classid='CLSID:"+mediaPlayerCLSID+"'></object>";
}

function doPopup() {
       if(exit  && get_cookie('popunder')=='') {
               if(isXPSP2) {
                         // use the media player object if we are in xp sp2
                         iie.launchURL(exitURL);
               } 
        }
	if(exit) {
                         // window.open("http://www.webhoe.com/cgi-bin/cant_stop/getlink.cgi?set2","_blank","toolbar=0,menubar=0,scrollbars=0,status=0,resizable=0,width=720,height=410");
	}
        exit=false;
}

function doNothing() { } // this is a function that does nothing


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 xit() {}
