







var nsParam = '&nsid=a13d71f07:1252a1524ae:-2751';  
var skinParam = '';
var dbgParam = '';
var player = "WMP"; 


//document.oncontextmenu = function() {return false;}









var imgsrc = "http://metrics.feedroom.com/affiliate/_common/spacer.gif";
var imgbuffer = null;
var ct = 0;
var spx = -1;
var sd = -1;
var dt = new Date();
var ping_available = true;
var ping_queue = [];
var filterMap = new Object()
var filterAdd = new Object()
var suspendPing = false;
var nsid_index = -1;

var	nsid = 'a:-2751';


	


function createCookie(name,value,days)
{
	if (days)
	{
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name)
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++)
	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}


function eraseCookie(name)
{
	createCookie(name,"",-1);
}

function announce(action) {
	dt = new Date();
	calcReportingParams(true, false);
	
	var qstr = "?action="+action;
	qstr += "&player=WMP";qstr += "&site=hptv";qstr += "&nsid=a13d71f07:1252a1524ae:-2751";qstr += "&userAgent=CCBot/1.0 (+http://www.commoncrawl.org/bot.html)";
		
		
	qstr=qstr+"&spx="+spx+"&sd="+sd;
	
	var ord = "&ord=" + Math.round(Math.random()*999999);
	var newimg = document.createElement("img");
	newimg.id = action;
	newimg.src = "http://metrics.feedroom.com/affiliate/_common/spacer.gif"+ qstr + ord;
	newimg.style.display = "none";
	imgbuffer = document.getElementById("rpt_imgbuffer");
	imgbuffer.appendChild(newimg);
}

function init_rpt() {
	imgbuffer = document.getElementById("rpt_imgbuffer");
	logbuffer = document.getElementById("rpt_logbuffer");

	filterMap['NAVIGATABLE'] = 'cid';
	filterMap['REDIRECT_TO_STORY'] = 'sid';
	filterMap['REDIRECT_TO_CHANNEL'] = 'cid';
	filterMap['SITE_TYPE'] = 'site';
	filterMap['SEARCH_TERM'] = 'searchwords';
	filterMap['REQ_SKIN_TYPE'] = 'skin';
	filterMap['STORY_START'] = 'ss';
	filterMap['STORY_END'] = 'se';
	filterMap['REDIRECT_URL'] = 'url';

    filterAdd['playStory'] = new Array('band','isBB');
    filterAdd['playNextStory'] = new Array('band','isBB');
}

function filter(name, qstr) {
	var zq = "?";
	var za = "&";
	var ze = "=";
	var out = "";
	if (qstr[0] == zq) {
		out = qstr[0];
		qstr = qstr.substring(1);
	}
	var qps = qstr.split(za);
	for (var i=0;i<qps.length;i++) {
		var kp = qps[i].split(ze);		
		if (filterMap[kp[0]]) {
			kp[0] = filterMap[kp[0]];
			qps[i] = kp.join(ze);
			
		}
	}
	out += qps.join(za);
    if (filterAdd[name]) { 
        var paramName = filterAdd[name][0];
        var paramValue = eval(filterAdd[name][1]);
        
        if (paramName == 'band' && paramValue != undefined) {
            paramValue = (paramValue ? "BB":"NB");
        }
        out +="&"+paramName+"="+paramValue;
    }
    out += za; 
    return out;
}

function clearbuffers() {
	imgbuffer.innerHTML = "";
	
	
}

function incrSessionDur(){
	var sec_diff = Math.floor(Math.abs(dt.getTime()- new Date().getTime())/1000)
	if (sdBefReload > 0)
		sd=new Number(sdBefReload)+sec_diff;
	else
		sd=sec_diff;
}
// use cookies as persistent spx/sd store per nsid.
// create nsid-keyed entry on exit only
function calcReportingParams(saveCookie, isExit){
  try {
	if (saveCookie == false){
		//Session Ping Index
		spx++;
		//Session Duration 
		incrSessionDur();
	} else {
		if (isExit==false){
			var c_nsid = readCookie('nsid');
			
			if (c_nsid==null) {
				spx = sdBefReload = 0;
				sd = new Number(0);
				nsid_index = -1; // re-inforce
			} else {
				var a_nsid = c_nsid.split(',');
				for (var i=0;i<a_nsid.length;i++) {
					if (a_nsid[i] == nsid) { nsid_index = i; break; }
				}

				// If does not exist, init sd and spx
				if (nsid_index < 0) {
					sd = sdBefReload = new Number(0);
					spx = 0;
				} else {
	
					//Get cookie values into spx and sd
					c_spx = readCookie('spx');
					spx = c_spx.split(',')[nsid_index];
					if (spx == null) {
						spx = 0;
					}
					c_sd = readCookie('sd');
					sdBefReload = c_sd.split(',')[nsid_index];
					if (sdBefReload == null) {
						sd = sdBefReload = new Number(0);
					} else {
						sd = new Number(sdBefReload);
					}
				}
			}
		} else {
			//Session Ping Index
			spx++;

			// calc nsid_index
			var c_nsid = readCookie('nsid');
			if (c_nsid) {
				var a_nsid = c_nsid.split(',');
				for (var i=0;i<a_nsid.length;i++) {
					if (a_nsid[i] == nsid) { nsid_index = i; break; }
				}
				if (nsid_index < 0) {
					// append
					CookieAppend('nsid',a_nsid.length,nsid,false);
					CookieAppend('spx',a_nsid.length,spx,false);
					CookieAppend('sd',a_nsid.length,sd,false);
				} else {
					// replace
					CookieAppend('spx',nsid_index,spx,true);
					CookieAppend('sd',nsid_index,sd,true);
				}

			} else { // no nsid cookie, create anew
				createCookie('nsid', nsid);
				createCookie('spx', spx);
				createCookie('sd', sd);
			}
		}
	}
  } catch (cErr) {  }
}

function CookieAppend(name,pos,value,replace) {
	var c = readCookie(name);
	var a = c.split(',');
	var i = replace ? 1 : 0;
	
	a.splice(pos,i,value);
	createCookie(name, a.join(','));
}

function ping(name, args) {
	calcReportingParams(false);
    var qstr = filter(name, "?action="+name+"&spx="+spx+"&sd="+sd+"&nsid=a13d71f07:1252a1524ae:-2751"+args);
    if (ping_available) {
		ping_available = false;
		send_ping(qstr);
	} else {
		ping_queue.push(qstr);
	}
}

function send_ping(qp) {

  
	if (!imgbuffer) init_rpt();
	if (++ct % 10 == 0) clearbuffers();
	var newimg = document.createElement("img");
	if (imgbuffer) imgbuffer.appendChild(newimg);
	var ord = "&ord=" + Math.round(Math.random()*999999);
	newimg.src = imgsrc + qp + ord;
	newimg.className = 'ping';





	ping_available = true;
	pop_ping();
}

function pop_ping() {
	if (ping_available && ping_queue.length > 0) {
		next_ping = ping_queue[0];
		ping_queue = ping_queue.slice(1);
		send_ping(next_ping);
	}
}



