/**
 * SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;
/* End SWFObject v1.5*/

/*	SWFObject v2.0 <http://code.google.com/p/swfobject/>
	Copyright (c) 2007 Geoff Stearns, Michael Williams, and Bobby van der Sluis
	This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
*/
var swfobject=function(){var Z="undefined",P="object",B="Shockwave Flash",h="ShockwaveFlash.ShockwaveFlash",W="application/x-shockwave-flash",K="SWFObjectExprInst",G=window,g=document,N=navigator,f=[],H=[],Q=null,L=null,T=null,S=false,C=false;var a=function(){var l=typeof g.getElementById!=Z&&typeof g.getElementsByTagName!=Z&&typeof g.createElement!=Z&&typeof g.appendChild!=Z&&typeof g.replaceChild!=Z&&typeof g.removeChild!=Z&&typeof g.cloneNode!=Z,t=[0,0,0],n=null;if(typeof N.plugins!=Z&&typeof N.plugins[B]==P){n=N.plugins[B].description;if(n){n=n.replace(/^.*\s+(\S+\s+\S+$)/,"$1");t[0]=parseInt(n.replace(/^(.*)\..*$/,"$1"),10);t[1]=parseInt(n.replace(/^.*\.(.*)\s.*$/,"$1"),10);t[2]=/r/.test(n)?parseInt(n.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof G.ActiveXObject!=Z){var o=null,s=false;try{o=new ActiveXObject(h+".7")}catch(k){try{o=new ActiveXObject(h+".6");t=[6,0,21];o.AllowScriptAccess="always"}catch(k){if(t[0]==6){s=true}}if(!s){try{o=new ActiveXObject(h)}catch(k){}}}if(!s&&o){try{n=o.GetVariable("$version");if(n){n=n.split(" ")[1].split(",");t=[parseInt(n[0],10),parseInt(n[1],10),parseInt(n[2],10)]}}catch(k){}}}}var v=N.userAgent.toLowerCase(),j=N.platform.toLowerCase(),r=/webkit/.test(v)?parseFloat(v.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,i=false,q=j?/win/.test(j):/win/.test(v),m=j?/mac/.test(j):/mac/.test(v);/*@cc_on i=true;@if(@_win32)q=true;@elif(@_mac)m=true;@end@*/return{w3cdom:l,pv:t,webkit:r,ie:i,win:q,mac:m}}();var e=function(){if(!a.w3cdom){return }J(I);if(a.ie&&a.win){try{g.write("<script id=__ie_ondomload defer=true src=//:><\/script>");var i=c("__ie_ondomload");if(i){i.onreadystatechange=function(){if(this.readyState=="complete"){this.parentNode.removeChild(this);V()}}}}catch(j){}}if(a.webkit&&typeof g.readyState!=Z){Q=setInterval(function(){if(/loaded|complete/.test(g.readyState)){V()}},10)}if(typeof g.addEventListener!=Z){g.addEventListener("DOMContentLoaded",V,null)}M(V)}();function V(){if(S){return }if(a.ie&&a.win){var m=Y("span");try{var l=g.getElementsByTagName("body")[0].appendChild(m);l.parentNode.removeChild(l)}catch(n){return }}S=true;if(Q){clearInterval(Q);Q=null}var j=f.length;for(var k=0;k<j;k++){f[k]()}}function J(i){if(S){i()}else{f[f.length]=i}}function M(j){if(typeof G.addEventListener!=Z){G.addEventListener("load",j,false)}else{if(typeof g.addEventListener!=Z){g.addEventListener("load",j,false)}else{if(typeof G.attachEvent!=Z){G.attachEvent("onload",j)}else{if(typeof G.onload=="function"){var i=G.onload;G.onload=function(){i();j()}}else{G.onload=j}}}}}function I(){var l=H.length;for(var j=0;j<l;j++){var m=H[j].id;if(a.pv[0]>0){var k=c(m);if(k){H[j].width=k.getAttribute("width")?k.getAttribute("width"):"0";H[j].height=k.getAttribute("height")?k.getAttribute("height"):"0";if(O(H[j].swfVersion)){if(a.webkit&&a.webkit<312){U(k)}X(m,true)}else{if(H[j].expressInstall&&!C&&O("6.0.65")&&(a.win||a.mac)){D(H[j])}else{d(k)}}}}else{X(m,true)}}}function U(m){var k=m.getElementsByTagName(P)[0];if(k){var p=Y("embed"),r=k.attributes;if(r){var o=r.length;for(var n=0;n<o;n++){if(r[n].nodeName.toLowerCase()=="data"){p.setAttribute("src",r[n].nodeValue)}else{p.setAttribute(r[n].nodeName,r[n].nodeValue)}}}var q=k.childNodes;if(q){var s=q.length;for(var l=0;l<s;l++){if(q[l].nodeType==1&&q[l].nodeName.toLowerCase()=="param"){p.setAttribute(q[l].getAttribute("name"),q[l].getAttribute("value"))}}}m.parentNode.replaceChild(p,m)}}function F(i){if(a.ie&&a.win&&O("8.0.0")){G.attachEvent("onunload",function(){var k=c(i);if(k){for(var j in k){if(typeof k[j]=="function"){k[j]=function(){}}}k.parentNode.removeChild(k)}})}}function D(j){C=true;var o=c(j.id);if(o){if(j.altContentId){var l=c(j.altContentId);if(l){L=l;T=j.altContentId}}else{L=b(o)}if(!(/%$/.test(j.width))&&parseInt(j.width,10)<310){j.width="310"}if(!(/%$/.test(j.height))&&parseInt(j.height,10)<137){j.height="137"}g.title=g.title.slice(0,47)+" - Flash Player Installation";var n=a.ie&&a.win?"ActiveX":"PlugIn",k=g.title,m="MMredirectURL="+G.location+"&MMplayerType="+n+"&MMdoctitle="+k,p=j.id;if(a.ie&&a.win&&o.readyState!=4){var i=Y("div");p+="SWFObjectNew";i.setAttribute("id",p);o.parentNode.insertBefore(i,o);o.style.display="none";G.attachEvent("onload",function(){o.parentNode.removeChild(o)})}R({data:j.expressInstall,id:K,width:j.width,height:j.height},{flashvars:m},p)}}function d(j){if(a.ie&&a.win&&j.readyState!=4){var i=Y("div");j.parentNode.insertBefore(i,j);i.parentNode.replaceChild(b(j),i);j.style.display="none";G.attachEvent("onload",function(){j.parentNode.removeChild(j)})}else{j.parentNode.replaceChild(b(j),j)}}function b(n){var m=Y("div");if(a.win&&a.ie){m.innerHTML=n.innerHTML}else{var k=n.getElementsByTagName(P)[0];if(k){var o=k.childNodes;if(o){var j=o.length;for(var l=0;l<j;l++){if(!(o[l].nodeType==1&&o[l].nodeName.toLowerCase()=="param")&&!(o[l].nodeType==8)){m.appendChild(o[l].cloneNode(true))}}}}}return m}function R(AE,AC,q){var p,t=c(q);if(typeof AE.id==Z){AE.id=q}if(a.ie&&a.win){var AD="";for(var z in AE){if(AE[z]!=Object.prototype[z]){if(z=="data"){AC.movie=AE[z]}else{if(z.toLowerCase()=="styleclass"){AD+=' class="'+AE[z]+'"'}else{if(z!="classid"){AD+=" "+z+'="'+AE[z]+'"'}}}}}var AB="";for(var y in AC){if(AC[y]!=Object.prototype[y]){AB+='<param name="'+y+'" value="'+AC[y]+'" />'}}t.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+AD+">"+AB+"</object>";F(AE.id);p=c(AE.id)}else{if(a.webkit&&a.webkit<312){var AA=Y("embed");AA.setAttribute("type",W);for(var x in AE){if(AE[x]!=Object.prototype[x]){if(x=="data"){AA.setAttribute("src",AE[x])}else{if(x.toLowerCase()=="styleclass"){AA.setAttribute("class",AE[x])}else{if(x!="classid"){AA.setAttribute(x,AE[x])}}}}}for(var w in AC){if(AC[w]!=Object.prototype[w]){if(w!="movie"){AA.setAttribute(w,AC[w])}}}t.parentNode.replaceChild(AA,t);p=AA}else{var s=Y(P);s.setAttribute("type",W);for(var v in AE){if(AE[v]!=Object.prototype[v]){if(v.toLowerCase()=="styleclass"){s.setAttribute("class",AE[v])}else{if(v!="classid"){s.setAttribute(v,AE[v])}}}}for(var u in AC){if(AC[u]!=Object.prototype[u]&&u!="movie"){E(s,u,AC[u])}}t.parentNode.replaceChild(s,t);p=s}}return p}function E(k,i,j){var l=Y("param");l.setAttribute("name",i);l.setAttribute("value",j);k.appendChild(l)}function c(i){return g.getElementById(i)}function Y(i){return g.createElement(i)}function O(k){var j=a.pv,i=k.split(".");i[0]=parseInt(i[0],10);i[1]=parseInt(i[1],10);i[2]=parseInt(i[2],10);return(j[0]>i[0]||(j[0]==i[0]&&j[1]>i[1])||(j[0]==i[0]&&j[1]==i[1]&&j[2]>=i[2]))?true:false}function A(m,j){if(a.ie&&a.mac){return }var l=g.getElementsByTagName("head")[0],k=Y("style");k.setAttribute("type","text/css");k.setAttribute("media","screen");if(!(a.ie&&a.win)&&typeof g.createTextNode!=Z){k.appendChild(g.createTextNode(m+" {"+j+"}"))}l.appendChild(k);if(a.ie&&a.win&&typeof g.styleSheets!=Z&&g.styleSheets.length>0){var i=g.styleSheets[g.styleSheets.length-1];if(typeof i.addRule==P){i.addRule(m,j)}}}function X(k,i){var j=i?"visible":"hidden";if(S){c(k).style.visibility=j}else{A("#"+k,"visibility:"+j)}}return{registerObject:function(l,i,k){if(!a.w3cdom||!l||!i){return }var j={};j.id=l;j.swfVersion=i;j.expressInstall=k?k:false;H[H.length]=j;X(l,false)},getObjectById:function(l){var i=null;if(a.w3cdom&&S){var j=c(l);if(j){var k=j.getElementsByTagName(P)[0];if(!k||(k&&typeof j.SetVariable!=Z)){i=j}else{if(typeof k.SetVariable!=Z){i=k}}}}return i},embedSWF:function(n,u,r,t,j,m,k,p,s){if(!a.w3cdom||!n||!u||!r||!t||!j){return }r+="";t+="";if(O(j)){X(u,false);var q=(typeof s==P)?s:{};q.data=n;q.width=r;q.height=t;var o=(typeof p==P)?p:{};if(typeof k==P){for(var l in k){if(k[l]!=Object.prototype[l]){if(typeof o.flashvars!=Z){o.flashvars+="&"+l+"="+k[l]}else{o.flashvars=l+"="+k[l]}}}}J(function(){R(q,o,u);if(q.id==u){X(u,true)}})}else{if(m&&!C&&O("6.0.65")&&(a.win||a.mac)){X(u,false);J(function(){var i={};i.id=i.altContentId=u;i.width=r;i.height=t;i.expressInstall=m;D(i)})}}},getFlashPlayerVersion:function(){return{major:a.pv[0],minor:a.pv[1],release:a.pv[2]}},hasFlashPlayerVersion:O,createSWF:function(k,j,i){if(a.w3cdom&&S){return R(k,j,i)}else{return undefined}},createCSS:function(j,i){if(a.w3cdom){A(j,i)}},addDomLoadEvent:J,addLoadEvent:M,getQueryParamValue:function(m){var l=g.location.search||g.location.hash;if(m==null){return l}if(l){var k=l.substring(1).split("&");for(var j=0;j<k.length;j++){if(k[j].substring(0,k[j].indexOf("="))==m){return k[j].substring((k[j].indexOf("=")+1))}}}return""},expressInstallCallback:function(){if(C&&L){var i=c(K);if(i){i.parentNode.replaceChild(L,i);if(T){X(T,true);if(a.ie&&a.win){L.style.display="block"}}L=null;T=null;C=false}}}}}();

/* add Array.push if needed */
if(Array.prototype.push == null){
        Array.prototype.push = function(item) { this[this.length] = item; return this.length; }
}

function getCookie(name) {
    if (new RegExp("\\b" + name + "=([^;]+)").test(document.cookie)){
        return unescape(RegExp.$1);}
    else
        return null;
}

function setCookie(name, value, days, path, domain, secure) {
    var c = name + "=" + escape(value);
    var expires = null;
    if (days)
        expires = new Date(new Date().getTime() + (days * 24 * 60 * 60 * 1000));
    if (expires)
        c += "; expires=" + expires.toUTCString();
    if (path)
        c += "; path=" + path;
    if (domain)
        c += "; domain=" + domain;
    if (secure)
        c += "; secure";
    document.cookie = c;
}

function addEvent(obj, evt, func) {
    if (obj.addEventListener)
        obj.addEventListener(evt, func, false);
    else if (obj.attachEvent)
        obj.attachEvent("on"+evt, func);
    else {
        var oldhandler = obj["on"+evt];
        obj["on"+evt] = (typeof oldhandler == "function")
            ? function() { oldhandler(); func(); } : func;
    }
}

function getElementsByTagNameFilter(root, tagName, filter) {
    var filtered = new Array();
    var elms = root.getElementsByTagName(tagName);
    for (var i = 0; i < elms.length; i++) {
        if (filter(elms[i])) {
            filtered[filtered.length] = elms[i];
        }
    }
    return filtered;
}

function hasClass(node, classname) {
    if (node) {
        var pattern = new RegExp("(?:^| )" + classname + "(?: |$)");
        return pattern.test(node.className);
    }
    return false;
}

function getParentByTagName(node, tagName) {
    var n = node;
    while (n && (n = n.parentNode) != null) {
        if (n.nodeType == 1 && n.tagName.toLowerCase() == tagName.toLowerCase())
            break;
    }
    return n;
}

function sethomepage(url) {
    window.open('http://static.cbslocal.com/CBS/national/htm/homepage/index.html','sethomepage','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=562,height=550,left=100,top=100,screenX=100,screenY=100');
}

function setOpacity(obj, opacity) {
    opacity = (opacity == 100) ? 99.999 : opacity;
    // IE/Win
    obj.style.filter = "alpha(opacity:" + opacity + ")";
    // Safari<1.2, Konqueror
    obj.style.KHTMLOpacity = opacity / 100;
    // Older Mozilla and Firefox
    obj.style.MozOpacity = opacity / 100;
    // Safari 1.2, newer Firefox and Mozilla, CSS3
    obj.style.opacity = opacity / 100;
}

function fadeIn(id, opacity) {
    obj = document.getElementById(id);
    if (obj == null) return;
    if (opacity < 100) {
        setOpacity(obj, opacity);
        opacity += 5;
        obj.fadeInTimeout = window.setTimeout("fadeIn('" + id + "'," + opacity + ")", 30);
        return;
    }
    // fix for Safari

}

function fadeOut(id, opacity) {
    obj = document.getElementById(id);
    if (obj == null) return;
    if (opacity > 0) {
        setOpacity(obj, opacity);
        opacity -= 5;
        obj.fadeOutTimeout = window.setTimeout("fadeOut('" + id + "'," + opacity + ")", 30);
        return;
    }
    obj.style.visibility = "hidden";
}

function savezip(anchor) {
    var img = new Image();
    img.src = anchor.href;
    var message = document.getElementById("pop_saved_generic");
    setOpacity(message, 100);
    message.style.left = (getRealLeft(anchor) - (((message.clientWidth || message.offsetWidth) - (anchor.clientWidth || anchor.offsetWidth)) / 2)) + "px";
    message.style.top = (getRealTop(anchor) + 30) + "px";
    message.style.visibility = "visible";
    setTimeout("fadeOut('" + message.id + "', 95)", 15000);
    return false;
}

function showZip(linkid, boxid) {
    var ziplink = document.getElementById(linkid);
    var zipbox = document.getElementById(boxid);
    setOpacity(zipbox, 0);
    zipbox.style.display = "block";
    ziplink.style.display = "none";
    fadeIn(zipbox.getAttribute("id"), 5);
}

function isFirefoxPC() {
    var ua = navigator.userAgent;
    return (/Firefox/.test(ua) && /Windows/.test(ua));
}

function selectTab(tabid, rest) {
    var tab = document.getElementById("tab" + tabid);
    var tabdata = document.getElementById("tab" + tabid + "data");
    if (tab && tabdata) {
        tab.className = "currenttab";
        tabdata.style.display = "block";
        for (var i = 1; i < arguments.length; i++) {
            var tab = document.getElementById("tab" + arguments[i]);
            var tabdata = document.getElementById("tab" + arguments[i] + "data");
            if (tab && tabdata) {
                tab.className = "";
                tabdata.style.display = "none"
            }
        }
    }
}

function selectCondition(anchor, max, displaytime) {
    var id;
    var now = document.getElementById("now");
    var h3title = document.getElementById("h3title");
    if (anchor == null) {
        now.style.display = "block";
        h3title.innerHTML = "Current Conditions";
        id = 0;
    } else {
        id = anchor.getAttribute("id").substring(5) - 0;
        now.style.display = "none";
        anchor.className = "shown";
    }
    for (var i = 1; i <= max; i++) {
        var cond = document.getElementById("hr" + i);
        var anchor = document.getElementById("navhr" + i);
        
        if (i == id) {
            cond.style.display = "block";
            h3title.innerHTML = "Forecast at " + displaytime;
        } else {
            cond.style.display = "none";
            anchor.className = "";
        }
    }
}

function showDetails(anchor, max) {
    var aid = anchor.getAttribute("id").substring(0,4);
    var detail = document.getElementById(aid + "detail");
    var display = detail.style.display;
    for (var i = 1; i <= max; i++) {
        var id = "day" + i;
        var trigger = document.getElementById(id + "trigger");
        var img = trigger.getElementsByTagName("img")[0];
        img.src = img.src.replace("_up_", "_down_");
        document.getElementById(id + "detail").style.display = "none";
    }
    if (display == "none" || display == "") {
        var trigger = document.getElementById(aid + "trigger");
        var img = trigger.getElementsByTagName("img")[0];
        img.src = img.src.replace("_down_", "_up_");
        detail.style.display = "block";
    }
}

function setDisplay(trigger, layerid, func) {
    var layer = document.getElementById(layerid);
    var display;
    if (layer) {
        display = layer.style.display;
        layer.style.display = (display == "block") ? "none" : "block";
    }
    if (typeof func == "function") {
        func(trigger, display);
    }
}

function setVisibility(trigger, layerid, func) {
    var layer = document.getElementById(layerid);
    var visibility;
    if (layer) {
        visibility = layer.style.visibility;
        layer.style.visibility = (visibility == "visible") ? "hidden" : "visible";
    }
    if (typeof func == "function") {
        func(trigger, visibility);
    }
}

function changeArrow(trigger, display) {
    if (trigger) {
        var id = trigger.getAttribute("id");
        var letter = id.substring(9);
        var arrow = document.getElementById("arrow_" + letter);
        if (arrow) {
            arrow.className = (display == "block") ? "showarrow" : "hidearrow";
            arrow.innerHTML = (display == "block") ? "Show" : "Hide";
        }
    }
}

function go(select) {
    if (select) {
        var index = select.selectedIndex;
        var value = select.options[index].value;
        if (value) {
            window.location = value;
        }
    }
}

function setFontSize(size) {
    var middle = document.getElementById("middle");
    var resultsbox = document.getElementById("resultsbox");
    var tdefault = document.getElementById("tdefault");
    var tmedium = document.getElementById("tmedium");
    var tlarge = document.getElementById("tlarge");
    switch (size) {
    case "medium":
        if (middle) middle.style.fontSize = "120%";
        if (middle) middle.style.lineHeight = "125%";
        if (resultsbox) resultsbox.style.fontSize = "120%";
        tdefault.className="none";
        tmedium.className="cbstv_text_select";
        tlarge.className="none";
        setCookie("style", "medium", 365, "/");
        break;
    case "large":
        if (middle) middle.style.fontSize = "140%";
        if (middle) middle.style.lineHeight = "125%";
        if (resultsbox) resultsbox.style.fontSize = "140%";
        tdefault.className="none";
        tmedium.className="none";
        tlarge.className="cbstv_text_select";
        setCookie("style", "large", 365, "/");
        break;
    default:
        if (middle) middle.style.fontSize = "110%";
        if (middle) middle.style.lineHeight = "125%";
        if (resultsbox) resultsbox.style.fontSize = "110%";
        tdefault.className="cbstv_text_select";
        tmedium.className="none";
        tlarge.className="none";
        setCookie("style", "default", 365, "/");
        break;
    }
}

function hideShowDis(objOrId, hide) {
    var el = (typeof objOrId == "string")
        ? document.getElementById(id) : objOrId;
    if (el) {
        if (hide) el.style.display = "none";
        else el.style.display = (el.style.display == "none")
            ? "block" : "none";
    }
}

function hideShowVis(objOrId, hide) {
    var el = (typeof objOrId == "string")
        ? document.getElementById(id) : objOrId;
    if (el) {
        if (hide) el.style.visibility = "hidden";
        else el.style.visibility = (el.style.visibility == "hidden")
            ? "visible" : "hidden";
    }
}

function getRealLeft(element) {
    var xPos = element.offsetLeft;
    var tempElement = element.offsetParent;
    while (tempElement != null) {
        xPos += tempElement.offsetLeft;
        tempElement = tempElement.offsetParent;
    }
    return xPos;
}

function getRealTop(element) {
    var yPos = element.offsetTop;
    var tempElement = element.offsetParent;
    while (tempElement != null) {
        yPos += tempElement.offsetTop;
        tempElement = tempElement.offsetParent;
    }
    return yPos;
}

function url2id(url) { return url.replace(/%\/./g, "_"); }

var clipNum = 0;
var readNews = getCookie("readnews");
var savedNews = getCookie("savednews");

if (readNews == null) readNews = "";
if (savedNews == null) savedNews = "";

function clipExists(url) {
    var clipsArray = savedNews.split("|");
    for (var i = 0; i < clipsArray.length; i++) {
        var itemArray = clipsArray[i].split(";");
        if (itemArray[1] == url) {
            return true;
        }
    }
    return false;
}

function charStrip(a) {
    a = a.split("|").join("");
    a = a.split("&").join("");
    a = a.split("'").join("");
    a = a.split("#").join("");
    a = a.split("$").join("");
    a = a.split("%").join("");
    a = a.split("^").join("");
    a = a.split("*").join("");
    a = a.split(":").join("");
    a = a.split("~").join("");
    a = a.split(";").join("");
    a = a.split(" ").join("+");
    return a;
}

function getParam(p) {
    var qstring = location.search.substring(1);
    var pattern = new RegExp("\\b" + p + "=([^&$]+)");
    var match = qstring.match(pattern);
    return match ? match[1] : "";
}

function getPic() {
    var path = unescape(getParam("gimg")).replace("+", " ");
    var title = unescape(getParam("gtitle")).replace("+", " ");
    showPicImpl(path, title);
}

function showPic(anchor) {
    var path = anchor.href;
    var title = anchor.title;
    showPicImpl(path, title);

    var advertframe =  document.getElementById("advertframe");
    if (advertframe) {
        advertframe.src = ''//advertframe.src;
    }
    return false;
}

function showPicImpl(path, title) {
    if (path && title) {
        var gallerybigimage = document.getElementById("gallerybigimage");
        var emailimagelink =  document.getElementById("emailimagelink");
        var gallerytitle =  document.getElementById("gallerytitle");

        if (gallerybigimage && emailimagelink && gallerytitle) {
            gallerybigimage.src = path;
            gallerytitle.firstChild.data = title;
            emailimagelink.href = emailimagelink.href.replace(/\bgimg=([^%]+)%26/, "gimg=" + escape(path) + "%26").replace(/gtitle=(.*)/, "gtitle=" + title.replace(" ", "%2520"));
        }
    }
}

addEvent(window, "load", getPic);

var fsize = getCookie("style") || "default";
document.write('<link rel="stylesheet" type="text/css" href="http://static.cbslocal.com/Themes/CBS/_resources/css/' + fsize + '.css"  />');

//New function added 1/12/06
function wipeInput(formName, inputField) {
	//alert(document.forms[formName][inputField].value);
	if (document.forms[formName][inputField].value == 'ZIP') {
		document.forms[formName][inputField].value = '';
	} else if (document.forms[formName][inputField].value == 'Quote') {
		document.forms[formName][inputField].value = '';
	}
}



function randomWeight(order) 
{
	/*var rNum=Math.floor(Math.random()*101);
	var domain = location.hostname

	if (domain == 'wcco.com')
	{
		if (rNum >= 0 && rNum <= 50) {selectPartnerTab('1','2','3','4','5','6','7');}
		if (rNum >= 51 && rNum <= 60) {selectPartnerTab('3','4','5','6','7','1','2');}
		if (rNum >= 61 && rNum <= 70) {selectPartnerTab('4','5','6','7','1','2','3');}
		if (rNum >= 71 && rNum <= 85) {selectPartnerTab('5','6','7','1','2','3','4');}
		if (rNum >= 86 && rNum <= 100) {selectPartnerTab('7','6','5','1','2','3','4');}
	}
	else
	{
		if (rNum >= 0 && rNum <= 50) {selectPartnerTab('1','2','3','4','5','6','7');}
		if (rNum >= 51 && rNum <= 60) {selectPartnerTab('2','1','3','4','5','6','7');}
		if (rNum >= 61 && rNum <= 70) {selectPartnerTab('3','4','5','6','7','1','2');}
		if (rNum >= 71 && rNum <= 80) {selectPartnerTab('4','5','6','7','1','2','3');}
		if (rNum >= 81 && rNum <= 90) {selectPartnerTab('5','6','7','1','2','3','4');}
		if (rNum >= 91 && rNum <= 100) {selectPartnerTab('7','6','5','1','2','3','4');}
	}*/
	
	selectPartnerTab(order);
}

var sURL = unescape(window.location.pathname);

function doLoad()
{
    // the timeout value should be the same as in the "refresh" meta-tag
    setTimeout( "refresh()", 1000*1000 ); 
}

function refresh()
{
    //  This version of the refresh function will cause a new
    //  entry in the visitor's history.  It is provided for
    //  those browsers that only support JavaScript 1.0.
    //
    window.location.href = sURL;
}




//Endeca Search - End

//Events
addEvent(window, 'load', ev_init, false);
var evpop;
function ev_init()
{
	evpop = new EventPop();
}

function EventPop()
{
	this.eventlist = new Array();
	
	// extensions for each event-related id
	this.linkend = '_link';
	this.detailend = '_detail';
	this.closeend = '_close';	

	// get all the links that open event divs (by class name)
	var evlinks =  document.eclass('cbstv_event-open');
	var i;		// counter
	
	// store event id stubs and bind functions
	for(i=0; i<evlinks.length; i++)
	{
		var evnameparts = evlinks[i].id.split("_");
		var evname = evnameparts[0];
		this.eventlist.push(evname);
		
		//addEvent(evlinks[i],'click', this.popper, false);	
		
	}
}


EventPop.prototype.popper = function(aclick)
{
	var clicked = '';		//this will hold the id stub for the event clicked
	var evspan = '';			//id for event details span
	
	// close all event spans
	var i;
	for(i=0; i<this.eventlist.length; i++)
	{
		var toclose = this.eventlist[i] + this.detailend;
		el(toclose).style.display = "none";	
	}
	
	
	var linkleft = findPos(aclick)[0];
	var linktop = findPos(aclick)[1];
	
	
		
	clicked = aclick.id.split("_")[0];
	evspan = clicked + this.detailend;
	el(evspan).style.display = "block";
	
	var curmarg = el(evspan).style.marginLeft;
	
	
	if(linkleft < 350)
	{
		//el(evspan).style.marginLeft = "-80px";
		el(evspan).className = el(evspan).className + " " + "cbstv_flip";
	}
	return false; 
}

EventPop.prototype.closeit = function(aclick)
{
	var clicked = '';		//this will hold the id stub for the event clicked
	var evspan = '';			//id for event details span
	
	clicked = aclick.id.split("_")[0];
	evspan = clicked + this.detailend;
	el(evspan).style.display = "none";
		
}

// document.getElementById shortcut
function el(elid)
{
	return document.getElementById(elid);	
}


// find true position of element
// source: http://www.quirksmode.org/js/findpos.html
function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		do {
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		} while (obj = obj.offsetParent);
	}
	return [curleft,curtop];
}

