﻿// JScript File

function ValidateContactUs()
{
    if (!ForceAlphabetic(document.ContactUs.txtFirstName,'First Name',"T")) return false;
    if (!ForceAlphabetic(document.ContactUs.txtLastName,'Last Name',"T")) return false;
    
    if (!ForceComboItems(document.ContactUs.ddlState,'State',"T")) return false;
    if (document.ContactUs.ddlState.value == "Other" && trimAll(document.ContactUs.txtStateOther.value) == "")
	{
        alert("Please Enter Other State");
        document.ContactUs.txtStateOther.focus();
        return false;
	}	
	
	if (!ForceNumericEntry(document.ContactUs.txtPinCode,'Pin Code',"F")) return false;
	if (!ForceNumericEntry(document.ContactUs.txtPhone,'Phone',"T")) return false;
	if (!ForceNumericEntry(document.ContactUs.txtMobile,'Mobile No.',"F")) return false;
    if (!ForcePhoneValidation(document.ContactUs.txtFax,'Fax',"F")) return false;
    if (!IsEmailValid(document.ContactUs.txtEmail,'Email',"T")) return false;
    if (!ForceDataEntry(document.ContactUs.txtImageCharacters,'Characters shown in Image',"T")) return false;
}


function ValidateFeedback()
{
    if (!ForceAlphabetic(document.Feedback.txtFirstName,'First Name',"T")) return false;
    if (!ForceAlphabetic(document.Feedback.txtLastName,'Last Name',"T")) return false;
    
    if (!ForceComboItems(document.Feedback.ddlState,'State',"T")) return false;
    if (document.Feedback.ddlState.value == "Other" && trimAll(document.Feedback.txtStateOther.value) == "")
	{
        alert("Please Enter Other State");
        document.Feedback.txtStateOther.focus();
        return false;
	}	
	
	if (!ForceNumericEntry(document.Feedback.txtPinCode,'Pin Code',"F")) return false;
	if (!ForcePhoneValidation(document.Feedback.txtPhone,'Phone',"T")) return false;
	if (!ForcePhoneValidation(document.Feedback.txtMobile,'Mobile No.',"F")) return false;
    if (!ForcePhoneValidation(document.Feedback.txtFax,'Fax',"F")) return false;
    if (!IsEmailValid(document.Feedback.txtEmail,'Email',"T")) return false;
    if (!ForceDataEntry(document.Feedback.txtImageCharacters,'Characters shown in Image',"T")) return false;
}




function ValidateSalesEnquiry()
{
    if (!ForceAlphabetic(document.SalesEnquiry.txtCompanyName,'Company Name',"T")) return false;
    if (!ForceAlphabetic(document.SalesEnquiry.txtContactPersonName,'Contact Person Name',"T")) return false;
    
    if (!ForceComboItems(document.SalesEnquiry.ddlState,'State',"T")) return false;
    if (document.SalesEnquiry.ddlState.value == "Other" && trimAll(document.SalesEnquiry.txtStateOther.value) == "")
	{
        alert("Please Enter Other State");
        document.SalesEnquiry.txtStateOther.focus();
        return false;
	}	
	
	if (!ForceNumericEntry(document.SalesEnquiry.txtPinCode,'Pin Code',"F")) return false;
	if (!ForcePhoneValidation(document.SalesEnquiry.txtPhone,'Phone',"T")) return false;
	if (!ForcePhoneValidation(document.SalesEnquiry.txtMobile,'Mobile No.',"F")) return false;
    if (!ForcePhoneValidation(document.SalesEnquiry.txtFax,'Fax',"F")) return false;
    if (!IsEmailValid(document.SalesEnquiry.txtEmail,'Email',"T")) return false;
    if (!ForceDataEntry(document.SalesEnquiry.txtImageCharacters,'Characters shown in Image',"T")) return false;
}


function ValidateSubmitResume()
{
	if (!ForceAlphabetic(document.SubmitResume.txtName, 'Name',"T")) return false;
	if (!IsEmailValid(document.SubmitResume.txtEmail,'Enter proper Email',"T")) return false;
	if (!ForceNumericEntry(document.SubmitResume.txtPhone,'Phone',"T")) return false;
	if (!ForceAlphabetic(document.SubmitResume.txtCity, 'City',"T")) return false;
	
	if (!ForceComboItems(document.SubmitResume.ddlState,'State',"T")) return false;
	if ((document.SubmitResume.ddlState.value == "Other") && (trimAll(document.SubmitResume.txtStateOther.value) == ""))
	{
		alert("Please Enter Other State");
        document.SubmitResume.txtStateOther.focus();
        return false;
	}
	
	if (!ForceComboItems (document.SubmitResume.ddlCountry,'Country',"T")) return false;
	if (!ForceDataEntry(document.SubmitResume.txtCurrentCTC, 'Current CTC')) return false;
}

