
function Browser ()
{
	this.ie = this.netscape = this.mac = this.opera = 0;
	var s = navigator.userAgent.toLowerCase ();
	this.ie = (parseFloat (s.slice (s.indexOf ("msie") + 5)));
	this.netscape = (this.ie) ? (0) : Gecko (s.indexOf ("gecko/"), s);
	this.mac = (s.indexOf ("mac") > -1);
	this.opera = (parseFloat (s.slice (s.indexOf ("opera") + 6)));
	if (this.opera) this.ie = 0;
	this.screenHeight = screen.height;
	this.screenWidth = screen.width;
	this.colorDepth = (this.netscape >= 4) ? screen.pixelDepth : screen.colorDepth;
}

var browser = new Browser ();

function Gecko (nTmp, s)
{
	if (nTmp >- 1)
	{
		nTmp = (parseFloat (s.slice (nTmp + 6)));
		if (nTmp >= 20020823) 
			nTmp = 7;
		else if(nTmp >= 20011019)
			nTmp = 6.2;
		else if(nTmp >= 20010726)
			nTmp = 6.1;
		else
			nTmp = 6;
	}
	else
	{
		nTmp = (parseFloat (s.slice (s.indexOf ("mozilla/") + 8)));
	}

	return nTmp;
}

function OpenPopupWindow (p1, p2, p3)
{
	window.open (p1, p2, p3);
}

function adpopup(adpop,w,h)
{
	window.open(adpop, "ADPopup", "resizable=no,status=no,scrollbars=no,menubar=no,toolbar=no,location=no,left=470,top=130,width=" + w + ",height=" + h + "");
}

function getextad(fbnid,furl,fwidth,fheight,fwmode,ftag,flink,ftype)
{
	document.write ("<OBJECT id=banner" + fbnid + " classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" width=\"" + fwidth + "\" height=\"" + fheight + "\" ");

	if (ftype == "roll")
	{
		document.write ( " style=\"position:absolute; z-index:100; left:" + GetAbsoluteLeft("lgadvtd") + "; top:" + GetAbsoluteTop("lgadvtd") + "\">");
	}
	else
	{
		document.write ( ">");
	}

	if (ftag == "")
	{
		document.write ("<param name=\"movie\" value=\"" + furl + "\">");
	}
	else
	{
		if (furl.lastIndexOf("?") > 0)
		{
			document.write (" <PARAM name=\"movie\" value=\"" + furl + "&" + ftag + "=" + escape(flink) + "\">");
		}
		else
		{
			document.write (" <PARAM name=\"movie\" value=\"" + furl + "?" + ftag + "=" + escape(flink) + "\">");
		}
	}

	document.write (" <param name=quality value=high>"
	+ " <param name=wmode value=\"" + fwmode + "\">");

	if (ftag != "")
	{
		if (furl.lastIndexOf("?") > 0)
		{
			document.write (" <EMBED src=\"" + furl + "&" + ftag + "=" + escape(flink) +  "\"");
		}
		else
		{
			document.write (" <EMBED src=\"" + furl + "?" + ftag + "=" + escape(flink) +  "\"");
		}
	}
	else
	{
		document.write (" <EMBED src=\"" + furl + "\"");
	}
	document.write (" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" wmode=" + fwmode + " width=\"" + fwidth + "\" height=\"" + fheight + "\"></EMBED>"
	+ " </OBJECT>");
}

function getextflashfloatad(furl,fwidth,fheight,fwmode,fleft,ftop,fname,ftimeout)
{
	var s = navigator.userAgent.toLowerCase ();
	var isie = (parseFloat (s.slice (s.indexOf ("msie") + 5)));
	
	if (isie && isie >= 5)
	{
		if (ftop == '')
		{
			var docHeight = document.body.clientHeight;
			var objHeight = docHeight - 420 - 60;
			if (objHeight < 0) {objHeight = '0';}
			else {objHeight = objHeight.toString();}
			ftop = objHeight;
		}
		var isDisplayed = GetFloatingCookie (fname + "Floating");
		if(isDisplayed != "yes")
		{
			document.write("<div id=\"FloatAdLayer\" style=\"position:absolute; width:" + fwidth + "px; height:" + fheight + "px; z-index:600; left:" + fleft + "px; top:" + ftop + "px; visibility: show\">"
				+"  <object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0\" width=\"" + fwidth + "\" height=\"" + fheight + "\" align=\"\">"
				+"  <param name=movie value=\"" + furl + "\">"
				+"  <param name=quality value=High>"
				+"  <param name=\"Src\" value=\"" + furl + "\">"
				+"  <param name=\"Scale\" value=\"ShowAll\">"
				+"  <param name=wmode value=\"" + fwmode + "\"> "
				+"  <embed src=\"" + furl + "\" width=\"" + fwidth + "\" height=\"" + fheight + "\" align=\"\" quality=high scale=exactfit bgcolor=#FFFFFF type=\"application/x-shockwave-flash\"  pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\"></embed>"
				+"  </object>"
				+"  </div>");
	
			setTimeout ("HideFloatAdBanner()", ftimeout);
			SetFloatingCookie (fname + "Floating", "yes");
		}
	}
}

