// EXIT ACTION

window.onbeforeunload=checkPop;
document.onmousemove = getMouseXY;

var exit_pop = false;
var mousex = 0;
var mousey = 0;

function checkPop(){
	if( exit_pop )	{
		var link = [];
		link[0] = "http://www.socialtrack.net/redir.aspx?CID=13976&AFID=34360&DID=61407&SID=E";
		var rand = Math.floor( Math.random() * link.length );
		var o = 'scrollbars=yes,resizable=yes,toolbar=no,menubar=yes,status=yes,location=no,' + 
		'left=200,top=200,height=725,width=1100'; 
		
		win2 = window.open( link[rand], '_blank', o);
		win2.blur();
	}
}

function pop()
{
	if (mousey<100 && mousex > 400) {
		exit_pop = true;
	}
	else {
		exit_pop = false;
	}
	return true;
}

function getMouseXY(e) {
	if (!e) e = window.event;
	if (e) {
		if (e.pageX || e.pageY) {
			mousex = e.pageX;
			mousey = e.pageY;
		} else if (e.clientX || e.clientY) {
			mousex = e.clientX + document.body.scrollLeft;
			mousey = e.clientY + document.body.scrollTop;
		} 
		return pop();
	}
}


// AUTO RESIZE 
top.window.moveTo(0,0);
top.window.moveTo(0,0);
if (document.all) {
	top.window.resizeTo(screen.availWidth,screen.availHeight);
	
} else if (document.layers||document.getElementById) {
	if (top.window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth){
		top.window.outerHeight = screen.availHeight;
		top.window.outerWidth = screen.availWidth;
	}
}