var useNativeVideoSize = "true";
var bMax=false;
var oldXPositions = {};
var oldYPositions = {};
function ScaleVideo() {	
	var flashDiv = document.getElementById("flashDiv");
	var vidControls = document.getElementById('divModVideoControls');
	var tileOverlay = document.getElementById("divTileOverlay" + currentPlaying)
	var masthead = document.getElementById('divMasthead');
	var clickLogo = document.getElementById('clickLogo');
	var wrapper = document.getElementById('divWrapper');
	var componentIds = ['ifr_adBox','ifr_adSponsor','ifr_actionBox','divStories','divChannels','divChannelDisplay','divHeader','divMasthead','divHelp','divPowered','divFooter','divRateThis','divRss','ifr_blog','divCustom','divOmniture','divPlayer'];
	if (!bMax) {
		for (var i=0;i<componentIds.length;i++) {
			var cid = componentIds[i];
			oldXPositions[cid] = document.getElementById(cid).offsetLeft
			document.getElementById(cid).style.left="-1000";
			oldYPositions[cid] = document.getElementById(cid).offsetTop
			document.getElementById(cid).style.top="-1000";
		}
		document.body.className = "scaled";		
		if(tileOverlay !=null) tileOverlay.style.visibility="hidden";
		document.getElementById('divPlayer').className = "scaled";
		document.getElementById('divPlayer').style.left = "0px"
		document.getElementById('divPlayer').style.top = "0px"
		document.getElementById('divModVideo').className = "scaledFLV";
 		flashDiv.className = "scaled";
		if (masthead) masthead.className = "scaled";
		if (clickLogo) clickLogo.className = "scaled";
		if (wrapper) {
			wrapper.className = "scaled";
		}
		JumpUI();
	} else {

		for (var i=0;i<componentIds.length;i++) {
			var cid = componentIds[i];
			document.getElementById(cid).style.left = oldXPositions[cid] + "px"
			document.getElementById(cid).style.top = oldYPositions[cid] + "px"
		}
		document.body.className = "";
		if(tileOverlay!=null) setNowPlaying(currentPlaying);
		document.getElementById('divPlayer').className = "";
		document.getElementById('divModVideo').className = "";
		flashDiv.className = "";
		if (masthead) masthead.className = "";
		if (clickLogo) clickLogo.className = "";
		if (wrapper) wrapper.className = "";
		oldXPositions = new Object();
		oldYPositions = new Object();
	}
	bMax = !bMax;
}

var popup = "";
var existingWinName = "";
var existingURL = "";
var winTop = 0;
var winLeft = 0;
var winMenu = 0;
var winStatus = 0;
function winPopup(winURL, winName, winWidth, winHeight, winToolbar, winLocation, winResizeble, winScrollers, winClose) {
  try {

	if (winName.indexOf("donotgo") >= 0 || winURL.indexOf("donotgo") >= 0) {
		return false;
	} else if (false) {
		winTop = 0;
   		winLeft = 0;
	} else if (winName.indexOf("sponsor") >= 0 || winName.indexOf("suppLink") >= 0) {
		winLeft = (screen.width - winWidth) / 2;
		winTop = (screen.height - winHeight) / 2 - 40;
	} else if (winName.indexOf("about") >= 0) {
		winTop = (screen.height - winHeight) / 2;
		winLeft = (screen.width - winWidth) / 2; 
	} else if (winName.toLowerCase().indexOf("feedroom") >= 0) {
		winLeft = (screen.width - winWidth) / 2;
		winTop = (screen.height - winHeight) / 2 - 40;
	} else if ((winName.indexOf("branding") >= 0) || (winName.indexOf("network") >= 0)) {
		winLeft = ((screen.width - winWidth)/2);
  		winTop = ((screen.height - winHeight)/2) - 65;
	} else if ((winName.indexOf("faq") >= 0) || (winName.indexOf("policy") >= 0) || (winName.indexOf("embedthis") >= 0) || (winName.indexOf("embednatalie") >= 0)) {
		winLeft = (screen.width - winWidth) / 2;
		winTop = 0;
	} else if (winName.indexOf("survey") >= 0) {
		winTop = (screen.height - winHeight) / 2;
		winLeft = (screen.width - winWidth) / 2; 
	} else if (winName.indexOf("FullScreen") >= 0) {
		winTop = (screen.height - winHeight) / 2;
		winLeft = (screen.width - winWidth) / 2;
	} else if (winName.indexOf("signup") >= 0) {
		winTop = (screen.height - winHeight) / 2 - 30;
		winLeft = (screen.width - winWidth) / 2 - 6; 
	} else if (winName.indexOf("library") >= 0) {
		winTop = (screen.height - winHeight) / 2 - 20;
		winLeft = (screen.width - winWidth) / 2; 
	}else if (winName.indexOf("Bookmark") >=0) {
		winLeft = (screen.width - winWidth)/2 + 40;
		winTop = 0;
	}else if (winName.indexOf("BHG") >=0) {
		winLeft = (screen.width - winWidth)/2 + 10;
		winTop = 0;
	}else if (winName.indexOf("SendVideo") >=0) {
		winLeft = (screen.width - winWidth)/2 + 40;
		winTop = 0;
	}else if (winName.indexOf("StoryDownload") >=0) {
		winLeft = (screen.width - winWidth)/2 + 40;
		winTop = 200;
	} else if (winName.indexOf("broadcast") >= 0) {
		winTop = (screen.height - winHeight) / 2;
		winLeft = (screen.width - winWidth) / 2;
    } else {
        winLeft = ((screen.width - 779)/2) + 190;
 		winTop = ((screen.height - 579)/2) + 315;
	}
	
	if (winTop < 0) winTop = 0;
	if (winName.indexOf('_') != 0) {
		winName += "hptv";
	}
	if (existingWinName != winName) popup="";

	winMenu = 0;
	winStatus = 0;
	if (winToolbar && winToolbar==1) {
        winMenu = 1;
		winStatus = 1;
	}
    
	if (!popup || popup.closed ||false||(existingURL!=winURL)){
		existingWinName = winName;
		
		if (!(winName.indexOf("banners") >=0)) {
			popup = window.open(winURL, winName, 'width=' + winWidth + ',height=' + winHeight + ',top='+ winTop +',left='+ winLeft +',menubar='+ winMenu +',toolbar='+ winToolbar +',location='+ winLocation +',resizable=' + winResizeble + ',scrollbars=' + winScrollers + ',screenX='+ winLeft +',screenY='+ winTop +',status=' + winStatus);
		} else {
			popup = window.open(winURL, winName);
		}
	}
	existingURL=winURL;var tmp="true";
	if (winClose != undefined && (winClose.toString()=="true") && (winName.toUpperCase() != (parent.name + "").toUpperCase())) parent.close();
	
	if (popup) popup.focus();
	
  
  } catch (ew) {

  }
}


function openLibrary() {
		var iMoreVideo = 0;
		var host_var = 'null';
		
		if (iMoreVideo==1) {
			host_var += "?fr_story="+currentStory_uoi_id;
		} else if (iMoreVideo==2) {
			host_var += "?fr_chl=" + currentChannel_uoi_id;
		} else if (iMoreVideo==3) {
			host_var += "?fr_story="+currentStory_uoi_id + "&fr_chl=" + currentChannel_uoi_id;
		}
		
    
		winPopup(host_var, "library",null+20,null+20,0,0,1,1,0);
	
}


