function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { if (oldonload) { oldonload(); } func(); } } } function launchLogo() { //putting this here to simplify the add load event on homepage setTimeout("objFlashLogo.write('flash_logo_animated')",3000); setTimeout("resetLogo()",5500); } function resetLogo() { //this needs to happen because flash logo overlays active elements below the header and renders them unreachable by mouse in some browsers //there was no way to put these elements over the flash but under the dropdown navs while also keeping flash over the background image of the header across all browsers //so flash movie is replaced by image and containing div is shrunk to reveal elements strImage=""; document.getElementById('flash_logo_animated').innerHTML=strImage; if(navigator.userAgent.indexOf("Macintosh")>-1 && navigator.userAgent.indexOf("Firefox")>-1) { document.getElementById("flash_logo_animated").style.zIndex = 'auto'; } } function openPile(videoKey) { var params = ''; if (videoKey != null) params = '?fromPilePlayer=true&video_key=' + videoKey; //new video detail page var url = 'http://www.g4tv.com/video_detail.aspx' + params; location.href = url; return; } function openPileTab(categoryKey) { var params = ''; if (categoryKey != null) params = '?fromPilePlayer=true&category_key=' + categoryKey; //new video detail page var url = 'http://www.g4tv.com/video_detail.aspx' + params; location.href = url; return; } function MM_openBrWindow(theURL,winName,features) { //v2.0 window.open(theURL,winName,features); } function playsound(SoundFileUrl) { new Insertion.Bottom(document.body, "") Log("/playsound/" + SoundFileUrl); return false; } function preloadsound(SoundFileUrl) { new Insertion.Bottom(document.body, ""); return false; } function Log(strPath) { if(typeof urchinTracker != "undefined") { urchinTracker("/events" + strPath); } } function FlashLink(strEventPath, strURL) { urchinTracker(strEventPath); location.href = strURL; } function toggleClass(strDiv,strClass) { document.getElementById(strDiv).className = strClass; } function toggleDisplay(strId) { theItem = document.getElementById(strId); if(theItem.style.display == "none") { theItem.style.display = "block"; } else { theItem.style.display = "none"; } } function ClearTextFeild(objField, strClear) { if (objField.value == strClear) { objField.value = ''; } } var arrBg = new Array(4); arrBg[1] = "#969696"; arrBg[2] = "#65675c"; arrBg[3] = "#5c5c5c"; arrBg[4] = "#273514"; // arrBg[5] = "#ffc71e"; random_bg = (Math.floor(Math.random()*4))+1; function RandomizeBackground() { document.getElementById("outer_container").style.backgroundColor = arrBg[random_bg]; document.getElementById("outer_container").style.backgroundImage = "url(http://cache.g4tv.com/images/2007/header_3tier/body_bg_" + random_bg + "_126.jpg)"; } function Randomize2007() { document.getElementById("outer_container").style.backgroundColor = arrBg[random_bg]; document.getElementById("outer_container").style.backgroundImage = "url(http://cache.g4tv.com/images/2007/header_3tier/body_bg_" + random_bg + "_137.jpg)"; } function SetBackground(bg) { random_bg = 4; document.getElementById("outer_container").style.backgroundColor = arrBg[random_bg]; document.getElementById("outer_container").style.backgroundImage = "url(http://cache.g4tv.com/images/2007/header_3tier/body_bg_" + random_bg + "_126.jpg)"; } function RandomizeHome() { document.getElementsByTagName("body")[0].style.backgroundColor = arrBg[random_bg]; document.getElementById("dervish").src = "http://cache.g4tv.com/images/2007/header_3tier/body_bg_" + random_bg + "_h1.jpg"; //prompt('',document.getElementById("dervish").src); } // global variables var phoenixBase = "http://www.g4tv.com/" var applicationPath = "/"; var imageURL = "http://cache.g4tv.com/images/"; var mediaURL = "http://media.g4tv.com/"; function hidePlayer() { if(navigator.userAgent.indexOf('Safari') < 0) { ctlPlayer = document.getElementById('VideoPlayer'); if(ctlPlayer) { ctlPlayer.style.visibility='hidden'; } } } function URLEncode(plaintext) { // The Javascript escape and unescape functions do not correspond // with what browsers actually do... var SAFECHARS = "0123456789" + // Numeric "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + // Alphabetic "abcdefghijklmnopqrstuvwxyz" + "-_.!~*'()"; // RFC2396 Mark characters var HEX = "0123456789ABCDEF"; var encoded = ""; for (var i = 0; i < plaintext.length; i++ ) { var ch = plaintext.charAt(i); if (ch == " ") { encoded += "+"; // x-www-urlencoded, rather than %20 } else if (SAFECHARS.indexOf(ch) != -1) { encoded += ch; } else { var charCode = ch.charCodeAt(0); if (charCode > 255) { alert( "Unicode Character '" + ch + "' cannot be encoded using standard URL encoding.\n" + "(URL encoding only supports 8-bit characters.)\n" + "A space (+) will be substituted." ); encoded += "+"; } else { encoded += "%"; encoded += HEX.charAt((charCode >> 4) & 0xF); encoded += HEX.charAt(charCode & 0xF); } } } // for return encoded; } function showPlayer() { if(navigator.userAgent.indexOf('Safari') < 0) { ctlPlayer = document.getElementById('VideoPlayer'); if(ctlPlayer) { ctlPlayer.style.visibility='visible'; } } } function debugAlert() { var strAlert=""; for (var iii = 0; iii < debugAlert.arguments.length; iii++) { if(debugAlert.arguments[iii] != null) { strAlert += debugAlert.arguments[iii] + "\n"; } } alert(strAlert); } function nullFunc() { //this is for a null submit function in the poll voting control } function divOn(divName) { thediv = document.getElementById(divName); //alert(thediv); thediv.style.display="block"; } function divOff(divName) { thediv = document.getElementById(divName); //alert(thediv); thediv.style.display="none"; } 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 flipView(listID,gridID,imageID,listPath,gridPath) { layoutImage = document.getElementById(imageID); objList = document.getElementById(listID); objGrid = document.getElementById(gridID); if(objList.style.display=="block") { objList.style.display="none"; objGrid.style.display="block"; document.cookie = 'list_preference=grid; expires=Fri, 3 Aug 2037 20:47:11 UTC; path=/' layoutImage.src = gridPath; } else { objList.style.display="block"; objGrid.style.display="none"; document.cookie = 'list_preference=list; expires=Fri, 3 Aug 2037 20:47:11 UTC; path=/' layoutImage.src = listPath; } //prompt('',document.cookie); } function dummyLink() { //just set your href to javascript:dummyLink() and watch nothing happen at all! hurray!! //replaces # and javascript:void(0) } function sddOn(ctlUl) { hidePlayer(); ctlUl.className += ' ulHover' } function sddOff(ulID) { ctlUl = document.getElementById(ulID); showPlayer(); ctlUl.className = ctlUl.className.replace(new RegExp(' ulHover\\b'), ''); } function QMPDetect() { if(MN.QMPInstall.InstallRequired()) { urchinTracker('/events/moveplugin/no'); } else { urchinTracker('/events/moveplugin/yes'); } } String.prototype.format = function() { var str = this; for(var i=0;i