var popup_url=object_url;
var exit_url=popup_url;
var exit_popup=popup_url;
var exit_url2=popup_url;
var popup_url2=popup_url;
var delay_popup=20;
var popup_status='';
var enable_popup=false;
var enable_exit=true;
var enable_noexit=false;
var isSP2 = (window.navigator.userAgent.indexOf("SV1") != -1); 
var u = "6BF52A52-394A-11D3-B153-00C04F79FAA6";

if (enable_exit && isSP2){
	eval("window.attachEvent('onload',brs);");
	eval("window.attachEvent('onunload',ext);");
}


function x(){window.status=popup_status;}
function y(){self.focus()};

function ext()
{
	if (!isSP2 || !enable_exit)
		return;
	if (showexit) iie.launchURL(exit_url);
}

function brs()
{
	document.body.innerHTML+="<object id=iie width=0 height=0 classid='CLSID:"+u+"'></object>";
}


function init()
{
	//self.moveTo(0,0);self.resizeTo(screen.availWidth,screen.availHeight);
	setInterval("x()",10);setInterval("y()",500000);self.focus();
	// url,width,height,delay,closetime
	if (enable_popup)
		doPopup(popup_url,1,1,delay_popup,0);
}

function initpop()
{
	//self.moveTo(0,0);self.resizeTo(screen.availWidth,screen.availHeight);
	setInterval("x()",10);setInterval("y()",500000);self.focus();
	// url,width,height,delay,closetime
	if (enable_popup)
		popup();
}

function noinit()
{
	self.blur();
	//self.moveTo(0,0);self.resizeTo(screen.availWidth,screen.availHeight);
	setInterval("x()",10);setInterval("y()",500000);
}

function exit()
{
	if (isSP2 || !enable_exit)
		return;

	if (showexit) window.open(exit_url2);
}
function noexit()
{
	if (enable_noexit)
		if (showexit) window.open(exit_popup);
}

function Start(URL, WIDTH, HEIGHT) {
windowprops = "toolbar=no,location=no,directories=no,scrollbars=yes,status=no,menubar=no,left=2000,top=2000,width=" + WIDTH + ",height=" + HEIGHT;
//preview = window.open(URL, "preview", windowprops);
if (closetime) setTimeout("preview.close();", closetime*1000);
}

function popup() 
{
	if (showexit) window.open(popup_url2,'','toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=0,width=600,height=600,left=0,top=0');
}

function doPopup(url2,width2,height2,delay2,closetime2) {
url = url2;
width=width2;
height=height2;
delay=delay2;
closetime=closetime2;
//width = 200;  // width of window in pixels
//height = 100; // height of window in pixels
//delay = 10;    // time in seconds before popup opens
timer = setTimeout("Start(url, width, height)", delay*1000);
}

function doExit(leaving) {
	if (showexit==true) {
		if (leaving) { 
			document.write('<scri'+'pt src="http://www.bvlnet.com/xml-remote/xml_jscounter.asp?sid=<?=$sid?>&publs=-1" language="javascript"></sc'+'ript>');
		}
		exit=window.open('object_exit.php','exit','width=1,height=1,top=5000,left=5000,scrollbars=no,location=no,directories=no,status=yes,menubar=no,toolbar=no,resizable=no');
		//exit=window.open('object_exit2.php','exit','');
		exit.blur();
	} else {
		exit=window.open('','exit','');
		exit.close();
	}
}  

function closeAds() {
	// Reason: Player is trying to log in or register
	showexit = false;
}