// cross-browser event handling for IE5+, NS6+ and Mozilla/Gecko
// By Scott Andrew
function addEvent(elm, evType, fn, useCapture)
{
	if (elm.addEventListener)
	{
		elm.addEventListener(evType, fn, useCapture);
		return true;
	}
	
	else if(elm.attachEvent)
	{
		var r = elm.attachEvent('on' + evType, fn);
		return r;
	}
	
	else
	{
		elm['on' + evType] = fn;
	}
}
			
// provide getElementsByClassName functionality
// returns array of elements bearing the passed class
// Source: http://javascript.about.com/library/bldom08.htm
document.eclass = function(cl) {
var retnode = [];
var myclass = new RegExp('\\b'+cl+'\\b');
var elem = this.getElementsByTagName('*');
for (var i = 0; i < elem.length; i++) {
var classes = elem[i].className;
if (myclass.test(classes)) retnode.push(elem[i]);
}
return retnode;
};
//End Events

function popUp(URL, width, height) {
  
    if (width == null)
        width = 1000;
    if (height == null)
        height = 680;

    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=" + width + ",height=" + height + "');");
}

function popUpFlexible(URL, width, height) {

    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=" + width + ",height=" + height + "');");
}

function hideAllUGCDiv(prefix)
{
    var el; 
    el = document.getElementById(prefix+"_divRecent");
    el.style.display  = "none";  
    el = document.getElementById(prefix+"_divEditor");
    el.style.display  = "none";   
    el = document.getElementById(prefix+"_divViewed");
    el.style.display  = "none";   
    el = document.getElementById(prefix+"_divRated"); 
    el.style.display  = "none";
    
    el = document.getElementById(prefix+"_lnkRecent");
    el.style.color = "";
    el = document.getElementById(prefix+"_lnkEditor");
    el.style.color = "";
    el = document.getElementById(prefix+"_lnkViewed");
    el.style.color = "";
    el = document.getElementById(prefix+"_lnkRated");
    el.style.color = "";   
}