function ValidateSignUp(varAddEdit)
{

    if (!ForceAlphabetic(document.SignUp.txtName,'Name',"T")) return false;
    if (!ForceDataEntry(document.SignUp.txtAddress,'Address')) return false;
    
    if (!ForceComboItems(document.SignUp.ddlState,'State',"T")) return false;
    if (document.SignUp.ddlState.value == "Other" && trimAll(document.SignUp.txtStateOther.value) == "")
	{
        alert("Please Enter Other State");
        document.SignUp.txtStateOther.focus();
        return false;
	}	
	
	if (!ForceNumericEntry(document.SignUp.txtPinCode,'Pin Code',"F")) return false;
	
	if (!ForceComboItems(document.SignUp.ddlCountry,'Country',"T")) return false;
	
	if (!ForceNumericEntry(document.SignUp.txtISDPhone,'ISD',"F")) return false;
	if (!ForceNumericEntry(document.SignUp.txtSTDPhone,'STD',"F")) return false;
	//if (!ForcePhoneValidation(document.SignUp.txtPhone,'Phone',"T")) return false;
	if (!ForceNumericEntry(document.SignUp.txtPhone,'Phone',"T")) return false;
	
	if (!ForceNumericEntry(document.SignUp.txtISDMobile,'ISD',"F")) return false;
	//if (!ForceNumericEntry(document.SignUp.txtSTDMobile,'STD',"F")) return false;
	//if (!ForcePhoneValidation(document.SignUp.txtMobile,'Mobile No.',"F")) return false;
	if (!ForceNumericEntry(document.SignUp.txtMobile,'Mobile No.',"F")) return false;
	
	if (varAddEdit == "EDIT")
	{
    if (!IsEmailValid(document.SignUp.txtEmail,'Email',"T")) return false;
    if (!ForceDataEntry(document.SignUp.txtPassword,'Password')) return false;
    if (document.SignUp.txtPassword.value.length < 6)
    {
        alert("Password minimum length 6 characters");
        document.SignUp.txtPassword.focus();
        return false;
    }
    if (!ForceDataEntry(document.SignUp.txtConfirmPassword,'Confirm Password')) return false;
    if (document.SignUp.txtPassword.value != document.SignUp.txtConfirmPassword.value)
    {
        alert("Password and Confirm Password should be same");
        document.SignUp.txtPassword.focus();
        return false;
    }
    
    if (!ForceComboItems(document.SignUp.ddlSecretQuestion,'Secret Question',"T")) return false;
    if (!ForceDataEntry(document.SignUp.txtAnswer,'Answer',"T")) return false;
    
    }
    if (!ForceDataEntry(document.SignUp.txtImageCharacters,'Characters shown in Image',"T")) return false;
    
    if (document.SignUp.chkTermsandConditions.checked != true)
    {
         alert("Please accept Terms and Conditions");
        document.SignUp.chkTermsandConditions.focus();
        return false;
    }
}

function ValidateUserLogin()
{
////    if (!IsEmailValid(document.Home.Login1_txtUserId,'User Login',"T")) return false;
////    if (!ForceDataEntry(document.Home.Login1_txtPassword,'Password')) return false;

        if (!IsEmailValid(document.getElementById("Login1_txtUserId"),'User Login',"T")) return false;
        if (!ForceDataEntry(document.getElementById("Login1_txtPassword"),'Password')) return false;
}

function ValidateLogin()
{
        if (!IsEmailValid(document.Login.txtUserId,'User Id',"T")) return false;
        if (!ForceDataEntry(document.Login.txtPassword,'Password')) return false;
}

function ValidateSearch()
{

        if (!ForceComboItems(document.getElementById("Search1_ddlSearch"),'Search Criteria',"T")) return false;
        if (!ForceDataEntry(document.getElementById("Search1_txtSearch"),'Search Keyword',"T")) return false;
        if (document.getElementById("Search1_txtSearch").value.length < 3)
        {
            alert("Search Keyword should be at least 3 Characters long");
            return false;
        }
}
function ValidateNewsLetter()
{
////    if (!ForceComboItems(document.Home.NewsLetterSubscription1_ddlSubject,'Newsletter Subject',"T")) return false;
////    if (!IsEmailValid(document.Home.NewsLetterSubscription1_txtEmailId,'Your Email Id',"T")) return false;

    if (!ForceComboItems(document.getElementById("NewsLetterSubscription1_ddlSubscriber"),'Subscriber',"T")) return false;
    if (!ForceComboItems(document.getElementById("NewsLetterSubscription1_lstSubject"),'Newsletter Subject',"T")) return false;
    if (!IsEmailValid(document.getElementById("NewsLetterSubscription1_txtEmailId"),'Your Email Id',"T")) return false;
}