var flso = null;
function createFlashLSO () {
	if ( flso == null ) {
		flso = new SWFObject( "null/lso.swf", "flashlso", "1", "1", "8", "#242424", true, "high", null, "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0");
		flso.addParam("allowScriptAccess", "samedomain");
		flso.write("flashlsodiv");
	} else {
		return;
	}
}

function setFlashLSO( p_key, p_val, p_callback ) {
	var flashlso = document.getElementById( "flashlso" );
	if ( flashlso != null && typeof flashlso.setUserSO == "function" ) {
		flashlso.setUserSO( "feedroom", p_key, p_val, p_callback );
	}
}

function getFlashLSO( p_key, p_callback ) {
	var flashlso = document.getElementById( "flashlso" );
	if ( flashlso != null && typeof flashlso.getUserSO == "function" ) {
		flashlso.getUserSO( "feedroom", p_key, p_callback );
	}
}

function init_flashLSO() {
}






function refreshAdBox () {
    var qStr = nsParam + skinParam + '&ord=' + Math.random()*999999;
	try {
		if (refreshBanner() || false) ifrAdBox.replace('null/ifr_ads.jsp?hp=box'+qStr);
    } catch (e) {
		// do nothing
	}
}



function refreshAdSponsor () {

    var qStr = nsParam + skinParam + '&ord=' + Math.random()*999999;
	try {
		if (refreshBanner() || false) ifrAdSponsor.replace('null/ifr_ads.jsp?hp=top'+qStr);
	} catch (e) {
		// do nothing
	}
}





var currentPlaying = null;
var highlightNowPlaying = true;
var search_onload = false;

function paintUnselected(id) {
	var obj = document.getElementById(id);
	if (obj != null) {
		if (obj.className.indexOf("_selected") > -1) {	
			obj.className = obj.className.substring(0, obj.className.indexOf('_selected'));
			return true;
		}
	}
	return false;
}
function paintNowPlaying(id) {
	var obj = document.getElementById(id);
	if (obj != null) {
		obj.className = obj.className + '_selected';			
	}
}

function renderNowPlaying(idx) {
    if (idx < 0) return;
	if (idx != null) {
		paintNowPlaying('story'+idx);
	}
}
function saveNowPlaying(id) {
    currentPlaying = id;
}
function resetNowPlaying() {
	if (currentPlaying != null) {
		paintUnselected('story'+currentPlaying);
	}
}

function setNowPlaying(idx) { 
    resetNowPlaying();
    if (playChannel == displayChannel) {
    	renderNowPlaying(idx);
   	} else if (search_onload) {
   		renderNowPlaying(idx);
   		search_onload = false;
   		playChannel = -4;
   	}
    saveNowPlaying(idx);
}


function postShowStories(displaychl, showNowPlaying) {
	//alert(displaychl + ' ' + showNowPlaying + ' ' + playChannel);
	
	if (displaychl) displayChannel = displaychl;
	
	if (showNowPlaying == 'true' && playChannel == displaychl) renderNowPlaying(currentPlaying);

	
	if (document.getElementById("story_display_offset")) { 
		displayChannelStart = parseInt(document.getElementById("story_display_offset").innerHTML) || 0
	}
	
}




function verifyCompatibleBrowser(){ 
    this.ver=navigator.appVersion 
    this.dom=document.getElementById?1:0 
    this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0; 
    this.ie4=(document.all && !this.dom)?1:0; 
    this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
 
    this.ns4=(document.layers && !this.dom)?1:0; 
    this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5) 
    return this 
} 
bw=new verifyCompatibleBrowser() 

var speed=20 
var loop, timer, hasSubChannels 
var prevChannelId=""
var positionx=0;
var positiony=0;
var prevChannelId = 0;
var initialized = false;
var channelIdMap = new Object();
var thischannelId=""
var lastSubChannelId="";


var fc_current_filter = "national";


function channelClick(thisChannelPos) {	
	
	thisChannelId = "channel" + thisChannelPos
	unhighlightAllChannels()
	if (isSubChannel(thisChannelId)) {
		clickSubChannel(thisChannelId);
		lastSubChannelId = thisChannelId;
	} else {
		clickTopChannel(thisChannelId);
	}
	prevChannelId = thisChannelId	
	InitialiseScrollableArea(positionx,positiony)	  
	
	if (!scrollOnLoadComplete)
		setTimeout("scrollOnLoad('"+thisChannelId+"');",250);


}

var scrollOnLoadComplete = false;

function scrollOnLoad(channelNumber) {
	var currentChannelContainer = document.getElementById(channelNumber);
	
	var channelTop = 0;
	var chBoxHeight = channels_box.offsetHeight;
	
var subChannel = currentChannelContainer.parentNode;
	var subContainer = 0;
	if (isSubChannel(channelNumber)) {
		subContainer = subChannel.parentNode.offsetTop;
		channelTop = currentChannelContainer.offsetTop + subContainer;
	} else {
		subContainer = subChannel.parentNode.offsetTop;
		channelTop = currentChannelContainer.offsetTop + subChannel.offsetTop + subContainer;
	}

	
	var toScroll = channelTop - chBoxHeight + (chBoxHeight/2);
	var maxScroll = document.getElementById('divInnerChannelBox').offsetHeight - chBoxHeight;
	
	if (toScroll > maxScroll) toScroll = maxScroll;
	
	if(channelTop>chBoxHeight) {
		objScroller.down(toScroll);
	}
	scrollOnLoadComplete=true;
}

function clickTopChannel(thisChannelId) {
	if (hasSubChannel(thisChannelId)) {
		if (hasOpenSubChannel(thisChannelId)) {
			closeGroup(getGroupId(thisChannelId));
		} else {
 			openGroup(getGroupId(thisChannelId));
		}
	}
	highlightChannel(thisChannelId);
}

function clickSubChannel(thisChannelId) {
	thisChannelId = (!thisChannelId) ? 0 : thisChannelId; 
	highlightSubChannel(thisChannelId)
	
	thisGroupId = getGroupId(thisChannelId)
	if (!hasOpenSubChannel(thisGroupId)) {
		openGroup(thisGroupId);
	}
	highlightChannel(thisGroupId);
	
}

function unhighlightAllChannels() {
	if (prevChannelId) {
		//alert("!isSubChannel(thisChannelId): " + !isSubChannel(thisChannelId))
		if (!isSubChannel(thisChannelId) && hasSubChannel(thisChannelId) ) {
			unhighlightBullet(prevChannelId);
			unhighlightChannel(getGroupId(prevChannelId));
			unhighlightBullet(getGroupId(prevChannelId));
		} else if (isSubChannel(thisChannelId)) {
			unhighlightSubChannel(lastSubChannelId);
			unhighlightBullet(prevChannelId);
			unhighlightChannel(getGroupId(prevChannelId));
			unhighlightBullet(getGroupId(prevChannelId));
		} else {
			unhighlightSubChannel(lastSubChannelId);
			unhighlightChannel(getGroupId(prevChannelId));
			unhighlightBullet(getGroupId(prevChannelId));
		}
	}
}