function showUGCDiv(pick, prefix)
{
    var el; 
    var lnk;
    hideAllUGCDiv(prefix);
    if (pick==1)
    {
        el = document.getElementById(prefix+"_divRecent");
        lnk = document.getElementById(prefix+"_lnkRecent");
    }
    else if (pick==2)
    {
        el = document.getElementById(prefix+"_divEditor");
        lnk = document.getElementById(prefix+"_lnkEditor");
    }
    else if (pick==3)
    {
        el = document.getElementById(prefix+"_divViewed");
        lnk = document.getElementById(prefix+"_lnkViewed");
    }
    else if (pick==4)
    {
        el = document.getElementById(prefix+"_divRated"); 
        lnk = document.getElementById(prefix+"_lnkRated");
    }
    
    else {
        return; 
    }

    if(typeof(el)!="undefined")
        el.style.display  = "";  
    
    if(typeof(lnk)!="undefined")
        lnk.style.color = "#000000";
}

/*for homepage weather header*/
function SwapWeatherLogo(CurrentCondition)
{
    var elem=document.getElementById("partlycloudy");
    if (CurrentCondition != "N/A")
        if (elem)
            elem.id=CurrentCondition;
}

function wui_getForecast(CallLetters, DomainName)
{
    var location = "";
    if (CallLetters == "wfor")
        location = "http://weather." + DomainName + "/cgi-bin/findweather/getForecast?brand=cbs4V3&query=";
    else if (CallLetters == "wcbs")
        location = "http://weather." + DomainName + "/cgi-bin/findweather/getForecast?brand=wcbstvV3&query=";
    else if (CallLetters == "wbz")
        location = "http://weather." + DomainName + "/cgi-bin/findweather/getForecast?brand=wbz4V3&query=";
    else if (CallLetters == "ktvt")
        location = "http://weather." + DomainName + "/cgi-bin/findweather/getForecast?brand=cbs11tvV3&query=";
    else if (CallLetters == "kcnc")
        location = "http://weather." + DomainName + "/cgi-bin/findweather/getForecast?brand=news4coloradoV3&query=";
    else
		location = "http://weather." + DomainName + "/cgi-bin/findweather/getForecast?brand=" + CallLetters + "V3&query=";
	
	return escape(location);
}