function ValidateOpinoinPoll()
{
    OpinionPollChecked = 0;
    for (i=0;1==1;i++)
    {
        if (document.getElementById("OpinionPoll1_rdbPollTitle_" + i) == null)
        {
            //alert("chklstAudience_" + i + " Not Found");
            break;
        }
        else
        {
            if (document.getElementById("OpinionPoll1_rdbPollTitle_" + i).checked == true)
            {
                OpinionPollChecked = 1;
                break;
            }
        }
    }
    if (OpinionPollChecked == 0)
    {
        alert("Please Select your Opinion Poll");
        return false;
    }
}

 function ValidForGetPassword()
 {
    if (!IsEmailValid(document.ForgetPassword.txtEmailId,'User Id/E-Mail Id',"T")) return false;
 }
 
 function ValidateSecretAnswer()
 {
    if (!ForceDataEntry(document.SecretQuestion.txtAnswer,'Answer')) return false;
 }

function ValidateChangePassword()
{

	if (!ForceDataEntry(document.ChangePassword.txtOldPassword,'Current Password')) return false;	
	if (!ForceDataEntry(document.ChangePassword.txtNewPassword,'New Password')) return false;
	if(document.ChangePassword.txtNewPassword.value.length<6)
    {
        alert("New Password should be of minimum 6 characters.");
        document.ChangePassword.txtNewPassword.focus();
        return false;
    }
	//$ Check for Confirm Password
	if (!ForceDataEntry(document.ChangePassword.txtConfirmPassword,'Confirm New Password')) return false;
	
	//* Check for Mismatch b/w New Password & Confirm Password
	elem1= document.getElementById("txtNewPassword");
	elem2= document.getElementById("txtConfirmPassword");
	elem3= document.getElementById("txtOldPassword");
    if(elem1.value==elem3.value)
    {
    alert("New Password and Current Password should be different");
	    elem1.focus();
	    return false;
    }
    if(elem1.value!=elem2.value)
    {
	    alert("Mismatch between New Password and Confirm New Password");
	    elem1.focus();
	    return false;
	}
}

function ValidateTellaFriend()
{
    if (!ForceAlphabetic(document.TellAFreind.txtName,'Name',"T")) return false;
    if (!IsEmailValid(document.TellAFreind.txtEmailId,'Your Email Id',"T")) return false;
    if (!IsEmailValid(document.TellAFreind.txtFreindEmailId,'Your Friend Email Id',"T")) return false;
    if (!ForceDataEntry(document.TellAFreind.txtImageCharacters,'Characters shown in Image',"T")) return false;
}

