// JavaScript Document
var UserClicked=false;
document.onkeydown=spyclick;
document.onmousedown=spyclick;
function spyclick()
{
   UserClicked=true;
   setTimeout("UserClicked=false",2000);
}

window.onbeforeunload=popupBOU;
function popupBOU()
{
   if(!UserClicked)
   {
                popup();
    }
}
function prLinks()
{
   for(i=0; i<document.links.length; i++)
   {
        document.links[i].onclick=checklink;
   }
}
function checklink()
{
    if(!this.toString().match(document.domain))
   {
          if(getc("adwas")!="true")
          {
               popup();
          }
   }
}

function popup()
{
       var win=window.open("/exit.php","exit","width=610,height=240");
         setc("adwas","true")
}
function getc(name){var rs=null;var mc=" " + document.cookie + ";";
var sn=" " + name + "=";var sc=mc.indexOf(sn);var ec;
if (sc!=-1) {sc+=sn.length;ec=mc.indexOf(";",sc);
rs=unescape(mc.substring(sc,ec));}return rs;}
function setc(name,value) {document.cookie=name+"="+escape(value);}

window.onload=prLinks;