function DrawWeatherHeader(DefaultZip, DivID, DefaultRadarImage, CallLetters, DomainName, SWFPath)
{
    var s3 = new SWFObject(SWFPath, 'autosizer', '264', '88', '9');
    s3.addParam('allowfullscreen', 'true');
    s3.addParam('allowscriptaccess', 'always');
    s3.addParam('wmode', 'transparent');
    s3.addParam('bgcolor', '');
    s3.addVariable('xmlPathA', escape('http://www.wunderground.com/cgi-bin/findweather/getForecast?brand=cbshomepageXML&site=' + CallLetters + '&query=zmw:'));
    s3.addVariable('xmlPathB', escape('.001.99999'));
    if (getCookie('DefLoc') != null)
        s3.addVariable('defaultZip', getCookie('DefLoc'));
    else
        s3.addVariable('defaultZip', DefaultZip);
    s3.addVariable('defaultRadarImage', DefaultRadarImage);
    s3.addVariable('cityClickThru', wui_getForecast(CallLetters, DomainName));
    s3.addVariable('jsFunctionName', 'SwapWeatherLogo');
    s3.addVariable('jsFunctionParam1', 'undefined');
    s3.addVariable('test_mode', 'false');

    if (CallLetters == "wcco") {
        s3.addVariable('locationFontColor', '000000');
        s3.addVariable('baseFontColor', '000000');
        s3.addVariable('linkFontColor', '3140AD');
    }
    
    if (CallLetters == "wbz") {
        s3.addVariable('locationFontColor', 'ffffff');
        s3.addVariable('baseFontColor', 'ffffff');
        s3.addVariable('linkFontColor', 'ffffff');
    }

    s3.write(DivID);
}