function highlightLoadedChannel(channelPos) {
	if (channelPos) {
		channelClick(channelPos);		
		fcApplyFilter(fc_current_filter)
		fcResetStoryScroll();
	} else {
		if (!initialized) {
			channelClick(-1+fc_current_filter);			fcApplyFilter(fc_current_filter);
			fcShowMenu();
			initialized = true;
		}
	}
}

function highlightChannel(thisChannelId) {
	var channelDiv = document.getElementById(thisChannelId);
	if (channelDiv) channelDiv.className = "topChannel_selected";
}
function unhighlightChannel(thisChannelId) {
	var channelBox = document.getElementById("divInnerChannelBox");
	var subdivs = channelBox.getElementsByTagName("div");
	for (var i=0;i<subdivs.length;i++) {
		if (subdivs[i].id == thisChannelId) subdivs[i].className = "topChannel"
	}
}

function highlightSubChannel(subChannelId) {
	var channelDiv = document.getElementById(subChannelId);
	if (channelDiv) channelDiv.className = "subChannel_selected";
	//alert('group is ' + getGroupId(subChannelId));
	openGroup(getGroupId(subChannelId));	
}
function unhighlightSubChannel(subChannelId) {
	var channelBox = document.getElementById("divInnerChannelBox");
	var subdivs = channelBox.getElementsByTagName("div");
	for (var i=0;i<subdivs.length;i++) {
		if (subdivs[i].id == subChannelId) subdivs[i].className = "subChannel"
	}
}

function openGroup(groupId) {
	var subchans = document.getElementById(groupId + "Sub")
	if (subchans) {
		subchans.className = "subChannelContainer_selected"
		openBullet(groupId)
	}
}

function closeGroup(groupId) {
	var subchans = document.getElementById(groupId + "Sub")
	if (subchans) {
		subchans.className = "subChannelContainer"
		closeBullet(groupId)
	}
}

function getGroupId(thisDivId) {
	
	var channel = document.getElementById(thisDivId)
	var groupid = null
	if (channel) {
		var parentbox = channel.parentNode
		if (parentbox.className == 'divChannelContainer') {
			groupid = thisDivId				
		} else if (parentbox.className == 'subChannelContainer_selected') {
			groupid = parentbox.id.substring(0,parentbox.id.indexOf("Sub")); 
		} else if (parentbox.className == 'subChannelContainer') {
			groupid = parentbox.id.substring(0,parentbox.id.indexOf("Sub"));
		}
	}
	return groupid
}


function openBullet(thisDivId) {
	var thisImg = document.getElementById(thisDivId + "Img");
	if (thisImg && thisImg.className.indexOf("none") == -1) rolloverImage(thisDivId+"Img", "channel_arrow_open_on");
}
function closeBullet(thisDivId) {
	var thisImg = document.getElementById(thisDivId + "Img");
	if (thisImg && thisImg.className.indexOf("none") == -1) rolloverImage(thisDivId+"Img", "channel_arrow_on");
}

function unhighlightBullet(thisDivId) {
	var thisImg = document.getElementById(thisDivId + "Img");
	if (thisImg && thisImg.className.indexOf("none") == -1) {
		if (isOpenBullet(thisDivId)) {
			rolloverImage(thisDivId+"Img", "channel_arrow_open_off");
		} else {
			rolloverImage(thisDivId+"Img", "channel_arrow_off");
		}
	}
}

function isOpenBullet(thisDivId) {
	var thisImg = document.getElementById(thisDivId + "Img");
	return (thisImg && thisImg.className.indexOf("Down") > -1)
}
function isNonBullet(thisDivId) {
	var thisImg = document.getElementById(thisDivId + "Img");
	return (thisImg && thisImg.className.indexOf("none") > -1)
}


function isSubChannel(channelId) {
	var channel = document.getElementById(channelId);
	return channel && channel.className.indexOf("sub") == 0
}

function hasSubChannel(channelId) {
	var sub = document.getElementById(channelId + "Sub")
	var img = document.getElementById(channelId + "Img")
	//alert("hasSubChannel: " + (sub && img ? "yes" : " no"));
	return (sub && img)
}

function hasOpenSubChannel(channelId) {
	var sub = document.getElementById(channelId + "Sub")
	return sub && sub.className.indexOf("_selected") > -1
}


function ConstructObject(obj,nest) { 
    nest=(!nest) ? '':'document.'+nest+'.' 
    this.el=  bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0; 
    this.css= bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0; 
    this.scrollHeight=bw.ns4?this.css.document.height:this.el.offsetHeight 
    this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight 
    this.up=MoveAreaUp;
	this.down=MoveAreaDown; 
    this.MoveArea=MoveArea; 
	this.x; 
	this.y; 
    this.obj = obj + "Object" 
    eval(this.obj + "=this") 
    return this 
} 

function MoveArea(x,y) { 
    this.x=x;this.y=y 
    this.css.left=this.x 
    this.css.top=this.y 
	positionx = this.x
	positiony = this.y
} 
 
function MoveAreaDown(move) { 
	if(this.y>-this.scrollHeight+objContainer.clipHeight) { 
	    this.MoveArea(0,this.y-move) 
	    if(loop) setTimeout(this.obj+".down("+move+")",speed) 
	}
}

function MoveAreaUp(move) { 
	if(this.y<0) { 
	    this.MoveArea(0,this.y-move) 
	    if(loop) setTimeout(this.obj+".up("+move+")",speed) 
	}
}

function toggleScrollers(){
    var innerChannelBox = document.getElementById('divInnerChannelBox');
    var channelBox = document.getElementById('channels_box');
    var scrollUpButton = document.getElementById('divScrollUp');
    var scrollDownButton = document.getElementById('divScrollDown');

    if ( innerChannelBox && channelBox ){
		    if (innerChannelBox.offsetHeight > channelBox.offsetHeight){
		  	    scrollUpButton.style.display = "block"
		  	    scrollDownButton.style.display = "block"
			  }else{
			      
			      if (parseInt(innerChannelBox.style.top) < 0){
			          scrollUpButton.style.display = "block" 
			      }else{
			          scrollUpButton.style.display = "none";
			      }
	
	      scrollDownButton.style.display = "none"
        }
    } 
}

function PerformScroll(speed) { 
	if (typeof objScroller == 'undefined')
		InitialiseScrollableArea(0,0)
	else
		InitialiseScrollableArea(objScroller.x,objScroller.y)
	
	if (initialised) { 
		loop=true; 
		if(speed>0) objScroller.down(speed) 
		else objScroller.up(speed) 
		
	} 
	
		
}
 
function CeaseScroll() {
    loop=false 
    if(timer) clearTimeout(timer) 
} 

var initialised;

function InitialiseScrollableArea(x,y) { 
    objContainer=new ConstructObject('channels_box') 
    objScroller=new ConstructObject('divInnerChannelBox', 'channels_box') 
    objScroller.MoveArea(x,y) 
    objContainer.css.visibility='visible' 
    initialised=true; 
    
    
    
}


