function DisplayMessage(status)
{
var msg="";
if(status=="1")
{
msg="Congratulations! Your blog post has been created successfully.";
ShowMessageBox(msg);
self.location.href="ViewBlogs.aspx";
return true;
}
else if(status=="0")
{
msg="Error occured while processing the submission. Please try again.";
alert(msg);
return false;
}
}
function DisplayUpdateMessage(status)
{
var msg="";
if(status=="1")
{
msg="Congratulations, your blog post has been updated successfully.";
ShowMessageBox(msg);
self.location.href="ViewBlogs.aspx";
return true;
}
else if(status=="0")
{
msg="Error occurred while processing the updation. Please try again.";
alert(msg);
return false;
}
}
function DisplayDispatchMessage(status)
{
var msg="";
if(status=="1")
{
msg="Congratulations, Blogs is dispatched successfully.";
ShowMessageBox(msg);
}
else if(status=="0")
{
msg="Error occured while dispatching, Please try again.";
alert(msg);
}
window.scrollTo(0,0);
return true;
}
function DisplayDuplicateNameMessage()
{
var newsletterErrorsDiv=document.getElementById("WarningMsgs_RegistrationErrors");
if(newsletterErrorsDiv!=null&&newsletterErrorsDiv!="")
{
newsletterErrorsDiv.style.display="block";
document.getElementById("WarningMsgs_divWarningInfo").style.display="block";
var msg="";
msg="Duplicate title of blog. Use another name.";
newsletterErrorsDiv.innerHTML=msg;
}
window.scrollTo(0,0);
return true;
}
function DeleteBlogConfirmation(BlogId,btnId)
{
document.getElementById("confirmBox_hidButtonId").value=btnId;
document.getElementById("hidRecordId").value=BlogId;
ShowConfirmBox('Would you like to delete this blog? It will also delete blog post and comments.');
return false;
}
function DeleteBlogPostConfirmation(BlogId,btnId)
{
document.getElementById("confirmBox_hidButtonId").value=btnId;
document.getElementById("hidRecordId").value=BlogId;
ShowConfirmBox('Would you like to delete this blog post? It will also delete blog post comments.');
return false;
}
function OffensiveBlogConfirmation(BlogId,btnId)
{
document.getElementById("confirmBox_hidButtonId").value=btnId;
document.getElementById("hidRecordId").value=BlogId;
ShowConfirmBox('Would you like to report this blog as offensive?');
return false;
}
function OffensiveBlogPostConfirmation(BlogId,btnId)
{
document.getElementById("confirmBox_hidButtonId").value=btnId;
document.getElementById("hidRecordId").value=BlogId;
ShowConfirmBox('Would you like to report this blog post as offensive?');
return false;
}
function OffensiveBlogCommentConfirmation(BlogId,btnId)
{
document.getElementById("confirmBox_hidButtonId").value=btnId;
document.getElementById("hidRecordId").value=BlogId;
ShowConfirmBox('Would you like to report this blog post comment as offensive?');
return false;
}
function DisplayCannotDispatchMessage()
{
var newsletterErrorsDiv=document.getElementById("WarningMsgs_RegistrationErrors");
if(newsletterErrorsDiv!=null&&newsletterErrorsDiv!="")
{
newsletterErrorsDiv.style.display="block";
document.getElementById("WarningMsgs_divWarningInfo").style.display="block";
var msg="";
msg="Blog cannot dispatch because of creation date.";
newsletterErrorsDiv.innerHTML=msg;
}
window.scrollTo(0,0);
return true;
}
function DispatchConfirmation()
{
var flag=document.getElementById("hiddenFlag").value;
if(flag=="0")
{
return confirm('Do you want to dispatch blog?');
}
if(flag=="1")
{
return confirm('The Blog is dispatched already. Do you want it dispatch again?');
}
}
function DeleteBlogCommentConfirmation(RecordId,btnId)
{
document.getElementById("confirmBox_hidButtonId").value=btnId;
document.getElementById("hidRecordId").value=RecordId;
ShowConfirmBox('Would you like to delete this comment?');
return false;
}
function AcceptBlogCommentConfirmation(RecordId,btnId)
{
document.getElementById("confirmBox_hidButtonId").value=btnId;
document.getElementById("hidRecordId").value=RecordId;
ShowConfirmBox('Would you like to accept this comment?');
return false;
}
function AddComments()
{
var hidAddCommentsEnable=document.getElementById("hidAddCommentsEnable").value;
if(hidAddCommentsEnable=="true")
{
return ShowModalPopup('pnlComment','Add Comments');
}
else
{
ShowMessageBox("You need to login for adding comment");
return false;
}
}
function btnAddBlogCommentCancel()
{
document.getElementById("txtCommentDescription").value="";
document.getElementById("WarningMsgs_RegistrationErrors").innerHTML="";
document.getElementById("WarningMsgs_RegistrationErrors").style.display="none";
document.getElementById("WarningMsgs_divWarningInfo").style.display="none";
return closepopup('pnlComment');
}
function ValidateAddNewBlog()
{
errors="";
var status=true;
mandatoryFieldsErrorFlag=false;
var varTemp;
var alertName;
var isMandatory;
alertName="Posted Date";
var currentdate=new Date();
var varselectedday=document.getElementById("ddlDayOfMonth").value;
var varselectedMonth=document.getElementById("ddlMonth").value-1;
var varselectedYear=document.getElementById("ddlBirthYear").value;
var selecteddate=new Date(varselectedYear,varselectedMonth,varselectedday);
if(varselectedMonth==1)
{
if(((varselectedYear%4==0)&&(varselectedYear%100!=0))||(varselectedYear%400==0))
{
if(varselectedday>29)
{
errors+=alertName+" Month ends  at 29."+'<br/>';
status=false;
return false;
}
else
{
status=true;
}
}
else
{
if(varselectedday>28)
{
errors+=alertName+"   Month  ends  at 28."+'<br/>';
status=false;
return false;
}
else
{
status=true;
}
}
}
else if((varselectedMonth==3)||(varselectedMonth==5)||(varselectedMonth==8)||(varselectedMonth==10))
{
if(varselectedday>30)
{
errors+=alertName+"  Month  ends  at 30."+'<br/>';
status=false;
return false;
}
else
{
status=true;
}
}
else
{
if((currentdate.getDate()==selecteddate.getDate())&&(currentdate.getMonth()==selecteddate.getMonth())&&(currentdate.getFullYear()==selecteddate.getFullYear()))
{
status=true;
}
else
{
if(selecteddate>currentdate==true)
{
errors+=alertName+" can not be greater than current date."+'<br/>';
status=false;
return false;
}
else
{
status=true;
}
}
}
varTemp=document.getElementById("txtBlogTitle");
alertName="Blog Header ";
isMandatory='True';
if(bValidate(varTemp,"General",isMandatory,alertName)!=true)
{
status=false;
return false;
}
else
{
if(varTemp.value.length>200)
{
errors+=alertName+" should not contain more than 200 characters ."+'<br/>';
varTemp.focus();
status=false;
return false;
}
}
alertName="Blog Content";
varTemp=document.getElementById("ta");
var MessageTextValue=varTemp.value;
MessageTextValue=tinyMCE.getInstanceById("ta").getHTML();
if(MessageTextValue=="")
{
if(mandatoryFieldsErrorFlag==false)
{
mandatoryFieldsErrorFlag=true;
}
errors+=alertName+" can not be blank.";
status=false;
return false;
}
return true;
}
function ValidateAddNewBlogStatus()
{
if(ValidateAddNewBlog()==true)
{
return true;
}
else
{
var registrationErrorsDiv=document.getElementById("WarningMsgs_RegistrationErrors");
registrationErrorsDiv.style.display="block";
document.getElementById("WarningMsgs_divWarningInfo").style.display="block";
registrationErrorsDiv.innerHTML="";
registrationErrorsDiv.innerHTML=errors;
window.scrollTo(0,0);
return false;
}
}
function ValidateComments()
{
errors="";
var status=true;
mandatoryFieldsErrorFlag=false;
var alertName="Comment Description ";
var varTemp;
varTemp=document.getElementById("txtCommentDescription");
var len=trim(varTemp.value).length;
varTemp.value=trim(varTemp.value);
if(len>1024)
{
errors=alertName+sDescription_Message+'<br/>';
status=false;
}
if(len==0)
{
errors=alertName+sDescription_MessageBlank+'<br/>';
document.getElementById("txtCommentDescription").value="";
document.getElementById("txtCommentDescription").focus();
status=false;
}
if(status==false)
{
var registrationErrorsDiv=document.getElementById("WarningMsgs_RegistrationErrors");
registrationErrorsDiv.style.display="block";
document.getElementById("WarningMsgs_divWarningInfo").style.display="block";
registrationErrorsDiv.innerHTML="";
registrationErrorsDiv.innerHTML=errors;
return false;
}
else
{
errors='';
status=CheckBanWord(document.getElementById("txtCommentDescription"),document.getElementById("txtCommentDescription"),document.getElementById("WarningMsgs_RegistrationErrors"));
if(status==false)
{
errors=''+document.getElementById("WarningMsgs_RegistrationErrors").innerHTML;
}
}
return status;
}
function ValidateCreateBlog()
{
errors="";
mandatoryFieldsErrorFlag=false;
var status=ValidateCreateBlogRoutines();
if(status==false)
{
var registrationErrorsDiv=document.getElementById("WarningMsgs_RegistrationErrors");
registrationErrorsDiv.style.display="block";
document.getElementById("WarningMsgs_divWarningInfo").style.display="block";
registrationErrorsDiv.innerHTML="";
registrationErrorsDiv.innerHTML=errors;
return false;
}
else
{
errors='';
status=CheckBanWord(document.getElementById("txtTitle"),document.getElementById("txtDescription"),document.getElementById("WarningMsgs_RegistrationErrors"));
if(status==false)
{
errors=''+document.getElementById("WarningMsgs_RegistrationErrors").innerHTML;
}
}
}
function ValidateCreateBlogRoutines()
{
var status=true;
mandatoryFieldsErrorFlag=false;
var varTemp=document.getElementById("txtTitle");
var alertName="Blog Title";
var isMandatory='True';
errors="";
if(bValidate(varTemp,"General",isMandatory,alertName)!=true)
{
varTemp.focus();
status=false;
return false;
}
else
{
if(varTemp.value.length>256)
{
errors=alertName+" should not contain more than 256 characters."+'<br/>';
varTemp.focus();
status=false;
return false;
}
}
alertName="Description";
varTemp=document.getElementById("txtDescription");
var len=varTemp.value.length;
if(len>1024)
{
errors=''+alertName+sDescription_Message+'<br/>';
varTemp.focus();
status=false;
return false;
}
return status;
}
function OpenPage()
{
var sFeatures='dialogHeight:100px,dialogWidth:400px,center:yes';
var taObj=document.getElementById("ta")
var html="";
if(document.all)
{
html=html+taObj.innerText;
}
else
{
html=html+taObj.textContent;
}
html=html+"</body>";
if(document.all)
{
var windowObj=window.open("",null,'height=500px,width=800px,left=150,top=150');
}
else
{
var windowObj=window.open("",null,'height=500px,width=800px,left=150,top=150');
}
windowObj.document.write(html);
}
function HandleException()
{
if(!document.all)
{
window.onbeforeunload=function()
{
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequest);
}
}
}
function endRequest(sender,e)
{
var err=e.get_error();
if(err)
{
if(err.name=="Sys.WebForms.PageRequestManagerServerErrorException")
{
e.set_errorHandled(true);
}
if(err.name=="Sys.WebForms.PageRequestManagerParserErrorException")
{
e.set_errorHandled(true);
}
}
}