/*end for homepage weather header*/

/*can tab selection*/
function showCanTab(pick) {
    var el;
    var lnk;
    hideAllCanDiv();

    el = document.getElementById("can" + pick);
    lnk = document.getElementById("canlnk" + pick);

    if (typeof (el) != "undefined")
        el.style.display = "";

    if (typeof (lnk) != "undefined")
        lnk.className = "cbstv_can_link_active";
}

function hideAllCanDiv() {
    var el;
    var i;
    for (i = 1; i <= 3; i++) {
        el = document.getElementById("can" + i);
        el.style.display = "none";
        el = document.getElementById("canlnk" + i);
        el.className = "cbstv_can_link_notactive";
    }
}

function showCanShowTab(pick, threshold) {
    var el;
    var lnk;
    hideAllCanShowDiv(threshold);

    el = document.getElementById("can_show" + pick);
    lnk = document.getElementById("can_showlnk" + pick);

    if (typeof (el) != "undefined")
        el.style.display = "";

    if (typeof (lnk) != "undefined")
        lnk.className = "cbstv_can_link_active";
}

function hideAllCanShowDiv(threshold) {
    var el;
    var i;
    for (i = 1; i <= threshold; i++) {
        el = document.getElementById("can_show" + i);
        el.style.display = "none";
        el = document.getElementById("can_showlnk" + i);
        el.className = "cbstv_can_link_notactive";
    }
}
/*end can tab selection*/

/*launchPlayer.js*/
var playerWin = null;

function launchPlayer(stationID, oneStat) {
    oString = '';
    if (oneStat != null && oneStat != "") oString = '&onestat=' + oneStat;

    link = 'http://player.play.it/player/player.html?v=4.1.25&id=' + stationID + oString;

    if (playerWin != null && playerWin.closed == false) {
        playerWin.location = link;
        playerWin.focus();
    } else {
        playerWin = window.open(link, '', 'width=511,height=485,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,top=200,left=200');
    }
}
/*end launchPlayer.js*/

/*adsIframe.js*/
//----------------------------------------------------
// dcAd
// keyValues should be in the form key=value;nextkey=nextval;
// If not using a keyValue, pass empty string.
//----------------------------------------------------

ord = genrateOrd();
incrementalTile = 1;

function genrateOrd() {
    return Math.random() * 10000000000000000;
}

//funtion to create incremental tild IDs
function incrementTile() {
    incrementalTile++;
}