function getextflashfloatadctag(furl,fwidth,fheight,fwmode,fleft,ftop,fname,ftimeout,fclicktag,fclickurl,fciid,fcrid)
{
	var s = navigator.userAgent.toLowerCase ();
	var isie = (parseFloat (s.slice (s.indexOf ("msie") + 5)));
	var fclickedurl = "http://www.ntvmsnbc.com/ads/adredir.asp?ciid=" + fciid + "&crid=" + fcrid + "&url=" + fclickurl
	
	if (isie && isie >= 5)
	{
		if (ftop == '')
		{
			var docHeight = document.body.clientHeight;
			var objHeight = docHeight - 420 - 60;
			if (objHeight < 0) {objHeight = '0';}
			else {objHeight = objHeight.toString();}
			ftop = objHeight;
		}
		var isDisplayed = GetFloatingCookie (fname + "Floating");
		if(isDisplayed != "yes")
		{
			document.write("<div id=\"FloatAdLayer\" style=\"position:absolute; width:" + fwidth + "px; height:" + fheight + "px; z-index:600; left:" + fleft + "px; top:" + ftop + "px; visibility: show\">"
				+"  <object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0\" width=\"" + fwidth + "\" height=\"" + fheight + "\" align=\"\">"
				+"  <param name=movie value=\"" + furl + "?" + fclicktag + "=" + escape(fclickedurl) + "\">"
				+"  <param name=quality value=High>"
				+"  <param name=\"Src\" value=\"" + furl + "?" + fclicktag + "=" + escape(fclickedurl) + "\">"
				+"  <param name=\"Scale\" value=\"ShowAll\">"
				+"  <param name=wmode value=\"" + fwmode + "\"> "
				+"  <embed src=\"" + furl + "?" + fclicktag + "=" + escape(fclickedurl) + "\" width=\"" + fwidth + "\" height=\"" + fheight + "\" align=\"\" quality=high scale=exactfit bgcolor=#FFFFFF type=\"application/x-shockwave-flash\"  pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\"></embed>"
				+"  </object>"
				+"  </div>");
	
			setTimeout ("HideFloatAdBanner()", ftimeout);
			SetFloatingCookie (fname + "Floating", "yes");
		}
	}
}

function HideFloatAdBanner(fname)
{
	var o = document.all.item("FloatAdLayer");
	if (o == null)
		return;
	o.style.display = "none";
}

function SetFloatingCookie(sName, sValue)
{
	var strCookie = sName + "=" + escape(sValue);
	document.cookie = strCookie;
}

function GetFloatingCookie(sName)
{
	var aCookie = document.cookie.split(";");
	for (var i=0; i < aCookie.length; i++)
	{
		var aCrumb = aCookie[i].split("=");
		while(aCrumb[0].indexOf(" ")==0) 
			aCrumb[0]=aCrumb[0].substr(1);
		if (sName == aCrumb[0])
			return unescape(aCrumb[1]);
	}
	return null;
}

function GetAbsoluteLeft(objectId) {
	var o = document.all.item(objectId);
	var oLeft = o.offsetLeft;
	while (o.offsetParent != null) {   
		oParent = o.offsetParent;    
		oLeft += oParent.offsetLeft;
		o = oParent;
	}
	return oLeft;
}

function GetAbsoluteTop(objectId) {
	var o = document.all.item(objectId);
	var oTop = o.offsetTop;
	while (o.offsetParent != null) { 
		oParent = o.offsetParent;  
		oTop += oParent.offsetTop; 
		o = oParent;
	}
	return oTop;
}

function getabsoluteleft (o) { return GetAbsoluteLeft (o); }
function getabsolutetop (o) { return GetAbsoluteTop (o); }
