
twttr.anywhere.config({domain:document.domain});twttr.anywhere(function(t){var moduleBody=$('.elem-links-twitter-post .elem-moduleBody');function init(){if(t.isConnected()){showConnected();}
else{showDisconnected();}
t.bind("authComplete",function(e,user){hideDisconnected();showConnected();});t.bind("signOut",function(e){hideConnected();showDisconnected();});}
function showDisconnected(){var ele=getElementFromTemplate('itvLive-template-disconnected');moduleBody.append(ele);t('.itvLive-connect-button',ele).connectButton();}
function hideDisconnected(){$('#itvLive-disconnected').remove();}
function showConnected(){var user=t.currentUser;var templateVars={screenName:user.screenName,profilePic:user.profileImageUrl.replace(/_normal.jpg$/,'_mini.jpg'),name:user.name};var ele=getElementFromTemplate('itvLive-template-connected',templateVars);var tweetBoxId='tweetbox';var $tweetboxEle=$('#'+tweetBoxId,ele);$('.itvLive-disconnect-button',ele).click(function(){twttr.anywhere.signOut();});moduleBody.append(ele);t('#'+tweetBoxId).tweetBox({height:70,width:640,label:$tweetboxEle.attr('data-label'),defaultContent:$tweetboxEle.attr('data-default-content')});}
function hideConnected(){$('#itvLive-connected').remove();}
function getElementFromTemplate(id,view,partials){return $($.mustache(document.getElementById(id).innerHTML,view,partials)).get(0);}
init();});