//backwards compatible for old ad tags	
function dcAd(site, zone, adId, keyValues, isFrame) {
    switch (adId) {
        case 'videosponsorbutton':
            size = '88x31';
            iFrameWidth = 150; //incorrect
            iFrameHeight = 31;  //incorrect
            break;
        case 'messaging':
            size = '300x250';
            xIndex = size.indexOf('x');
            iFrameWidth = size.substring(0, xIndex);
            iFrameHeight = size.substring(xIndex + 1, size.length);
            break;
        case 'skyscraper':
            size = '160x600';
            xIndex = size.indexOf('x');
            iFrameWidth = size.substring(0, xIndex);
            iFrameHeight = size.substring(xIndex + 1, size.length);
            break;
        case 'hpsidebar':
            size = '300x40';
            xIndex = size.indexOf('x');
            iFrameWidth = size.substring(0, xIndex);
            iFrameHeight = size.substring(xIndex + 1, size.length);
            break;
        case 'sponsoredby':
            size = '330x25';
            xIndex = size.indexOf('x');
            iFrameWidth = size.substring(0, xIndex);
            iFrameHeight = size.substring(xIndex + 1, size.length);
            break;
        case 'hpcenterbar':
            size = '355x40';
            xIndex = size.indexOf('x');
            iFrameWidth = size.substring(0, xIndex);
            iFrameHeight = size.substring(xIndex + 1, size.length);
            break;
        case 'modulesponsor':
            size = '88x31';
            iFrameWidth = 88; //incorrect
            iFrameHeight = 55;  //incorrect
            break;
        case 'modulesponsorwide':
            size = '521x31';
            iFrameWidth = 521;
            iFrameHeight = 31;
            break;
        case 'button2':
            size = '120x60';
            xIndex = size.indexOf('x');
            iFrameWidth = size.substring(0, xIndex);
            iFrameHeight = size.substring(xIndex + 1, size.length);
            break;
        case 'navad':
            size = '90x120';
            iFrameWidth = 90; //incorrect
            iFrameHeight = 120;  //incorrect
            break;
        case 'richmedia':
            size = '1x3';
            xIndex = size.indexOf('x');
            iFrameWidth = size.substring(0, xIndex);
            iFrameHeight = size.substring(xIndex + 1, size.length);
            break;
        case 'bizdevtext':
            size = '1x2';
            iFrameWidth = 0; //will never use iframes
            iFrameHeight = 0;  //will never use iframes
            break;
        case 'narrowsky':
            size = '120x600';
            xIndex = size.indexOf('x');
            iFrameWidth = size.substring(0, xIndex);
            iFrameHeight = size.substring(xIndex + 1, size.length);
            break;
        case 'mainheaderad':
            size = '120x60';
            iFrameWidth = 120; //incorrect
            iFrameHeight = 60;  //incorrect
            break;
        case 'leaderboard':
            size = '728x90';
            xIndex = size.indexOf('x');
            iFrameWidth = size.substring(0, xIndex);
            iFrameHeight = size.substring(xIndex + 1, size.length);
            break;
        case 'sponsoredwildcard':
            size = '1x4';
            xIndex = size.indexOf('x');
            iFrameWidth = 0; //will never use iframes
            iFrameHeight = 0;  //will never use iframes
            break;
        case 'specialoffer':
            size = '1x5';
            xIndex = size.indexOf('x');
            iFrameWidth = 0; //will never use iframes
            iFrameHeight = 0;  //will never use iframes
            break;
        case 'halfpage':
            size = '300x600';
            xIndex = size.indexOf('x');
            iFrameWidth = size.substring(0, xIndex);
            iFrameHeight = size.substring(xIndex + 1, size.length);
            break;
        case 'flex':
            size = '160x600,300x250,300x600';
            xIndex = size.indexOf('x');
            iFrameWidth = '300';
            iFrameHeight = '600';
            break;
        default:
            size = '1x1';
            iFrameWidth = 1;
            iFrameHeight = 1;
    }

    dcRichAd(site, zone, adId, keyValues, isFrame, iFrameWidth, iFrameHeight);
}

function dcRichAd(site, zone, adId, keyValues, isFrame, iFrameWidth, iFrameHeight) {
    switch (adId) {
        //leave 1 blank for XML video ad 
        case 'videosponsorbutton':
            size = '88x31';
            break;
        case 'messaging':
            size = '300x250';
            break;
        case 'skyscraper':
            size = '160x600';
            break;
        case 'hpsidebar':
            size = '300x40';
            break;
        case 'sponsoredby':
            size = '330x25';
            break;
        case 'hpcenterbar':
            size = '355x40';
            break;
        case 'modulesponsor':
            size = '88x31';
            break;
        case 'modulesponsorwide':
            size = '521x31';
            break;
        case 'button2':
            size = '120x60';
            break;
        case 'navad':
            size = '90x120';
            break;
        case 'richmedia':
            size = '1x3';
            break;
        case 'bizdevtext':
            size = '1x2';
            break;
        case 'narrowsky':
            size = '120x600';
            break;
        case 'mainheaderad':
            size = '120x60';
            break;
        case 'leaderboard':
            size = '728x90';
            break;
        case 'sponsoredwildcard':
            size = '1x4';
            break;
        case 'specialoffer':
            size = '1x5';
            break;
        case 'halfpage':
            size = '300x600';
            break;
        case 'flex':
            size = '160x600,300x250,300x600';
            break;
    }

    zone = zone.replace("partners.", "partner.");
    tileId = incrementalTile;
    incrementTile();

    if (isFrame) {
        document.write('<iframe id="dc' + ord + 't' + tileId + '" src="#" width="' + iFrameWidth + '" height="' + iFrameHeight + '" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling=no borderCOLOR="#000000">');
        if (navigator.userAgent.indexOf("Gecko") == -1) {
            document.write('<script language="JavaScript" src="http://ad.doubleclick.net/adj/' + site + '/' + zone + ';' + keyValues + 'tile=' + tileId + ';sz=' + size + ';abr=!ie;ord=' + ord + '?" type="text/javascript"><\/script>');
        }
        document.write('</iframe>');

        if (document.getElementById('dc' + ord + 't' + tileId)) {
            //document.getElementById('dc' + ord + 't' + tileId).src = 'http://ad.doubleclick.net/adi/' + site + '/' + zone + ';' + keyValues + 'tile=' + tileId + ';sz=' + size + ';ord=' + ord + '?';
            document.getElementById('dc' + ord + 't' + tileId).src ="http://sites.cbslocal.com/services/DCRefresh.aspx?keyValues=" + keyValues + "&tileId=" + tileId + "&site=" + site + "&size=" + size + "&ord=" + ord + "&zone=" + zone + "&dcSeed=" + "0";
        }
    } else {
        document.write('<script language="JavaScript" src="http://ad.doubleclick.net/adj/' + site + '/' + zone + ';' + keyValues + 'tile=' + tileId + ';sz=' + size + ';ord=' + ord + '?" type="text/javascript"><\/script>');
    }
    //</script><noscript><a href="http://ad.doubleclick.net/jump/' + site + '/' + zone + ';' + keyValues + 'tile=' + tileId + ';sz=' + size + ';ord=123456789?" target="_blank"><img src="http://ad.doubleclick.net/ad/cbstest.gustavo/sports;tile=1;sz=300x250;ord=123456789?" width="300" height="250" border="0" alt=""></a></noscript>
}

function resetAd(newOrd, dcSeed, keyValues, i) {

    iFrameID = document.getElementsByTagName("iframe")[i].id;
    //if the iFrame is for a Double Click ad...
    if (iFrameID.substring(0, 2) == "dc") {

        //don't need to redraw iFrame
        //recall Double Click

        if (document.getElementById(iFrameID)) {

            //pull out all variables I need from the current source as a string
            iFrameSrc = document.getElementById(iFrameID).src;

            if (iFrameSrc.indexOf("DCRefresh") == -1) {
                //first call to refresh
                //string manipulation of DC call

                siteStartPos = iFrameSrc.lastIndexOf("/", iFrameSrc.lastIndexOf("/")) + 1;
                siteEndPos = iFrameSrc.indexOf("/", siteStartPos);
                sizeStartPos = iFrameSrc.indexOf("s=z") + 3;
                sizeEndPos = iFrameSrc.indexOf(";", sizeStartPos);
                ordStartPos = iFrameSrc.indexOf("ord=") + 4;
                ordEndPos = iFrameSrc.indexOf("?", ordStartPos);
                zoneStartPos = iFrameSrc.lastIndexOf("/") + 1;
                zoneEndPos = iFrameSrc.indexOf(";", zoneStartPos);
            }
            else {
                //not the first call to refresh
                //string manipulation of dcrefresh

                siteStartPos = iFrameSrc.indexOf("&site=") + 6;
                siteEndPos = iFrameSrc.indexOf("&size=", siteStartPos);
                sizeStartPos = iFrameSrc.indexOf("&size=") + 6;
                sizeEndPos = iFrameSrc.indexOf("&ord=", sizeStartPos);
                ordStartPos = iFrameSrc.indexOf("&ord=") + 5;
                ordEndPos = iFrameSrc.indexOf("&zone=", ordStartPos);
                zoneStartPos = iFrameSrc.indexOf("&zone=") + 6;
                zoneEndPos = iFrameSrc.indexOf("&dcSeed=", zoneStartPos);
            }

            zone = iFrameSrc.substring(zoneStartPos, zoneEndPos);
            tile = incrementalTile;
            incrementTile();
            size = iFrameSrc.substring(sizeStartPos, sizeEndPos);
            site = iFrameSrc.substring(siteStartPos, siteEndPos);

            //alert("keyValues="+ keyValues +"\n"+"tileId="+ tile +"\n"+"size="+ size +"\n"+"ord="+ newOrd +"\n"+"zone="+ zone +"\n");

            var thisFrame = document.getElementById(iFrameID);
            if (iFrameSrc.indexOf("DCRefresh") == -1)
                thisFrame.src = "http://sites.cbslocal.com/services/DCRefresh.aspx?keyValues=" + escape(keyValues) + "&tileId=" + tile + "&site=" + site + "&size=" + size + "&ord=" + newOrd + "&zone=" + zone + "&dcSeed=" + dcSeed;
            else
                thisFrame.src = "http://sites.cbslocal.com/services/DCRefresh.aspx?keyValues=" + keyValues + "&tileId=" + tile + "&site=" + site + "&size=" + size + "&ord=" + newOrd + "&zone=" + zone + "&dcSeed=" + dcSeed;
        }
    }
}