function ValidateBillingDetail()
{
    if (!ForceAlphabetic(document.BillingDetail.txtName,'Name',"T")) return false;
    if (!ForceDataEntry(document.BillingDetail.txtAddress,'Address')) return false;
    
    if (!ForceComboItems(document.BillingDetail.ddlState,'State',"T")) return false;
    if (document.BillingDetail.ddlState.value == "Other" && trimAll(document.BillingDetail.txtStateOther.value) == "")
	{
        alert("Please Enter Other State");
        document.BillingDetail.txtStateOther.focus();
        return false;
	}	
	
	if (!ForceNumericEntry(document.BillingDetail.txtPinCode,'Pin Code',"F")) return false;
	if (!ForceComboItems(document.BillingDetail.ddlCountry,'Country',"T")) return false;
	 
	if (!ForceNumericEntry(document.BillingDetail.txtISDPhone,'ISD',"F")) return false;
	if (!ForceNumericEntry(document.BillingDetail.txtSTDPhone,'STD',"F")) return false;
//	if (!ForcePhoneValidation(document.BillingDetail.txtPhone,'Phone',"T")) return false;
	if (!ForceNumericEntry(document.BillingDetail.txtPhone,'Phone',"T")) return false;
	
	if (!ForceNumericEntry(document.BillingDetail.txtISDMobile,'ISD',"F")) return false;
//	if (!ForcePhoneValidation(document.BillingDetail.txtMobile,'Mobile No.',"F")) return false;
	if (!ForceNumericEntry(document.BillingDetail.txtMobile,'Mobile No.',"F")) return false;
	
    if (!ForceDataEntry(document.BillingDetail.txtDeliveryAddress,'Address')) return false;
    
    if (!ForceComboItems(document.BillingDetail.ddlDeliveryState,'State',"T")) return false;
    if (document.BillingDetail.ddlDeliveryState.value == "Other" && trimAll(document.BillingDetail.txtDeliveryStateOther.value) == "")
	{
        alert("Please Enter Other State");
        document.BillingDetail.txtDeliveryStateOther.focus();
        return false;
	}	
	
	if (!ForceNumericEntry(document.BillingDetail.txtDeliveryPinCode,'Pin Code',"F")) return false;
	if (!ForceComboItems(document.BillingDetail.ddlDeliveryCountry,'Country',"T")) return false;
	
	if (!ForceNumericEntry(document.BillingDetail.txtISDDeliveryPhone,'ISD',"F")) return false;
	if (!ForceNumericEntry(document.BillingDetail.txtSTDDeliveryPhone,'STD',"F")) return false;
//	if (!ForcePhoneValidation(document.BillingDetail.txtDeliveryPhone,'Phone',"T")) return false;
	if (!ForceNumericEntry(document.BillingDetail.txtDeliveryPhone,'Phone',"T")) return false;

	if (!ForceNumericEntry(document.BillingDetail.txtISDDeliveryMobile,'ISD',"F")) return false;
//	if (!ForcePhoneValidation(document.BillingDetail.txtDeliveryMobile,'Mobile No.',"F")) return false;
	if (!ForceNumericEntry(document.BillingDetail.txtDeliveryMobile,'Mobile No.',"F")) return false;
	
    if (!ForceDataEntry(document.BillingDetail.txtImageCharacters,'Characters shown in Image',"T")) return false;
    
    if (document.BillingDetail.chkTermsandConditions.checked != true)
    {
         alert("Please accept Terms and Conditions");
        document.BillingDetail.chkTermsandConditions.focus();
        return false;
    }
}

function ValidateCatalogue()
{
    if ( (document.Catalogue.rdoPriceCatalogueList[0].checked == false ) && ( document.Catalogue.rdoPriceCatalogueList[1].checked == false )) 
    {
        alert ( "Please choose 'Price List' or 'Catalogue' " ); 
        return false;
    }
    
    if (!ForceComboItems(document.Catalogue.ddlSelectCriteria,'Criteria',"T")) return false;
    
}
function ValidateCataloguePrint()
{ 
    if (!ForceComboItems(document.Catalogue.ddlSelectCriteria,'Criteria',"T")) return false;
    
}
function ValidateBuyOnline()
{
       
    if (!ForceComboItems(document.Catalogue.ddlSelectCriteria,'Criteria',"T")) return false;
    
}


