
/* NBC11.com scripts */
// Begin national js scripts

// Site Info Object
var siteinfo = {
tld:"com", lang:"en", timezone:"PDT", advertisingid:"bay", matchcomid:"510037", ultraseekregion:"nbc", affiliate:"nbc", state:"ca", owner:"nbc", region:"nbc", is_ia:"yes", 
 sitekey:{lc:"bay", uc:"BAY" }, 
 sitename:{lc:"nbc11", mx:"NBC11", uc:"NBC11", display:"NBC11.com" }, 
 callletters:{lc:"kntv", uc:"KNTV" }, 
 statecode:{uc:"CA", lc:"ca" }, 
 statename:{uc:"CALIFORNIA", lc:"california", mx:"California" }, 
 city:{uc:"SAN FRANCISCO", lc:"san francisco", mx:"San Francisco" }, 
 contentrights:{cnn:"no", nbcoo:"yes", group:"blue", ah:"yes" }, 
 feedroom_links:{url:"http://kntv.feedroom.com/index.jsp?auto_band=X", url:"http://kntv.feedroom.com/index.jsp?auto_band=X" }, 
 search:{ultraseekregion:"nbc" }, 
 sitedescription:{ }, 
 sitekeywords:{ }, 
 thirdparty_info:{
  experian_auto:{id:"1741"}, 
  experion:{id:"6394"}, 
  eharmony:{cid:"1207", clicktracker_dfp:"12700839;8704162;f"}, 
  findlaw:{clicktracker_dfp:"6861458;8704162;r"}, 
  homestore:{code:"ib", clicktracker_id:"4292", clicktracker_dfp:"7412444;8704162;f"}, 
  valpak:{clicktracker:"4783", clicktracker_dfp:"7440789;8704162;s"}, 
  titantv:{id1:"53480"}, 
  monster:{lid:"349,343,20586,702,352,355,883,356"}, 
  moviefone:{uid:"22003"}
 }, 
 video:{cpcode:"8135" }
}


// GLOBAL Variables
now = new Date();
expire = new Date((now.getFullYear()+1),now.getMonth(),now.getDate());
var child = 0;
var rnd = new Date();
rnd = rnd.getTime();

// Deprecated variables
var IBS_Sitekey = siteinfo.sitekey.lc;
var IS_IA = siteinfo.is_ia;
IBSSite = new Object();
dotPosition = document.location.host.indexOf('.')+1;
IBSSite.domain = document.location.host.substring(dotPosition);

// Set environment variables
env = new Object();
env.bVer = navigator.appVersion;
env.bName = navigator.appName;
env.platform = navigator.platform;
env.userAgent = navigator.userAgent;
env.cookies = navigator.cookieEnabled;
env.NS4 = (document.layers)? 1 : 0;
env.MacIE = ((navigator.userAgent.indexOf("IE 4")  > -1) && (navigator.userAgent.indexOf("Mac")  > -1))? 1 : 0;
env.IE4 = (document.all && !env.MacIE)? 1 : 0;
env.Gen4 = (document.all || document.layers)? 1 : 0;
if(env.bName.indexOf('Netscape') != -1) isNN = true;
else isNN = false;
if(env.bName.indexOf('Microsoft') != -1) isIE = true;
else isIE = false;

//Open window - pass URL and Attributes
function popUp(URL, ATTRIBUTES)  {
	DEF_ATTRIB = 'width=200,height=200,top=100,left=100,resizable=yes,scrollbars';
	if (ATTRIBUTES == null) {
		ATTRIBUTES = DEF_ATTRIB;
	}
	child = window.open(URL, "spawn", ATTRIBUTES);
	// child.opener = self;
}


// reload adcode
function refreshAd(ad) {
	if (typeof bannerUrl == 'undefined') {
		bannerUrl = document.getElementById(ad).src;
	}
	rnd++;  //increment the random number
	document.getElementById(ad).src = bannerUrl;
}


// Define client cookie values
cookiesList = document.cookie.split('; ');
myCookies = new Array();
for(c=0; c<cookiesList.length; c++) {
	cookieTemp = cookiesList[c].split('=');
	myCookies[cookieTemp[0]] = cookieTemp[1];
}

// Added new variable to support multiple sub domains
var docDomain = document.domain.split('.');
var dd='';
for(var i=1; i<docDomain.length; i++) {
	dd+="."+docDomain[i];
}
docDomain=dd;

// Set cookie info
function setCookie( name, value, path, expires, domain, secure ) {
	expire.setTime(now.getTime() + expires * 24 * 60 * 60 * 1000);
	curCookie =  name + "=" + escape(value) +
		((expires) ? "; expires=" + expire.toGMTString() : "") +
		((path) ? "; path=" + path : "") +
		((domain) ? "; domain=" + domain : "") +
		((secure) ? "; secure" : "");
	if ((name + "=" + escape(value)).length <= 4000) document.cookie = curCookie;
	else if (confirm("Cookie exceeds 4KB and will be cut!")) document.cookie = curCookie;
}

// Get cookie info
function getCookie(c) {
	if(typeof myCookies[c] != 'undefined') return myCookies[c];
	else return '';
}

// Remove cookie
function deleteCookie(name,path) {
	setCookie(name,"",path,-1,docDomain);
}

// In case old cookie functions are used somewhere...
WM_setCookie  = setCookie;
WM_readCookie = getCookie;
WM_killCookie = deleteCookie;



function fixPngImage(p) {
	var imgsrc;
	var trans = "http://images.ibsys.com/sh/images/spacer.gif";   
	if(typeof p.tested != undefined && !p.tested &&  typeof p.runtimeStyle != 'undefined') {
	   // retain image src
	   imgsrc = p.src;

	   // make sure the image is a PING
	   if ( /\.png$/.test( imgsrc.toLowerCase() ) ) {
	   	// If it is set it to a transparent image
		p.src = trans;
		// Set the runtime style to load the alpha image in the background
		p.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + imgsrc + "',sizingMethod='scale')";
		p.tested = true;
	   }
   }
}

// Calls 'func' on 'eventName' in 'obj'
function addEvent(obj, eventName, func)
{
	if(obj.addEventListener)
		return obj.addEventListener(eventName, func, true);
	else if(obj.attachEvent)
	{
		obj.attachEvent("on" + eventName, func);
		return true;
	}
	return false;
}
function mwpop(path,w,h) {
	var atts = 'width='+w+',height='+h+',\'scrollbars=yes,toolbar=no,status=no,location=no,menubar=no,top=50,left=50';
	popUp(path, atts);
}

// End national_js scripts