function resetAdsWithKeyValues(newOrd, dcSeed, keyValues) {
    //for the newOrd, the video ad is Tile 1
    incrementalTile = 2;
    for (var i = 0; i < document.getElementsByTagName("iframe").length; i++) {
        iFrameID = document.getElementsByTagName("iframe")[i].id;
        //if the iFrame is for a Double Click ad...
        if (iFrameID.substring(0, 2) == "dc") {

            if (document.getElementById(iFrameID)) {
                resetAd(newOrd, dcSeed, keyValues, i);
            }
        }
    }
}

function resetAds(newOrd, dcSeed) {
    //for the newOrd, the video ad is Tile 1
    incrementalTile = 2;
    for (var i = 0; i < document.getElementsByTagName("iframe").length; i++) {
        iFrameID = document.getElementsByTagName("iframe")[i].id;
        //if the iFrame is for a Double Click ad...
        if (iFrameID.substring(0, 2) == "dc") {

            if (document.getElementById(iFrameID)) {

                //pull out all variables I need fromt he current source as a string
                iFrameSrc = document.getElementById(iFrameID).src;

                if (iFrameSrc.indexOf("DCRefresh") == -1) {
                    //first call to refresh
                    //string manipulation of DC call

                    keyvaluesStartPos = iFrameSrc.indexOf(";") + 1;
                    keyvaluesEndPos = iFrameSrc.indexOf("tile", keyvaluesStartPos);

                }
                else {
                    //not the first call to refresh
                    //string manipulation of dcrefresh

                    keyvaluesStartPos = iFrameSrc.indexOf("?keyValues=") + 11;
                    keyvaluesEndPos = iFrameSrc.indexOf("&tileId=", keyvaluesStartPos);
                }

                keyValues = iFrameSrc.substring(keyvaluesStartPos, keyvaluesEndPos);
                resetAd(newOrd, dcSeed, keyValues, i);
            }
        }
    }
}

function cbstvAds_SetCook(adID, stayopen, daystilexpire) {
    var CookieAd = $.cookie('cbstvSawAd_' + adID);

    if (CookieAd != "true") {
        var t = setTimeout(function() { cbstvAds_onExpand(adID, stayopen) }, 800);
        $.cookie('cbstvSawAd_' + adID, 'true', { expires: daystilexpire })
    }
}

function cbstvAds_onExpand(adID, stayopen) {
    if ($('#cbstvAds_thisSwf_' + adID).is(":hidden")) {
        $('#cbstvAds_thisImg_' + adID).hide();
        $('#cbstvAds_thisSwf_' + adID).slideDown("slow");
    }
    var t = setTimeout(function() { cbstvAds_onCollapse(adID) }, stayopen);
}

function cbstvAds_onCollapse(adID) {
    $('#cbstvAds_thisSwf_' + adID).slideUp("slow");
    var t = setTimeout(function() { $('#cbstvAds_thisImg_' + adID).show() }, 800);
}

function cbstvAds_PagePeel(adLinkTarget, bigAd, adID, introSwf, bigSwf) {
    $('#cbstvAds_PagePeel_' + adID).pagePeel({
        adLink: cbstvAds_thisPeelBackClick,
        adLinkTarget: adLinkTarget,
        hPosition: 'right',
        vPosition: 'top',
        bigSWFIntro: introSwf,
        bigSWF: bigSwf,
        bigAd: bigAd,
        smallWidth: 120,
        smallHeight: 120,
        introAnim: true,
        introWidth: 300,
        introHeight: 300,
        flash: true
    });
}

var clickCount = 0;

function onSlideshowAction(p_ID)
{
	clickCount++;
	resetAds(genrateOrd(), p_ID);
	doHitboxTrack(p_ID);
	if(clickCount % 3 == 0)
	{	
        // for interstisial
	}
}

function doHitboxTrack(p_ID)
{
	_hbPageView(content_title, content_group);
}


//This function is passed to the video section players as a substitute to resetAds 
function doNothing(newOrd, dcSeed) {

}
/*end adsIframe.js*/

/*menu_functions.js*/
// MAIN LEFT NAVIGATION
function cbstv_mainMenu() {
    document.write('<ul class="cbstv_nav_primary">');
    for (i = 0; i < cbstv_mainmenu_array; i++) {
        if (cbstv_mainCss[i] == '') {
            cbstv_mainCss[i] = "cbstv_nav_" + cbstv_mainName[i].toLowerCase();
        }
        document.write('<li><a href=', cbstv_mainSRC[i], ' name=&amp;lid=nav_', cbstv_mainName[i].toLowerCase(), ' target=', cbstv_mainTarget[i], ' class=', cbstv_mainCss[i], '>', cbstv_mainLabel[i], '</a></li>');
    }
    document.write('</ul>');
}
//end MAIN MENU

// SECONDARY LEFT NAVIGATION
function cbstv_secondaryMenu() {

    for (i = 0; i < cbstv_submenu_array; i++) {
        if (cbstv_subType[i] == "header") {
            document.write('<li class="cbstv_nav_hdr">', cbstv_subLabel[i], '</li>');
        } else {
            document.write('<li><a href=', cbstv_subSRC[i], ' name=&amp;lid=nav_', cbstv_subName[i].toLowerCase(), ' target=', cbstv_subTarget[i], '>', cbstv_subLabel[i], '</a></li>');
        }
    }
}
//end SECONDARY MENU

// FOOTER MENU
function cbstv_footerMenu() {

    document.write('<div class="cbstv_footer">');
    document.write('<ul class="cbstv_footnav">');
    for (i = 0; i < cbstv_footmenu_array; i++) {
        if (cbstv_footType[i] == "first") {
            document.write('<li class="cbstv_ftr_first"><a href=', cbstv_footSRC[i], ' name=&amp;lid=nav_', cbstv_footName[i].toLowerCase(), ' target=', cbstv_footTarget[i], '>', cbstv_footLabel[i], '</a></li>');
        }
        else {
            document.write('<li><a href=', cbstv_footSRC[i], ' target=', cbstv_footTarget[i], '>', cbstv_footLabel[i], '</a></li>');
        }
    }
    document.write('</ul>');
    //document.write ('<p>&copy; MMVII, CBS Broadcasting Inc. All Rights Reserved.</p>');
    document.write('</div>');

}
//end Footer

