function CallFootballService(strUrl,isMwv){if(isMwv){strUrl=strUrl.replace("&amp;","&")}var domainName="";domainName=document.location.protocol+"//"+document.location.host+"/";if(strUrl.indexOf("?")>-1){strUrl+="&"}else{strUrl+="?"}strUrl+="cacheBuster="+new Date().getTime();var html=GetAjaxResponse(domainName+strUrl);document.writeln(html)}function GetAjaxResponse(strUrl){var client=GetAjaxObject();var response;if(client){client.open("GET",strUrl,false);client.send(null);response=client.responseText}else{response="-1"}return response}function GetAjaxObject(){if(window.XMLHttpRequest){return new XMLHttpRequest()}else{if(window.ActiveXObject){var msxmls=new Array("Msxml2.XMLHTTP.5.0","Msxml2.XMLHTTP.4.0","Msxml2.XMLHTTP.3.0","Msxml2.XMLHTTP","Microsoft.XMLHTTP");for(var i=0;i<msxmls.length;i++){try{return new ActiveXObject(msxmls[i])}catch(e){}}}}};ItvJs.Twitter={_oTweetUsers:[],Register:function(oOptions){if(oOptions.dispaly!==undefined){oOptions.display=oOptions.dispaly}ItvJs.Twitter._oTweetUsers.push(oOptions)},Init:function(){var aUsers=ItvJs.Twitter._oTweetUsers;for(var i=0;i<aUsers.length;i++){if(aUsers[i].cache!==undefined&&$.cookie("twitter_"+aUsers[i].user+"_"+aUsers[i].target)){document.getElementById(aUsers[i].target).innerHTML=$.cookie("twitter_"+aUsers[i].user+"_"+aUsers[i].target)}else{$("#"+aUsers[i].target).addClass("loading");ItvJs.Twitter._FetchFeed(aUsers[i].user,aUsers[i].results,function(oFeedData,oOptions){if(oFeedData.results.length>0){var sFeedHTML=ItvJs.Twitter._RenderFeed(oFeedData,oOptions)}else{var sFeedHTML=""}if(oOptions.cache!==undefined){$.cookie("twitter_"+oOptions.user+"_"+oOptions.target,sFeedHTML,{expires:oOptions.cache,path:"/"})}document.getElementById(oOptions.target).innerHTML=sFeedHTML},aUsers[i])}}},_getFriendlyTime:function(iTime){var dDateNow=new Date(),sDayPlural="";iOffset=dDateNow.getTime()-iTime;if(iOffset>(24*60*60*1000)){if(Math.round(iOffset/24/60/60/1000)>1){sDayPlural="s"}sOffsetOut="About "+Math.round(iOffset/24/60/60/1000)+" day"+sDayPlural+" ago"}else{if(iOffset>(60*60*1000)){sOffsetOut="About "+Math.round(iOffset/60/60/1000)+" hours ago"}else{sOffsetOut="About "+Math.round(iOffset/60/1000)+" minutes ago"}}return sOffsetOut},makeTweetHTML:function(sTweet){sTweet=ItvJs.Twitter._linkUrl(sTweet);sTweet=ItvJs.Twitter._linkUser(sTweet);return ItvJs.Twitter._linkHash(sTweet)},_linkUrl:function(sTweet){return sTweet.replace(/((ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?)/gi,' <a href="$1" target="_blank">$1</a> ')},_linkUser:function(sTweet){return sTweet.replace(/^[\@]+([A-Za-z0-9-_]+)| [\@]+([A-Za-z0-9-_]+)/gi,' <a href="http://twitter.com/$1$2" target="_blank">@$1$2</a> ')},_linkHash:function(sTweet){return sTweet.replace(/[\#]+([A-Za-z0-9-_]+)/gi,' <a href="http://search.twitter.com/search?q=&tag=$1&lang=all" target="_blank">#$1</a> ')},_RenderFeed:function(oFeedData,oOptions){var aTwitterHTML=[],iResultCount=0,iCurrentResult=0,iFinalResultCount=0,bRowOdd=true;if(!oFeedData){return}if(oOptions.title!==undefined){aTwitterHTML.push('<div class="tvs-tweetTitle">');aTwitterHTML.push("<h3>"+oOptions.title+" on <span>Twitter</span></h3>");aTwitterHTML.push("</div>")}if(oOptions.html!==false){aTwitterHTML.push("<ul>")}if(oFeedData.results.length){for(i=0;i<oFeedData.results.length;i++){if((oOptions.reply!==false||!oFeedData.results[i].text.match(/^@/))&&(oOptions.display===undefined||i<oOptions.display)){iResultCount++}}for(i=0;i<oFeedData.results.length;i++){if((oOptions.reply!==false||!oFeedData.results[i].text.match(/^@/)||(oOptions.display!==undefined&&iResultCount<oOptions.display))&&(oOptions.display===undefined||i<oOptions.display)){iFinalResultCount++}}for(i=0;i<oFeedData.results.length;i++){if((oOptions.reply!==false||!oFeedData.results[i].text.match(/^@/)||(oOptions.display!==undefined&&iResultCount<oOptions.display))&&(oOptions.display===undefined||i<oOptions.display)){if(oOptions.html===false){aTwitterHTML.push(ItvJs.Twitter.makeTweetHTML(oFeedData.results[i].text))}else{aTwitterHTML.push('<li class="'+(bRowOdd?"tvs-tweetOdd":"tvs-tweetEven")+" "+((iResultCount-1)===iCurrentResult?"tvs-tweetLast":"")+" "+(iCurrentResult===0?"tweetFirst":"")+'">');if(bRowOdd){bRowOdd=false}else{bRowOdd=true}aTwitterHTML.push('<p class="tvs-tweetText">'+ItvJs.Twitter.makeTweetHTML(oFeedData.results[i].text)+"</p>");if((i+1)===iFinalResultCount&&oOptions.follow===true){if(oOptions.name===undefined){oOptions.name=""}aTwitterHTML.push('<p class="tvs-tweetDate">'+ItvJs.Twitter._getFriendlyTime(Date.parse(oFeedData.results[i].created_at))+'</p></li><li><p class="tvs-follow"><a href="http://twitter.com/'+oOptions.user+'" target="_blank">Follow '+oOptions.name+" on Twitter &gt;&gt;</a></p>")}else{aTwitterHTML.push('<p class="tvs-tweetDate">'+ItvJs.Twitter._getFriendlyTime(Date.parse(oFeedData.results[i].created_at))+"</p>")}iCurrentResult++;aTwitterHTML.push("</li>")}if(oOptions.iTime===undefined){oOptions.iTime=Date.parse(oFeedData.results[i].created_at)}}}}if(oOptions.html!==false){aTwitterHTML.push("</ul>")}return aTwitterHTML.join("")},_FetchFeed:function(sUserName,iTweetCount,fCallback,oOptions){var screenFeedURL="";if(sUserName===undefined){sUserName="twitter"}if(fCallback===undefined){fCallback=function(){}}if(iTweetCount===undefined){iTweetCount=5}if(oOptions.feed!==undefined){screenFeedURL=oOptions.feed}else{screenFeedURL="http://search.twitter.com/search.json?&q=from:"+sUserName+"&rpp="+iTweetCount+"&callback=?"}$.getJSON(screenFeedURL,function(oFeedData){if(typeof oOptions.onload==="function"){oOptions.onload(oFeedData,oOptions)}else{fCallback(oFeedData,oOptions)}})}};$(window).ready(function(){if(ItvJs&&ItvJs.Twitter){ItvJs.Twitter.Init()}});
if(typeof ItvJs.Glob!==undefined){ItvJs.Tvshows=ItvJs.Glob};
