var timeridmain = null;
var timeridsub = null;

function isClosed(id) {
	return (getCookie(id) == null ? false : true);
}

function setClosed(id) {
	//Set a cookie to not display the add for 24 hours
	var exp = getExpDate(1,0,0);
	setCookie(id,"hide", exp, "/");
	if (timeridmain != null) {
		clearTimeout(timeridmain);
	}
	if (timeridsub != null) {
		clearTimeout(timeridsub);
	}
}

function showInterstitialAdd(id) {
	initDHTMLAPI();
	//if (!isClosed()) {
		var obj = getRawObject(id);
		var center = getCenterPosition(obj);
		shiftTo(obj, center[0], center[1] - 50);
		show(obj);
		timeridmain = setTimeout("showInterstitialAdd('"+id+"')", 250); //quarter second
		/*
		centerOnWindow(obj);
		timeridsub = setTimeout("showInterstitialAdd('"+id+"')", 250); //quarter second	
		*/
	//}
}

function showInterstitialAddMainLayout(id) {
	initDHTMLAPI();
	//if (!isClosed()) {
		var obj = getRawObject(id);
		var center = getCenterPosition(obj);
		shiftTo(obj, center[0], center[1] - 50);
		show(obj);
		timeridmain = setTimeout("showInterstitialAddMainLayout('"+id+"')", 250); //quarter second	
	//}
}

function closeInterstitialAdd(id) {
	var obj = getRawObject(id);
	hide(obj);
	setClosed(id);
}

function openWindow(url) {
	var win = window.open(url,"reddoor");
	win.focus();
}

