var answerCount = 0; var questionCount = 0; var factCount = 0; var lastFact; var saveLoad = false; var arrResponse = new Array(); arrResponse[0] = "wrong.gif"; arrResponse[1] = "no.gif"; arrResponse[2] = "incorrect.gif"; arrResponse[3] = "even_more.gif"; arrResponse[4] = "even_watch.gif"; /********/ /* SIFR */ /********/ function Heroes_sIFR() { if(typeof sIFR == "function") { sIFR.replaceElement(".sifr-black", named({sFlashSrc: "/flash/sifr/smackattackbb_bold.swf", sColor: "#000000", sWmode: "transparent" })); sIFR.replaceElement(".poll_headline", named({sFlashSrc: "/flash/sifr/smackattackbb_bold.swf", sColor: "#ffab75", sWmode: "transparent" })); sIFR.replaceElement(".poll_result_headline", named({sFlashSrc: "/flash/sifr/smackattackbb_bold.swf", sColor: "#ffab75", sWmode: "transparent" })); }; } addLoadEvent(Heroes_sIFR); function activize(obj) { obj.getElementsByTagName("span")[0].className="active"; } function activeOff() { arrQs = document.getElementById("trivia_box").getElementsByTagName("div"); for(iii=0; iii < arrQs.length; iii++) { if(arrQs[iii].getElementsByTagName) { arrQs[iii].getElementsByTagName("span")[0].className=""; } } } function CaptionPop(theID, mssg) { //alert(theID); the_parent = document.getElementById(theID); //alert(parent); theDiv = document.createElement("div"); theDiv.setAttribute("id","cap_pop"); theText = document.createTextNode(mssg); theDiv.appendChild(theText); the_parent.appendChild(theDiv); } function CaptionOff(theID) { the_parent = document.getElementById(theID); the_parent.removeChild(document.getElementById("cap_pop")); } function answerMe(obj, ans) { strURL = "http://38.107.97.125/images/2007/heroes/"; if (ans == document.getElementById("correct_answer").innerHTML) { strURL += "correct.gif"; } else { strURL += arrResponse[answerCount]; } document.getElementById("imgResponse").src = strURL; answerCount = (answerCount < 4) ? answerCount+1 : 4; obj.getElementsByTagName("input")[0].checked = true; } function unClickEm() { boxx = document.getElementById("trivia_box"); if(boxx) { putz = boxx.getElementsByTagName("input"); for(iii=0;iii < putz.length; iii++) { if(putz[iii].checked) { putz[iii].checked = false; } } } } addLoadEvent(unClickEm); function nextQuestion(questionNumber) { answerCount = 0; questionNumber++; paramz = 'questionNumber=' + questionNumber; var buzzJax = new Ajax.Request('http://www.g4tv.com/heroes/trivia.aspx',{parameters: paramz, onSuccess:handlerTrivia, onFailure:errFunc}); } var handlerTrivia = function(t) { document.getElementById("trivia_box").innerHTML = t.responseText; } var errFunc = function(t) { //alert('Error: ' + t.status + " --- " + t.statusText); } function nextFact() { factCount++; if ( factCount >= lastFact ) { document.getElementById("btnNextFact").style.display = "none"; } paramz = 'factNumber=' + factCount; var buzzJax = new Ajax.Request('http://www.g4tv.com/heroes/trivia.aspx',{parameters: paramz, onSuccess:handlerFact, onFailure:errFunc}); } var handlerFact = function(t) { //prompt('',t.responseText); document.getElementById("lblFact").innerHTML = t.responseText; } function captionIt(userKey) { strTop = escape(document.getElementById("iptTop").value); strBottom = escape(document.getElementById("iptBottom").value); intCaptionSourcePhotoKey = document.getElementById("iptKey").value objErr = document.getElementById("errr"); strTest = ' ' + strTop + ' ' + strBottom + ' '; var regex = new RegExp('fuck-related-| (ph|[fƒ*`])+[^a-z0-9]*([uüÜv*`^_@-]|\\(_\\)|\\\\\\/)+[^a-z0-9]*([c(kqx<*`]|!<|\\|<)+| fcuk|ucfk|fck|f-k|fkn|fawk| shit-related-| [s$*]+[^a-z0-9]*([h#*]|.-.)+[^a-z0-9]*[i1l!\\|*]+[^a-z0-9]*([t+†7*])+| fag-related-| [^a-z](f|ph)[^a-z0-9]*[aA@][^a-z0-9]*g| (f|ph)[^a-z0-9]*[aA@][^a-z0-9]*[gj]+[^a-z0-9]*[oi0][^a-z0-9]*t| fgt| (\\b)homo(\\b)| ass-related-| (\\b)[a@][s$z]{2}[^a-z0-9]*(kisser|lick|hole|wipe|hat|head|face)| racist-related-| (\\b)nigg(er|a)[s$z]*(\\b)| (\\b)chink[s$z]*(\\b)| (\\b)gook[s$z]*(\\b)| (\\b)wop[s$z]*(\\b)| (\\b)kike[s$z]*(\\b)| (\\b)wetback[s$z]*(\\b)| sexual-related-| (\\b)p([uüÜv*`]|\\(_\\))[s$]+([yie]*[sZ$]*)+(\\b)| (\\b)c[o0]ck| (\\b)cawks| (\\b)coxs| (\\b)ji[sz$]+m*(\\b)| (\\b)clit(\\b)| lingu(lu)*s(\\b)| (\\b)cum(ming)*(\\b)| (\\b)cunt| (\\b)t+it+[aiey]*[s$z]*(\\b)| (\\b)twat(\\b)| (\\b)fel+atio(\\b)| (\\b)(blow|rim)[^a0z0-9]*job(\\b)| undesirable-web-sites-| (\\b)tubgirl(\\b)| (\\b)goatse(\\b)| (\\b)goat.cx(\\b)| (\\b)freeipods.com(\\b)| (\\b)freedesktoppc(\\b)| (\\b)judgecal(\\b)| (\\b)ezlaptop(\\b)| (\\b)lemonparty(\\b)| (\\b)imageshack(\\b)| (\\b)ogrish(\\b)'); if (strTest.match(regex)) { objErr.innerHTML = "Hey! No profanity!"; objErr.className = "errr"; objErr.style.visibility = "visible"; return; } if (strTop.length < 1 && strBottom.length < 1 ) { document.getElementById("errr").innerHTML = "A blank caption won't work. Please be more creative."; objErr.className = "errr"; objErr.style.visibility = "visible"; } else { objErr.style.visibility = "hidden"; if(userKey > 0) { saveLoad = true; objErr.className = "savinggg"; objErr.innerHTML = "We are saving your image"; objErr.style.visibility = "visible"; // objDiv2 = document.getElementById(pnlComposeId); objDiv2.style.display = "none"; paramz = "topcaption=" + strTop + "&bottomcaption=" + strBottom + "&csp_key=" + intCaptionSourcePhotoKey + "&userkey=" + userKey; var capJax = new Ajax.Request('http://www.g4tv.com/heroes/captionImageSave.aspx',{parameters: paramz, onSuccess:finishCaption, onFailure:errFunc}); } else { saveLoad = false; document.getElementById("imgCaption").src = "CaptionImage.ashx?topcaption=" + strTop + "&bottomcaption=" + strBottom + "&csp_key=" + intCaptionSourcePhotoKey; } } } var finishCaption = function(t) { //prompt('',t.responseText); var response = eval("(" + t.responseText + ")"); objErr = document.getElementById("errr"); objErr.className = "corrr"; objErr.innerHTML = "Your image has been saved to our collection!"; objErr.style.visibility = "visible"; objDiv2 = document.getElementById(pnlComposeId); objDiv2.style.display = "block"; objDiv2.className += " pnlFinal"; strLoc = document.location + ""; strLoc = strLoc.replace("#ttext",""); strHtml = "
Share this photo:
OR"; objDiv2.innerHTML = strHtml; document.getElementById("imgCaption").src = response.photo.url; } function starOn(numm,starId) { document.getElementById(starId).src = "http://38.107.97.125/images/2007/heroes/stars_" + numm + ".gif"; } function starOff(starId) { document.getElementById(starId).src = "http://38.107.97.125/images/2007/heroes/avg_" + document.getElementById(starId).className.replace("imgStars ","") + ".gif"; } function starVote(intRating,intEntityKey,intUserKey,starId,voteId) { //deactivate voting mechanism document.getElementById(voteId).style.display = "none"; arrVoters = document.getElementById(voteId).childNodes; for(iii = 0; iii < arrVoters.length; iii++) { if(arrVoters[iii].attributes) { arrVoters[iii].setAttribute("onmouseout",null); } } starz = document.getElementById(starId); starz.src = "http://38.107.97.125/images/2007/heroes/stars_" + intRating + ".gif"; starz.title = "Average rating: " + document.getElementById(starId).className.replace("imgStars ",""); starz.alt = "Average rating: " + document.getElementById(starId).className.replace("imgStars ",""); // //Vote paramz = 'rating=' + intRating + '&entitykey=' + intEntityKey + '&userkey=' + intUserKey + '&entitytype=CaptionPhoto'; var voteJax = new Ajax.Request('http://www.g4tv.com/ajax_vote.aspx',{parameters: paramz, onSuccess:handlerFunc, onFailure:errFunc}); } var handlerFunc = function(t) { // } var errFunc = function(t) { //alert('Error: ' + t.status + " --- " + t.statusText); } function lengthMax( objThis, intMax) { //alert(objThis.value.length); if(objThis.value.length > intMax) { objThis.value = objThis.value.substr(0,200); } else { objThis.focus() } }