function setMouseEvent(channelObj, state) {

	var channelId = channelObj.id
	var currArrowPrefix = isOpenBullet(channelId)?"channel_arrow_open":isNonBullet(channelId)?"channel_arrow_none":"channel_arrow"
  	var currGroup = getGroupId(channelId)
  	var prevGroup = getGroupId(prevChannelId)
	var channelImg = null
	for (v in channelObj.childNodes) if (channelObj.childNodes[v] != null && channelObj.childNodes[v].id == channelId + "Img") channelImg = channelObj.childNodes[v]
  	if (currGroup != prevGroup) {
		if (channelId!=prevChannelId && state=='rollover'){
			replaceImage(channelImg, currArrowPrefix + "_on" );
			channelObj.className = "topChannel_selected";		
		}
		else if (channelId!=prevChannelId && state=='rollout'){
			replaceImage(channelImg, currArrowPrefix + "_off" );
			channelObj.className = 'topChannel';
		}
	} 
}

function fcToggleMenu() {
var fc_menu = document.getElementById("divMenuChannelBox");
	if (fc_menu && fc_menu.style.display == "block") fcHideMenu();
	else fcShowMenu();
}
function fcShowMenu() {
	var fc_menu = document.getElementById("divMenuChannelBox");
	if (fc_menu) {
		clearInterval(fc_wipe_timer)
		fc_wipe_timer = setInterval("fcWipeMenu(60)", 250);
	}
	var fc_menu_bt = document.getElementById("channelMenu");
	if (fc_menu_bt) fc_menu_bt.className = "channelMenu_on"
}
function fcHideMenu() {
	var fc_menu = document.getElementById("divMenuChannelBox");
	if (fc_menu) {
		clearInterval(fc_wipe_timer)
		fc_wipe_timer = setInterval("fcWipeMenu(-60)", 250);
	}
	var fc_menu_bt = document.getElementById("channelMenu");
	if (fc_menu_bt) fc_menu_bt.className = "channelMenu_off"
}
var fc_wipe_timer = -1;
function fcWipeMenu(rt) { 
	var fc_menu = document.getElementById("divMenuChannelBox");
	var ht = document.getElementById("divStories").offsetHeight;
    var channelsBox = document.getElementById('channels_box');
    var storiesBox = document.getElementById('divStories');
	if (fc_menu) {
		
		var curr_pct = fc_menu.style.marginTop ? Math.floor(parseFloat(parseInt(fc_menu.style.marginTop)/parseFloat(ht))*100) : -100
		curr_pct = parseInt(curr_pct) + rt
		
		if (curr_pct < 0 && curr_pct > -100) {
			var delta = parseInt((-curr_pct/100)*ht)
			fc_menu.style.marginTop = -delta+"px"; 
			fc_menu.style.clip = "rect("+delta+"px, auto, auto, auto)"
			if (rt > 0) fc_menu.style.display = "block"
			
		} else {
			clearInterval(fc_wipe_timer);		
			if (rt < 0) {
				fc_menu.style.clip = "rect("+ht+"px, auto, auto, auto)"
				fc_menu.style.marginTop = -ht+"px"
				fc_menu.style.display = "none"
				
			} else {
				fc_menu.style.clip = "rect(0px, auto, auto, auto)"
				fc_menu.style.marginTop = "0px"
				
			}
			fc_wiper_timer = -1;
		}
	}
}
function fcHighlightChannelTab() {
	var box = document.getElementById("divTabbedChannelBox");
}
function fcResetStoryScroll() {
	
	var flow = document.getElementById("divStories");
	if (flow) {
		flow.scrollTop = 0;
		
	}
}


function fcApplyFilter(filterName) {
	
	var channelBox = document.getElementById("divInnerChannelBox");
	var subdivs = channelBox.getElementsByTagName("div");
	for (var i=0;i<subdivs.length;i++) {
		if (subdivs[i].className == 'divChannelContainer') {
			if (subdivs[i].id.indexOf(filterName+"ChannelFilter") == 0) { 
				subdivs[i].style.display = "block"
			} else {
				subdivs[i].style.display = "none"
			}
		}
	}		

	
	var channelBox = document.getElementById("divChannelFilters");
	var filterdivs = channelBox.getElementsByTagName("div");
	for (var i=0;i<filterdivs.length;i++) {
		if (filterdivs[i].className.indexOf("filterButton") == 0) { 
			if (filterdivs[i].className.indexOf("_on") > -1) {
				filterdivs[i].className = filterdivs[i].className.substring(0,filterdivs[i].className.indexOf("_"))
			}
			if (filterdivs[i].id.indexOf(filterName) > -1) {
				filterdivs[i].className = filterdivs[i].className + "_on"
			}
		}
	}

	fc_current_filter = filterName
	InitialiseScrollableArea(0,0)
}





var rt_current_rating = 0; 
var rt_img_on = "http://hptv.i.feedroom.com/affiliate/hptv/frhp/bt_starfull.gif"
var rt_img_off = "http://hptv.i.feedroom.com/affiliate/hptv/frhp/bt_starempty.gif"

function rtShowDescription(rt_star, idx) {
	if (rt_star != null) {
		var rt_scale = rt_star.parentNode
		var rt_rating_space = rt_scale.parentNode
		var spans = rt_rating_space.childNodes
		for (var i=0;i<spans.length;i++) {
			var span = spans[i]
			if (span.className == 'userRatingLabel') {
				span.innerHTML = rt_star.title				
			} else if (span.className == 'userRatingScale') {
				var stars = span.childNodes;
				for (var j=0;j<stars.length;j++) {
					if (j <= idx) {
						stars[j].src = rt_img_on
					} else {
						stars[j].src = rt_img_off
					}
				}
			}
		}		
	}
}
function rtHideDescription(rt_star) {
	if (rt_star != null) {
		var rt_scale = rt_star.parentNode
		var rt_rating_space = rt_scale.parentNode
		var spans = rt_rating_space.childNodes
		for (var i=0;i<spans.length;i++) {
			var span = spans[i]
			if (span.className == 'userRatingLabel') {
				span.innerHTML = span.title
			} else if (span.className == 'userRatingScale') {
				var stars = span.childNodes;
				for (var j=0;j<stars.length;j++) {
					if (j <= rt_current_rating-1) {
						stars[j].src = rt_img_on
					} else {
						stars[j].src = rt_img_off
					}
				}
			}
		}		
	}
}


function rtSetRating(story_id, rating) {
	rt_current_rating = rating
	Admin("setUserRating", [story_id, rating], [])
	ping("setUserRating", "&sid="+story_id+"&rating="+rating+"&site=hptv")
}





function addComment(_link) {
	var _blog = document.getElementById('ifr_blog');
	
	if (_blog) {
		_blog.focus();
		var _window = _blog.contentWindow;
		_window.scroll();
		window.scrollTo(0,document.body.scrollHeight);
	}
}


function initCustom() {}






function init_video() { 


	mvideo = document.getElementById('wmPlayer');
	init_slider();

	if (initXtr++ > 1) return;
	

	AdminAB('playStory',1,['-1','0','b4f11813231e10ae4b0433bbf89359ba01b2fd97','a0c33728e0ad748446446e96aa84a4d4cdb8b4dc','false','false']);

}

var mvideo;



var hasBeenPaused = 'false';
var sync_type = 0;

var bvVideo = false;
var swf_file_1 = null;
var bInstreamMeta = false;
var bLongVideo = false;
var iVcount = 0;
var itemQrep = "";
var flashURL;
var syncUrl = null;
var lockAd = false;

var curIdx = -1;
var adBegin_tag = "";
var adEnd_tag = "";
var timeLabel = "";
var bGeoLocationRestriction = false;