//BEGIN HORIZONTAL MENU FUNCTIONS

function cbstv_cbs_horizmenu() {

    var lastlength = 0;
    document.write('<table border="0" cellpadding="0" cellspacing="0"><tr>');

    for (i = 0; i < cbstv_toplevelnav.length; i++) {
        cbstv_toplevelnavitem = cbstv_toplevelnav[i];
        if (cbstv_toplevelnavitem[2] == '') {
            cbstv_toplevelnavitem[2] = "cbstv_nav_" + cbstv_toplevelnavitem[0].toLowerCase();
        }
        
        cbstv_submenunav = cbstv_toplevelnavitem[5];
        if (cbstv_submenunav.length > 0) {

            document.write('<td><div><div class="cbstv_main_menu_item_div">');
            document.write('<ul id="imenus', [i], '" class="', cbstv_toplevelnavitem[2], '">');
            document.write('<li class="cbstv_main_menu_item" style="width:130px;"><a href="', cbstv_toplevelnavitem[1], '" name ="', cbstv_toplevelnavitem[3], '" target="', cbstv_toplevelnavitem[4], '"><img src="http://static.cbslocal.com/Themes/CBS/_resources/img/arrow_main.gif" width="7" height="5" alt="expand" style="margin-right:10px; border: none;"/>', cbstv_toplevelnavitem[0], '</a>');
            document.write('<div><ul class="cbstv_sub_menu_ul">');

            for (j = lastlength; j < cbstv_submenunav.length; j++) {
                cbstv_submenunavitem = cbstv_submenunav[j];
                if (cbstv_submenunavitem[2] == '') {
                    cbstv_submenunavitem[2] = "cbstv_nav_" + cbstv_submenunavitem[0].toLowerCase();
                }
                document.write('<li class="', cbstv_submenunavitem[2], '"><a href="', cbstv_submenunavitem[1], '" name=', cbstv_submenunavitem[3], '" target="', cbstv_submenunavitem[4], '">', cbstv_submenunavitem[0], '</a></li>')
            }

            lastlength = cbstv_submenunav.length;

            document.write('</ul></div></li></ul></div></div>');
            document.write('<script type="text/javascript" language="JavaScript">');
            document.write('list7 = true;');
            document.write('function imenus_data', i, '(){');
            document.write('this.enable_visual_design_mode = false;');
            document.write('this.main_is_horizontal = true;');
            document.write('this.menu_showhide_delay = 0;');
            document.write('}');
            document.write('</script>');
            document.write('<br/></td>');
        }
        else {
            document.write('<td><div><div class="cbstv_main_menu_item_div cbstv_notvisible">');
            document.write('<ul id="imenus', [i], '" class="', cbstv_toplevelnavitem[2], '">');
            document.write('<li class="cbstv_main_menu_item" style="width:130px;"><a href="', cbstv_toplevelnavitem[1], '" name ="', cbstv_toplevelnavitem[3], '" target="', cbstv_toplevelnavitem[4], '"><img src="http://static.cbslocal.com/Themes/CBS/_resources/img/arrow_main.gif" width="7" height="5" alt="expand" style="margin-right:10px; border: none;"/>', cbstv_toplevelnavitem[0], '</a>');
            document.write('<div><ul class="cbstv_sub_menu_ul">');
            document.write('<li><a href="" name=', cbstv_submenunavitem[3], '" target=""></a></li>')
            document.write('</ul></div></li></ul></div></div>');
            document.write('<script type="text/javascript" language="JavaScript">');
            document.write('list7 = true;');
            document.write('function imenus_data', i, '(){');
            document.write('this.enable_visual_design_mode = false;');
            document.write('this.main_is_horizontal = true;');
            document.write('this.menu_showhide_delay = 0;');
            document.write('}');
            document.write('</script>');
            document.write('<br/></td>');
        }
    }

    document.write('</tr></table>');
}
//END HORIZONTAL MENU FUNCTIONS
/*end menu_functions.js*/

/**
* Dreamsocket
*  
* Copyright  2005 Dreamsocket.
* All Rights Reserved.  
*
* This software (the "Software") is the property of Dreamsocket and is protected by U.S. and
* international intellectual property laws. No license is granted with respect to the
* software and users may not, among other things, reproduce, prepare derivative works
* of, modify, distribute, sublicense, reverse engineer, disassemble, remove, decompile,
* or make any modifications of the Software without written permission from Dreamsocket.
* Further, Dreamsocket does not authorize any user to remove or alter any trademark, logo,
* copyright or other proprietary notice, legend, symbol, or label in the Software.
* This notice is not intended to, and shall not, limit any rights Dreamsocket has under
* applicable law.
*  
*/


var CBSVideoUtils = new Object();

// Static Properties
CBSVideoUtils.popoffVideoPlayer = null;
CBSVideoUtils.MINI_WIDTH = 310;
//CBSVideoUtils.MINI_HEIGHT = 370;
CBSVideoUtils.MINI_HEIGHT = 410;
CBSVideoUtils.POPOFF_URL = "";

// Static Methods
CBSVideoUtils.launchPopoff = function(p_categoryId, p_videoStoryIds, p_videoId, p_videoTime, p_videoStatus, p_siteId) {
    var query = "?";
    var isScrollable = "no";
    var isResizable = "no";

    var _location = document.location.href;
    var _domain = _location.substr(0, _location.indexOf(document.domain) + document.domain.length);
    var _domainParts = _domain.split(".");

    if (_domainParts.length > 2)
        _domain = "http://" + _domain.replace(_domainParts[0] + ".", "");

    //	CBSVideoUtils.POPOFF_URL= "http://static.cbslocal.com/CBS/national/htm/videoplayer/" + p_siteId + "/popoff.html";
    CBSVideoUtils.POPOFF_URL = _domain + "/services/popoff.aspx";
    //	CBSVideoUtils.POPOFF_URL= "http://" + location.hostname + "/services/popoff.aspx";

    query += "categoryId=" + p_categoryId + "&";
    query += "videoId=" + p_videoId + "&";
    query += "videoPlayStatus=" + p_videoStatus + "&";

    if (p_videoStoryIds != null) {
        query += "videoStoryIds=" + p_videoStoryIds + "&";
    }
    if (p_videoTime.length != null) {
        query += "videoTime=" + p_videoTime + "&";
    }



    CBSVideoUtils.popoffVideoPlayer = window.open
	(
		CBSVideoUtils.POPOFF_URL + query,
		"popoffVideoPlayer",
		"width=" + CBSVideoUtils.MINI_WIDTH + "," +
		"height=" + CBSVideoUtils.MINI_HEIGHT + ", " +
		"scrollbars=" + isScrollable + ", " +
		"resizable=" + isResizable + ", " +
		"menubar=no, location=no, toolbar=no, status=no, directories=no"
	);
    CBSVideoUtils.popoffVideoPlayer.focus();
}

// hbxStrip from hbxhelpers.js
function hbxStrip(a) {
    a = a.split("|").join("");
    a = a.split("&").join("");
    a = a.split("'").join("");
    a = a.split("#").join("");
    a = a.split("$").join("");
    a = a.split("%").join("");
    a = a.split("^").join("");
    a = a.split("*").join("");
    a = a.split(":").join("");
    a = a.split("~").join("");
    a = a.split(";").join("");
    a = a.split(" ").join("+");
    return a;
}

var currentDiv;
function displayDiv(newDiv) {

    if (currentDiv) {
        if (document.getElementById(currentDiv)) {
                document.getElementById(currentDiv).style.display = 'none';
            }
        }
        if (document.getElementById(newDiv)) {
            document.getElementById(newDiv).style.display = 'block';
        }
        
    currentDiv = newDiv;
}
