//Start of the function to validate the client side  in home page for member login
function submitForms()
{
    if (isEmail())
        return true;
    else
       return false;
}

function submit()
{
     if(isEmailFormat())
          return true;
     else
          return false;
}
function isEmailFormat()
{
    if (frm3.emailid.value == '')
    {
	alert ("The email field is blank.\n Please enter your email address.");
	frm3.emailid.focus();
	return false;
    }
    if (frm3.email.value.indexOf ('@',0) == -1 ||
    frm3.emailid.value.indexOf ('.',0) == -1) {
	alert ("The email field requires a \"@\" and a \".\"be used.\nPlease re-enter your email address.");
	frm3.emailid.select();
	frm3.emailid.focus();
	return false;
    }
    return true;
}
function submitLogin()
{
   if(isId_Pwd() )
        return true;
   else
        return false;
}
function isId_Pwd()
{
   if(login.u.value == "")
   {
        alert ("Email field is left blank.\nPlease enter your email correctly.");
        login.u.focus();
        return false;
   }
   if (login.p.value == "")
   {
        if(login.todo.value == "sendpass")
            return true;
        else
        {
            alert ("Password field is left blank.\nPlease enter your password.");
            if(login.p.value == "")
            {
                login.p.focus();
                return false;
            }
        }
   } 
   return true;
}
//Start validate edit info
function update_info(frm_edit) 
{
if (isUEmail(frm_edit) && isUName(frm_edit) && isUAbout(frm_edit) && isUPass(frm_edit) && isUOldPass(frm_edit))
    if (confirm("You are about to update your information.\nClick OK to submit. Cancel to abort."))
    {
        return true;
    }
    else
    {
        alert("You have chosen to abort the submission.");
        return false
    }
    else
        return false;
}
function isUEmail(frm_edit)
{
    if(frm_edit.newemail.value == '')
    {
	 alert ("The email field is blank.\n Please enter your email address.");
	 frm_edit.newemail.focus();
	 return false;
    }
    if (frm_edit.newemail.value.indexOf ('@',0) == -1 ||
    frm_edit.newemail.value.indexOf ('.',0) == -1) {
	alert ("The email field requires a \"@\" and a \".\"be used.\nPlease re-enter your email address.");
	frm_edit.newemail.select();
	frm_edit.newemail.focus();
	return false;
    }
    return true;
}
function isUName(frm_edit) {
    if (frm_edit.name.value == "")
    {
        alert ("The name field is blank.\nPlease enter your name.");
        frm_edit.name.focus();
        return false;
    }
    return true;
}
function isUPass(frm_edit) {
    if (frm_edit.password1.value != ""){
     if (frm_edit.password1.value !=  frm_edit.password2.value) {
     alert ("The value in password field and confirm password field doesn't match.\nPlease enter it correctly.");
     frm_edit.password1.focus();
     return false;
     }
    if (frm_edit.password1.value.length < 5) {
	alert ("The password length should not be less than 5 charecters.");
	frm_edit.password1.focus();
    return false;
    }
    if (frm_edit.password1.value ==  frm_edit.password2.value) {
        return true;
    }
	}
    else
        return true;
}
function isUOldPass(frm_edit) {
    if (frm_edit.p.value == "")
    {
        alert ("The current password field is blank.\nPlease enter your current password.");
        frm_edit.p.focus();
        return false;
    }
    return true;
}
function isUAbout(frm_edit) {
    if (frm_edit.aboutme.value.length > 200)
    {
        alert ("Your description for yourself is to long.");
        frm_edit.aboutme.focus();
        return false;
    }
    return true;
}
//Start validate edit blog
function update_blog(frm_blog) 
{
if (isBBlogURI(frm_blog) && isBBlogTitle(frm_blog) && isBBlogDesc(frm_blog) && isBBlogLang(frm_blog))
    if (confirm("You are about to submit your information.\nClick OK to submit. Cancel to abort."))
    {
        return true;
    }
    else
    {
        alert("You have chosen to abort the submission.");
        return false
    }
    else
        return false;
}
function isBBlogURI(frm_blog) {
    if (frm_blog.bloguri.value == "")
    {
        alert ("The blog URI field is blank.\nPlease enter your blog URI.");
        frm_blog.bloguri.focus();
        return false;
    }
    return true;
}
function isBBlogTitle(frm_blog) {
    if (frm_blog.blogtitle.value == "")
    {
        alert ("The blog title field is blank.\nPlease enter your blog title.");
        frm_blog.blogtitle.focus();
        return false;
    }
    return true;
}
function isBBlogDesc(frm_blog) {
    if (frm_blog.blogdescription.value == "")
    {
        alert ("The blog description field is blank.\nPlease enter your blog description.");
        frm_blog.blogdescription.focus();
        return false;
    }
    return true;
}
function isBBlogLang(frm_blog) {
    if (frm_blog.bloglang.value == "")
    {
        alert ("The blog language field is blank.\nPlease enter your blog language.");
        frm_blog.bloglang.focus();
        return false;
    }
    return true;
}
//Start validate add new blog
function add_blog(frm_add_blog) 
{
if (isABlogURI(frm_add_blog) && isABlogTitle(frm_add_blog) && isABlogDesc(frm_add_blog) && isABlogLang(frm_add_blog))
    if (confirm("You are about to submit your information.\nClick OK to submit. Cancel to abort."))
    {
        return true;
    }
    else
    {
        alert("You have chosen to abort the submission.");
        return false
    }
    else
        return false;
}
function isABlogURI(frm_add_blog) {
    if (frm_add_blog.bloguri.value == "")
    {
        alert ("The blog URI field is blank.\nPlease enter your blog URI.");
        frm_add_blog.bloguri.focus();
        return false;
    }
    return true;
}
function isABlogTitle(frm_add_blog) {
    if (frm_add_blog.blogtitle.value == "")
    {
        alert ("The blog title field is blank.\nPlease enter your blog title.");
        frm_add_blog.blogtitle.focus();
        return false;
    }
    return true;
}
function isABlogDesc(frm_add_blog) {
    if (frm_add_blog.blogdescription.value == "")
    {
        alert ("The blog description field is blank.\nPlease enter your blog description.");
        frm_add_blog.blogdescription.focus();
        return false;
    }
    return true;
}
function isABlogLang(frm_add_blog) {
    if (frm_add_blog.bloglang.value == "")
    {
        alert ("The blog language field is blank.\nPlease enter your blog language.");
        frm_add_blog.bloglang.focus();
        return false;
    }
    return true;
}
//Start of the function to validate the client side in contact page
function submitContact(contactad) 
{
if (isCEmail(contactad) && isCName(contactad) && isCMsg(contactad) && isCVerify(contactad))
    if (confirm("You are about to submit your information.\nClick OK to submit. Cancel to abort."))
    {
        alert("Your submission will now be sent.\nThank you.");
        return true;
    }
    else
    {
        alert("You have chosen to abort the submission.");
        return false
    }
    else
        return false;
}
function isCEmail(contactad)
{
    if(contactad.UserEmail.value == '')
    {
	 alert ("The email field is blank.\n Please enter your email address.");
	 contactad.UserEmail.focus();
	 return false;
    }
    if (contactad.UserEmail.value.indexOf ('@',0) == -1 ||
    contactad.UserEmail.value.indexOf ('.',0) == -1) {
	alert ("The email field requires a \"@\" and a \".\"be used.\nPlease re-enter your email address.");
	contactad.UserEmail.select();
	contactad.UserEmail.focus();
	return false;
    }
    return true;
}
function isCName(contactad) {
    if (contactad.Fname.value == "")
    {
        alert ("The name field is blank.\nPlease enter your name.");
        contactad.Fname.focus();
        return false;
    }
    return true;
}
function isCMsg(contactad) {
    if (contactad.my_message.value == "")
    {
        alert ("The message field is blank.\nPlease enter your message.");
        contactad.my_message.focus();
        return false;
    }
    return true;
}
function isCVerify(contactad) {
    if (contactad.pass.value == "")
    {
        alert ("The verify field is blank.\nPlease enter your verify code.");
        contactad.pass.focus();
        return false;
    }
    return true;
}
//Start of the function to validate the client side in comment page
function SendComm(send_comm) 
{
if (isSCName(send_comm) && isSCMessage(send_comm))
    if (confirm("You are about to submit your information.\nClick OK to submit. Cancel to abort."))
    {
        return true;
    }
    else
    {
        alert("You have chosen to abort the submission.");
        return false
    }
    else
        return false;
}
function isSCName(send_comm) {
    if (send_comm.my_name.value == "")
    {
        alert ("The name field is blank.\nPlease enter your name.");
        send_comm.my_name.focus();
        return false;
    }
    return true;
}
function isSCMessage(send_comm) {
    if (send_comm.my_message.value == "") {
         alert ("The comment field is blank.\nPlease enter your comment.");
         send_comm.my_message.focus();
         return false;
    }
	if (send_comm.my_message.value.length > 200) {
	alert ("The comment length should not be more than 200 charecters.");
	send_comm.my_message.focus();
    return false;
    }
    return true;
}
//Start of the function to validate the client side in testimoni page
function SendTesti(send_testi) 
{
if (isSTName(send_testi) && isSTMessage(send_testi))
    if (confirm("You are about to submit your testimoni.\nClick OK to submit. Cancel to abort."))
    {
        return true;
    }
    else
    {
        alert("You have chosen to abort the submission.");
        return false
    }
    else
        return false;
}
function isSTName(send_testi) {
    if (send_testi.my_name.value == "")
    {
        alert ("The name field is blank.\nPlease enter your name.");
        send_testi.my_name.focus();
        return false;
    }
    return true;
}
function isSTMessage(send_testi) {
    if (send_testi.my_message.value == "") {
         alert ("The testimoni field is blank.\nPlease enter your testimoni.");
         send_testi.my_message.focus();
         return false;
    }
	if (send_testi.my_message.value.length > 200) {
	alert ("The testimoni length should not be more than 200 charecters.");
	send_testi.my_message.focus();
    return false;
    }
    return true;
}
//Start of the function to validate the client side in sendmail page
function SendEmail(send_email) 
{
if (isSEName(send_email) && isSEEmail(send_email) && isSESubject(send_email) && isSEMessage(send_email))
    if (confirm("You are about to submit your information.\nClick OK to submit. Cancel to abort."))
    {
        return true;
    }
    else
    {
        alert("You have chosen to abort the submission.");
        return false
    }
    else
        return false;
}
function isSEName(send_email) {
    if (send_email.my_name.value == "")
    {
        alert ("The name field is blank.\nPlease enter your name.");
        send_email.my_name.focus();
        return false;
    }
    return true;
}
function isSEEmail(send_email)
{
    if(send_email.my_email.value == '')
    {
	 alert ("The email field is blank.\n Please enter your email address.");
	 send_email.my_email.focus();
	 return false;
    }
    if (send_email.my_email.value.indexOf ('@',0) == -1 ||
    send_email.my_email.value.indexOf ('.',0) == -1) {
	alert ("The email field requires a \"@\" and a \".\"be used.\nPlease re-enter your email address.");
	send_email.my_email.select();
	send_email.my_email.focus();
	return false;
    }
    return true;
}
function isSESubject(send_email) {
    if (send_email.my_subject.value == "") {
         alert ("The subject field is blank.\nPlease enter your email subject.");
         send_email.my_subject.focus();
         return false;
    }
    return true;
}
function isSEMessage(send_email) {
    if (send_email.my_message.value == "") {
         alert ("The message field is blank.\nPlease enter your message.");
         send_email.my_message.focus();
         return false;
    }
    return true;
}
//Start of the function to validate the client side in addblog page
function submitInfo(addblog) 
{
if (isEmail(addblog) && isName(addblog) && isPass(addblog) && isCountry(addblog) && isBloguri(addblog) && isBlogtitle(addblog) && isBlogdesc(addblog) && isBloglang(addblog) && isTerms(addblog))
    if (confirm("You are about to submit your information.\nClick OK to submit. Cancel to abort."))
    {
        alert("Your submission will now be sent.\nThank you for joining!");
        return true;
    }
    else
    {
        alert("You have chosen to abort the submission.");
        return false
    }
    else
        return false;
}
function isEmail(addblog)
{
    if(addblog.UserEmail.value == '')
    {
	 alert ("The email field is blank.\nPlease enter your email address.");
	 addblog.UserEmail.focus();
	 return false;
    }
    if (addblog.UserEmail.value.indexOf ('@',0) == -1 ||
    addblog.UserEmail.value.indexOf ('.',0) == -1) {
	alert ("The email field requires a \"@\" and a \".\"be used.\nPlease re-enter your email address.");
	addblog.UserEmail.select();
	addblog.UserEmail.focus();
	return false;
    }
    return true;
}
function isName(addblog) {
    if (addblog.Fname.value == "")
    {
        alert ("The name field is blank.\nPlease enter your name.");
        addblog.Fname.focus();
        return false;
    }
    return true;
}
function isPass(addblog) {
     if (addblog.password1.value == "" || addblog.password2.value == "") {
         alert ("The password field or confirm password field is  blank.\nPlease enter your password.");
         addblog.password1.focus();
         return false;
     }
     if (addblog.password1.value !=  addblog.password2.value) {
     alert ("The value in password field and confirm password field doesn't match.\nPlease enter it correctly.");
     addblog.password1.focus();
     return false;
     }
    if (addblog.password1.value.length < 5) {
	alert ("The password length should not be less than 5 charecters.");
	addblog.password1.focus();
    return false;
    }
    if (addblog.password1.value ==  addblog.password2.value) {
        return true;
    }
}
function isCountry(addblog) {
    if (addblog.country.value == "1") {
        alert ("You didnt selected your country.\nPlease select it correctly from the list.");
        addblog.country.focus();
        return false;
    }
    return true;
}
function isBloguri(addblog) {
    if (addblog.bloguri.value == "") {
         alert ("The blog URI field is blank.\nPlease enter your blog URI correctly.");
         addblog.bloguri.focus();
         return false;
    }
    return true;
}
function isBlogtitle(addblog) {
    if (addblog.blogtitle.value == "") {
         alert ("The blog title field is blank.\nPlease enter your blog title correctly.");
         addblog.blogtitle.focus();
         return false;
    }
    return true;
}
function isBlogdesc(addblog) {
    if (addblog.blogdescription.value == "") {
         alert ("The blog description field is blank.\nPlease enter your blog description correctly.");
         addblog.blogdescription.focus();
         return false;
    }
    return true;
}
function isBloglang(addblog) {
    if (addblog.bloglang.value == "") {
         alert ("The blog language field is blank.\nPlease enter your blog language correctly.");
         addblog.bloglang.focus();
         return false;
    }
    return true;
}
function isTerms(addblog)
{
    if(addblog.terms.checked==false)
    {
	 alert("You can't able to proceed until you accept our Terms and Conditions");
	 return false;
    }
    return true;
}
//Start of the function to validate the client side in delete comment page
function del_comm(frm_comment) 
{
if (isCommDelete(frm_comment))
    if (confirm("Delete this comment(s).\nClick OK to submit. Cancel to abort."))
    {
        alert("Blog comment will be deleted.\nPlease wait.");
        return true;
    }
    else
    {
        alert("You have chosen to abort the submission.");
        return false
    }
    else
        return false;
}
function isCommDelete(frm_comment)
{
    if(frm_comment.blogid.value == "")
    {
	 alert("Cannot delete comment");
	 return false;
    }
    return true;
}
//Start of the function to validate the client side in delete testimoni page
function del_testi(frm_testi) 
{
if (isTestiDelete(frm_testi))
    if (confirm("Delete this testimonial(s).\nClick OK to submit. Cancel to abort."))
    {
        alert("Blogger testimonial will be deleted.\nPlease wait.");
        return true;
    }
    else
    {
        alert("You have chosen to abort the submission.");
        return false
    }
    else
        return false;
}
function isTestiDelete(frm_testi)
{
    if(frm_testi.blogger.value == "")
    {
	 alert("Cannot delete testimonial");
	 return false;
    }
    return true;
}
//Start of the function to validate the client side in delete favorite page
function del_fav(frm_fav) 
{
if (isFavDelete(frm_fav))
    if (confirm("Delete this blogs.\nClick OK to submit. Cancel to abort."))
    {
        alert("Favorite blogs will be deleted.\nPlease wait.");
        return true;
    }
    else
    {
        alert("You have chosen to abort the submission.");
        return false
    }
    else
        return false;
}
function isFavDelete(frm_fav)
{
    if(frm_fav.blogger.value == "")
    {
	 alert("Cannot delete blog");
	 return false;
    }
    return true;
}
//Start of the function to validate the client side in delete invite blg page
function del_blg_invite(blg_invite) 
{
if (isBIDelete(blg_invite))
    if (confirm("Delete this bloggers.\nClick OK to submit. Cancel to abort."))
    {
        alert("Bloggers will be deleted.\nPlease wait.");
        return true;
    }
    else
    {
        alert("You have chosen to abort the submission.");
        return false
    }
    else
        return false;
}
function isBIDelete(blg_invite)
{
    if(blg_invite.blogger.value == "")
    {
	 alert("Cannot delete blogger");
	 return false;
    }
    return true;
}
//Start of the function to validate the client side in delete waiting blg page
function del_blg_waited(blg_waited) 
{
if (isBWDelete(blg_waited))
    if (confirm("Delete this bloggers.\nClick OK to submit. Cancel to abort."))
    {
        alert("Bloggers will be deleted.\nPlease wait.");
        return true;
    }
    else
    {
        alert("You have chosen to abort the submission.");
        return false
    }
    else
        return false;
}
function isBWDelete(blg_waited)
{
    if(blg_waited.blogger.value == "")
    {
	 alert("Cannot delete blogger");
	 return false;
    }
    return true;
}
//Start of the function to validate the client side in delete bloggies blg page
function del_bloggies(del_blg) 
{
if (isBBDelete(del_blg))
    if (confirm("Delete this bloggers.\nClick OK to submit. Cancel to abort."))
    {
        alert("Bloggers will be deleted.\nPlease wait.");
        return true;
    }
    else
    {
        alert("You have chosen to abort the submission.");
        return false
    }
    else
        return false;
}
function isBBDelete(del_blg)
{
    if(del_blg.blogger.value == "")
    {
	 alert("Cannot delete blogger");
	 return false;
    }
    return true;
}
//Start of the function to validate the client side in delete blog page
function del_blog(delete_blog) 
{
if (isBlogDelete(delete_blog))
    if (confirm("Delete this blog.\nClick OK to submit. Cancel to abort."))
    {
        alert("Blog will be deleted.\nPlease wait.");
        return true;
    }
    else
    {
        alert("You have chosen to abort the submission.");
        return false
    }
    else
        return false;
}
function isBlogDelete(delete_blog)
{
    if(delete_blog.bloggerid.value == "")
    {
	 alert("Cannot delete blog");
	 return false;
    }
    return true;
}
//Start of the function to validate the client side in search blogger page
function searchBlogger(blogger) {
    if (blogger.blogger.value == "")
    {
        alert ("The blogger keyword field is blank.\nPlease enter your keyword.");
        blogger.blogger.focus();
        return false;
    }
    return true;
}
//Start of the function to validate the client side in search blog page
function searchBlog(blog) {
    if (blog.blog.value == "")
    {
        alert ("The blog keyword field is blank.\nPlease enter your keyword.");
        blog.blog.focus();
        return false;
    }
    return true;
}
//Popup window function
function popUp(URL) 
{
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=1,menubar=0,resizable=0,width=150,height=150,left = 565,top = 437');");
}
//limit textarea
function limitText(limitField, limitCount, limitNum)
{
	if (limitField.value.length > limitNum) {
		limitField.value = limitField.value.substring(0, limitNum);
	} else {
		limitCount.value = limitNum - limitField.value.length;
	}
}
//Start validate resend activation code
function submitResendAct(resendact) 
{
if (isRAEmail(resendact))
    if (confirm("We will resend your information.\nClick OK to submit. Cancel to abort."))
    {
        return true;
    }
    else
    {
        alert("You have chosen to abort the submission.");
        return false
    }
    else
        return false;
}
function isRAEmail(resendact)
{
    if(resendact.UserEmail.value == '')
    {
	 alert ("The email field is blank.\n Please enter your email address.");
	 resendact.UserEmail.focus();
	 return false;
    }
    if (resendact.UserEmail.value.indexOf ('@',0) == -1 ||
    resendact.UserEmail.value.indexOf ('.',0) == -1) {
	alert ("The email field requires a \"@\" and a \".\"be used.\nPlease re-enter your email address.");
	resendact.UserEmail.select();
	resendact.UserEmail.focus();
	return false;
    }
    return true;
}