







var nsParam = '&nsid=a1009e5eb:12529e707dd:-6cc2';  
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:-6cc2';


	


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=hphowto";qstr += "&skin=totalcare";qstr += "&nsid=a1009e5eb:12529e707dd:-6cc2";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=a1009e5eb:12529e707dd:-6cc2"+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 = ['divHeader','divFooter','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 += "hphowto";
	}
	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 init_video() { 


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

	if (initXtr++ > 1) return;
	

	AdminAB('playStory',1,['-1','0','d9db8c702b9ca4c4206c6581e26877d135b8e8b8','4d4e94574f88a3717b8ebfd7bdde4cda6197e1ef','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() {


}

function syncAds(state) {


	
	
}


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=a1009e5eb:12529e707dd:-6cc2')
		
		} 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) {
	
  
    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) {
  
		updateUI();

	}


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

	

    itemQrep = "";
}


function updateUI() {
	if (!isUpdated) {

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

		if(!bPlayVideo) PausePlayVideo();
        isUpdated = true;
		
		isUpdated = true; 
	}
}



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;
		
		
		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();
				
			} else { 
				hide_duration();
			}
		} else {
			lRefreshTimer = setTimeout('doRefresh()',15000); // check for live
		  clearTimeout(lDurationTimer);
			setDurationCounterDisplay("LIVE");
			
			
			hide_slider();
		}
	
	
	//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;

	
	

    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');
  	
}


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)? "mute"+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){
	        document.getElementById('bandImg').alt = 'Switch to low band';
	        document.getElementById('bandImg').title = 'Switch to low band';
	    }else{
		 	document.getElementById('bandImg').alt = 'Switch to high band';
	        document.getElementById('bandImg').title = 'Switch to high band';
		}
		changeImage("bandImg", "_over");

		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 set on server side
var showInfoWinClient = true;  //this is set on the client side
function VCommand(vcommand) {

    

    //special case for Max
if (videovideo){

    if (mvideo.playState == 3){

        if (vcommand.indexOf("Max")>=0 && showInfoWinSession && showInfoWinClient ) {  //check if already shown?
            //check if cookie is set
            if (document.cookie.indexOf("FullScreenInfoShown") == -1 ){
                winPopup('null/ModVideoControlsMax_dsp.jsp?nsid=a1009e5eb:12529e707dd:-6cc2','FullScreen',420,90,0,0,0,0,false);
            }else {
                showInfoWinClient = false;
                eval(vcommand + "Video()");
            }
        }else {
            eval(vcommand + "Video()");
        }
    }
 } 
}


var DragLayer;
var SliderFill;

var dodrag = 0;

function dragObj(obj){
    this.css=document.getElementById(obj).style;
	this.entity=document.getElementById(obj);	
	this.x=this.css.pixelLeft;
	this.moveIt=b_moveIt;
	this.init=b_init;
	this.drag=false;
	this.clickedX=0;
	this.dragIt=b_interval;
	this.dragPause=1000;
	this.start=0;
	this.pos=0;
	this.end=100;
	this.pause=b_pause;
	this.resume=b_continue;
	replaceImage(this.entity, "#" + this.entity.id) 
	return this;
}

function fillObj(obj) {
	this.css = document.getElementById(obj).style;
	return this;
}

function moveItSlowly(){
	if (mvideo.playState == 3 && !DragLayer.drag){
		_vp = mvideo.controls.currentPosition;
		_vd = mvideo.currentMedia.duration;
		
		DragLayer.pos = parseInt((_vp/_vd)*(DragLayer.end-DragLayer.start)) + DragLayer.start;
		if (DragLayer.pos<DragLayer.end){	 
			DragLayer.moveIt(DragLayer.pos);
			
			
			dodrag = setTimeout('moveItSlowly();',DragLayer.dragPause);
		}
	} else {
		setTimeout('moveItSlowly();',1000);
	}
	
}

var seconds=0;
var minutes=0;
var sprefix;
var mprefix;


