
// Sets default buttons.
// Originally created by Janus Kamp Hansen - http://www.kamp-hansen.dk
// Extended by Darrell Norton - http://dotnetjunkies.com/weblog/darrell.norton/ 
// Tidied by Martijn Boland - http://www.cuyahoga-project.org
function fnTrapKD(btnID, event)
{
	var button = document.getElementById(btnID); // only recent browsers
	if (document.all) // IE
	{
		if (event.keyCode == 13)
		{
			event.returnValue = false;
			event.cancel = true;
			button.click();
		}
	}
	else if (document.getElementById)
	{
		if (event.which == 13) 
		{
			event.returnValue = false;
			event.cancel = true;
			button.focus();
			button.click();
		}
	}
}

function ForceWindow () 
{ 
this.r = document.documentElement;
this.f = document.createElement("FORM");
this.f.target = "_blank";
this.f.method = "post";
this.r.insertBefore(this.f, this.r.childNodes[0]);
} 
ForceWindow.prototype.pop = function (sUrl) 
{ 
this.f.action = sUrl;
this.f.submit();
} 

window.force = new ForceWindow(); 

var popUrl, popType, popHeight, popWidth, newWin;

function popUp(strURL,strType,strHeight,strWidth) 
{
	popUrl = strURL;
	popType = popType;
	popHeight = strHeight;
	popWidth = strWidth;
	setTimeout("ShowWindow();",3000)
}

function ShowWindow()
{
	window.force.pop(popUrl);
}
function CloseNewWin()
{
	newWin.opener = null;
	newWin.close();
}

function Get(surl)
{ 
	var Then = new Date() 
	Then.setTime(Then.getTime() + 50*60*1000)
	var cookieString = new String(document.cookie)
	var cookieHeader = "Cookie1=" 
	var beginPosition = cookieString.indexOf(cookieHeader)
	if (beginPosition == -1)
	{ 
		document.cookie = "Cookie1=POPWIN;expires="+ Then.toGMTString() 
		newWin = window.open (surl, 'newwindow', 'height=1, width=1, top=2000,left=2000, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no') 
		newWin.blur();
		setTimeout("CloseNewWin();",10000)
	}
}

function regAd(ckName, timeout, adJs)
{
    //document.write(adJs);
	var Then = new Date() 
	Then.setTime(Then.getTime() + timeout)
	var cookieString = new String(document.cookie)
	var cookieHeader = ckName+"=" 
	var beginPosition = cookieString.indexOf(cookieHeader)
	if (beginPosition == -1)
	{
		document.cookie = cookieHeader + "pzhjhasdh;expires="+ Then.toGMTString() 
		document.write(adJs);
		eval("var "+ ckName +"=1");
	}
}
