function ShowSocialSettings()
{
ShowModalPopup_O('dsocialsettings','Social Networking Set Up');
var objValue=document.getElementById("socialsettingcontrol_hidSocialSettings").value;
var ListBoxObj=document.getElementById('socialsettingcontrol_ListShareItems');
document.getElementById("socialsettingcontrol_chkSendTweet").checked=false;
document.getElementById("socialsettingcontrol_chkSendFacebook").checked=false;
document.getElementById("socialsettingcontrol_txtTweetUname").disabled=false;
document.getElementById("socialsettingcontrol_txtTweetUname").value="";
document.getElementById("socialsettingcontrol_txtTweetPwd").disabled=true;
document.getElementById("socialsettingcontrol_txtTweetPwd").value="";
var lstLength=ListBoxObj.options.length;
for(i=0;i<lstLength;i++)
{
ListBoxObj.options[i].selected=false;
}
if(objValue!="")
{
var splitResult=objValue.split("$");
if(splitResult[0]=="True")
{
document.getElementById("socialsettingcontrol_chkSendTweet").checked=true;
}
if(splitResult[1]=="True")
{
document.getElementById("socialsettingcontrol_chkSendFacebook").checked=true;
}
document.getElementById("socialsettingcontrol_txtTweetUname").value=splitResult[2];
var splitCommaResult=splitResult[3].split(",");
for(i=0;i<splitCommaResult.length;i++)
{
if(splitCommaResult[i]!="")
{
ListBoxObj.options[splitCommaResult[i]].selected=true;
}
}
}
document.getElementById("socialsettingcontrol_ListShareItems").style.display="block";
document.getElementById("socialsettingcontrol_divWarningMsg").style.display="none";
document.getElementById("socialsettingcontrol_divTwitterDetails").style.display="none";
document.getElementById("socialsettingcontrol_divTwitterMsg").style.display="none";
if(document.getElementById("socialsettingcontrol_hidTweetPwd").value=="")
{
document.getElementById("socialsettingcontrol_divTwitterDetails").style.display="block";
document.getElementById("dsocialsettings").style.height="410px";
}
else
{
document.getElementById("socialsettingcontrol_divTwitterMsg").style.display="block";
document.getElementById("dsocialsettings").style.height="350px";
}
CheckTweetClick();
var registrationErrorsDiv=document.getElementById("socialsettingcontrol_WarningMsgs_RegistrationErrors");
registrationErrorsDiv.style.display="none";
document.getElementById("socialsettingcontrol_WarningMsgs_divWarningInfo").style.display="none";
return false;
}
function CloseSocialSettings()
{
closepopup_O('dsocialsettings');
return false;
}
function ValidateSocialSettings()
{
var status=ValidateSocialSettingsData();
if(status==false)
{
document.getElementById("socialsettingcontrol_divWarningMsg").style.display="none";
var registrationErrorsDiv=document.getElementById("socialsettingcontrol_WarningMsgs_RegistrationErrors");
registrationErrorsDiv.style.display="block";
registrationErrorsDiv.innerHTML="";
document.getElementById("socialsettingcontrol_WarningMsgs_divWarningInfo").style.display="block";
registrationErrorsDiv.innerHTML=errors;
return false;
}
else
{
var registrationErrorsDiv=document.getElementById("socialsettingcontrol_WarningMsgs_RegistrationErrors");
registrationErrorsDiv.style.display="none";
document.getElementById("socialsettingcontrol_WarningMsgs_divWarningInfo").style.display="none";
return true;
}
}
function ValidateSocialSettingsData()
{
var status=true;
var varTemp;
var isMandatory='True';
errors="";
var chkSendTweet=document.getElementById("socialsettingcontrol_chkSendTweet");
if(chkSendTweet.checked==true)
{
varTemp=document.getElementById("socialsettingcontrol_txtTweetUname");
alertName="Twitter Username";
if(varTemp.value=="")
{
errors='Please enter '+alertName+'.';
varTemp.focus();
return false;
}
if(document.getElementById("socialsettingcontrol_hidTweetPwd").value=="")
{
alertName="Twitter Password";
var newPassword=document.getElementById("socialsettingcontrol_txtTweetPwd");
errors="";
if(newPassword.value=="")
{
errors='Please enter '+alertName+'.';
newPassword.focus();
return false;
}
if(bValidate(newPassword,"PasswordWithoutSpace",isMandatory,alertName)!=true)
{
return false;
}
}
}
return status;
}
function ShowTwitterDetails()
{
document.getElementById("socialsettingcontrol_divTwitterDetails").style.display="block";
document.getElementById("dsocialsettings").style.height="410px";
document.getElementById("socialsettingcontrol_divTwitterMsg").style.display="none";
}
function CheckTweetClick()
{
if(document.getElementById("socialsettingcontrol_txtTweetUname")!=null)
{
document.getElementById("socialsettingcontrol_txtTweetPwd").value="";
document.getElementById("socialsettingcontrol_txtTweetUname").disabled=true;
document.getElementById("socialsettingcontrol_txtTweetPwd").disabled=true;
}
var chkSendTweet=document.getElementById("socialsettingcontrol_chkSendTweet");
if(chkSendTweet.checked==true)
{
if(document.getElementById("socialsettingcontrol_txtTweetUname")!=null)
{
document.getElementById("socialsettingcontrol_txtTweetUname").disabled=false;
document.getElementById("socialsettingcontrol_txtTweetPwd").disabled=false;
}
}
checkListboxStatus();
}
function CheckFacebookClick()
{
checkListboxStatus();
}
function checkListboxStatus()
{
var ListBoxObj=document.getElementById('socialsettingcontrol_ListShareItems');
var chkSendTweet=document.getElementById("socialsettingcontrol_chkSendTweet");
var chkSendFacebook=document.getElementById("socialsettingcontrol_chkSendFacebook");
if(ListBoxObj!=null&&ListBoxObj!="")
{
var lstLength=ListBoxObj.options.length;
var i;
var isSelected=false;
for(i=0;i<lstLength;i++)
{
if(ListBoxObj.options[i].selected==true)
{
isSelected=true;
break;
}
}
if((isSelected==true)&&(chkSendTweet.checked==false)&&(chkSendFacebook.checked==false))
{document.getElementById("socialsettingcontrol_divWarningMsg").style.display="none";
var registrationErrorsDiv=document.getElementById("socialsettingcontrol_WarningMsgs_RegistrationErrors");
registrationErrorsDiv.style.display="block";
document.getElementById("socialsettingcontrol_WarningMsgs_divWarningInfo").style.display="block";
registrationErrorsDiv.innerHTML="Select the relevant checkbox to share the updates on twitter and facebook.";
}
else
{
var registrationErrorsDiv=document.getElementById("socialsettingcontrol_WarningMsgs_RegistrationErrors");
registrationErrorsDiv.style.display="none";
document.getElementById("socialsettingcontrol_WarningMsgs_divWarningInfo").style.display="none";
registrationErrorsDiv.innerHTML="";
}
}
}

