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

// Site Info Object
var siteinfo = {
tld:"com", lang:"en", timezone:"PDT", advertisingid:"fran", station:"fran", ultraseekregion:"cox", affiliate:"fox", state:"ca", owner:"cox", region:"cox", is_ia:"yes", 
 sitekey:{lc:"fran", uc:"FRAN" }, 
 sitename:{lc:"ktvu", mx:"KTVU", uc:"KTVU.COM", display:"KTVU.com" }, 
 callletters:{lc:"ktvu", uc:"KTVU" }, 
 statecode:{uc:"CA", lc:"ca" }, 
 statename:{uc:"CALIFORNIA", lc:"california", mx:"California" }, 
 city:{uc:"SAN FRANCISCO", lc:"san francisco", mx:"San Francisco" }, 
 contentrights:{cnn:"yes", nbcoo:"no", group:"red", ah:"no" }, 
 search:{ultraseekregion:"cox" }, 
 thirdparty_info:{
  experian_auto:{id:"1759"}, 
  stepup:{id:"1000"}, 
  eharmony:{cid:"1223", clicktracker_dfp:"12700856;8704162;e"}, 
  experion:{id:"6411"}, 
  date:{citycode:"1823654", clicktracker:"5444", clicktracker_dfp:"7391734;8704162;n"}, 
  findlaw:{clicktracker_dfp:"6861486;8704162;s"}, 
  homestore:{tracker_id:"4163", code:"ci", clicktracker_dfp:"7412453;8704162;f"}, 
  valpak:{clicktracker:"4797", clicktracker_dfp:"7440761;8704162;i"}, 
  yellowpages:{tracker_id:"3830", from:"CoxBayinsider", clicktracker_dfp:"7347920;8704162;l"}, 
  careerbuilder:{tracker_id:"4076"}, 
  moviesearch:{zip:"94105"}, 
  titantv:{id1:"53004", id2:"53005"}, 
  mailforms:{email:"bill.murray"}, 
  monster:{lid:"349,343,20586,702,352,355,883,356"}, 
  coupons:{pid:"11109&zid=wr49&nid=11"}
 }, 
 video:{playerversion:"3", skin:"blue", wxicons:"cox", headerlinks:"#000099", cpcode:"12948" }
}


// 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


