var ads_agt=navigator.userAgent.toLowerCase();

var ads_is_major = parseInt(navigator.appVersion);
var ads_is_minor = parseFloat(navigator.appVersion);

var ads_is_nav  = ((ads_agt.indexOf('mozilla')!=-1) && (ads_agt.indexOf('spoofer')==-1)
			&& (ads_agt.indexOf('compatible') == -1) && (ads_agt.indexOf('opera')==-1)
			&& (ads_agt.indexOf('webtv')==-1));
var ads_is_nav2 = (ads_is_nav && (ads_is_major == 2));
var ads_is_nav3 = (ads_is_nav && (ads_is_major == 3));
var ads_is_nav4 = (ads_is_nav && (ads_is_major == 4));
var ads_is_nav4up = (ads_is_nav && (ads_is_major >= 4));

//testing for moz5 is not helpful
//var ads_is_nav5 = (ads_is_nav && (ads_is_major == 5));
//var ads_is_nav5up = (ads_is_nav && (ads_is_major >= 5));

var ads_is_nav6 = (ads_is_nav && (ads_agt.indexOf("netscape6")!=-1) && (ads_agt.indexOf("6.1")==-1));
var ads_is_nav6up = (ads_is_nav && !ads_is_nav4 && !ads_is_nav3 && !ads_is_nav2);
var ads_is_nav6_1 = (ads_is_nav && (ads_agt.indexOf("netscape6")!=-1) && (ads_agt.indexOf("6.1")!=-1));
var ads_is_nav6_1up = (ads_is_nav && !ads_is_nav6 && !ads_is_nav4 && !ads_is_nav3 && !ads_is_nav2);


var ads_is_ie   = ((ads_agt.indexOf("msie") != -1) && (ads_agt.indexOf("opera") == -1) && (ads_agt.indexOf("omniweb") == -1));
var ads_is_ie3  = (ads_is_ie && (ads_is_major < 4));
var ads_is_ie4  = (ads_is_ie && (ads_is_major == 4) && (ads_agt.indexOf("msie 5")==-1) && (ads_agt.indexOf("msie 6")==-1));
var ads_is_ie4up  = (ads_is_ie  && (ads_is_major >= 4));
var ads_is_ie5  = (ads_is_ie && (ads_is_major == 4) && (ads_agt.indexOf("msie 5.0")!=-1) );
var ads_is_ie5up  = (ads_is_ie  && !ads_is_ie3 && !ads_is_ie4);

var ads_is_ie5_1_macbeta = (ads_is_ie && (ads_agt.indexOf("mac")!=-1) && (ads_agt.indexOf("5.1b")!=-1));

var ads_is_win   = ( (ads_agt.indexOf("win")!=-1) || (ads_agt.indexOf("16bit")!=-1) );
var ads_is_mac    = (ads_agt.indexOf("mac")!=-1);


function toggleAd() {


	if (!itsclosed) {
		HandleClick(0);
		itsclosed = true;
	} else
	if (itsclosed) {
		HandleClick(1);
		itsclosed = false;
	}
}

function HandleClick(theAction) {
// 1 = open, 0 = close

	if (getsSplash) HideSplash();

	if (theAction == 1) {

			if (document.getElementById) {
					document.getElementById('hiddenLayer').style.display = "block";
					document.getElementById('adFrame').src = adPath;
			}

			if (document.images) openTrk.src = openTrkPath + noCache();
	} else if (theAction == 0) {

			if (document.getElementById) {
				document.getElementById('adFrame').src = "http://www.silicon.com/i/b.gif";
				document.getElementById('hiddenLayer').style.display = "none";

			}

			if (document.images) closeTrk.src = closeTrkPath + noCache();
	}
}


function Rollup() {
	if (getsSplashRollup) {
		splashHeight = 210;
		newHeight = splashHeight;
		rollSpeed = 1;
		rollInt = setInterval("Shrink();", 10);
	} else if (getsSplash) HideSplash();
}

function Shrink() {
	document.getElementById('splashLayer').style.height = newHeight + "px";
	document.getElementById('splashFrame').style.height = newHeight + "px";
	newHeight -= rollSpeed;
	rollSpeed += 20;
	if (newHeight < 4) {
		clearInterval(rollInt);
		HideSplash();
	}


}

function HideSplash() {
	if (getsSplash) {
		document.getElementById('splashLayer').style.display = "none";
		getsSplash = false;
		itsclosed = 1;
	}
}



function CheckOokie() {
	theCookie = document.cookie;
	this.seenIt = (theCookie.indexOf(creative + "glu=1")!=-1); 

	if (!this.seenIt && getsGlu) {
		var theDate = new Date();
		//set cookie expiration time.  current setting is 24 hrs.
		exp = theDate.getTime() + (24 * 60 * 60 * 1000);
		theDate.setTime(exp);
		document.cookie = creative + "glu=1; expires=" + theDate.toGMTString();
	}
}

function setCookie()
	{
		var theDate = new Date();
		//set cookie expiration time.  current setting is 24 hrs.
		exp = theDate.getTime() + (24 * 60 * 60 * 1000);
		theDate.setTime(exp);
		document.cookie = creative + "glu=0; expires=" + theDate.toGMTString();
		alert(document.cookie);
	}

function noCache() {
	// 2-check with tlu
	var d = new Date();
	now = "+" + d.getTime() + "/http://images.zdnet.com/adverts/imp/dotclear.gif";
	return now;
}

