var preOnLoadFunctions = new Array(); function addPreload(newFunction){ preOnLoadFunctions[preOnLoadFunctions.length] = newFunction; } function swapCountryTo(inLocation){ document.getElementById('countryText').innerHTML = inLocation; } function MM_jumpMenu(targ,selObj,restore){ //v3.0 eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'"); if (restore) selObj.selectedIndex=0; } var COMPETITION = new Array(); COMPETITION[COMPETITION.length] = '2008 Final Standings'; COMPETITION[COMPETITION.length] = '2009 Built Ford Tough Series Standings'; COMPETITION[COMPETITION.length] = 'Copenhagen Bull Riding sm Challenger Tour Standings'; COMPETITION[COMPETITION.length] = '2009 Qualifier Standings'; COMPETITION[COMPETITION.length] = 'Top All-Time Money Earners'; COMPETITION[COMPETITION.length] = 'Built Ford Tough World Champion Million Dollar Bonus'; COMPETITION[COMPETITION.length] = '2009 Ford F-150 Challenge'; COMPETITION[COMPETITION.length] = 'Enterprise Ride With the Best'; COMPETITION[COMPETITION.length] = 'Ford Truck Moment of Truth'; COMPETITION[COMPETITION.length] = 'Daisy Rookie of the Year'; COMPETITION[COMPETITION.length] = 'Salem NationaLease High Mark Bull Bonus '; COMPETITION[COMPETITION.length] = 'Copenhagen Bull Riding sm 90 Point Club'; COMPETITION[COMPETITION.length] = 'Bull Team Challenge'; var RIDERS = new Array(); RIDERS[RIDERS.length] = 'Rider Search'; RIDERS[RIDERS.length] = 'Injury Report'; RIDERS[RIDERS.length] = '2009 Built Ford Tough Series Standings'; RIDERS[RIDERS.length] = 'Copenhagen Bull Riding Challenger Tour Standings'; RIDERS[RIDERS.length] = '2009 Qualifier Standings'; RIDERS[RIDERS.length] = 'Top All-Time Money Earners'; RIDERS[RIDERS.length] = 'Become a Bull Rider'; var BULLS = new Array(); BULLS[BULLS.length] = 'Bull Search'; BULLS[BULLS.length] = 'Animal Welfare'; BULLS[BULLS.length] = 'Stock Contractors'; BULLS[BULLS.length] = '2009 Bull Teams'; var SCHEDULE = new Array(); SCHEDULE[SCHEDULE.length] = '2009 Built Ford Tough Series Schedule'; SCHEDULE[SCHEDULE.length] = '2009 Copenhagen Bull Riding Challenger Tour Schedule'; SCHEDULE[SCHEDULE.length] = '2009 Enterprise Tour Schedule'; SCHEDULE[SCHEDULE.length] = '2009 Discovery Tour Schedule'; SCHEDULE[SCHEDULE.length] = 'Television Schedule'; SCHEDULE[SCHEDULE.length] = 'ESPN Team Shootout Schedule'; SCHEDULE[SCHEDULE.length] = 'PBR Brazil'; SCHEDULE[SCHEDULE.length] = 'PBR Australia'; SCHEDULE[SCHEDULE.length] = 'PBR Canada'; SCHEDULE[SCHEDULE.length] = 'PBR Mexico'; var PBR101 = new Array(); PBR101[PBR101.length] = 'PBR 101 Video'; PBR101[PBR101.length] = 'Bull Riding Basics'; PBR101[PBR101.length] = 'Bull Riding Equipment'; PBR101[PBR101.length] = 'All About Bull Riding'; PBR101[PBR101.length] = 'Bull Riding Dictionary'; PBR101[PBR101.length] = 'Bullfighters'; PBR101[PBR101.length] = 'FAQ'; PBR101[PBR101.length] = 'Ride and Event Scoring'; PBR101[PBR101.length] = 'PBR Second Round Draft'; var ABOUTPBR = new Array(); ABOUTPBR[ABOUTPBR.length] = 'About US'; ABOUTPBR[ABOUTPBR.length] = 'Contact Us'; ABOUTPBR[ABOUTPBR.length] = 'Staff Directory'; ABOUTPBR[ABOUTPBR.length] = 'Ring of Honor'; ABOUTPBR[ABOUTPBR.length] = 'Resistol Relief Foundation'; ABOUTPBR[ABOUTPBR.length] = 'PBR Music'; ABOUTPBR[ABOUTPBR.length] = 'Careers'; ABOUTPBR[ABOUTPBR.length] = 'PBR Blogs'; ABOUTPBR[ABOUTPBR.length] = 'Community Relations'; var SPONSORS = new Array(); var FANS = new Array(); FANS[FANS.length] = 'Join TeamPBR'; FANS[FANS.length] = 'Newsletter/Mailing list'; FANS[FANS.length] = 'PBR Store'; FANS[FANS.length] = 'Resistol Relief Fund'; FANS[FANS.length] = 'PBR Outreach'; FANS[FANS.length] = 'PBR Fantasy'; FANS[FANS.length] = 'PBR Web Chats'; FANS[FANS.length] = 'Night Club PBR'; FANS[FANS.length] = 'Your Voice: Poll Results'; FANS[FANS.length] = 'PBR Big Sky'; FANS[FANS.length] = 'PBR Blogs'; var MULTIMEDIA = new Array(); MULTIMEDIA[MULTIMEDIA.length] = 'PBR Video'; MULTIMEDIA[MULTIMEDIA.length] = 'In the News'; MULTIMEDIA[MULTIMEDIA.length] = 'PBR Press Releases'; MULTIMEDIA[MULTIMEDIA.length] = 'Public Event Photos'; MULTIMEDIA[MULTIMEDIA.length] = 'Media Credential Form'; MULTIMEDIA[MULTIMEDIA.length] = 'PBR Press Room'; MULTIMEDIA[MULTIMEDIA.length] = 'Photo Database'; MULTIMEDIA[MULTIMEDIA.length] = 'Television Schedule'; MULTIMEDIA[MULTIMEDIA.length] = 'Fan Photos - Buy Here'; MULTIMEDIA[MULTIMEDIA.length] = 'Ride and Wrecks of the Week'; MULTIMEDIA[MULTIMEDIA.length] = 'PBR Music'; MULTIMEDIA[MULTIMEDIA.length] = 'Top 3 Videos From Each Event'; MULTIMEDIA[MULTIMEDIA.length] = 'PBR Blog'; MULTIMEDIA[MULTIMEDIA.length] = 'PBR Games'; var MERCHANDISE = new Array(); MERCHANDISE[MERCHANDISE.length] = 'PBR Store'; MERCHANDISE[MERCHANDISE.length] = 'PBR Wrangler Jeans'; MERCHANDISE[MERCHANDISE.length] = 'Mens'; MERCHANDISE[MERCHANDISE.length] = 'Ladies'; MERCHANDISE[MERCHANDISE.length] = 'Kids'; MERCHANDISE[MERCHANDISE.length] = 'Toys and Collectibles'; MERCHANDISE[MERCHANDISE.length] = 'PBR Music'; var EVENTRESULTS = new Array(); var menuwidth='165px' //default menu width var menubgcolor='555555' //menu bgcolor var disappeardelay=250 //menu disappear speed onMouseout (in miliseconds) var hidemenu_onclick="yes" //hide menu when user clicks within menu? /////No further editting needed var ie4=document.all var ns6=document.getElementById&&!document.all if (ie4||ns6) document.write('') function getposOffset(what, offsettype){ var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop; var parentEl=what.offsetParent; while (parentEl!=null){ totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop; parentEl=parentEl.offsetParent; } return totaloffset; } function showhide(obj, e, visible, hidden, menuwidth){ if(typeof e.type == 'unknown') usetype = 'mouseover'; else usetype = e.type; if (ie4||ns6) dropmenuobj.style.left=dropmenuobj.style.top="-500px" if (menuwidth!=""){ dropmenuobj.widthobj=dropmenuobj.style dropmenuobj.widthobj.width=menuwidth } if (usetype=="click" && obj.visibility==hidden || usetype=="mouseover") obj.visibility=visible else if (usetype=="click") obj.visibility=hidden } function iecompattest(){ return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body } function clearbrowseredge(obj, whichedge){ var edgeoffset=0 if (whichedge=="rightedge"){ var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15 dropmenuobj.contentmeasure=dropmenuobj.offsetWidth if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure) edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth } else{ var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18 dropmenuobj.contentmeasure=dropmenuobj.offsetHeight if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up? edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight if ((dropmenuobj.y-topedge) 0) answers = answers.substring(1, answers.length); else return; var voter = new myXMLObj("pollDiv", "/pollRecorder.cfm", "pid=" + answers); voter.callback = handleAnswer; voter.send(); } function multiAnswerResults(questionid) { var voter = new myXMLObj("pollDiv", "/pollRecorder.cfm", "qid=" + questionid); voter.callback = handleAnswer; voter.send(); } function myXMLObj(targDivIn, targUrlIn, postParamsIn){ this.targetDiv = targDivIn; this.targUrl = targUrlIn; this.postParams = postParamsIn; this.callback = "undef"; this.send = function() { if(document.getElementById(this.targetDiv)) var theTargetDivObj = document.getElementById(this.targetDiv); req = false; params = this.postParams; if (params != "") method = "POST"; else method = "GET"; contentType = "application/x-www-form-urlencoded"; if(window.XMLHttpRequest) { try { req = new XMLHttpRequest(); }catch(e) { req = false; } }else if(window.ActiveXObject) { try { req = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try { req = new ActiveXObject("Microsoft.XMLHTTP"); }catch(e){ req = false; } } } if(req) { var self = this; // put a reference to "this" in a local-scoped variable req.onreadystatechange = function() { self.processReqChange(); }; result = this.targUrl.match(/\?/gi); if(method == "GET") { if(globalArgs == "" && typeof 'parseUri' != 'undefined' && parseUri(window.location.href)['query']) extraString = parseUri(window.location.href)['query']; else extraString = globalArgs; if (result != null) useUrl = this.targUrl + "&" + extraString + "&test=" + Math.random(); else useUrl = this.targUrl + "?" + extraString + "&DD_test=" + Math.random(); uri = parseUri('http://www.pbrnow.com/' + useUrl + '&' + extraString); query = uri['query']; args = new Array(); args = query.split('&'); UIFIER = new Array(); for(argsLength = 0;argsLength < args.length;argsLength++) if(args.length > 0) { thisParam = args[argsLength].split("="); if(thisParam[0]) { eval('thisResult = typeof ' + thisParam[0]) if(!thisParam[1]) thisParam[1] = ''; UIFIER[thisParam[0].toUpperCase()]= thisParam[1]; } } useString = "?a=1"; for(key in UIFIER) if (UIFIER[key].indexOf('__array') == -1 && key.indexOf('__array')) useString += "&" + key + "=" + UIFIER[key]; if(uri['path'].length < 1) useUrl = '/' + useString; else useUrl = uri['path'] + useString; useUrl = useUrl.replace('//', '/'); req.open(method, useUrl, true); }else req.open(method, this.targUrl, true); if(contentType) req.setRequestHeader("Content-Type", contentType); req.send(params); } } this.processReqChange = function() { if (req.readyState == 4) { if (req.status == 200) { if(this.targetDiv == 'ignore') { } else if(this.targetDiv != "LogInProcess" && this.targetDiv != "LogOutProcess" && this.targetDiv != "errorReport") swapDivText(this.targetDiv, req.responseText,this.targUrl); else performOnLoadOperations(this.targetDiv, this.targetUrl, displayList[currentLoad]); beenClicked = 0; if(this.callback != "undef") this.callback(req.responseText); } else { alert ( "Error: " + req.status + " \n Text: " + req.statusText + "\n" + this.targUrl); checkLoadNextContent(); } if(document.getElementById('loadingNoticeDiv')) document.getElementById('loadingNoticeDiv').style.visibility = "hidden"; } } } function swapDivText(id, text) { eval("divToSwap = document.getElementById('"+ id + "');"); if(divToSwap && divToSwap.innerHMTL != text && text.indexOf("A Problem Has Occurred") == -1) { divToSwap.style.visibility = "visible"; divToSwap.innerHTML = text; } else { if( text.indexOf("A Problem Has Occurred") != -1) error = "A content error occured."; else if (!divToSwap ) error = "No container could be located: " + id ; else if (divToSwap.innerHMTL == text) error = "Same content already on page."; else error = "Unknown error"; displayNotice("Content Error", "Unable to display some, or all, of the page content. We apologize for this.
" + error, "pageErrorNotice", 400); //alert("Unable to display some, or all, of the page content. We apologize for this"); } } function switchResultsTo(targTab) { if( document.getElementById("resultDiv" + targTab) ) { try{ switchToTab(targTab); if (targTab <= 5) { startTab = 1; endTab = 6; }else{ startTab = 6; endTab = 10; } for (i = startTab; i < endTab; i++) if (i != targTab && document.getElementById("resultDiv" + i)) document.getElementById("resultDiv" + i).style.display = "none"; }catch(e){ } document.getElementById("resultDiv" + targTab).style.display = "block"; } try{FixBoxes();}catch(e){} } function switchToTab(targTab) { if (targTab <= 5) { startTab = 1; endTab = 6; }else{ startTab = 6; endTab = 10; } for (i = startTab; i < endTab; i++) { try{ if (i != targTab && document.getElementById('tabLeft' + i)) { document.getElementById('tabLeft' + i).style.backgroundImage='url(/images/tabs/tabOffLeft.jpg)'; document.getElementById('tabMiddle' + i).style.backgroundImage='url(/images/tabs/tabOffMiddle.jpg)'; document.getElementById('tabRight' + i).style.backgroundImage='url(/images/tabs/tabOffRight.jpg)'; } }catch(e){ } } document.getElementById('tabLeft' + targTab).style.backgroundImage='url(/images/tabs/tabOnLeft.jpg)'; document.getElementById('tabMiddle' + targTab).style.backgroundImage='url(/images/tabs/tabOnMiddle.jpg)'; document.getElementById('tabRight' + targTab).style.backgroundImage='url(/images/tabs/tabOnRight.jpg)'; return true; } function collapseExpand(tagId, expandText, collapseText) { var tdd = document.getElementById(tagId); var td = document.getElementById(tagId + 'ff'); var txt = document.getElementById(tagId + 'text'); if(!expandText) var expandText = "Click here to Expand this area and view its contents"; if(!collapseText) var collapseText = "Collapse"; if(document.all) { if (!tdd) return; else if ( tdd.style.display != 'none') { tdd.style.display = "none"; txt.innerHTML = expandText; } else { tdd.style.display = "block"; txt.innerHTML = collapseText; } }else{ if (!td) return; else if ( td.style.height != '30px') { td.style.height = '30px'; tdd.style.visibility = "hidden"; txt.innerHTML = expandText; } else { tdd.style.visibility = "visible"; td.style.height = 'auto'; txt.innerHTML = collapseText; } } try{ FixBoxes(); setTimeout('FixBoxes();', 10); }catch(e){} } bpc=0; width = 80; doRotate = true; rotateCalled = false; oldPos = ""; // rotateInterval = setInterval('rotateStaticBanners()', 10000); bannerSwapperArray = new Array(); if(!bannerSwapperArray[39]) { bannerSwapperArray[39] = new Array(); bannerSwapperArray[39][0] = 0; } bannerSwapperArray[39][bannerSwapperArray[39].length] = new Array(); bannerSwapperArray[39][bannerSwapperArray[39].length - 1][0] = 'http://www.pbrnow.com/uploads/rodeo.jpg'; bannerSwapperArray[39][bannerSwapperArray[39].length - 1][1] = '1'; bannerSwapperArray[39][bannerSwapperArray[39].length - 1][2] = '219&ts=1268511357220'; bannerSwapperArray[39][bannerSwapperArray[39].length - 1][3] = '0'; if(!bannerSwapperArray[39]) { bannerSwapperArray[39] = new Array(); bannerSwapperArray[39][0] = 0; } bannerSwapperArray[39][bannerSwapperArray[39].length] = new Array(); bannerSwapperArray[39][bannerSwapperArray[39].length - 1][0] = 'http://www.pbrnow.com/uploads/eight-in-eight-banner-160x75.jpg'; bannerSwapperArray[39][bannerSwapperArray[39].length - 1][1] = '2'; bannerSwapperArray[39][bannerSwapperArray[39].length - 1][2] = '642&ts=1268511357220'; bannerSwapperArray[39][bannerSwapperArray[39].length - 1][3] = '0'; if(!bannerSwapperArray[39]) { bannerSwapperArray[39] = new Array(); bannerSwapperArray[39][0] = 0; } bannerSwapperArray[39][bannerSwapperArray[39].length] = new Array(); bannerSwapperArray[39][bannerSwapperArray[39].length - 1][0] = 'http://www.pbrnow.com/uploads/bps_160x75.jpg'; bannerSwapperArray[39][bannerSwapperArray[39].length - 1][1] = '2'; bannerSwapperArray[39][bannerSwapperArray[39].length - 1][2] = '680&ts=1268511357220'; bannerSwapperArray[39][bannerSwapperArray[39].length - 1][3] = '0'; if(!bannerSwapperArray[39]) { bannerSwapperArray[39] = new Array(); bannerSwapperArray[39][0] = 0; } bannerSwapperArray[39][bannerSwapperArray[39].length] = new Array(); bannerSwapperArray[39][bannerSwapperArray[39].length - 1][0] = 'http://www.pbrnow.com/uploads/PBR.jpg'; bannerSwapperArray[39][bannerSwapperArray[39].length - 1][1] = '1'; bannerSwapperArray[39][bannerSwapperArray[39].length - 1][2] = '501&ts=1268511357220'; bannerSwapperArray[39][bannerSwapperArray[39].length - 1][3] = '0'; if(!bannerSwapperArray[40]) { bannerSwapperArray[40] = new Array(); bannerSwapperArray[40][0] = 0; } bannerSwapperArray[40][bannerSwapperArray[40].length] = new Array(); bannerSwapperArray[40][bannerSwapperArray[40].length - 1][0] = 'http://www.pbrnow.com/uploads/Final21.gif'; bannerSwapperArray[40][bannerSwapperArray[40].length - 1][1] = '1'; bannerSwapperArray[40][bannerSwapperArray[40].length - 1][2] = '427&ts=1268511357220'; bannerSwapperArray[40][bannerSwapperArray[40].length - 1][3] = '0'; if(!bannerSwapperArray[40]) { bannerSwapperArray[40] = new Array(); bannerSwapperArray[40][0] = 0; } bannerSwapperArray[40][bannerSwapperArray[40].length] = new Array(); bannerSwapperArray[40][bannerSwapperArray[40].length - 1][0] = 'http://www.pbrnow.com/uploads/PBRnow_160x75.gif'; bannerSwapperArray[40][bannerSwapperArray[40].length - 1][1] = '3'; bannerSwapperArray[40][bannerSwapperArray[40].length - 1][2] = '671&ts=1268511357220'; bannerSwapperArray[40][bannerSwapperArray[40].length - 1][3] = '0'; if(!bannerSwapperArray[40]) { bannerSwapperArray[40] = new Array(); bannerSwapperArray[40][0] = 0; } bannerSwapperArray[40][bannerSwapperArray[40].length] = new Array(); bannerSwapperArray[40][bannerSwapperArray[40].length - 1][0] = 'http://www.pbrnow.com/uploads/banner_pbr.gif'; bannerSwapperArray[40][bannerSwapperArray[40].length - 1][1] = '1'; bannerSwapperArray[40][bannerSwapperArray[40].length - 1][2] = '558&ts=1268511357220'; bannerSwapperArray[40][bannerSwapperArray[40].length - 1][3] = '0'; if(!bannerSwapperArray[41]) { bannerSwapperArray[41] = new Array(); bannerSwapperArray[41][0] = 0; } bannerSwapperArray[41][bannerSwapperArray[41].length] = new Array(); bannerSwapperArray[41][bannerSwapperArray[41].length - 1][0] = 'http://www.pbrnow.com/uploads/daisy.jpg'; bannerSwapperArray[41][bannerSwapperArray[41].length - 1][1] = '1'; bannerSwapperArray[41][bannerSwapperArray[41].length - 1][2] = '220&ts=1268511357220'; bannerSwapperArray[41][bannerSwapperArray[41].length - 1][3] = '0'; if(!bannerSwapperArray[41]) { bannerSwapperArray[41] = new Array(); bannerSwapperArray[41][0] = 0; } bannerSwapperArray[41][bannerSwapperArray[41].length] = new Array(); bannerSwapperArray[41][bannerSwapperArray[41].length - 1][0] = 'http://www.pbrnow.com/uploads/bigTex160x75.jpg'; bannerSwapperArray[41][bannerSwapperArray[41].length - 1][1] = '1'; bannerSwapperArray[41][bannerSwapperArray[41].length - 1][2] = '222&ts=1268511357220'; bannerSwapperArray[41][bannerSwapperArray[41].length - 1][3] = '0'; if(!bannerSwapperArray[41]) { bannerSwapperArray[41] = new Array(); bannerSwapperArray[41][0] = 0; } bannerSwapperArray[41][bannerSwapperArray[41].length] = new Array(); bannerSwapperArray[41][bannerSwapperArray[41].length - 1][0] = 'http://www.pbrnow.com/uploads/160x75.jpg'; bannerSwapperArray[41][bannerSwapperArray[41].length - 1][1] = '2'; bannerSwapperArray[41][bannerSwapperArray[41].length - 1][2] = '635&ts=1268511357220'; bannerSwapperArray[41][bannerSwapperArray[41].length - 1][3] = '0'; if(!bannerSwapperArray[42]) { bannerSwapperArray[42] = new Array(); bannerSwapperArray[42][0] = 0; } bannerSwapperArray[42][bannerSwapperArray[42].length] = new Array(); bannerSwapperArray[42][bannerSwapperArray[42].length - 1][0] = 'http://www.pbrnow.com/uploads/abbi-20082.jpg'; bannerSwapperArray[42][bannerSwapperArray[42].length - 1][1] = '1'; bannerSwapperArray[42][bannerSwapperArray[42].length - 1][2] = '277&ts=1268511357220'; bannerSwapperArray[42][bannerSwapperArray[42].length - 1][3] = '0'; if(!bannerSwapperArray[42]) { bannerSwapperArray[42] = new Array(); bannerSwapperArray[42][0] = 0; } bannerSwapperArray[42][bannerSwapperArray[42].length] = new Array(); bannerSwapperArray[42][bannerSwapperArray[42].length - 1][0] = 'http://www.pbrnow.com/uploads/911369_TE_FB_160x758.swf'; bannerSwapperArray[42][bannerSwapperArray[42].length - 1][1] = '1'; bannerSwapperArray[42][bannerSwapperArray[42].length - 1][2] = '710&ts=1268511357220'; bannerSwapperArray[42][bannerSwapperArray[42].length - 1][3] = '0'; if(!bannerSwapperArray[42]) { bannerSwapperArray[42] = new Array(); bannerSwapperArray[42][0] = 0; } bannerSwapperArray[42][bannerSwapperArray[42].length] = new Array(); bannerSwapperArray[42][bannerSwapperArray[42].length - 1][0] = 'http://www.pbrnow.com/uploads/visa_passport160-x-75.jpg'; bannerSwapperArray[42][bannerSwapperArray[42].length - 1][1] = '1'; bannerSwapperArray[42][bannerSwapperArray[42].length - 1][2] = '662&ts=1268511357220'; bannerSwapperArray[42][bannerSwapperArray[42].length - 1][3] = '0'; /*********************************************** * AnyLink Drop Down Menu- � Dynamic Drive (www.dynamicdrive.com) * This notice MUST stay intact for legal use * Visit http://www.dynamicdrive.com/ for full source code ***********************************************/ function writeNextEvent() { if(document.getElementById('nextEventHolder')) { newDiv = document.createElement("div"); newDiv.style.position = "relative"; newDiv.style.width = "304px"; newDiv.style.height = "53px"; newDiv.style.top = "10px"; newDiv.style.zIndex = 99999; newDiv.style.zindex = 99999; newDiv.style.left = "380px"; 0.351354958442 newDiv.innerHTML = ''; document.getElementById('nextEventHolder').appendChild(newDiv); } } try{ addPreload(writeNextEvent); // addLoadEvent(writeNextEvent); }catch(e){ } Array.prototype.inArray = function (value) { var i; for (i=0; i < this.length; i++) { if (this[i] === value) { return true; } } return false; }; function addEvent( obj, type, fn ) { if (obj.addEventListener) { obj.addEventListener( type, fn, false ); EventCache.add(obj, type, fn); } else if (obj.attachEvent) { obj["e"+type+fn] = fn; obj[type+fn] = function() { obj["e"+type+fn]( window.event ); } obj.attachEvent( "on"+type, obj[type+fn] ); EventCache.add(obj, type, fn); } else { obj["on"+type] = obj["e"+type+fn]; } } var EventCache = function(){ var listEvents = []; return { listEvents : listEvents, add : function(node, sEventName, fHandler){ listEvents.push(arguments); }, flush : function(){ var i, item; for(i = listEvents.length - 1; i >= 0; i = i - 1){ item = listEvents[i]; if(item[0].removeEventListener){ item[0].removeEventListener(item[1], item[2], item[3]); }; if(item[1].substring(0, 2) != "on"){ item[1] = "on" + item[1]; }; if(item[0].detachEvent){ item[0].detachEvent(item[1], item[2]); }; item[0][item[1]] = null; }; } }; }(); addEvent(window,'unload',EventCache.flush); function getLength(text) { //TODO: cleanup so doesnt interfere with page at all (hide in absolute div or something?) var ruler = document.createElement("span"); ruler.innerHTML = text; document.body.appendChild(ruler); retVal = ruler.offsetWidth; document.body.removeChild(ruler); return retVal; } function getHeight(text) { var ruler = document.createElement("div"); ruler.style.width = "290px"; ruler.innerHTML = text; document.body.appendChild(ruler); retVal = ruler.offsetHeight; document.body.removeChild(ruler); return retVal; } function getGoodText(text, height, node) { //make a decent start guess (we'll say 8 pixels a character) retval = text; if(getHeight(retval) > height) { desiredCount = (height /12 ) * 40; retval = text.substring(0, desiredCount); itercount = 0; while(getHeight(retval) > height) { itercount++; //todo: optimize to substract an approximation to the goal rather than a fixed, large amount retval = retval.substring(0, retval.length - 65); //lets back up a word inTag = false; while(retval.substring(retval.length - 1, retval.length) != ' ' || inTag) { if (retval.substring(retval.length - 1, retval.length) == '>') inTag = true; if (retval.substring(retval.length - 1, retval.length) == '<') inTag = false; retval = retval.substring(0, retval.length - 1); } } //in case our guess was right, or below, lets back up to a space while(retval.substring(retval.length - 1, retval.length) != ' ') { retval = retval.substring(0, retval.length - 1); } //since we've ended on a space, lets remove it before appending our '...' if(retval.substring(retval.length - 1, retval.length) == ' ') retval = retval.substring(0, retval.length - 1); retval += "...
"; if(document.getElementById('linkForStory' + node)) retval += document.getElementById('linkForStory' + node).innerHTML; }else if(document.getElementById('linkForStory' + node)) retval += document.getElementById('linkForStory' + node).innerHTML; return retval; } function checkStoryLengths(height) { for(var i = 1; i < 15; i++) { var storySpan = document.getElementById('storyText' + i); if(storySpan) { storySpan.innerHTML = getGoodText(storySpan.innerHTML, height, i); } } } addPreload(function(){ try{ checkStoryLengths(428); FixBoxes(); setTimeout("FixBoxes();", 5000); } catch(e){ } } ); if(typeof sIFR == "function" && !sIFR.UA.bIsIEMac){ sIFR.setup(); }; function showPlayer(videoID,GetAutoPlay, story) { activateStory(story); document.getElementById('HPFCenterImage').style.top = (250) + 'px'; document.getElementById('videoPlayer').innerHTML = getVideoViewer(videoID, {width: 442, height: 332, config: {autoplay: false}}); // alert(getVideoViewer(videoID, {width: 442, height: 332, config: {autoplay: GetAutoPlay}})); } function showText(story) { hideAndActivateText(lastTextActivated, story); lastTextActivated = story; FixBoxes(); } var num = 0; function JSVideoPlayer(playListIn, descriptionContainerIDIn, titleContainerIDIn, navCallBackFunctionIn,playlistContainerIDIn,usePlayListIn,overLayCallBackFunctionIn){ this.internalPlaylist = playListIn; this.descriptionContainerID = descriptionContainerIDIn; this.titleContainerID = titleContainerIDIn; this.navCallBackFunction= navCallBackFunctionIn; this.currentPosition = 0; this.lastPlayerStatus = -10; this.playerStatus = -10; this.playStack = new Array(); this.ytplayerID = 'ytplayer' + Math.ceil(Math.random() * 1000); this.ytDevKey = 'AI39si5ZYda4KHUD8hIxgJZVKx-t5SP0QHnN_GysjQno86PT67hpyRIHFUMflLHz_AnwkB2PUspNy7_lZyBr44Rf9a4Q7rmHrA'; this.allowAutoSkip = true; this.playlistContainerID = playlistContainerIDIn; this.currentLoadedHash = new Array(); this.stateStack = new Array(); this.adVids = new Array(); this.adMode = false; this.ignoreNextState = false; this.stateStack[this.stateStack.length] = this.playerStatus; this.overLayCallBackFunction = overLayCallBackFunctionIn; this.showedAd = false; if(typeof usePlayListIn == 'undefined' || usePlayListIn) this.usePlayList = true; else this.usePlayList = false; //lets find a uniqueid that isn't in use while(document.getElementById(this.ytplayerID)){ this.ytplayerID = 'ytplayer' + Math.ceil(Math.random() * 1000); } this.setAdMode = function(adModeIn, vid){ this.adMode = adModeIn; try{ //this.overLayCallBackFunction(adModeIn, this.internalPlaylist.videos[this.currentPosition +1].ID); this.overLayCallBackFunction(adModeIn, vid); }catch(e){ //alert(e.message); } } this.onBufferFull = function(clip){// - Called when a video has completely buffered. this.notifyOfStateChange(1); } this.onResume = function(clip){//(clip) - Called when the video resumes playback after being stopped or paused. this.notifyOfStateChange(4); } this.onPlay = function(clip){//(clip) - Called when the play button is clicked. var newid = ''; try{ newid = clip['info']['id']; }catch(e){ newid = ''; } this.notifyOfStateChange(3, newid); } this.onPause = function(clip){//(clip) - Called when the pause button is clicked. this.notifyOfStateChange(2); } this.onStop = function(clip){//(clip) - Called when the stop button is clicked. this.notifyOfStateChange(7); } this.onClipDone = function(clip){//(clip) - Called when a video completes playback. //logText('onclipdone called'); this.notifyOfStateChange(0); } //replaces the internal play list with what is passed this.loadPlayList = function (playListIn){ if(this.adMode) return; this.internalPlaylist = playListIn; //queUpVideo(0); this.startPlaying(0, true); this.updatePlaylistDisplay(); } this.removeVideoByVID = function(videoIDIn){ logText('removing: ' + videoIDIn + ' from playlist of length ' + this.internalPlaylist.videos.length); var counter; for (counter = 0; counter < this.internalPlaylist.videos.length; counter++){ if (videoIDIn.toUpperCase() == this.internalPlaylist.videos[counter].ID.toUpperCase()){ logText('removeVideoByVID: ' + videoIDIn.toUpperCase() + ' == ' + this.internalPlaylist.videos[counter].ID.toUpperCase()); break; }else{ logText('removeVideoByVID: ' + videoIDIn.toUpperCase() + ' != ' + this.internalPlaylist.videos[counter].ID.toUpperCase()); } } if (counter < this.internalPlaylist.videos.length){ for(var i = counter; counter < this.internalPlaylist.videos.length -1; counter++){ this.internalPlaylist.videos[counter] = this.internalPlaylist.videos[counter +1]; logText('removeVideoByVID: copying to ' + counter + ' from ' + (counter + 1)); } if (this.currentPosition >= counter) this.currentPosition--; this.internalPlaylist.videos.pop(); this.updatePlaylistDisplay(); return true; } return false; } //returns the underlying youtube object this.getPlayerObj = function(){ //TODO change to internal reference return document.getElementById(this.ytplayerID); } //returns the current video this.getCurrentVideo = function(){ return this.internalPlaylist.videos[this.currentPosition]; } //appends the passed play list to the current list this.queToList = function(playListIn){ for(var i =0 ; i < playListIn.videos.length; i++) this.internalPlayList.addVideo(playListIn[i]); } this.playVideo = function(playListIn){ if(this.adMode) return; this.loadPlayList(playListIn); this.startPlaying(0); } this.present = function(targetDiv, autoplay, widthIn, heightIn){ try{ var useCurrent = -1; if(autoplay){ for(var i = 0; i < this.currentLoadedHash.length; i++){ if(this.internalPlaylist.videos[this.currentPosition].ID == this.currentLoadedHash[i]){ useCurrent = i; //logText("present: video found in current list :" + useCurrent); } } } if (useCurrent > -1 && autoplay){ this.playStack[this.playStack.length] = this.currentPosition; var isAd = false; for(var k = 0; k < this.adVids.length && !isAd; k++) if( this.adVids[k] == this.currentLoadedHash[useCurrent]) isAd = true; this.setAdMode(isAd, this.currentLoadedHash[useCurrent]); logText("present: ToClip: '" + useCurrent + "': " + this.currentLoadedHash[useCurrent]); this.ignoreNextState = true; try{ setTimeout('player.getPlayerObj().ToClip(' + useCurrent + ')' , 10); if(document.all){ setTimeout('player.getPlayerObj().DoPlay()', 100); setTimeout('player.getPlayerObj().DoPlay()', 120); }else{ setTimeout('player.getPlayerObj().DoPlay()', 500); setTimeout('player.getPlayerObj().DoPlay()', 1000); // setTimeout('player.getPlayerObj().DoPlay()', 1500); } }catch(e){alert(e.message);} this.logList(); //if(this.playerStatus == 2 || this.playerStatus == 4 || this.playerStatus == -1){ // logText('present: plstatus: ' + this.playerStatus + ', setting doplay, 100'); // setTimeout('player.getPlayerObj().DoPlay()', 100); //} }else{ try{ if(typeof autoplay == 'undefined' || !autoplay) autoplay = false; if (typeof widthIn == 'undefined' || !widthIn || isNaN(widthIn)) var width = document.getElementById(targetDiv).offsetWidth; else var width = widthIn; if (typeof heightIn == 'undefined' || !heightIn || isNaN(heightIn)) var height = document.getElementById(targetDiv).offsetHeight; else var height = heightIn; if(!width || width == 0){ width = document.getElementById(targetDiv).style.width.substring(0,document.getElementById(targetDiv).style.width.length -2); } if(!height || height == 0){ height = document.getElementById(targetDiv).style.height.substring(0,document.getElementById(targetDiv).style.height.length -2); } var embedCode = "http://service.twistage.com/plugins/player.swf?p=pbrtv&autoplay=" + autoplay; var ytFlash = new SWFObject(embedCode, this.ytplayerID, width, height, "9.0"); ytFlash.addParam('allowscriptaccess', "always"); ytFlash.addParam('wmode', "transparent"); ytFlash.addParam('base', 'http://service.twistage.com'); ytFlash.addParam('autoplay', autoplay); ytFlash.addParam('allowFullScreen', 'true'); var listHash = "["; this.currentLoadedHash = new Array(); if(! this.showedAd){ this.showedAd = true; //this is where we can use any logic to choose to diplay an ad or not } listHash += "{video_id:'" + this.internalPlaylist.videos[this.currentPosition].ID + "'},"; this.currentLoadedHash[this.currentLoadedHash.length] = this.internalPlaylist.videos[this.currentPosition].ID; for( var i = 0 ; i < this.internalPlaylist.videos.length; i++){ if(this.internalPlaylist.videos[this.currentPosition].ID != this.internalPlaylist.videos[i].ID){ listHash += "{video_id:'" + this.internalPlaylist.videos[i].ID + "'},"; this.currentLoadedHash[this.currentLoadedHash.length] = this.internalPlaylist.videos[i].ID; } } listHash = listHash.substring(0, listHash.length -1);//trim the final comma listHash += "]"; logText("present: " + listHash); ytFlash.addParam('flashvars', 'v=0&l=' + listHash + '&config={config:{autoplay:true}}'); // ytFlash.addParam('flashvars', 'v=' + this.internalPlaylist.videos[this.currentPosition].ID + '&config={config:{autoplay:'+autoplay+'}}'); ytFlash.addParam('base', 'http://service.twistage.com'); document.getElementById(targetDiv).innerHTML = ""; ytFlash.write(targetDiv); //We need to record that we have played a video (or attempted to). this.playStack[this.playStack.length] = this.currentPosition; }catch(e){alert(e.message);} } if(this.internalPlaylist.videos[this.playStack[this.playStack.length - 2]]) this.navCallBackFunction(this.playerStatus, this.lastPlayerStatus, this.internalPlaylist.videos[this.currentPosition].ID, this.internalPlaylist.videos[this.playStack[this.playStack.length - 2]].ID); else this.navCallBackFunction(this.playerStatus, this.lastPlayerStatus, this.internalPlaylist.videos[this.currentPosition].ID, 'asdasdfadf'); this.updateTitleInfo(); }catch(e){ logText("present : " + e.message); } } this.onError = function(error){ logText('general error: '); } this.startPlaying = function (position, autoplay){ if(typeof autoplay == 'undefined' || ! autoplay) autoplay = false; try{ if(!position) position = 0; if(isNaN(position)) position = 0; }catch(e){ position = 0; } logText("startPlaying: " + position + " with autoplay: " + autoplay); if(this.playerStatus == 2){ document.getElementById(this.ytplayerID).DoPlay(); logText('startPlaying unpausing:' + this.currentPosition); }else{ logText('startPlaying new position:' + position); this.currentPosition = position; this.present("videoPlayer", autoplay); } } this.notifyOfStateChange = function (newState, newidIn){ if(newState == 2) this.setAdMode(true); if(typeof newidIn == 'undefined' || !newidIn){ var newid = ''; }else{ var newid = newidIn; } if(this.ignoreNextState){ this.ignoreNextState = false; logText('notifyOfStateChange : (IGNORED) ' + newState + ": " + newidIn); return; }else logText('notifyOfStateChange : ' + newState + ": " + newidIn); //this handles user nav from the player itself if( newState == 3 && newid != '' && newid != this.getCurrentVideo().ID && !this.adMode){ logText('notifyOfStateChange: curpos: ' + this.currentPosition + ':' + newid + ' != ' + this.getCurrentVideo().ID ); //when we get here its becaue the user interacted with the player controls to swap videos //first lets try to find the video in the current play list var pos = -1; for(var l = 0; l < this.internalPlaylist.videos.length; l++){ if (newid == this.internalPlaylist.videos[l].ID) pos = l; } if(pos != -1 && !this.adMode){ logText('notifyOfStateChange: navigating to playlist index '+pos+' to keep up with user nav'); this.startPlaying(pos, true); }else if (!this.adMode){ //if we get here the user interacted with the player controls and selected a video not in our play list // this could be an ad or a video we don't want to see for(var k = 0; k < this.adVids.length; k++){ if( this.adVids[k] == newid){ logText('notifyOfStateChange: ad playing -- setting ad mode '); this.setAdMode(true, newid); //no more action required return; }else{ logText('notifyOfStateChange: navigated to video not in play list'); } } }else{ // we are just recovering from displaying an ad //not going to adjust anything } } this.stateStack[this.stateStack.length] = newState; this.lastPlayerStatus = this.playerStatus; this.playerStatus = newState; if(this.playerStatus == 0){ this.stateStack[this.stateStack.length] = -2; this.lastPlayerStatus = this.playerStatus; this.playerStatus = -2; logText('notifyOfStateChange : ' + '-2'); try{ this.getPlayerObj().DoStop(); }catch(e){ logText('notifyOfStateChange: ' + e.message); } if(this.currentPosition < this.internalPlaylist.videos.length){ logText('notifyOfStateChange: end of video, playing next'); var useSpot = this.currentPosition; if(this.adMode){ this.setAdMode(false); logText('notifyOfStateChange: rolling into current video from ad. starting position ' + ( useSpot)); }else{ logText('notifyOfStateChange: roll over to next video, starting position ' + (++useSpot)); } this.stateStack[this.stateStack.length] = -1; this.lastPlayerStatus = this.playerStatus; this.playerStatus = -1; logText('notifyOfStateChange : ' + '-1'); this.startPlaying(useSpot, true); }else{ logText('notifyOfStateChange: end of playlist'); } } } this.navigateVideoBy = function (changeAmt) { if(this.adMode) return; this.currentPosition += changeAmt; if(this.currentPosition < 0) this.currentPosition = 0; else if(this.currentPosition >= this.internalPlaylist.videos.length) this.currentPosition = this.internalPlaylist.videos.length - 1; this.allowAutoSkip = false; this.startPlaying(this.currentPosition); } this.updateTitleInfo = function () { var dContainer = document.getElementById(this.descriptionContainerID); var tContainer = document.getElementById(this.titleContainerID); if(tContainer) tContainer.innerHTML = this.internalPlaylist.videos[this.currentPosition].Title; if(dContainer) dContainer.innerHTML = this.internalPlaylist.videos[this.currentPosition].Description; } this.updatePlaylistDisplay = function() { if(!this.usePlayList) return; //alert(this.internalPlaylist.videos.length); var idList = ""; var resultHTML = ''; try{ for(var i = 0; i < this.internalPlaylist.videos.length; i++){ resultHTML += ''; idList += this.internalPlaylist.videos[i].ID + ","; } }catch(e){ logText("updatePlaylistDisplay : " + e.message); } resultHTML += '
'+this.internalPlaylist.videos[i].Title+'
'; //here we either request the list from the server or statically populate via client side HTML generation above //document.getElementById(this.playlistContainerID).innerHTML = resultHTML; var playListSender = new myXMLObj("ignore", "/video/videoSearch.cfm", "playList=true&vidList=" + idList + "&playListID=" + this.playlistContainerID + "¤tVid=" + this.internalPlaylist.videos[this.currentPosition].ID); playListSender.callback = this.managePlayListUpdate; playListSender.send(); } this.managePlayListUpdate = function(respJSON){ try{ var responseObj = eval( "(" + respJSON + ")" ); }catch(e){ logText("JSVideoPlayer: managePlayListUpdate: 1: Unable to parse server return data. Your upload may have started, but may not have."); } try{ document.getElementById(responseObj.PLID).innerHTML = responseObj.SEARCHTEXT; }catch(e){ logText("JSVideoPlayer:managePlayListUpdate 2: " + e.message); } try{ loadMyFuncModule(responseObj.RESPONSEJS); }catch(e){ logText("JSVideoPlayer:managePlayListUpdate 3: "+ e.message); } toggleLoad(false); } this.addVideo = function(videoIn){ for(var m = 0; m < this.internalPlaylist.videos.length; m++){ if(videoIn.ID == this.internalPlaylist.videos[m].ID){ return m; } } var videoIndex = this.internalPlaylist.videos.length; this.internalPlaylist.addVideo(videoIn); this.updatePlaylistDisplay(); return videoIndex; } this.logList = function(){ for (var l =0; l < this.internalPlaylist.videos.length; l++){ logText("playlistDump" + l + ": " + this.internalPlaylist.videos[l].ID); } } this.updatePlaylistDisplay(); return this; } function PlayList(){ this.videos = new Array(); this.addVideo = function(videoIn) { var videoIndex = this.videos.length; this.videos[this.videos.length] = videoIn; return videoIndex; } return this; } function Video(IDIn, TitleIn, DescriptionIn, EmbedURLIn, WatchURLIn) { this.ID = IDIn; this.Title = TitleIn; this.Description = DescriptionIn; this.EmbedUrl = EmbedURLIn; this.WatchURL = WatchURLIn; return this; } function writeGetToughFlash() { if(document.getElementById('gtPlayerContainer')) { gtDiv = document.createElement("div"); gtDiv.id = "gtPlayerDiv"; gtDiv.style.position = "absolute"; gtDiv.style.top = ""; document.getElementById('gtPlayerContainer').appendChild(gtDiv); var gtFlash = new SWFObject("/flash/getToughPlayer.swf", "headerFlash", "455", "325", "8.0"); gtFlash.write("gtPlayerDiv"); } } function videoFinished(eventType){ try{ gtp = document.getElementById("gtPlayerDiv"); document.getElementById('gtPlayerContainer').removeChild(gtDiv);// now we kick off the regular video newTest(); FixBoxes(); }catch(e){ } } function navUpdater(){ return void(9); } function onBufferFull(clip){// - Called when a video has completely buffered. player.onBufferFull(clip); } function onResume(clip){// - Called when the video resumes playback after being stopped or paused. player.onResume(clip); } function onPlay(clip){// - Called when the play button is clicked. player.onPlay(clip); } function onPause(clip){// - Called when the pause button is clicked. player.onPause(clip); } function onStop(clip){// - Called when the stop button is clicked. player.onStop(clip); } function onClipDone(clip){// - Called when a video completes playback. player.onClipDone(clip); } if(typeof sIFR == "function"){ sIFR.bHideBrowserText = false; sIFR.bFixFragIdBug = false; // not recommended! sIFR.setup(); }; if(typeof sIFR == "function"){ sIFR.replaceElement("h2", named({sFlashSrc: "/28dayslater.swf", sColor: "#000", sCase: "upper"})); };