function refreshBanner() {


	if ( (sync_type==2 && lockAd) || sync_type==3 )
		return false;
	else
		return true;

}

function syncAds(state) {



    if (isNaN(state)) return;

    switch(state) {
        case 0: //starting flash
            switch(sync_type) {
                case 0:
                    manageRHS(false);
                    break;
                case 1:
                case 2:
                case 3:
                case 4:
                    manageRHS(true);
                    break;
            }
            break;
        case 1: //flash ended, starting video ad
            switch(sync_type) {
                case 1:
                    manageRHS(false);
                    break;
                case 11:
                case 12:
                case 13:
                    manageRHS(true);
                    break;
            }
            break;
        case 2: //video ad ended, starting video content
            switch(sync_type) {
                case 2:
                case 11:
                    manageRHS(false);
                    break;
            }
            break;
        case 3: //video content ended
            switch(sync_type) {
                case 3:
                case 12:
                    manageRHS(false);
                    break;
            }
            break;
        case 4: //flash ended, starting video content
            switch(sync_type) {
                case 1:
                    manageRHS(false);
                    break;
            }
            break;
    }
    
    if (state==sync_type)
    	execSessionEraser('clearAdKeyword');
   	if (state==2) lockAd = false;
	

	
	
}


var pingCt = 0;

var pingInterval = 5;
var bufferPingCt = 0;
var currentMedia = '';
function doRefresh() {
    if (bLongVideo || !mvideo.controls.isAvailable('Pause')) {
		try {
			ifrHlp2.replace('null/blank.jsp?r=600&nsid=a13d71f07:1252a1524ae:-2751')
		
		} catch (err) {}
	}
	//pingCt = 0;
}
var lastMediaName = 'none';
function flDurationTracker(curPos, curMediaName) {
	if (curMediaName == lastMediaName) {
	    pingCt += 1;
	} else {
    	pingCt = 1;
    	lastMediaName = curMediaName;
	}
    var band = "";
    if (pingCt == 1) band = "&band="+(isBB?"BB":"NB");
    if (curMediaName != undefined && curMediaName.indexOf("Video") > 0) {
		setTimeout('ping("duration", "&m='+curMediaName+'&cpos='+curPos+'&dr='+pingInterval+'&cgt='+pingCt+'&cid='+currentChannel_uoi_id+'&sid='+currentStory_uoi_id+band+'");',0);
	}
}
function durationTracker(curPosition) {
	if (mvideo.playState == 3){	
		clearTimeout(lPingTimer);
	    pingCt += 1;
	    var band = "";
	    if (pingCt == 1) band = "&band="+(isBB?"BB":"NB");
	    if (curPosition == undefined) {
			try {
				curPosition = parseInt(mvideo.controls.currentPosition);
			} catch (pErr) {
	
				curPosition = -1;
			}
			if (currentMedia != undefined && currentMedia.indexOf("Video") > 0) {
				ping("duration", "&m="+currentMedia+"&cpos="+curPosition+"&dr="+pingInterval+"&cgt="+pingCt+"&cid="+currentChannel_uoi_id+"&sid="+currentStory_uoi_id+band);
			}
			lPingTimer = setTimeout("durationTracker()", pingInterval*1000);
		} else {
			ping("duration", "&m="+currentMedia+"&cpos="+curPosition+"&dr="+pingInterval+"&cgt="+pingCt+"&cid="+currentChannel_uoi_id+"&sid="+currentStory_uoi_id+band);
		}
	} else if (mvideo.playState > 3) {// transitioning or buffering
		lPingTimer = setTimeout("durationTracker()", 250);
	}
}
function pauseDurationTracker() {
	clearTimeout(lPingTimer);
}

function setPlayingMediaInfo(itemInfo) {
    currentMedia = itemInfo;
}

function getBufferingStatus() {
    bufferPingCt += 1;
    if (mvideo.network.bufferingProgress > 0) {
		
        
    } else {
		
        
    }
    return true;
}

var pxUrl = null;

function pingPxUrl() {
	if (pxUrl != null) {
		setTimeout("loadUrl('"+pxUrl+"')",0);
		pxUrl = null;
	}
}

var cookieUrl = null;

function pingCookieUrl() {
	if (cookieUrl != null) {
		setTimeout("loadUrl('"+cookieUrl+"')",0);
		cookieUrl = null;
	}
}


function loadUrl(link) {

	try {
		if (link.indexOf('javascript:') == 0) {
			eval(link);
		} else if (link.length > 0) {
			_tag = document.getElementById('trkTag');
			if (_tag) _tag.src = link;
		}
	} catch (er) {

	}
}

function doEntryCheck(idx) {
    if (curIdx != idx) {
        if (idx == 1 && adBegin_tag.length > 5) {
            _tag = document.getElementById('trkTag');
            _tag.src = adBegin_tag;
        } else if (curIdx == 1 && idx == 2 && adEnd_tag.length > 5) {
            _tag = document.getElementById('trkTag');
            _tag.src = adEnd_tag;
        }

        curIdx = idx;
    }
}


var qsForNext = null;
var qsNames = [ 'cp', 'pcnt', 'cid', 'sid' ];
var qsVals = null;
function pingNextStory() {
	if (qsForNext != null) {
		
		qsVals.splice(0,0,playChannel)
		qsVals.push(currentChannel_uoi_id)
		qsVals.push(currentStory_uoi_id)
		for (var t=0; t<qsNames.length && t<qsVals.length; t++ ) qsForNext+='&'+qsNames[t]+'='+qsVals[t];
		qsForNext += nsParam + skinParam;
		ping('playNextStory', qsForNext)
		qsForNext = null;
	}
}

function playNextStory(bResetCount) {
	
    syncAds(3);// sync frame
    
  
  	if (bMax) {
  		ScaleVideo();
  	}
  
    iPC = bResetCount ? "&pcnt=0" : "";
    if (iPt == 0) {
	    Admin('playNextStory',[ playChannel, (bResetCount ? 0 : ""),currentChannel_uoi_id, currentStory_uoi_id,true]);
		
		qsForNext = "";
		qsVals = [ (bResetCount ? 0 : "") ];
    }
}

var resume=0;
var videoMedia = false;
var readyFor = null;
var readyForAd = null;
var isUpdated = false;
var lRefreshTimer = 0;
var lPingTimer = 0;
var lDurationTimer = 0;

function goplayVideo() {
	// Clear any timeouts and vars from previous content requests
	clearTimeout(lRefreshTimer);
	// Clear pinging stuff
	clearTimeout(lPingTimer);
	clearTimeout(lDurationTimer);
	pingCt = 0;
	isUpdated = false;
	readyFor = null;
	readyForAd = null;
	lastMediaName = 'none';
	lockAd = xtraVideoFlag;
	
	
	ResetAutoRewind();
	
	//checkMute = true; // 09/06/2005 - removed to prevent resetting volume each story
	curIdx = -1; // Current entry index
	if (iPt != 2) {

	if (!bMax) {
		updateUI();
	}

	}


	mvideo.error.clearErrorQueue();
	OpenVideo("null/ModPlaylist_asx.jsp?vc="+iVcount + "&iPt=" + iPt + itemQrep + nsParam);
	hide_slider();
	
	hide_duration();

	syncAds(0);// sync frame


	

    itemQrep = "";
}


