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.toGMTString();
return UTCstring;
}
function expiry_date(){
var current_date = new Date ( );
var month_names = new Array ( );
month_names[month_names.length] = "January";
month_names[month_names.length] = "February";
month_names[month_names.length] = "March";
month_names[month_names.length] = "April";
month_names[month_names.length] = "May";
month_names[month_names.length] = "June";
month_names[month_names.length] = "July";
month_names[month_names.length] = "August";
month_names[month_names.length] = "September";
month_names[month_names.length] = "October";
month_names[month_names.length] = "November";
month_names[month_names.length] = "December";
var current_year=current_date.getFullYear();
var current_month=month_names[current_date.getMonth()];
var current_day=current_date.getDate();
var new_date=current_month+" "+current_day+","+current_year;
var milli_secs=Date.parse(new_date);
current_date.setTime(milli_secs+86401000);
var tomorrow=current_date.toGMTString();
return tomorrow;
}
function getcookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}
function setcookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "; expires="+expiry_date();
	document.cookie = name+"="+value+expires+"; path=/";
}
/*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){
if(duration!=0){
	cookiestring=name+"="+escape(value)+"; expires="+getexpirydate(duration)+"; path=/;";
}else{
	cookiestring=name+"="+escape(value)+"; expires="+expiry_date()+"; path=/;";
}
alert("???cookiestring is "+cookiestring);
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("","Exit PopOVER","dialogHeight: 400px;dialogWidth: 300px;dialogTop: px; dialogLeft: px; edge: Raised; center: Yes; help: no; resizable: Yes; status: Yes;"); }
		catch (e) {adeel = 1};
		if (adeel != 1) return;
		var confMsg = "Claim your FREE copy of the MVNO List - completely free and without obligation. Blycroft Publishing released the 1st MVNO Directory in June 2006. Back then MVNO activity had ballooned in several markets; particularly in the USA and parts of Western Europe. This 1st edition tracked 240 operations and for the first time this qualified list of operators has been made available for free. Get your copy now without obligation.   ";
		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=30
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 = "#FF8000"
	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(getcookie('safeexit') == 'yes'){
		return;
	}

	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) {
			exitlayer.style.top=  parseInt(((document.layers)?window.pageYOffset:document.body.scrollTop) + (((!document.all)?window.innerHeight:document.body.clientHeight) - 400) / 2);
			exitlayer.style.left=  parseInt(((document.layers)?window.pageXOffset:document.body.scrollLeft) + (((!document.all)?window.innerWidth:document.body.clientWidth) - 300) / 2);
			exitlayer.style.visibility="visible";
			exitoverlay.style.visibility="visible";
			shadeinexoverlay();
			setcookie('safeexit','yes',1);
			shownexit = 1;
		}
	}
}
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() {
	var rvw=getcookie('safeexit');
	if(rvw!=null){
		if(rvw == 'yes'){
		return;
		}
	}
	setcookie("safeexit","no",1);
	prepareExitTrack();
	if (window.attachEvent) {
		window.attachEvent("onbeforeunload", cookiecheck); 
		window.attachEvent("onunload", cookiecheck); }
	else {
		window.onbeforeunload = cookiecheck; 
		window.onunload = cookiecheck; }
	return;
}
function cookiecheck(){
	var currentvalue;
	var uservalue =1;
	if(getcookie('popover') > 0){
		currentvalue = getcookie('popover');
		if(currentvalue == (uservalue+1))
		{
		}
		else
		{
			currentvalue = parseInt(currentvalue) + 1;
			setcookie('popover', currentvalue ,364);
			exitbox();
		}
	}
	else
	{
		setcookie('popover',2,364);
		exitbox();
	}
}
window.onload=function(){
 	init();
}