function b_interval(i) {
	if (i <= 0) i=0;
	DragLayer.dragPause = parseInt(i*3.3);
	moveItSlowly();
	
	
}
function b_pause() {
	clearTimeout(dodrag);
}
function b_continue(i) {
	moveItSlowly();
	
}
function b_init() {
	clearTimeout(dodrag);
	DragLayer.moveIt(DragLayer.start);
	DragLayer.pos=DragLayer.start;
}
function b_moveIt(x){
	this.x=x; 
	this.css.left=this.x;
}
function mmover(e){
	DragLayer.isOver=true;
}
function mmout(e){
	DragLayer.isOver=false;
}
function mup(){
    
    if(DragLayer.drag){
		DragLayer.drag=false;
		DragLayer.pos = DragLayer.x;
		ii = (DragLayer.x+1-DragLayer.start)/(DragLayer.end-DragLayer.start)*(DragLayer.dragPause/3.3);
		SlideVideo(ii);
		if (!bPlayVideo) PausePlayVideo();
	}
}
function mdown(){
    
	if(DragLayer.isOver && mvideo.controls.isAvailable("currentPosition")) {
		clearTimeout(dodrag);
		x=event.screenX;
		DragLayer.drag=true;
		DragLayer.clickedX=x-DragLayer.x;
		if (bPlayVideo) PausePlayVideo();  
	}
}
function mmove(e){
    
    x=event.screenX - DragLayer.clickedX
	if((DragLayer.drag)&&(x>=DragLayer.start)&&(x<=DragLayer.end)){
		DragLayer.moveIt(x);
	}
	return false;
}

function SlideVideo(pos) {
	mvideo.controls.currentPosition = pos;
	resume=pos;
}

function resumeSlider() {
	if (resume > 0) {
		DragLayer.resume();
		resume=0;
	}
}

function show_slider() { 
	DragLayer.css.visibility = "visible";
	SliderFill.css.visibility = "visible";
}

function hide_slider() { 
	DragLayer.css.visibility = "hidden";
	SliderFill.css.visibility = "hidden";
	
}




function init_slider(){
	SliderFill = new fillObj('slider_fill'); 
	DragLayer=new dragObj('slider');
	DragLayer.entity.onmouseover=mmover;
	DragLayer.entity.onmouseout=mmout;	
	DragLayer.entity.onmousedown=mdown;
	DragLayer.entity.onmouseup=mup;
	DragLayer.entity.onmousemove=mmove;
	DragLayer.init();
	
	
	SliderBG = document.getElementById("slider_bg");
	DragLayer.start=SliderBG.offsetLeft
	DragLayer.end=SliderBG.offsetLeft+SliderBG.offsetWidth-DragLayer.entity.offsetWidth
	DragLayer.pos=DragLayer.start
	SliderFill.css.left=DragLayer.start+2
	
	
	
}





function reboot() {
	window.location.href = "null/?" + skinParam + dbgParam;
}
function getLocation(id) {
	var locRef = null;
	var iRef = document.getElementById(id);
	if (iRef) {
		locRef = iRef.contentWindow ? iRef.contentWindow.location : frames[id].location;
	}
	return locRef
}
function JumpUI() {
	window.scrollTo(0,0); 
}
function exit(){
	calcReportingParams(true, true); 
}


var initXtr = 0; 
var ifrHlp2 = null; 


function summonJsFragment(jsFragUrl) {
	var incJS = document.createElement('script');
	incJS.setAttribute('language', 'javascript');incJS.setAttribute('type', 'text/javascript');incJS.setAttribute('src', jsFragUrl);
	incJS.onload = function () {incs[incs.length] = true;}
	incJS.onreadystatechange = function () {	if(incJS.readyState == 'loaded') {incs[incs.length] = true;}	}
	document.getElementsByTagName('head').item(0).appendChild(incJS);
}
var incs=new Array();
var mxCntr=20;
var currCntr=0;
function spinUntilLoaded(iMustLoad) {
	if (incs.length < iMustLoad && ++currCntr < mxCntr) {
		setTimeout('spinUntilLoaded('+iMustLoad+')', 200);
	} else {
		sniffer();
	}
}


function loadIncludes() {
	
	summonJsFragment('null/include/dispatcher.jsp?nsid=a1009e5eb:12529e707dd:-6cc2');

	
	summonJsFragment('null/include/helper.jsp?nsid=a1009e5eb:12529e707dd:-6cc2');

	
	summonJsFragment('null/include/funcMouseOver.jsp?nsid=a1<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>