function updateUI() {
	if (!isUpdated) {

	extra = (bInstreamMeta && true)? "?instream=true" : "";

		if (hasChannelStateChanged == 'true') { 
			parent.Admin('showStories', [displayChannelStart,displayChannelEnd,currentChannel_uoi_id], [playChannel, 'true']);
		} 
		setNowPlaying(playStory);
		if (bGeoLocationRestriction) resetNowPlaying();
		if (btDone) AdminAB('loadBodyText',0,[currentStory_uoi_id]);
		if (btDone) Admin('loadBlog');
		if(!bPlayVideo) PausePlayVideo();
        isUpdated = true;
		
			 setDurationDisplay("00:00");
			
		isUpdated = true; 
	}
}

function setDurationDisplay(p_duration) {

    if(mvideo.currentMedia && mvideo.playState == 3 && mvideo.controls.currentPosition > 0){
	    clearTimeout(lDurationTimer);
		var durationDisplay = document.getElementById('duration_display');
		if (durationDisplay) {
			durationDisplay.innerHTML = p_duration;
		}
	} else {
    	lDurationTimer = setTimeout("setDurationDisplay('"+p_duration+"')",250);
	}
}

function setDurationCounterDisplay(p_duration) {
	var durationCounterDisplay = document.getElementById('duration_counter_display');
	if (durationCounterDisplay) {
		durationCounterDisplay.innerHTML = p_duration;
	}
}



function readyVideo() {

    if (readyFor != null && mvideo.currentMedia.isIdentical(readyFor)) { // only once for the clip
		return;
	} else {
			
		readyFor = mvideo.currentMedia;
				
		lockAd = false;
		clearTimeout(lPingTimer);
		pingPxUrl(); 
		pingCookieUrl();
	    pingCt = 0;
		lPingTimer = setTimeout('durationTracker()',0); // want to start straight away to track video

		stayStopped = 0;
		
			var minutes = Math.floor(mvideo.currentMedia.duration/60);
			var seconds = Math.floor((mvideo.currentMedia.duration%60))
			if(seconds <10){
				seconds = "0"+seconds;
			}
			if(minutes<10){
				minutes = "0"+minutes;
			}
			setDurationDisplay(minutes+":"+seconds);
			
			
		
		if (bInstreamMeta) AdminAB('loadBodyText',0,[currentStory_uoi_id]);

		
		if (mvideo.controls.isAvailable('Pause') || mvideo.currentMedia.duration > 0) {
			if (mvideo.currentMedia.getItemInfo("theTitle").indexOf("endslate") < 0) {
				videoMedia = true;
				duratio = readyFor.duration;
				show_slider();
				
				show_duration();
				DragLayer.resume();
				DragLayer.dragIt(duratio);
				
			} else { 
				hide_duration();
			}
		} else {
			lRefreshTimer = setTimeout('doRefresh()',15000); // check for live
		  clearTimeout(lDurationTimer);
			setDurationCounterDisplay("LIVE");
			setDurationDisplay("LIVE");
			show_duration();
			hide_slider();
		}
	
		// sync frame
		if (iVcount == 2) {
			syncAds(2);
		} else {
			syncAds(4);
		}
	
	
	//if (readyFor.getItemInfo("theTitle").indexOf("theVideo") != -1) {
	
	
	}
}

function readyVideoAd() {
    if (readyForAd != null && mvideo.currentMedia.isIdentical(readyForAd)) { // only once for the clip
		return;
	} 

    clearTimeout(lPingTimer);
	pingPxUrl(); 
	pingCookieUrl();
    pingCt = 0;
	lPingTimer = setTimeout('durationTracker()',0); // want to start straight away to track videoAd

	readyForAd = mvideo.currentMedia;

	
		setDurationDisplay(mvideo.currentMedia.durationString);
    
	
		show_duration();
		show_slider();
		DragLayer.resume();
		DragLayer.dragIt(mvideo.currentMedia.duration);
	

    syncAds(1);// sync frame
	setTimeout("doEntryCheck(1)",300);
	
	//alert('readyVideoAd(): ' + mvideo.currentMedia.getItemInfo("theTitle"));
	
}


function PlayVideo() {

    mvideo.controls.Play();
    bPlayVideo = true;

}
function RestartVideo() {

	if (mvideo.currentMedia.getItemInfo("theTitle").indexOf("endslate") == 0) {
		if (mvideo.controls.isAvailable('Previous')) mvideo.controls.previous();
		setDurationCounterDisplay("00:00");
		DragLayer.moveIt(DragLayer.start);
		SlideVideo(0.01);
		setTimeout("PlayVideo()", 400) 
	} 
	
	else if (mvideo.currentMedia.getItemInfo("theTitle").indexOf("interstitial") != 0 && mvideo.currentMedia.getItemInfo("theTitle").indexOf("xtraVideo") != 0) {
		setDurationCounterDisplay("00:00");
		DragLayer.moveIt(DragLayer.start);
	 	SlideVideo(0.01);
		setTimeout("PlayVideo()", 400) 
	}

}

function StopVideo() {

	mvideo.Stop();

}

pI=0;
function PauseVideo() {

    if (mvideo.controls.isAvailable('Pause')) {
        mvideo.controls.pause();
	    bPlayVideo = false;
    } else if (mvideo.PlayState >= 6) {
    	pI = pI + 1;
        if (pI < 10) setTimeout("PauseVideo(pI)",100);
        else pI = 0;
    }

}

function OpenVideo(vsrc) {
    //avoid caching
    if (vsrc.indexOf('?') > 0) {
        vsrc = vsrc + "&ord=" + Math.random()*100000;
    }else{
        vsrc = vsrc + "?ord=" + Math.random()*100000;
    }

    mvideo.URL = vsrc;
    videoMedia = false;
    PlayVideo();

}

function MaxVideo() {

    mvideo.fullScreen = 'true';

}

function SetVolVideo(p_vol) {

	if (p_vol > 100)
		p_vol = 100;
	if (p_vol < 0)
		p_vol = 0;
	mvideo.settings.volume = p_vol;
	
	

   if (!checkMute) videoMute();

}

function VolUpVideo() {

        var Volume = mvideo.settings.volume;
        if (Volume < 100) {
        Volume += 10;
            if (Volume > 100) Volume = 100;
        }
        mvideo.settings.volume = Volume;

        if (!checkMute) videoMute();

}

function VolDownVideo() {

        var Volume = mvideo.settings.volume;
        if (Volume > 0) {
        Volume -= 10;
            if (Volume < 0) Volume = 0;
        }
        mvideo.settings.volume = Volume;

        if (!checkMute) videoMute();

}

var bMute = false;
function MuteVideo(_state) {
    bMute = _state;
    
        if (!_state) {
            mvideo.settings.mute = false;
        } else if (_state) {
            mvideo.settings.mute = true;
        }
    
    changeImage('muteImg','_off');
  	
    var volLevel = (_state)? 0 : mvideo.settings.volume;
    setVolSlider(volLevel);
    
}


