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 toggleClass2(strDiv,strClass1,strClass2) { objDiv = document.getElementById(strDiv); //debugAlert(objDiv.className,strClass1,strClass2); if(objDiv.className != strClass1) { objDiv.className = strClass1; } else { objDiv.className = strClass2; } } 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) { if(bg != undefined) { 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; } var ListGridButtonIds; function AddLGButtonId(theID) { if(ListGridButtonIds) { ListGridButtonIds += "," + theID; //debugAlert('2nd or more', theID, ListGridButtonIds); } else { ListGridButtonIds = theID; //debugAlert('1stTime', theID, ListGridButtonIds); } } function flipView(listID,gridID,listPath,gridPath,listSearchLabelID,gridSearchLabelID) { 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=/' arrIDs = ListGridButtonIds.split(","); for(iii = 0; iii < arrIDs.length; iii++) { document.getElementById(arrIDs[iii]).src = gridPath; } if (typeof(listSearchLabelID) != 'undefined' && typeof(gridSearchLabelID) != 'undefined') { document.getElementById(listSearchLabelID).style.display = "none"; document.getElementById(gridSearchLabelID).style.display = "block"; } } else { objList.style.display="block"; objGrid.style.display="none"; document.cookie = 'list_preference=list; expires=Fri, 3 Aug 2037 20:47:11 UTC; path=/' arrIDs = ListGridButtonIds.split(","); for(iii = 0; iii < arrIDs.length; iii++) { document.getElementById(arrIDs[iii]).src = listPath; } if (typeof(listSearchLabelID) != 'undefined' && typeof(gridSearchLabelID) != 'undefined') { document.getElementById(listSearchLabelID).style.display = "block"; document.getElementById(gridSearchLabelID).style.display = "none"; } } //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 0) { objResponse.each(function(objItem) { theDiv = document.getElementById(objItem.DivID); theDiv.innerHTML = objItem.HTML; //debugAlert(objItem.DivID, theDiv, objItem.HTML); }) } } var errFunc = function(t) { // } function addToQueryString(strUrl, strName, strValue) { if (strUrl.indexOf("?")<0) { //alert('non querystring') strUrl += "?" + strName + "=" + strValue; } else { //alert('has querystring') testNV = strName + "="; strQ = strUrl.substring(strUrl.indexOf("?") + 1, strUrl.length); if(strQ.indexOf("&") < 0) { //alert('has one name value') //only one name value pair in querystring if(strQ.indexOf(testNV) > -1) { //alert('is existing name value') //just replace existing strQ = "?" + strName + "=" + strValue; } else { //alert('is not existing name value') strQ = "?" + strQ + "&" + strName + "=" + strValue; } } else { //handle multiple name value pairs //alert('is multiples') foundit=false; arrNV = strQ.split("&"); for (iii = 0; iii < arrNV.length; iii++) { if(arrNV[iii].indexOf(testNV) < 0) { //alert('is not existing name value') if(iii==0) { strQ = "?" + arrNV[iii]; } else { strQ += "&" + arrNV[iii]; } } else { //alert('is existing name value'); foundit = true; if(iii==0) { strQ = "?" + strName + "=" + strValue; } else { strQ += "&" + strName + "=" + strValue; } } } if(!foundit) { strQ += "&" + strName + "=" + strValue; } } strUrl = strUrl.substring(0, strUrl.indexOf("?")) + strQ; } return strUrl; } /* Client-side access to querystring name=value pairs Version 1.3 28 May 2008 License (Simplified BSD): http://adamv.com/dev/javascript/qslicense.txt */ function Querystring(qs) { // optionally pass a querystring to parse this.params = {}; if (qs == null) qs = location.search.substring(1, location.search.length); if (qs.length == 0) return; // Turn back to // See: http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.13.4.1 qs = qs.replace(/\+/g, ' '); var args = qs.split('&'); // parse out name/value pairs separated via & // split out each name=value pair for (var i = 0; i < args.length; i++) { var pair = args[i].split('='); var name = decodeURIComponent(pair[0]); var value = (pair.length==2) ? decodeURIComponent(pair[1]) : name; this.params[name] = value; } } Querystring.prototype.get = function(key, default_) { var value = this.params[key]; return (value != null) ? value : default_; } Querystring.prototype.contains = function(key) { var value = this.params[key]; return (value != null); } function validateEmail(email) { var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/; if(reg.test(email) == false) { return false; } else { return true; } }