function ValidateGetPublished()
{
    if (!ForceAlphabetic(document.GetPublished.txtAuthorName1,'Author Name',"T")) return false;
    if (!ForceDataEntry(document.GetPublished.txtDOB1,'Date of Birth',"T")) return false;
    if (!ForceAlphabetic(document.GetPublished.txtEducation1,'Education Details',"T")) return false;
    
    if (!ForceDataEntry(document.GetPublished.txtOfficialAddress1,'Official Address')) return false;
    if (!ForceDataEntry(document.GetPublished.txtPermanentAddress1,'Permanent Address')) return false;
     
    if (!ForceNumericEntry(document.GetPublished.txtISDPhone1,'ISD',"F")) return false;
	if (!ForceNumericEntry(document.GetPublished.txtSTDPhone1,'STD',"F")) return false;
	//if (!ForcePhoneValidation(document.GetPublished.txtPhone1,'Phone',"T")) return false;
	if (!ForceNumericEntry(document.GetPublished.txtPhone1,'Phone',"T")) return false;
	if (!IsEmailValid(document.GetPublished.txtEmail1,'Email',"T")) return false;
	 
	if (!ForceNumericEntry(document.GetPublished.txtISDPhone2,'ISD',"F")) return false;
	if (!ForceNumericEntry(document.GetPublished.txtSTDPhone2,'STD',"F")) return false;
	//if (!ForcePhoneValidation(document.GetPublished.txtPhone2,'Phone',"F")) return false;
	if (!ForceNumericEntry(document.GetPublished.txtPhone2,'Phone',"F")) return false;
	
	if (!IsEmailValid(document.GetPublished.txtEmail2,'Email',"F")) return false;
	
	if (!ForceNumericEntry(document.GetPublished.txtISDPhone3,'ISD',"F")) return false;
	if (!ForceNumericEntry(document.GetPublished.txtSTDPhone3,'STD',"F")) return false;
	//if (!ForcePhoneValidation(document.GetPublished.txtPhone3,'Phone',"F")) return false;
	if (!ForceNumericEntry(document.GetPublished.txtPhone3,'Phone',"F")) return false;
	
	if (!IsEmailValid(document.GetPublished.txtEmail3,'Email',"F")) return false;
	
    if (!ForceAlphabetic(document.GetPublished.txtTitle,'Title of Book',"T")) return false;
    if (!ForceDataEntry(document.GetPublished.txtSubject,'Subject Area',"T")) return false;
    if (!ForceComboItems(document.GetPublished.ddlBookType,'Type of Book',"T")) return false;
    if (!ForceDataEntry(document.GetPublished.txtManuscript,'Details about the manuscript',"T")) return false;
    if (!ForceDataEntry(document.GetPublished.txtAboutBook,'About the book',"T")) return false;
    
    if (!ForceNumericEntry(document.GetPublished.txtCourseEnrolment,'Course Enrolment',"F")) return false;
	
    if (!ForceAlphabetic(document.GetPublished.txtBookAuthor1,'Author Name1',"F")) return false;
    if (!ForceAlphabetic(document.GetPublished.txtBookPublisher1,'Publisher1',"F")) return false;
    if (!ForceNumericEntry(document.GetPublished.txtBookPrice1,'Price1',"F")) return false;
	
    if (!ForceAlphabetic(document.GetPublished.txtBookAuthor2,'Author Name2',"F")) return false;
    if (!ForceAlphabetic(document.GetPublished.txtBookPublisher2,'Publisher2',"F")) return false;
    if (!ForceNumericEntry(document.GetPublished.txtBookPrice2,'Price2',"F")) return false;
	
    if (!ForceAlphabetic(document.GetPublished.txtBookAuthor3,'Author Name3',"F")) return false;
    if (!ForceAlphabetic(document.GetPublished.txtBookPublisher3,'Publisher3',"F")) return false;
    if (!ForceNumericEntry(document.GetPublished.txtBookPrice3,'Price3',"F")) return false;
	
    if (!ForceAlphabetic(document.GetPublished.txtBookAuthor4,'Author Name4',"F")) return false;
    if (!ForceAlphabetic(document.GetPublished.txtBookPublisher4,'Publisher4',"F")) return false;
    if (!ForceNumericEntry(document.GetPublished.txtBookPrice4,'Price4',"F")) return false;
	
	if (!ForceNumericEntry(document.GetPublished.txtBookYear1,'Year1',"F")) return false;
	if (!ForceAlphabetic(document.GetPublished.txtBookJournal1,'Publisher/Journal 1',"F")) return false;
	if (!ForceNumericEntry(document.GetPublished.txtBookYear2,'Year2',"F")) return false;
    if (!ForceAlphabetic(document.GetPublished.txtBookJournal2,'Publisher/Journal 2',"F")) return false;
    if (!ForceNumericEntry(document.GetPublished.txtBookYear3,'Year3',"F")) return false;
    if (!ForceAlphabetic(document.GetPublished.txtBookJournal3,'Publisher/Journal 3',"F")) return false;
    if (!ForceNumericEntry(document.GetPublished.txtBookYear4,'Year4',"F")) return false;
    if (!ForceAlphabetic(document.GetPublished.txtBookJournal4,'Publisher/Journal 4',"F")) return false;
    if (!ForceNumericEntry(document.GetPublished.txtBookYear5,'Year5',"F")) return false;
    if (!ForceAlphabetic(document.GetPublished.txtBookJournal5,'Publisher/Journal 5',"F")) return false;
    if (!ForceNumericEntry(document.GetPublished.txtBookYear6,'Year6',"F")) return false;
    if (!ForceAlphabetic(document.GetPublished.txtBookJournal6,'Publisher/Journal 6',"F")) return false;
    
    if (!ForceAlphabetic(document.GetPublished.txtExpertName1,'Expert Name1',"T")) return false;
    if (!ForceDataEntry(document.GetPublished.txtExpertAddress1,'Expert Address1')) return false;
    
    if (!ForceAlphabetic(document.GetPublished.txtExpertName2,'Expert Name2',"T")) return false;
    if (!ForceDataEntry(document.GetPublished.txtExpertAddress2,'Expert Address2')) return false;
    
    
}

function ValidateUploadResume()
{
    if(!getFileType(document.SubmitResume.fileUploadResume))return false;
    if (!ForceAlphabetic(document.SubmitResume.txtImageCharacters, 'Image Characters',"T")) return false;
}

function ValidateUnsubscribe()
{
     if (!IsEmailValid(document.Unsubscribe.txtEmail,'Email',"T")) return false;
}