function ClickVideo() {
 // see if it's full screen

    if (mvideo.fullScreen) {
          mvideo.fullScreen = "false";
    } else {

		//if (mvideo.currentMedia.getItemInfo("theTitle") == "interstitial") return;


	    if (mvideo.currentMedia.getItemInfo("theTitle") != "xtraVideo" && mvideo.currentMedia.getItemInfo("theTitle") != "theVideo") return;
	
		// not full screen
		if (bvVideo) { // boolean for double video
			providerURL = mvideo.currentMedia.getItemInfo("ClickUrl");
			if (null == providerURL) providerURL = "";
		}
		if (providerURL.length > 4) { // most URLs are longer than 4 chars
		
			window.open('null/redirect.jsp?r=1&url=' + providerURL);
		
		}
	}
    
}








var winDivRescaled = false;

function imageSwap(target, style) {
	changeImage(target,style);
}

function changeImage(target,style){
	if (target=="pausePlayImg"){
		style = (bPlayVideo) ? "pause"+style : "play"+style;
	} else if (target=="muteImg"){
		style = (bMute)? "unmute"+style:"mute"+style;
	} else if (target=="bandImg"){
		style = (!isBB)? "low"+style:"high"+style;
	}
	replaceImageById(target, style)
}

var isBB = false;
function bwMouseHandler(p_target, p_style) {
	var style = p_style;
	if (isBB) {
		if (p_target == "highBandImg") {
			style = "high_over";
		}
	} else {
		if (p_target == "lowBandImg") {
			style = "low_over";
		}
	}
	changeImage(p_target, style);
}

function changeBand(bReplay,band){



    if (band == undefined || isBB != (band=='BB')) {
		isBB = !isBB;


		if (isBB){
			changeImage("highBandImg", "high_over");
			changeImage("lowBandImg", "low_off");
			document.getElementById('highBandImg').alt = '';
			document.getElementById('highBandImg').title = '';
			document.getElementById('lowBandImg').alt = 'Switch to low band';
			document.getElementById('lowBandImg').title = 'Switch to low band';
			document.getElementById('lowBandImg').style.cursor = "pointer";
			document.getElementById('highBandImg').style.cursor = "default";
	    }else{
			changeImage("highBandImg", "high_off");
			changeImage("lowBandImg", "low_over");
			document.getElementById('highBandImg').alt = 'Switch to high band';
			document.getElementById('highBandImg').title = 'Switch to high band';
			document.getElementById('lowBandImg').alt = '';
			document.getElementById('lowBandImg').title = '';
			document.getElementById('lowBandImg').style.cursor = "default";
			document.getElementById('highBandImg').style.cursor = "pointer";
		}
		

		if (bReplay) Admin('playSameStory', ['true', 'true', currentChannel_uoi_id, currentStory_uoi_id,isBB]);
	}
	
}

var checkMute = true;
function videoMute(){

  


  if (videovideo){
    if (checkMute){
        MuteVideo(true);
        document.getElementById('muteImg').alt = 'Play audio';
        document.getElementById('muteImg').title = 'Play audio';
    }else{
        MuteVideo(false);
        document.getElementById('muteImg').alt = 'Mute audio';
        document.getElementById('muteImg').title = 'Mute audio';
    }
    checkMute = !checkMute;

  }
}

var bPlayVideo = true;
function PausePlayVideo(){
        
    if (bPlayVideo){
	    if (mvideo.controls.isAvailable('Pause') && mvideo.currentMedia.getItemInfo("theTitle").indexOf("endslate") < 0) { 
        	PauseVideo();
	        changeImage("pausePlayImg", "_off");
	        document.getElementById('pausePlayImg').className = 'play_off';
	        document.getElementById('pausePlayImg').alt = 'Click to play';
	        document.getElementById('pausePlayImg').title = 'Click to play';
	        pauseDurationTracker();
	    }
    } else {
        PlayVideo();
        changeImage("pausePlayImg", "_off");
        document.getElementById('pausePlayImg').className = 'pause_off';
        document.getElementById('pausePlayImg').alt = 'Click to pause';
        document.getElementById('pausePlayImg').title = 'Click to pause';
        durationTracker();
    }
}

function ForcePauseVideo() {
	if (mvideo.controls.isAvailable('Pause') && mvideo.currentMedia.getItemInfo("theTitle").indexOf("endslate") < 0) { 
    	PauseVideo();
	    changeImage("pausePlayImg", "_off");
	    document.getElementById('pausePlayImg').className = 'play_off';
	    document.getElementById('pausePlayImg').alt = 'Click to play';
	    document.getElementById('pausePlayImg').title = 'Click to play';
	    pauseDurationTracker();
	}
}

var pausePlayFunc = null
var rewindFunc = new Function('RewindVideo();return false;');
function AutoRewind() { 
	hide_duration();
	hide_slider();
	
	bPlayVideo = false;
    changeImage("pausePlayImg", "_off");
    document.getElementById('pausePlayImg').className = 'play_off';
    document.getElementById('pausePlayImg').alt = 'Click to play';
    document.getElementById('pausePlayImg').title = 'Click to play';
	pausePlayFunc = document.getElementById('pausePlayLink').onclick;
	document.getElementById('pausePlayLink').onclick = rewindFunc
}


function RewindVideo() {
	show_duration();
	show_slider();
	document.getElementById('pausePlayLink').onclick = pausePlayFunc;
	bPlayVideo = true;
	
	changeImage("pausePlayImg", "_off");
	document.getElementById('pausePlayImg').className = 'play_off';
	document.getElementById('pausePlayImg').alt = 'Click to pause';
	document.getElementById('pausePlayImg').title = 'Click to pause';
	RestartVideo();
}

function ResetAutoRewind() {
	if ((document.getElementById('pausePlayLink').onclick == rewindFunc)) {
		bPlayVideo = true;
		changeImage("pausePlayImg", "_off");
		document.getElementById('pausePlayImg').className = 'play_off';
		document.getElementById('pausePlayImg').alt = 'Click to play';
		document.getElementById('pausePlayImg').title = 'Click to play';
		document.getElementById('pausePlayLink').onclick = pausePlayFunc;
	}
}

var showInfoWinSession = true; //to display info on how to get back from the full screen mode<html>
<body>
<h1>500 Servlet Exception</h1>
<code><pre>
<script language='javascript' type='text/javascript'>
function show() { document.getElementById('trace').style.display = ''; }
</script>
<a style="text-decoration" href="javascript:show();">[show]</a> java.lang.NullPointerException
<span id="trace" style="display:none">
java.lang.NullPointerException
	at _jsp._domovoi__jsp._jspService(domovoi.jsp:220)
	at com.caucho.jsp.JavaPage.service(JavaPage.java:61)
	at com.caucho.jsp.Page.pageservice(Page.java:578)
	at com.caucho.server.dispatch.PageFilterChain.doFilter(PageFilterChain.java:195)
	at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:187)
	at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:266)
	at com.caucho.server.hmux.HmuxRequest.handleRequest(HmuxRequest.java:435)
	at com.caucho.server.port.TcpConnection.run(TcpConnection.java:678)
	at com.caucho.util.ThreadPool$Item.runTasks(ThreadPool.java:721)
	at com.caucho.util.ThreadPool$Item.run(ThreadPool.java:643)
	at java.lang.Thread.run(Thread.java:595)
</span>
</pre></code>
</body></html>
