FB.init({appId:'152830838067568',status:true,cookie:true,xfbml:true, oauth:true });FB.Event.subscribe('auth.login',function(response){LoggedIntoFaceBook();});FB.Event.subscribe('auth.logout',function(response){NotLoggedIn();});FB.getLoginStatus(function(response){if(response.session){LoggedIntoFaceBook();}else{NotLoggedIn();}});function LoggedIntoTwitter(username){if($("#post-to-twitter").is(':visible')){$("#post-to-twitter").children(".auth").hide().siblings().show();}
$("#txtTwitterName").val(username);}
function LoggedIntoFaceBook(){if($("#post-to-facebook").is(':visible')){$("#post-to-facebook").children(".auth").hide().siblings().show();}
FB.api('/me',function(response){$("#fbName").val(response.name);});}
function NotLoggedIn(){if($("#post-to-facebook").is(':visible')){$("#post-to-facebook").children(".auth").show().siblings().hide();}}
function NotLoggedInToTwitter() { if ($("#post-to-twitter").is(':visible')) { $("#post-to-twitter").children(".auth").show().siblings().hide(); } }
function PostToFacebook(){if($("#txtPost").val()!=""){var result=$.ajax({type:"POST",url:"/social/facebook-post.aspx",data:"fbpost="+$("#txtPost").val()+"&fbperson="+$("#fbName").val(),dataType:"html",async:false,success:function(msg){}}).responseText;$("#post-to-facebook").children(".post").addClass("confirmation").html(result);}else{alert("Please enter your moment.");}
return false;}
function PostToOporto(){if(($("#txtOporto").val()!="")&&($("#txtOportoName").val()!="")){var result=$.ajax({type:"POST",url:"/social/oporto-post.aspx",data:"opost="+$("#txtOporto").val()+"&operson="+$("#txtOportoName").val(),dataType:"html",async:false,success:function(msg){}}).responseText;$("#post-to-oporto").children(".post").addClass("confirmation").html(result);}else{alert("Please enter your name and moment.");}
return false;}
function PostToTwitter(){if(($("#txtTwitter").val()!="")&&($("#txtTwitterName").val()!="")){var result=$.ajax({type:"POST",url:"/social/twitter-post.aspx",data:"opost="+$("#txtTwitter").val()+"&operson="+$("#txtTwitterName").val(),dataType:"html",async:false,success:function(msg){}}).responseText;$("#post-to-twitter").children(".post").addClass("confirmation").html(result);}else{alert("Please enter your moment.");}
return false;}
