//SAINTS SCRIPTS
function butOn(object) {try{var img=document.getElementById(object);if(img.src.indexOf('%20on.ashx')==-1){img.src=img.src.replace('.ashx',' on.ashx');}}catch(ex){}}
function butOff(object) {try{var img=document.getElementById(object);img.src=img.src.replace('%20on.ashx','.ashx');}catch(ex){}}

function imgOver2(object,image) {$("#" + object).attr({src: staticSite + "/images/" + image});}
function imgOut2(object,image)  {$("#" + object).attr({src: staticSite + "/images/" + image});}

//NAV functions
var timer;
var currentNav;

function navOn1(object){clearTimeout(timer);navAllOff1();butOn(object);}
function navOff1(object) {if (object !== currentNav){timer=setTimeout("setNav1(currentNav)",500);}}
function setNav1(nav){currentNav = nav;navAllOff1();butOn(currentNav);}
function navAllOff1 () {for(var i=0;i<15;i++){butOff('mnav' + i);}}

// PRINT STUFF
function printme(){if(document.getElementById('printmeframe')==null){$("<iframe height='0' width='0' frameborder='0' id='printmeframe'></iframe>").appendTo("body");}var print=window.location;if(print.href.indexOf("?")>-1){print+="&p=1&ap=1";}else{print+="?p=1&ap=1";}$("#printmeframe").attr("src",print);}

//Photo Gallery
function lpg(url, title){try{tb_show(title, url + "?TB_iframe=true&height=575&width=855", false);}catch(ex){var popup=window.open(url);if(popup==null){alert('popup blocked');}}}

// NFL
function loadNfcOptions(o,file) {if(o.length==1){$.getScript("/js/" + file + ".js");}}
function launchNfl(o){if(o.selectedIndex>0){var popup=window.open('http://' + o.options[o.selectedIndex].value);if(popup==null){alert('popup blocked')};}}

// polling
var curPoll="";
function submitVote(pollId){var option=getVote(pollId);if(option==null){alert("you must choose a selection first");}else{$("#pollQuestion").css("display","none");$("#pollResults").css("display","inline");$("#pollResultsTable").html("Submitting Your Vote");curPoll=pollId;$.post("/poll/vote.aspx",{pollId:pollId,option:option.value},returnFromVote);}}
function getVote(pollId){var options=document.forms[0].elements[pollId + "-poll"];if(options!=null){for(var i=0;i<options.length;i++){if(options[i].checked){return options[i];}}}else{alert("Error: Couldnt Find The Poll - Please try again soon");}return null;}
function getResults(pollId){$("#pollQuestion").css("display","none");$("#pollResults").css("display","inline");$("#pollResultsTable").html("Retrieving Results");$.post("/poll/vote.aspx",{pollId:pollId},pollResults);}
function pollResults(data){$("#pollResultsTable").html(data);}
function returnFromVote(data){$.cookie('poll-' + curPoll, '1'); pollResults(data);}

// resize
function fixSize(){try{var diff=$("#contentBigTable").height()-$("#contentTable").height()-$("#secHd").height()-$("#contentPadding").height();if(diff>0){$("#contentTd").append("<img src='" + staticSite + "/images/spacer.gif' alt='' height='" + diff + "' width='1'>");}else{diff=$("#contentBigTable").height()-$("#intSponsorBg").height()-$("#relGd").height()-$("#gamedayContent").height()-$("#relHd").height()-$("#relContent").height()-$("#middleMiddleAd").height()-$("#middleBottomAd").height()-250;$("#middleBottomAd").append("<img src='" + staticSite + "/images/spacer.gif' alt='' height='" + diff + "' width='1'>");}}catch(ex){}}

//video / audio player
function lvp(url, title){try{tb_show(title, url + "?TB_iframe=true&height=430&width=905", false);}catch(ex){var popup=window.open(url);if(popup==null){alert('popup blocked');}}}

// set lite menu
function setLitNav(){var curNavToSet=window.location.pathname.toLowerCase();if(curNavToSet.indexOf("/articles/")==0){curNavToSet="/news" + curNavToSet;}for(var i=0;i<menus.length;i++){if(curNavToSet.indexOf(menus[i])==0){setNav1("mnav" + i);}}}
