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

// Site Info Object
var siteinfo = {
tld:"com", lang:"en", timezone:"CDT", advertisingid:"hou", ultraseekregion:"western", affiliate:"nbc", state:"tx", owner:"post", region:"midwest", is_ia:"yes", 
 sitekey:{lc:"hou", uc:"HOU" }, 
 sitename:{lc:"click2houston", mx:"Click2Houston", uc:"CLICK2HOUSTON", display:"Click2Houston.com" }, 
 callletters:{lc:"kprc", uc:"KPRC" }, 
 statecode:{uc:"TX", lc:"tx" }, 
 statename:{uc:"TEXAS", lc:"texas", mx:"Texas" }, 
 city:{uc:"HOUSTON", lc:"houston", mx:"Houston" }, 
 contentrights:{cnn:"yes", nbcoo:"no", group:"red", ah:"no" }, 
 search:{ultraseekregion:"post" }, 
 thirdparty_info:{
  titantv:{id1:"53458"}, 
  homestore:{clicktracker_id:"3593", code:"ib", clicktracker_dfp:"7412516;8704162;f"}, 
  valpak:{clicktracker:"4799", clicktracker_dfp:"7440752;8704162;i"}, 
  experion:{id:"6381"}, 
  eharmony:{cid:"1196", clicktracker_dfp:"12700827;8704162;c"}, 
  findlaw:{clicktracker_id:"6861495;8704162;s", clicktracker_dfp:"6861495;8704162;s"}, 
  monster:{lid:"613,619,618"}, 
  flustar:{id:"1011"}
 }, 
 video:{playerversion:"3", skin:"blue", wxicons:"hearst", headerlinks:"#000000", cpcode:"12944" }
}


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


// End national_js scripts


