
var shareImgs=new Array("icon_fb.png","icon_myspace.png","icon_livejournal.png","icon_twitter.png","icon_igoogle.png","icon_diggit.png","icon_delicious.png");var shareLabels=new Array("Facebook","MySpace","LiveJournal","Twitter","Google","Digg","Delicious");var altShareLabels=new Array("Add to Facebook","Post to MySpace","LiveJournal","Twitter","Google Bookmark","Digg this","Save to del.icio.us");var shareControlTimeout=500;var shareControlClosetimer=0;var shareControlDDMenuItem=0;function shareControlOpen(id)
{shareCancelCloseTime();if(shareControlDDMenuItem)shareControlDDMenuItem.style.visibility='hidden';shareControlDDMenuItem=document.getElementById(id);shareControlDDMenuItem.style.visibility='visible';}
function shareControlClose()
{if(shareControlDDMenuItem)shareControlDDMenuItem.style.visibility='hidden';}
function shareControlClosetime()
{shareControlClosetimer=window.setTimeout(shareControlClose,shareControlTimeout);}
function shareCancelCloseTime()
{if(shareControlClosetimer)
{window.clearTimeout(shareControlClosetimer);shareControlClosetimer=null;}}
document.onclick=shareControlClose;function shareFBShowLogin(label,comment,iconUrl,webUrl,fbabsoluteurl)
{shareControlClose();FB_RequireFeatures(["XFBML"],function()
{var facebookCB=createDelegate(shareFacebook,this,[label,comment,iconUrl,webUrl,fbabsoluteurl]);FB.Facebook.init(SKAVA_SHARE_FBAPIKEY,(fbabsoluteurl&&fbabsoluteurl.length>0?fbabsoluteurl+"/xd_receiver.html":"xd_receiver.html"));FB.Connect.requireSession(function()
{FB.Connect.ifUserConnected(function(uid)
{facebookCB();},function()
{return false;});});});}
var shareFacebook=function(shareLbl,shareComment,shareIconUrl,shareWebUrl,fbabsoluteurl)
{FB_RequireFeatures(["XFBML"],function()
{FB.Facebook.init(SKAVA_SHARE_FBAPIKEY,(fbabsoluteurl&&fbabsoluteurl.length>0?fbabsoluteurl+"/xd_receiver.html":"xd_receiver.html"));FB.Facebook.get_sessionState().waitUntilReady(function()
{var shareFbActionURL=shareWebUrl+(shareWebUrl.indexOf('?')==-1?'?':'&')+"skip=true";invitationFBML='<fb:fbml>'+'<fb:request-form action="'+shareFbActionURL+'" close_dialog="1" method="POST" invite="false" type="Share" content="You are requested to view this.'+'<fb:req-choice url=\''+shareWebUrl+'\' label=\'Accept\' />">'+'<fb:multi-friend-selector rows="3" cols="5" showborder="false" actiontext="Share this item" exclude_ids="" />'+'</fb:request-form>'+'</fb:fbml>';dialog=new FB.UI.FBMLPopupDialog("Share with your friends",invitationFBML);dialog.set_placement(FB.UI.PopupPlacement.topCenter);dialog.setContentHeight(500);dialog.setContentWidth(800);dialog.show();});});}
function shareItControlElmts(shareControlEl,label,comment,iconUrl,webUrl,fbabsoluteurl,useFacebookConnect)
{label=sanitizeStr(label);comment=sanitizeStr(comment);var shareData=''+'<ul id="shareControlUL">'+'<li class="ccrNoStyle"><a href="#" onclick="return false;" onmouseover="shareControlOpen(\'shareControlDiv\')" onmouseout="shareControlClosetime()">'+shareControlEl+'</a>'+'<div class="ccrNoPrint" id="shareControlDiv" onmouseover="shareCancelCloseTime()" onmouseout="shareControlClosetime()">';if(useFacebookConnect)
{shareData+='<a href="#" onclick=\"shareFBShowLogin(\''+label+'\', \''+comment+'\', \''+iconUrl+'\', \''+webUrl+'\', \''+fbabsoluteurl+'\'); return false;\"><img border="none" src="'+VERSION_DIR+'img/'+shareImgs[0]+'" valign="middle" align="center">&nbsp;</img><font class="shareControlTextPaddingTop">'+shareLabels[0]+'&nbsp;</font></a> ';}
for(var i=(useFacebookConnect?1:0);i<shareLabels.length;i++)
{shareData+='<a href="#" valign="middle" title="'+altShareLabels[i]+'" id="idskava_'+shareLabels[i]+'" onclick="callForSocialShare(this, \''+label+'\', \''+comment+'\', \''+iconUrl+'\', \''+webUrl+'\');return false;"><img border="none" src="'+VERSION_DIR+'img/'+shareImgs[i]+'" valign="middle" align="center">&nbsp;</img><font class="shareControlTextPaddingTop">'+shareLabels[i]+'&nbsp;</font></a>';}
shareData+='</div>'+'</li>'+'</ul>';return shareData;}
function callForSocialShare(el,shareLbl,shareComment,shareIconUrl,shareWebUrl)
{var elId=el.id.split("_")[1];switch(elId)
{case shareLabels[0]:{shareFb(myCallbackSwf,shareLbl,shareComment,shareIconUrl,shareWebUrl);}
break;case shareLabels[1]:{shareMs(myCallbackSwf,shareLbl,shareComment,shareIconUrl,shareWebUrl);}
break;case shareLabels[2]:{shareLj(myCallbackSwf,shareLbl,shareComment,shareIconUrl,shareWebUrl);}
break;case shareLabels[3]:{shareTwitter(myCallbackSwf,shareLbl,shareComment,shareIconUrl,shareWebUrl);}
break;case shareLabels[4]:{shareGoog(myCallbackSwf,shareLbl,shareComment,shareIconUrl,shareWebUrl);}
break;case shareLabels[5]:{shareDigg(myCallbackSwf,shareLbl,shareComment,shareIconUrl,shareWebUrl);}
break;case shareLabels[6]:{shareDelicious(myCallbackSwf,shareLbl,shareComment,shareIconUrl,shareWebUrl);}
break;}
shareControlClose();}
function getTwitterComments(callbck,userName,passwd,xmlresponse)
{var afterLoad=function(result,xmlhttp)
{if(callbck)
{callbck(result,xmlhttp);}};var errcbk=function(msg)
{};var twitterServerUrl="http://"+document.domain+"/mc/twitter";var queryParamString="?consumerkey="+userName+"&consumersecret="+passwd+((xmlresponse)?"&xmlresponse=1":"&jsonresponse=1");jx.load(twitterServerUrl+queryParamString,afterLoad,"application/x-www-form-urlencoded","POST",errcbk);}
function postTwitterComments(callbck,userName,passwd,status,xmlresponse)
{var afterLoad=function(result,xmlhttp)
{if(callbck)
{callbck(result,xmlhttp);}};var errcbk=function(msg)
{};var twitterServerUrl="http://"+document.domain+"/mc/twitter";var queryParamString="?consumerkey="+userName+"&consumersecret="+passwd+"&status="+status+"&method=posttwitter"+((xmlresponse)?"&xmlresponse=1":"&jsonresponse=1");jx.load(twitterServerUrl+queryParamString,afterLoad,"application/x-www-form-urlencoded","POST",errcbk);}
