var isFF = navigator.userAgent.indexOf("Gecko");
function getexpirydate( nodays){
var UTCstring;
Today = new Date();
nomilli=Date.parse(Today);
Today.setTime(nomilli+nodays*24*60*60*1000);
UTCstring = Today.toUTCString();
return UTCstring;
}
function getcookie(cookiename) {
 var cookiestring=""+document.cookie;
 var index1=cookiestring.indexOf(cookiename);
 if (index1==-1 || cookiename=="") return "";
 var index2=cookiestring.indexOf(';',index1);
 if (index2==-1) index2=cookiestring.length;
 return unescape(cookiestring.substring(index1+cookiename.length+1,index2));
}
function setcookie(name,value,duration){
cookiestring=name+"="+escape(value)+";EXPIRES="+getexpirydate(duration);
document.cookie=cookiestring;
if(!getcookie(name)){
return false;
}
else{
return true;
}
}
function date1(){
now = new Date();
then = new Date(" Jan 01 1970 00:00:00");
seconds=now-then/1000;
month=1+now.getMonth();
day=now.getDate();
year=now.getFullYear();
document.write( day+"-"+month+"-"+year+"");
}
var shownleave = 0;
function exitbox(){
if (shownleave == 1) return;
shownleave = 1;
nowatch = 1;
if(getcookie('safeexit') == 'yes'){
return;
}
else
{
try {var adeel = window.showModalDialog("popup/popup.html","Exit PopOVER","dialogHeight: 600px;dialogWidth: 500px;dialogTop: px; dialogLeft: px; edge: Raised; center: Yes; help: no; resizable: Yes; status: no;"); }
catch (e) {adeel = 1};
if (adeel != 1) return;
var confMsg = "Please check this great offer once more! <sample message>";
try {window.event.returnValue = confMsg;}
catch(e) { }
return confMsg;
}}
var exitlayer;
function prepareExitTrack() {
mkoverlayexit(); sl =0;
exitlayer = document.getElementById("itexit").cloneNode(true);
document.body.appendChild(exitlayer);
}

var n=50
var exitoverlay;
function mkoverlayexit() {
exitoverlay = document.createElement('DIV');
exitoverlay.style.position = 'absolute';
exitoverlay.style.left = '0px';
exitoverlay.style.top = '0px';
var w = (document.body.scrollWidth>document.body.clientWidth)? document.body.scrollWidth : document.body.clientWidth;
var h = (document.body.scrollHeight>document.body.clientHeight)? document.body.scrollHeight : document.body.clientHeight;
w = w + 50;
h = h + 50;
exitoverlay.style.width = w;
exitoverlay.style.height = h;
exitoverlay.innerHTML = "<table width = " + w + " height = " + h + "> </table>"
exitoverlay.style.backgroundColor = "#0000FF"
exitoverlay.above = exitlayer;
exitoverlay.style.visibility = "hidden";
document.body.appendChild(exitoverlay);
exitoverlay.style.opacity = 0;
exitoverlay.style.filter = 'alpha(opacity=' + 0 + ')';
}
var sl = 0;
var tm = 14;
function shadeinexoverlay() {
exitoverlay.style.opacity = ((n/100) / 10) * sl;
exitoverlay.style.filter = 'alpha(opacity=' + (n / 10) * sl + ')';
sl+=1;
if (sl<=10)  setTimeout('shadeinexoverlay()',tm); }
function shadeoutexoverlay() {
exitoverlay.style.opacity = (n/100) / 10 * sl;
exitoverlay.style.filter = 'alpha(opacity=' + n / 10 * sl + ')';
sl-=1;
if (sl>=0)  {setTimeout('shadeoutexoverlay()',tm); }
else {exitoverlay.style.visibility = "hidden";
exitlayer.style.visibility = "hidden";
} }
var x,y, nowatch = 0; var shownexit = 0;
function mouseProc(e) {
if (document.all) {x = event.clientX; y = event.clientY}
else {x = e.pageX - document.body.scrolLLeft; y = e.pageY - document.body.scrollTop;}
if ((y<20) && (nowatch == 0)){
if (shownexit == 0) {
shownexit = 1;
exitlayer.style.top=  parseInt(((document.layers)?window.pageYOffset:document.body.scrollTop) + (((!document.all)?window.innerHeight:document.body.clientHeight) - 600) / 2);
exitlayer.style.left=  parseInt(((document.layers)?window.pageXOffset:document.body.scrollLeft) + (((!document.all)?window.innerWidth:document.body.clientWidth) - 500) / 2);
exitlayer.style.visibility="visible";
exitoverlay.style.visibility="visible";
shadeinexoverlay();
}
}
}
function dismissexit(){
try {if (document.getElementById('idiframe')) {frames['idiframe'].location.href = 'about:blank';}} catch (e) {}
nowatch = 1;
sl = 10; shadeoutexoverlay();
}
document.onmouseout=mouseProc;
document.onmousemove=mouseProc;
function init() {
setcookie('safeexit','no',1);
prepareExitTrack();
if (window.attachEvent) {
window.attachEvent("onbeforeunload", exitbox);
window.attachEvent("onunload", exitbox); }else {
window.onbeforeunload = exitbox;
window.onunload = exitbox; }
}

function IPOLoad() {
    init();
}

