 // form validation function //

function showMessageLogin() {

    var txtUserName = document.getElementById("ctl00_ContentPlaceHolder1_txtUserName");

    var txtPassword = document.getElementById("ctl00_ContentPlaceHolder1_txtPassword");
    var nameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
    if (txtUserName.value == "") {

        inlineMsg('ctl00_ContentPlaceHolder1_txtUserName', 'Please enter username.', 2);
        return false;
    }
    else if (!txtUserName.value.match(nameRegex)) {
        inlineMsg('ctl00_ContentPlaceHolder1_txtUserName', 'You have entered an invalid username.', 2);

        return false;
    }
    if (txtPassword.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtPassword', 'Please enter password.', 2);
        return false;
    }
    return true;
}


function showMessageAdminLogin() {

    var txtUserName = document.getElementById("ctl00_ContentPlaceHolder1_txtUserName");

    var txtPassword = document.getElementById("ctl00_ContentPlaceHolder1_txtPassword");
    var nameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
    if (txtUserName.value == "") {

        inlineMsg('ctl00_ContentPlaceHolder1_txtUserName', 'Please enter email address.', 2);
        return false;
    }
    else if (!txtUserName.value.match(nameRegex)) {
        inlineMsg('ctl00_ContentPlaceHolder1_txtUserName', 'You have entered an invalid username.', 2);

        return false;
    }
    if (txtPassword.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtPassword', 'Please enter password.', 2);
        return false;
    }
    return true;
}




function ForgotPasswordMessage() {

    var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
    var txtUserName = document.getElementById("ctl00_ContentPlaceHolder1_txtUserName");
    var nameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
    if (txtUserName.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtUserName', 'Please enter email address.', 2);
        return false;
    }
    else if (!txtUserName.value.match(emailRegex)) {
    inlineMsg('ctl00_ContentPlaceHolder1_txtUserName', 'You have entered an invalid email address.', 2);
        return false;
    }
    return true;
}


function ChangeEmailMessage() {

    var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
    var txtUserName = document.getElementById("ctl00_ContentPlaceHolder1_txtUserName");
    var nameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
    if (txtUserName.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtUserName', 'Please enter email address.', 2);
        return false;
    }
    else if (!txtUserName.value.match(emailRegex)) {
        inlineMsg('ctl00_ContentPlaceHolder1_txtUserName', 'You have entered an invalid email address.', 2);
        return false;
    }
    return true;
}


function RFQDetails() {


    var txtDueDate = document.getElementById("ctl00_ContentPlaceHolder1_txtDueDate");
    var nameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;


    if (txtDueDate.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtDueDate', 'Please enter Date.', 2);
        return false;
    }
    return true;
}



function DropDownOptions() {

    var drpOptions = document.getElementById("ctl00_ContentPlaceHolder1_drpOptions");

    var txtValue = document.getElementById("ctl00_ContentPlaceHolder1_txtValue");
    var nameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
    if (drpOptions.value == "0") {

        inlineMsg('ctl00_ContentPlaceHolder1_drpOptions', 'Please select drop down options.', 2);
        return false;
    }

    if (txtValue.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtValue', 'Please enter value.', 2);
        return false;
    }
    return true;
}


function PriceOptions() {

    var drpOptions = document.getElementById("ctl00_ContentPlaceHolder1_drpOptions");

    var txtPrice = document.getElementById("ctl00_ContentPlaceHolder1_txtPrice");
    var nameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
    var numberRegex = /([0-9]+)/;

    if (drpOptions.value == "0") {

        inlineMsg('ctl00_ContentPlaceHolder1_drpOptions', 'Please select drop down options.', 2);
        return false;
    }

    if (txtPrice.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtPrice', 'Please enter price.', 2);
        return false;
    }
    else if (!txtPrice.value.match(numberRegex)) {
    inlineMsg('ctl00_ContentPlaceHolder1_txtPrice', 'You have entered an invalid price.', 2);
        return false;
    }
    return true;
}
function showRFQSearch() {

    var txtState = document.getElementById("ctl00_ContentPlaceHolder1_txtState");
    var txtFromDate = document.getElementById("ctl00_ContentPlaceHolder1_txtFromDate");
    var txtToDate = document.getElementById("ctl00_ContentPlaceHolder1_txtToDate");

    if (txtState.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtState', 'Please enter state to search.', 2);
        return false;
    }

    if (txtFromDate.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtFromDate', 'Please enter from date to search.', 2);
        return false;
    }

    if (txtToDate.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtToDate', 'Please enter to date to search.', 2);
        return false;
    }
      

    return true;
}

function addBannerValidate() {

    var txtTitle = document.getElementById("ctl00_ContentPlaceHolder1_txtTitle");
    var fileUpload = document.getElementById("ctl00_ContentPlaceHolder1_fileUpload");
   // var urlRegx = /^(ht|f)tp(s?)\:\/\/[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*(:(0-9)*)*(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&amp;%\$#_]*)?$/;
   // var urlRegx = /^(ht|f)tp(s?)\:\/\/[a-zA-Z0-9\-\._]+(\.[a-zA-Z0-9\-\._]+){2,}(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&amp;%\$#_]*)?$/;
    var urlRegx = /(((ht|f)tp(s?):\/\/)|(www\.[^ \[\]\(\)\n\r\t]+)|(([012]?[0-9]{1,2}\.){3}[012]?[0-9]{1,2})\/)([^ \[\]\(\),;&quot;'&lt;&gt;\n\r\t]+)([^\. \[\]\(\),;&quot;'&lt;&gt;\n\r\t])|(([012]?[0-9]{1,2}\.){3}[012]?[0-9]{1,2})/;
    var txtUrl = document.getElementById("ctl00_ContentPlaceHolder1_txtUrl");
    if (txtTitle.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtTitle', 'Please enter title.', 2);
        return false;
    }

    if (fileUpload.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_fileUpload', 'Please upload a file.', 2);
        return false;
    }
    if (txtUrl.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtUrl', 'Please enter url.', 2);
        return false;
    }
    if (txtUrl.value != "") {
        if (!txtUrl.value.match(urlRegx)) {
            inlineMsg('ctl00_ContentPlaceHolder1_txtUrl', 'You have entered an invalid url.', 2);
            return false;
        }
    }

    var drpPosition = document.getElementById("ctl00_ContentPlaceHolder1_drpOptions");
    if (drpPosition.value=="Select") {
        inlineMsg('ctl00_ContentPlaceHolder1_drpOptions', 'Please select position.', 2);
        return false;
    }
}





function editBannerValidate() {

    var txtTitle = document.getElementById("ctl00_ContentPlaceHolder1_txtTitle");
   
    // var urlRegx = /^(ht|f)tp(s?)\:\/\/[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*(:(0-9)*)*(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&amp;%\$#_]*)?$/;
    // var urlRegx = /^(ht|f)tp(s?)\:\/\/[a-zA-Z0-9\-\._]+(\.[a-zA-Z0-9\-\._]+){2,}(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&amp;%\$#_]*)?$/;
    var urlRegx = /(((ht|f)tp(s?):\/\/)|(www\.[^ \[\]\(\)\n\r\t]+)|(([012]?[0-9]{1,2}\.){3}[012]?[0-9]{1,2})\/)([^ \[\]\(\),;&quot;'&lt;&gt;\n\r\t]+)([^\. \[\]\(\),;&quot;'&lt;&gt;\n\r\t])|(([012]?[0-9]{1,2}\.){3}[012]?[0-9]{1,2})/;
    var txtUrl = document.getElementById("ctl00_ContentPlaceHolder1_txtUrl");
    if (txtTitle.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtTitle', 'Please enter title.', 2);
        return false;
    }


    if (txtUrl.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtUrl', 'Please enter url.', 2);
        return false;
    }
    if (txtUrl.value != "") {
        if (!txtUrl.value.match(urlRegx)) {
            inlineMsg('ctl00_ContentPlaceHolder1_txtUrl', 'You have entered an invalid url.', 2);
            return false;
        }
    }

    var drpPosition = document.getElementById("ctl00_ContentPlaceHolder1_drpOptions");
    if (drpPosition.value == "Select") {
        inlineMsg('ctl00_ContentPlaceHolder1_drpOptions', 'Please select position.', 2);
        return false;
    }
}



function errorChangePassword() {
    var txtOldPassword = document.getElementById("ctl00_ContentPlaceHolder1_txtOldPassword").value;
    var txtNewPassword = document.getElementById("ctl00_ContentPlaceHolder1_txtNewPassword").value;
    var txtConfirmPassword = document.getElementById("ctl00_ContentPlaceHolder1_txtConfirmPassword").value;


    var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;

    var messageRegex = new RegExp(/<\/?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)\/?>/gim);
    var numberRegex = /([0-9]+)/;


    // Old Password
    if (txtOldPassword == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtOldPassword', 'please enter your current password.', 2);
        return false;
    }

    // New Password
    if (txtNewPassword == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtNewPassword', 'Please enter your new password.', 2);
        return false;
    }

    // Confirm Password
    if (txtConfirmPassword == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtConfirmPassword', 'Please enter your re-type password.', 2);
        return false;
    }

    if (!txtNewPassword.match(txtConfirmPassword)) {

        inlineMsg('ctl00_ContentPlaceHolder1_txtConfirmPassword', 'Please enter re-type  and new passwords same.', 2);
        return false;
    }

}
function rulesErrorMessage() {


    var fromAge = document.getElementById("ctl00_ContentPlaceHolder1_txtFromAge");
    var toAge = document.getElementById("ctl00_ContentPlaceHolder1_txtToAge");
    var ddlAgeGroup = document.getElementById("ctl00_ContentPlaceHolder1_ddlAgeGroup").value;

    var nameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
    var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
    var zipRegex = /^\d{5}(-\d{4})?$/;
    var phoneRegex = /^[0-9]\d{2}-\d{3}-\d{4}$/;
    var messageRegex = new RegExp(/<\/?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)\/?>/gim);
    var numberRegex = /([0-9]+)/;


    if (fromAge.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtFromAge', 'Please enter from age.', 2);
        return false;
    }
    else if (fromAge.value != "") {
        if (!fromAge.value.match(numberRegex)) {
            inlineMsg('ctl00_ContentPlaceHolder1_txtFromAge', 'You have entered an invalid from age.', 2);
            return false;
        }
    }
    if (toAge.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtToAge', 'Please enter to age.', 2);
        return false;
    }
    else if (toAge.value != "") {
        if (!toAge.value.match(numberRegex)) {
            inlineMsg('ctl00_ContentPlaceHolder1_txtToAge', 'You have entered an invalid to age.', 2);
            return false;
        }
    }

    if (ddlAgeGroup == "0") {
        inlineMsg('ctl00_ContentPlaceHolder1_ddlAgeGroup', 'Please select age group.', 2);
        return false;
    }


}
function ErrorTransactionBtAge() {

    var startdate = document.getElementById("ctl00_ContentPlaceHolder1_txtDateRange");
    var enddate = document.getElementById("ctl00_ContentPlaceHolder1_txtDateRangeTo");

    if (startdate.value != "" && enddate.value != "") {

        var fromAge = startdate.value;
        var toAge = enddate.value;
        if (Date.parse(fromAge) > Date.parse(toAge)) {

            inlineMsg('ctl00_ContentPlaceHolder1_txtDateRangeTo', 'end date should greater than start date.', 2);
            return false;
        }
    }
    return true;
}
function transactionByAgeErrorMessage() {
    var startdate = document.getElementById("ctl00_ContentPlaceHolder1_txtDateRange");
    var enddate = document.getElementById("ctl00_ContentPlaceHolder1_txtDateRangeTo");

    if (startdate.value != "" && enddate.value != "") {

        var fromAge = startdate.value;
        var toAge = enddate.value;
        if (Date.parse(fromAge) > Date.parse(toAge)) {

            inlineMsg('ctl00_ContentPlaceHolder1_txtDateRangeTo', 'end date should greater than start date.', 2);
            return false;
        }
    }
    return true;
}
function display() {



    var txtAdvertiser = document.getElementById("ctl00_ContentPlaceHolder1_txtAdvertiser");
    var txtCampaignsName = document.getElementById("ctl00_ContentPlaceHolder1_txtCampaignsName");
    var txtCampaignsDescription = document.getElementById("ctl00_ContentPlaceHolder1_txtCampainsDescription");

    var txtStartDate = document.getElementById("ctl00_ContentPlaceHolder1_txtStartDate");
    var txtEndDate = document.getElementById("ctl00_ContentPlaceHolder1_txtEndDate");
    var txtMaximumImpression = document.getElementById("ctl00_ContentPlaceHolder1_txtMaximumImpression");
    var txtMaximumDailyImpression = document.getElementById("ctl00_ContentPlaceHolder1_txtMaximumDailyImpression");
    var numberRegex = /([0-9]+)/;


    if (txtAdvertiser.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtAdvertiser', 'Please enter advertiser .', 2);
        return false;

    }

    if (txtCampaignsName.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtCampaignsName', 'Please enter campaigns name .', 2);
        return false;
    }
    if (txtCampaignsDescription.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtCampainsDescription', 'Please enter campains description.', 2);
        return false;
    }


    if (txtStartDate.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtStartDate', 'Please select start date.', 2);
        return false;
    }
    if (txtEndDate.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtEndDate', 'Please select end date.', 2);
        return false;
    }
    if (txtStartDate.value != "" && txtEndDate.value != "") {
        var startDate = txtStartDate.value;
        var endDate = txtEndDate.value;
        if (Date.parse(startDate) > Date.parse(endDate)) {

            inlineMsg('ctl00_ContentPlaceHolder1_txtEndDate', 'End date should greater than start date.', 2);
            return false;
        }
    }
    if (txtMaximumImpression.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtMaximumImpression', 'Please enter maximum impression.', 2);
        return false;
    }
    else if (txtMaximumImpression.value != "") {
        if (!txtMaximumImpression.value.match(numberRegex)) {
            inlineMsg('ctl00_ContentPlaceHolder1_txtMaximumImpression', 'You have entered an invalid maximum impression.', 2);
            return false;
        }
    }

    if (txtMaximumDailyImpression.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtMaximumDailyImpression', 'Please enter maximum daily impression.', 2);
        return false;
    }
    else if (txtMaximumDailyImpression.value != "") {
        if (!txtMaximumDailyImpression.value.match(numberRegex)) {
            inlineMsg('ctl00_ContentPlaceHolder1_txtMaximumDailyImpression', 'You have entered an invalid maximum daily impression.', 2);
            return false;
        }
    }
    if (txtMaximumImpression.value != "" && txtMaximumDailyImpression.value != "") {
        var maxImpression = txtMaximumImpression.value;
        var maxDailyImpression = txtMaximumDailyImpression.value;
        if (parseInt(maxImpression) > parseInt(maxDailyImpression)) {

            inlineMsg('ctl00_ContentPlaceHolder1_txtMaximumDailyImpression', 'Maximum Daily Impressions should greater than Maximum Impressions.', 2);
            return false;
        }
    }

    return true;
}
function validate_paidService() {
    var YES = document.getElementById("ctl00_MainContent_chkPaidSericeYes");
    var NO = document.getElementById("ctl00_MainContent_chkPaidSericeNo");

    var dispservice = document.getElementById("ctl00_MainContent_dispservice");

    if ((YES.checked) || (NO.checked))
        return true;
    else
        inlineMsg('ctl00_MainContent_dispservice', 'You must select service type.', 2);
    return false;
    // if(YES.value != "")
    // {
    // return true;
    // }
    // else
    // {
    // inlineMsg('ctl00_MainContent_drpIndustry','You must select industry.',2);
    // return false;
    // }
}

function validate_Industry() {
    var country = document.getElementById("ctl00_MainContent_drpIndustry");
    if (country.value != "") {
        return true;
    }
    else {
        inlineMsg('ctl00_MainContent_drpIndustry', 'You must select industry.', 2);
        return false;
    }
}


function validate_step0() {

    chosen = ""
    len = 4

    for (i = 0; i < len; i++) {
        if (document.getElementById("ctl00_MainContent_rdSessionType_" + i).checked) {
            chosen = document.getElementById("ctl00_MainContent_rdSessionType_" + i).value;
        }
    }

    if (chosen == "") {

        inlineMsg('fee', 'You must choose a product.', 2);

        // VISIBILITY: hidden; WIDTH: 1px
        return false;

    }


}











var dtCh = "/";
var minYear = 1900;
var maxYear = 2100;

function isInteger(s) {
    var i;
    for (i = 0; i < s.length; i++) {
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag) {
    var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++) {
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function daysInFebruary(year) {
    // February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ((!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28);
}
function DaysArray(n) {
    for (var i = 1; i <= n; i++) {
        this[i] = 31
        if (i == 4 || i == 6 || i == 9 || i == 11) { this[i] = 30 }
        if (i == 2) { this[i] = 29 }
    }
    return this
}

function isDate(dtStr) {
    var daysInMonth = DaysArray(12)
    var pos1 = dtStr.indexOf(dtCh)
    var pos2 = dtStr.indexOf(dtCh, pos1 + 1)
    var strMonth = dtStr.substring(0, pos1)
    var strDay = dtStr.substring(pos1 + 1, pos2)
    var strYear = dtStr.substring(pos2 + 1)
    var txtLastWorkDate = document.getElementById("ctl00_MainContent_txtLastWorkDate").value

    strYr = strYear
    if (strDay.charAt(0) == "0" && strDay.length > 1) strDay = strDay.substring(1)
    if (strMonth.charAt(0) == "0" && strMonth.length > 1) strMonth = strMonth.substring(1)
    for (var i = 1; i <= 3; i++) {
        if (strYr.charAt(0) == "0" && strYr.length > 1) strYr = strYr.substring(1)
    }
    month = parseInt(strMonth)
    day = parseInt(strDay)
    year = parseInt(strYr)
    if (pos1 == -1 || pos2 == -1) {

        inlineMsg('ctl00_MainContent_txtLastWorkDate', 'The date format should be : mm/dd/yyyy.', 2)


        return false;
    }
    if (strMonth.length < 1 || month < 1 || month > 12) {
        inlineMsg('ctl00_MainContent_txtLastWorkDate', 'Please enter a valid month', 2)

        return false
    }
    if (strDay.length < 1 || day < 1 || day > 31 || (month == 2 && day > daysInFebruary(year)) || day > daysInMonth[month]) {

        inlineMsg('ctl00_MainContent_txtLastWorkDate', 'Please enter a valid day', 2)

        return false
    }
    if (strYear.length != 4 || year == 0 || year < minYear || year > maxYear) {
        inlineMsg('ctl00_MainContent_txtLastWorkDate', 'Please enter a valid 4 digit year between ' + minYear + ' and ' + maxYear, 2)


        return false
    }
    if (dtStr.indexOf(dtCh, pos2 + 1) != -1 || isInteger(stripCharsInBag(dtStr, dtCh)) == false) {
        inlineMsg('ctl00_MainContent_txtLastWorkDate', 'Please enter a valid date', 2)

        return false
    }
    return true
}























function checkdate(input) {
    var validformat = /^\d{4}\/\d{2}\/\d{2}$/ //Basic check for format validity
    var returnval = false
    if (validformat.test(input.value)) {
        alert("Invalid Date Format. Please correct and submit again.")
        return false;
    }
    else {
        //Detailed check for valid date ranges
        var yearfield = input.value.split("/")[0]
        var monthfield = input.value.split("/")[1]
        var dayfield = input.value.split("/")[2]
        var dayobj = new Date(yearfield, monthfield - 1, dayfield)
        if ((dayobj.getMonth() + 1 != monthfield) || (dayobj.getDate() != dayfield) || (dayobj.getFullYear() != yearfield))
            alert("Invalid Day, Month, or Year range detected. Please correct and submit again.")
        else
            returnval = true
    }
    if (returnval == false) input.select()
    return returnval
}




















/*AJ*/

// form validation function //
function validate_PasswordReset() {


    var txtEmailAddress = document.getElementById("ctl00_MainContent_txtEmailAddress").value;

    var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;

    var messageRegex = new RegExp(/<\/?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)\/?>/gim);
    var numberRegex = /([0-9]+)/;


    // CONTACT EMAIL
    if (txtEmailAddress == "") {
        inlineMsg('ctl00_MainContent_txtEmailAddress', 'You must enter your email.', 2);
        return false;
    }
    if (!txtEmailAddress.match(emailRegex)) {
        inlineMsg('ctl00_MainContent_txtEmailAddress', 'You have entered an invalid email.', 2);
        return false;
    }

    // END
    return true;
}

//validate_ForgetPassword


// form validation function //
function validate_ForgetPassword() {

    var email = document.getElementById("ctl00_MainContent_email").value;
    var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
    // CONTACT EMAIL
    if (email == "") {
        inlineMsg('ctl00_MainContent_email', 'You must enter your email.', 2);
        return false;
    }
    if (!email.match(emailRegex)) {
        inlineMsg('ctl00_MainContent_email', 'You have entered an invalid email.', 2);
        return false;
    }

    return true;
}





// form validation function //
function validate_ChangePassword() {


    var txtOldPassword = document.getElementById("ctl00_MainContent_txtOldPassword").value;
    var txtNewPassword = document.getElementById("ctl00_MainContent_txtNewPassword").value;
    var txtConfirmPassword = document.getElementById("ctl00_MainContent_txtConfirmPassword").value;


    var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;

    var messageRegex = new RegExp(/<\/?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)\/?>/gim);
    var numberRegex = /([0-9]+)/;


    // Old Password
    if (txtOldPassword == "") {
        inlineMsg('ctl00_MainContent_txtOldPassword', 'You must enter your Old Password.', 2);
        return false;
    }

    // New Password
    if (txtNewPassword == "") {
        inlineMsg('ctl00_MainContent_txtNewPassword', 'You must enter your New Password.', 2);
        return false;
    }

    // Confirm Password
    if (txtConfirmPassword == "") {
        inlineMsg('ctl00_MainContent_txtConfirmPassword', 'You must enter your Confirm Password.', 2);
        return false;
    }

    if (!txtNewPassword.match(txtConfirmPassword)) {
        inlineMsg('ctl00_MainContent_txtNewPassword', 'You must enter Confirm and new passwords same.', 2);
        return false;
    }

    //  if(!txtConfirmPassword.match(txtNewPassword)) {
    //    inlineMsg('txtConfirmPassword','You must enter Confirm and new passwords same.',2);
    //    return false;
    //  }



    //  if(!txtEmailAddress.match(emailRegex)) {
    //    inlineMsg('txtEmailAddress','You have entered an invalid email.',2);
    //    return false;
    //  }

    // END
    return true;
}
/*AJ*/

// START OF MESSAGE SCRIPT //

var MSGTIMER = 50;
var MSGSPEED = 5;
var MSGOFFSET = 3;
var MSGHIDE = 3;

// build out the divs, set attributes and call the fade function //
function inlineMsg(target, string, autohide) {
    var msg;
    var msgcontent;
    if (!document.getElementById('msg')) {

        msg = document.createElement('div');
        msg.id = 'msg';
        msg.nowrap = "nowrap";
        msg.setAttribute("WIDTH", "500PX");
        msgcontent = document.createElement('div');
        msgcontent.id = 'msgcontent';

        document.body.appendChild(msg);
        msg.appendChild(msgcontent);
        msg.style.filter = 'alpha(opacity=0)';
        msg.style.opacity = 0;

        msg.alpha = 0;

    } else {

        msg = document.getElementById('msg');
        msgcontent = document.getElementById('msgcontent');
    }
    msgcontent.innerHTML = string;
    msg.style.display = 'block';
    var msgheight = msg.offsetHeight;

    var targetdiv = document.getElementById(target);


    targetdiv.focus();
    var targetheight = targetdiv.offsetHeight;
    var targetwidth = targetdiv.offsetWidth;
    var topposition = topPosition(targetdiv) - ((msgheight - targetheight) / 2);
    var leftposition = leftPosition(targetdiv) + targetwidth + MSGOFFSET;
    msg.style.top = topposition + 'px';
    msg.style.left = leftposition + 'px';
    clearInterval(msg.timer);
    msg.timer = setInterval("fadeMsg(1)", MSGTIMER);
    if (!autohide) {
        autohide = MSGHIDE;
    }
    window.setTimeout("hideMsg()", (autohide * 1000));
}

// hide the form alert //
function hideMsg(msg) {
    var msg = document.getElementById('msg');
    if (!msg.timer) {
        msg.timer = setInterval("fadeMsg(0)", MSGTIMER);
    }
}

// face the message box //
function fadeMsg(flag) {
    if (flag == null) {
        flag = 1;
    }
    var msg = document.getElementById('msg');
    var value;
    if (flag == 1) {
        value = msg.alpha + MSGSPEED;
    } else {
        value = msg.alpha - MSGSPEED;
    }
    msg.alpha = value;
    msg.style.opacity = (value / 100);
    msg.style.filter = 'alpha(opacity=' + value + ')';
    if (value >= 99) {
        clearInterval(msg.timer);
        msg.timer = null;
    } else if (value <= 1) {
        msg.style.display = "none";
        clearInterval(msg.timer);
    }
}

// calculate the position of the element in relation to the left of the browser //
function leftPosition(target) {
    var left = 0;
    if (target.offsetParent) {
        while (1) {
            left += target.offsetLeft;
            if (!target.offsetParent) {
                break;
            }
            target = target.offsetParent;
        }
    } else if (target.x) {
        left += target.x;
    }
    return left;
}

// calculate the position of the element in relation to the top of the browser window //
function topPosition(target) {
    var top = 0;
    if (target.offsetParent) {
        while (1) {
            top += target.offsetTop;
            if (!target.offsetParent) {
                break;
            }
            target = target.offsetParent;
        }
    } else if (target.y) {
        top += target.y;
    }
    return top;
}

// preload the arrow //
if (document.images) {
    arrow = new Image(7, 80);
    arrow.src = "msg_arrow.gif";
}

function validateCheckupForm() {

    //var product = form.product.value;
    var cardtype = document.getElementById("cardtype").value;
    var contact_name = document.getElementById("txtFName").value;

    var contact_lastname = document.getElementById("txtLName").value;
    var contact_email = document.getElementById("txtEmail").value;
    var contact_address = document.getElementById("txtBillingAddr1").value;
    var contact_city = document.getElementById("txtCity").value;
    var contact_state = document.getElementById("contactState").value;
    var contact_zip = document.getElementById("txtZipCode").value;
    var contact_country = document.getElementById("contactCountry").value;
    var contact_phone = document.getElementById("txtHomeTelePh").value;
    var credit_card = document.getElementById("txtCreditCard").value;
    var csc = document.getElementById("txtSecurityCd").value;
    var expmonth = document.getElementById("expMonth").value;
    var expyear = document.getElementById("expYear").value;
    var Qty = document.getElementById("txtQty").value;

    var nameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
    var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
    var zipRegex = /^\d{5}(-\d{4})?$/;
    var phoneRegex = /^[0-9]\d{2}-\d{3}-\d{4}$/;
    var messageRegex = new RegExp(/<\/?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)\/?>/gim);
    var numberRegex = /([0-9]+)/;
    // PRODUCT


    chosen = ""


    if (contact_name == "") {
        inlineMsg('txtFName', 'You must enter your name.', 2);
        return false;
    }
    if (!contact_name.match(nameRegex)) {
        inlineMsg('txtFName', 'You have entered an invalid name.', 2);
        return false;
    }
    // CONTACT LAST NAME
    if (contact_lastname == "") {
        inlineMsg('txtLName', 'You must enter your last name.', 2);
        return false;
    }
    if (!contact_lastname.match(nameRegex)) {
        inlineMsg('txtLName', 'You have entered an invalid last name.', 2);
        return false;
    }

    // CONTACT PHONE NUMBER
    if (contact_phone == "") {
        inlineMsg('txtHomeTelePh', 'You must enter your phone number.', 2);
        return false;
    }
    if (!contact_phone.match(phoneRegex)) {
        inlineMsg('txtHomeTelePh', 'You have entered an invalid phone number.', 2);
        return false;
    }

    // CONTACT EMAIL
    if (contact_email == "") {
        inlineMsg('txtEmail', 'You must enter your email.', 2);
        return false;
    }
    if (!contact_email.match(emailRegex)) {
        inlineMsg('txtEmail', 'You have entered an invalid email.', 2);
        return false;
    }

    // CREDIT CARD TYPE
    //  if(cardtype == "") {
    //  alert(cardtype.value);
    //    return false;
    //  }

    // CREDIT CARD NUMBER
    if (credit_card == "") {
        inlineMsg('txtCreditCard', 'You must enter your credit card number.', 2);
        return false;
    }
    if (!credit_card.match(numberRegex)) {
        inlineMsg('txtCreditCard', 'You have entered an invalid credit card number.', 2);
        return false;
    }

    // EXPIRATION DATE - MONTH
    if (expmonth == 'Please Select Month') {
        inlineMsg('expmonth', 'You must select your card expiration month.', 2);
        return false;
    }
    // EXPIRATION DATE - YEAR
    if (expyear == 'Please Select Year') {
        inlineMsg('expyear', 'You must select your card expiration year.', 2);
        return false;
    }

    // CSC
    if (csc == "") {
        inlineMsg('txtSecurityCd', 'You must enter your CSC number.', 2);
        return false;
    }

    // CONTACT ADDRESS
    if (contact_address == "") {
        inlineMsg('txtBillingAddr1', 'You must enter your address.', 2);
        return false;
    }
    // CONTACT CITY
    if (contact_city == "") {
        inlineMsg('txtCity', 'You must enter your city.', 2);
        return false;
    }
    if (!contact_city.match(nameRegex)) {
        inlineMsg('txtCity', 'You have entered an invalid city name.', 2);
        return false;
    }
    // CONTACT STATE
    if (contact_state == "") {
        inlineMsg('contact_state', 'You must select your state.', 2);
        return false;
    }
    // CONTACT ZIP
    if (contact_zip == "") {
        inlineMsg('txtZipCode', 'You must enter your zip code.', 2);
        return false;
    }
    if (!contact_zip.match(zipRegex)) {
        inlineMsg('txtZipCode', 'You have entered an invalid zip code.', 2);
        return false;
    }
    // CONTACT COUNTRY


    if (contact_country == 'Please select') {
        inlineMsg('contact_country', 'You must select your country.', 2);
        return false;
    }

    //United States
    //Km.soomro
    if (contact_country == 'United States') {
        if (contact_state == 'Please Select State') {
            inlineMsg('contact_state', 'You must select your state.', 2);
            return false;
        }

    }
    else
        phoneRegex = numberRegex // replace phone regular expression

    if (Qty == "0") {
        inlineMsg('txtQty', 'You must enter quantity .', 2);
        return false;
    }
    if (!Qty.match(numberRegex)) {
        inlineMsg('txtQty', 'You have entered an invalid quantity.', 2);
        return false;
    }

    // END
    return true;
}


function TransactionDateValidation() {


    var rdDate = document.getElementById("ctl00_ContentPlaceHolder1_rdodate").checked;
    var rdDateRange = document.getElementById("ctl00_ContentPlaceHolder1_rdoDateRangeTo").checked;
    var fromDate = document.getElementById("ctl00_ContentPlaceHolder1_txtDateRangeFrom").value;
    var toDate = document.getElementById("ctl00_ContentPlaceHolder1_txtDateRangeTo").value;
    if (rdDate == false && rdDateRange == false) {
        inlineMsg('ctl00_ContentPlaceHolder1_rdodate', 'Please select atleast one radio button', 2);
        return false;
    }

    if (rdDateRange == true) {
        if (fromDate == "") {
            inlineMsg('ctl00_ContentPlaceHolder1_txtDateRangeFrom', 'Please enter from date', 2);
            return false;
        }
        else if (toDate == "") {
            inlineMsg('ctl00_ContentPlaceHolder1_txtDateRangeTo', 'Please enter to date', 2);
            return false;
        }
    }
    //return true ;
}


function showAddBrandMsg() {

    var txtBrandName = document.getElementById("ctl00_ContentPlaceHolder1_txtBrandName");

    var txtBrandDesc = document.getElementById("ctl00_ContentPlaceHolder1_txtDescription");
    if (txtBrandName.value == "") {

        inlineMsg('ctl00_ContentPlaceHolder1_txtBrandName', 'Please enter brand name.', 2);
        return false;
    }

    if (txtBrandDesc.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtDescription', 'Please enter brand description.', 2);
        return false;
    }
    return true;
}


function showMessageAddShipping() {

    var txtLower = document.getElementById("ctl00_ContentPlaceHolder1_txtLower");

    var txtUpper = document.getElementById("ctl00_ContentPlaceHolder1_txtUpper");

    var txtCharges = document.getElementById("ctl00_ContentPlaceHolder1_txtCharges");
    var nameRegex = /^\d*[0-9]\d*(\.\d+)?$/;
    if (txtLower.value == "") {

        inlineMsg('ctl00_ContentPlaceHolder1_txtLower', 'Please enter lower limit.', 2);
        return false;
    }
    else if (!txtLower.value.match(nameRegex)) {
        inlineMsg('ctl00_ContentPlaceHolder1_txtLower', 'You have entered an lower limit.', 2);

        return false;
    }
    if (txtUpper.value == "") {

        inlineMsg('ctl00_ContentPlaceHolder1_txtUpper', 'Please enter upper limit.', 2);
        return false;
    }
    else if (!txtUpper.value.match(nameRegex)) {
        inlineMsg('ctl00_ContentPlaceHolder1_txtUpper', 'You have entered an upper limit.', 2);

        return false;
    }
    if (txtCharges.value == "") {

        inlineMsg('ctl00_ContentPlaceHolder1_txtCharges', 'Please enter charges.', 2);
        return false;
    }
    else if (!txtCharges.value.match(nameRegex)) {
        inlineMsg('ctl00_ContentPlaceHolder1_txtCharges', 'You have entered an charges.', 2);

        return false;
    }
    return true;
}





function showAdminHomeMsg() {

    var txtSearch = document.getElementById("ctl00_ContentPlaceHolder1_txtSearch");
    var drpSearch = document.getElementById("ctl00_ContentPlaceHolder1_drpSearch");
    if (drpSearch.value == "0") {
        inlineMsg('ctl00_ContentPlaceHolder1_drpSearch', 'Please select search by.', 2);
        return false;
    }
    else if (txtSearch.value == "") {

        inlineMsg('ctl00_ContentPlaceHolder1_txtSearch', 'Please enter the value to search.', 2);
        return false;
    }


    return true;
}

function showAdminHomeMsg1() {

    var txtSearchOrd = document.getElementById("ctl00_ContentPlaceHolder1_txtSearchOrd");
    var drpSearchOrd = document.getElementById("ctl00_ContentPlaceHolder1_drpSearchOrd");
    if (drpSearchOrd.value == "0") {
        inlineMsg('ctl00_ContentPlaceHolder1_drpSearchOrd', 'Please select search by.', 2);
        return false;
    }
    else if (txtSearchOrd.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtSearchOrd', 'Please enter the value to search.', 2);
        return false;
    }

    return true;
}











//sheetal

function showMessageLoginUser() {

    var txtLoginId = document.getElementById("ctl00_ContentPlaceHolder2_txtLoginId");

    var txtPassword = document.getElementById("ctl00_ContentPlaceHolder2_txtPassword");
    var nameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
    var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
    var namenumberRegex = /([a-zA-Z0-9]{6})/;
    
    if (txtLoginId.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder2_txtLoginId', 'Please enter login id.', 2);
        return false;
    }
    else if (!txtLoginId.value.match(emailRegex)) {
        inlineMsg('ctl00_ContentPlaceHolder2_txtLoginId', 'You have entered an invalid login id.', 2);
        return false;
    }
    if (txtPassword.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder2_txtPassword', 'Please enter password.', 2);
        return false;
    }

    else if (!txtPassword.value.match(namenumberRegex)) {
        inlineMsg('ctl00_ContentPlaceHolder2_txtPassword', 'Password should be atleast 6 characters.', 2);

        return false;
    }
    return true;
}

function userForgotPasswordMessage() {
    var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
    var txtEmailId = document.getElementById("ctl00_ContentPlaceHolder2_txtEmailId");
    var nameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
    if (txtEmailId.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder2_txtEmailId', 'Please enter email address.', 2);
        return false;
    }
    else if (!txtEmailId.value.match(emailRegex)) {
        inlineMsg('ctl00_ContentPlaceHolder2_txtEmailId', 'You have entered an invalid email address.', 2);
        return false;
    }
    return true;
}






function userErrorChangePassword() {
    var txtCurrentPassword = document.getElementById("ctl00_ContentPlaceHolder2_txtCurrentPassword").value;
    var txtNewPassword = document.getElementById("ctl00_ContentPlaceHolder2_txtNewPassword").value;
    var txtRetypePassword = document.getElementById("ctl00_ContentPlaceHolder2_txtRetypePassword").value;


    var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;

    var messageRegex = new RegExp(/<\/?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)\/?>/gim);
    var numberRegex = /([0-9]+)/;
    var namenumberRegex = /([a-zA-Z0-9]{6})/;

    // Old Password
    if (txtCurrentPassword == "") {
        inlineMsg('ctl00_ContentPlaceHolder2_txtCurrentPassword', 'please enter your current password.', 2);
        return false;
    }

    else if (!txtCurrentPassword.match(namenumberRegex)) {

        inlineMsg('ctl00_ContentPlaceHolder2_txtCurrentPassword', 'Password should be atleast 6 characters.', 2);

        return false;
    }
    // New Password
    if (txtNewPassword == "") {
        inlineMsg('ctl00_ContentPlaceHolder2_txtNewPassword', 'Please enter your new password.', 2);
        return false;
    }
    else if (!txtNewPassword.match(namenumberRegex)) {
        inlineMsg('ctl00_ContentPlaceHolder2_txtNewPassword', 'Password should be atleast 6 characters.', 2);

        return false;
    }

    // Confirm Password
    if (txtRetypePassword == "") {
        inlineMsg('ctl00_ContentPlaceHolder2_txtRetypePassword', 'Please enter your re-type password.', 2);
        return false;
    }

    if (!txtNewPassword.match(txtRetypePassword)) {

        inlineMsg('ctl00_ContentPlaceHolder2_txtNewPassword', 'New password & re-type password should be same.', 2);
        return false;
    }

}




function showMessageLogin() {

    var txtUserName = document.getElementById("ctl00_ContentPlaceHolder1_txtLoginName");

    var txtPassword = document.getElementById("ctl00_ContentPlaceHolder1_txtLoginPassword");
    var nameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
    if (txtUserName.value == "") {

        inlineMsg('ctl00_ContentPlaceHolder1_txtLoginName', 'Please enter username.', 2);
        return false;
    }
    else if (!txtUserName.value.match(nameRegex)) {
        inlineMsg('ctl00_ContentPlaceHolder1_txtLoginName', 'You have entered an invalid username.', 2);

        return false;
    }
    if (txtPassword.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtLoginPassword', 'Please enter password.', 2);
        return false;
    }
    return true;
}
//Buyer create box validation
function showCreateBox() {

    var txtBoxPN = document.getElementById("ctl00_ContentPlaceHolder1_txtBoxPN");
    var numberRegex = /([0-9]+)/;
    if (txtBoxPN.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtBoxPN', 'Please enter box product number.', 2);
        return false;
    }

//    else if (txtBoxPN.value != "") {
//        if (!txtBoxPN.value.match(numberRegex)) {
//            inlineMsg('ctl00_ContentPlaceHolder1_txtBoxPN', 'You have entered an invalid box product number.', 2);
//            return false;
//        }
//    }
    var drpStyle = document.getElementById("ctl00_ContentPlaceHolder1_ddlStyle");
   
    
    var drpLength1 = document.getElementById("ctl00_ContentPlaceHolder1_drpLength1");
    if (drpLength1.value == "0") {
        inlineMsg('ctl00_ContentPlaceHolder1_drpLength1', 'Please select box length.', 2);
        return false;
    }


    var txtLength = document.getElementById("ctl00_ContentPlaceHolder1_txtLength");
    if (txtLength.value != "") {
        if (!txtLength.value.match(numberRegex)) {
            inlineMsg('ctl00_ContentPlaceHolder1_txtLength', 'You have entered an invalid length.', 2);

            return false;
        }
    }

    var txtLength1 = document.getElementById("ctl00_ContentPlaceHolder1_txtLength1");
    if (txtLength1.value != "") {
        if (!txtLength1.value.match(numberRegex)) {
            inlineMsg('ctl00_ContentPlaceHolder1_txtLength1', 'You have entered an invalid length1.', 2);

            return false;
        }
    }
    var intLength = parseInt(txtLength.value);
    var intLength1 = parseInt(txtLength1.value);

    if (txtLength1.value != "" && txtLength.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtLength', 'Please enter length.', 2);
        return false;
    }

    if (txtLength.value != "" && txtLength1.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtLength1', 'Please enter length.', 2);
        return false;
    }


    if (intLength >= intLength1) {
        inlineMsg('ctl00_ContentPlaceHolder1_txtLength', 'Numerator should not be greater than denominator.', 2);
        return false;
    }

    if (intLength == 0) {
        inlineMsg('ctl00_ContentPlaceHolder1_txtLength', 'Numerator should not be zero.', 2);
        return false;
    }

    if (intLength1 == 0) {
        inlineMsg('ctl00_ContentPlaceHolder1_txtLength1', 'Denominator should not be zero.', 2);
        return false;
    }


    if (drpStyle.value == "1" || drpStyle.value == "2" || drpStyle.value == "3") 
    {
        var drpWidth1 = document.getElementById("ctl00_ContentPlaceHolder1_drpWidth1");
        if (drpWidth1.value == "0") {
            inlineMsg('ctl00_ContentPlaceHolder1_drpWidth1', 'Please select box width', 2);
            return false;
        }
        var drpDepth1 = document.getElementById("ctl00_ContentPlaceHolder1_drpDepth1");
        if (drpDepth1.value == "0") {
            inlineMsg('ctl00_ContentPlaceHolder1_drpDepth1', 'Please select box depth.', 2);
            return false;
        }
    }

   
    var txtWidth = document.getElementById("ctl00_ContentPlaceHolder1_txtWidth");
    if (txtWidth.value != "") {
        if (!txtWidth.value.match(numberRegex)) {
            inlineMsg('ctl00_ContentPlaceHolder1_txtWidth', 'You have entered an invalid width.', 2);

            return false;
        }
    }

    var txtWidth1 = document.getElementById("ctl00_ContentPlaceHolder1_txtWidth1");
    if (txtWidth1.value != "") {
        if (!txtWidth1.value.match(numberRegex)) {
            inlineMsg('ctl00_ContentPlaceHolder1_txtWidth1', 'You have entered an invalid width.', 2);

            return false;
        }
    }

    

    var txtDepth = document.getElementById("ctl00_ContentPlaceHolder1_txtDepth");
    if (txtDepth.value != "") {
        if (!txtDepth.value.match(numberRegex)) {
            inlineMsg('ctl00_ContentPlaceHolder1_txtDepth', 'You have entered an invalid depth.', 2);

            return false;
        }
    }

    var txtDepth1 = document.getElementById("ctl00_ContentPlaceHolder1_txtDepth1");
    if (txtDepth1.value != "") {
        if (!txtDepth1.value.match(numberRegex)) {
            inlineMsg('ctl00_ContentPlaceHolder1_txtDepth1', 'You have entered an invalid depth.', 2);

            return false;
        }
    }


    

    if (txtDepth1.value != "" && txtDepth.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtDepth', 'Please enter depth.', 2);
        return false;
    }
    if (txtDepth.value != "" && txtDepth1.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtDepth1', 'Please enter depth.', 2);
        return false;
    }

    if (txtWidth1.value != "" && txtWidth.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtWidth', 'Please enter width.', 2);
        return false;
    }
    if (txtWidth.value != "" && txtWidth1.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtWidth1', 'Please enter width.', 2);
        return false;
    }
    
   
    var intWidth=parseInt(txtWidth.value);
    var intWidth1=parseInt(txtWidth1.value);
    var intDepth=parseInt(txtDepth.value);
    var intDepth1 = parseInt(txtDepth1.value);

    if (intWidth == 0) {
        inlineMsg('ctl00_ContentPlaceHolder1_txtWidth', 'Numerator should not be zero.', 2);
        return false;
    }

    if (intWidth1.value == 0) {
        inlineMsg('ctl00_ContentPlaceHolder1_txtWidth1', 'Denominator should not be zero.', 2);
        return false;
    }

    if (intDepth == 0) {
        inlineMsg('ctl00_ContentPlaceHolder1_txtDepth', 'Numerator should not be zero.', 2);
        return false;
    }

    if (intDepth1.value == 0) {
        inlineMsg('ctl00_ContentPlaceHolder1_txtDepth1', 'Denominator should not be zero.', 2);
        return false;
    }
    
   
    if(intWidth>=intWidth1)
    {
        inlineMsg('ctl00_ContentPlaceHolder1_txtWidth', 'Numerator should not be greater than denominator.', 2);
        return false;
    }
    if(intDepth>=intDepth1)
    {
        inlineMsg('ctl00_ContentPlaceHolder1_txtDepth', 'Numerator should not be greater than denominator.', 2);
        return false;
    }

    return true;

}
//Buyer create RFQ validation
function showNewRFQ() {
    var ddlQtyQuoted = document.getElementById("ctl00_ContentPlaceHolder1_ddlQtyQuoted");
    if (ddlQtyQuoted.value == "0") {
        inlineMsg('ctl00_ContentPlaceHolder1_ddlQtyQuoted', 'Please enter quantity to be quoted', 2);
        return false;
    }


    var txtDate = document.getElementById("ctl00_ContentPlaceHolder1_txtDate");
    if (txtDate.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtDate', 'Please enter date you want all quotes to be received.', 2);
        return false;
    }
   
    var txtDeliveryZip = document.getElementById("ctl00_ContentPlaceHolder1_txtDeliveryZip");
    if (txtDeliveryZip.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtDeliveryZip', 'Please enter delivery zip code.', 2);
        return false;
    }
}
//Buyer registration validation
function showBuyerRegistration() {
    var txtCompName = document.getElementById("ctl00_ContentPlaceHolder1_txtCompName");
    if (txtCompName.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtCompName', 'Please enter company name', 2);
        return false;
    }
    var txtContactName = document.getElementById("ctl00_ContentPlaceHolder1_txtContactName");
    if (txtContactName.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtContactName', 'Please enter contact name', 2);
        return false;
    }
    var txtBillStreet = document.getElementById("ctl00_ContentPlaceHolder1_txtBillStreet");
    if (txtBillStreet.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtBillStreet', 'Please enter street', 2);
        return false;
    }
    var txtBillCity = document.getElementById("ctl00_ContentPlaceHolder1_txtBillCity");
    if (txtBillCity.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtBillCity', 'Please enter city', 2);
        return false;
    }
    var ddlBillState = document.getElementById("ctl00_ContentPlaceHolder1_ddlBillState");
    if (ddlBillState.value == "0") {
        inlineMsg('ctl00_ContentPlaceHolder1_ddlBillState', 'Please select state', 2);
        return false;
    }
    var txtBillZipCode = document.getElementById("ctl00_ContentPlaceHolder1_txtBillZipCode");
    var zipRegex = /^\d{5}(-\d{4})?$/;
    if (txtBillZipCode.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtBillZipCode', 'Please enter zip code', 2);
        return false;
    }
    else if (!txtBillZipCode.value.match(zipRegex)) {
        inlineMsg('ctl00_ContentPlaceHolder1_txtBillZipCode', 'You have entered an invalid zip code', 2);
        return false;
    }

    var txtShipStreet = document.getElementById("ctl00_ContentPlaceHolder1_txtShipStreet");
    if (txtShipStreet.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtShipStreet', 'Please enter street', 2);
        return false;
    }
    var txtShipCity = document.getElementById("ctl00_ContentPlaceHolder1_txtShipCity");
    if (txtShipCity.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtShipCity', 'Please enter city', 2);
        return false;
    }
    var ddlShipState = document.getElementById("ctl00_ContentPlaceHolder1_ddlShipState");
    if (ddlBillState.value == "0") {
        inlineMsg('ctl00_ContentPlaceHolder1_ddlShipState', 'Please select state', 2);
        return false;
    }
    var txtShipZipCode = document.getElementById("ctl00_ContentPlaceHolder1_txtShipZipCode");
    var zipRegex = /^\d{5}(-\d{4})?$/;
    if (txtShipZipCode.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtShipZipCode', 'Please enter zip code', 2);
        return false;
    }
    else if (!txtShipZipCode.value.match(zipRegex)) {
        inlineMsg('ctl00_ContentPlaceHolder1_txtShipZipCode', 'You have entered an invalid zip code', 2);
        return false;
    }
    var txtBillPhone = document.getElementById("ctl00_ContentPlaceHolder1_txtBillPhone");
//    var phoneRegex = /^[0-9]\d{2}-\d{3}-\d{4}$/;
    //    var phoneRegex = /^\([1-9]\d{2}\)\s?\d{3}\-\d{4}$/;
    var phoneRegex = /^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/;
    if (txtBillPhone.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtBillPhone', 'Please enter phone number', 2);
        return false;
    }
    else if (!txtBillPhone.value.match(phoneRegex)) {
        inlineMsg('ctl00_ContentPlaceHolder1_txtBillPhone', 'You have entered an invalid phone number', 2);
        return false;
    }
    var txtBillEmailAddr = document.getElementById("ctl00_ContentPlaceHolder1_txtBillEmailAddr");
    var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
    if (txtBillEmailAddr.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtBillEmailAddr', 'Please enter email address', 2);
        return false;
    }
    else if (!txtBillEmailAddr.value.match(emailRegex)) {
        inlineMsg('ctl00_ContentPlaceHolder1_txtBillEmailAddr', 'You have entered an invalid email address', 2);
        return false;
    }
    var txtUserName = document.getElementById("ctl00_ContentPlaceHolder1_txtUserName");
    var nameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
    if (txtUserName.value == "") {

        inlineMsg('ctl00_ContentPlaceHolder1_txtUserName', 'Please enter username.', 2);
        return false;
    }

    var txtPassword = document.getElementById("ctl00_ContentPlaceHolder1_txtPassword");

    if (txtPassword.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtPassword', 'Please enter password.', 2);
        return false;
    }

    var txtConfirmPassword = document.getElementById("ctl00_ContentPlaceHolder1_txtConfirmPassword");

    if (txtPassword.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtConfirmPassword', 'Please enter confirm password.', 2);
        return false;
    }


    if (txtPassword.value != txtConfirmPassword.value) {
        inlineMsg('ctl00_ContentPlaceHolder1_txtConfirmPassword', 'Password and confirm password should be same.', 2);
        return false;
    }


}
//Buyer Account information
function showBuyerInformation() {
    var txtCompName = document.getElementById("ctl00_ContentPlaceHolder1_txtCompName");
    if (txtCompName.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtCompName', 'Please enter company name', 2);
        return false;
    }
    var txtContactName = document.getElementById("ctl00_ContentPlaceHolder1_txtContactName");
    if (txtContactName.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtContactName', 'Please enter contact name', 2);
        return false;
    }
    var txtBillStreet = document.getElementById("ctl00_ContentPlaceHolder1_txtBillStreet");
    if (txtBillStreet.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtBillStreet', 'Please enter street', 2);
        return false;
    }
    var txtBillCity = document.getElementById("ctl00_ContentPlaceHolder1_txtBillCity");
    if (txtBillCity.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtBillCity', 'Please enter city', 2);
        return false;
    }
    var ddlBillState = document.getElementById("ctl00_ContentPlaceHolder1_ddlBillState");
    if (ddlBillState.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_ddlBillState', 'Please select state', 2);
        return false;
    }
    var txtBillZipCode = document.getElementById("ctl00_ContentPlaceHolder1_txtBillZipCode");
    var zipRegex = /^\d{5}(-\d{4})?$/;
    if (txtBillZipCode.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtBillZipCode', 'Please enter zip code', 2);
        return false;
    }
    else if (!txtBillZipCode.value.match(zipRegex)) {
        inlineMsg('ctl00_ContentPlaceHolder1_txtBillZipCode', 'You have entered an invalid zip code', 2);
        return false;
    }

    var txtShipStreet = document.getElementById("ctl00_ContentPlaceHolder1_txtShipStreet");
    if (txtShipStreet.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtShipStreet', 'Please enter street', 2);
        return false;
    }
    var txtShipCity = document.getElementById("ctl00_ContentPlaceHolder1_txtShipCity");
    if (txtShipCity.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtShipCity', 'Please enter city', 2);
        return false;
    }
    var ddlShipState = document.getElementById("ctl00_ContentPlaceHolder1_ddlShipState");
    if (ddlBillState.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_ddlShipState', 'Please select state', 2);
        return false;
    }
    var txtShipZipCode = document.getElementById("ctl00_ContentPlaceHolder1_txtShipZipCode");
    var zipRegex = /^\d{5}(-\d{4})?$/;
    if (txtShipZipCode.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtShipZipCode', 'Please enter zip code', 2);
        return false;
    }
    else if (!txtShipZipCode.value.match(zipRegex)) {
        inlineMsg('ctl00_ContentPlaceHolder1_txtShipZipCode', 'You have entered an invalid zip code', 2);
        return false;
    }
    var txtBillPhone = document.getElementById("ctl00_ContentPlaceHolder1_txtBillPhone");
    //    var phoneRegex = /^[0-9]\d{2}-\d{3}-\d{4}$/;
//    var phoneRegex = /^\([1-9]\d{2}\)\s?\d{3}\-\d{4}$/;
    var phoneRegex = /^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/;
    if (txtBillPhone.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtBillPhone', 'Please enter phone number', 2);
        return false;
    }
    else if (!txtBillPhone.value.match(phoneRegex)) {
        inlineMsg('ctl00_ContentPlaceHolder1_txtBillPhone', 'You have entered an invalid phone number', 2);
        return false;
    }
    var txtBillEmailAddr = document.getElementById("ctl00_ContentPlaceHolder1_txtBillEmailAddr");
    var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
    if (txtBillEmailAddr.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtBillEmailAddr', 'Please enter email address', 2);
        return false;
    }
    else if (!txtBillEmailAddr.value.match(emailRegex)) {
        inlineMsg('ctl00_ContentPlaceHolder1_txtBillEmailAddr', 'You have entered an invalid email address', 2);
        return false;
    }
    var txtUserName = document.getElementById("ctl00_ContentPlaceHolder1_txtUserName");
//    var nameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
    if (txtUserName.value == "") {

        inlineMsg('ctl00_ContentPlaceHolder1_txtUserName', 'Please enter username.', 2);
        return false;
    }
//    else if (!txtUserName.value.match(nameRegex)) {
//        inlineMsg('ctl00_ContentPlaceHolder1_txtUserName', 'You have entered an invalid username.', 2);
//        return false;
//    }
    var txtPassword = document.getElementById("ctl00_ContentPlaceHolder1_txtPassword");
    if (txtPassword.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtPassword', 'Please enter password.', 2);
        return false;
    }
}
//Manufacturer Side Validation....done by Mona.

function loginValidation() {

    var txtLoginName = document.getElementById("ctl00_txtLoginName");

    var txtLoginPassword = document.getElementById("ctl00_txtLoginPassword");
    var nameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
    var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
    var namenumberRegex = /([a-zA-Z0-9]{6})/;
    if (txtLoginName.value == "") {
        inlineMsg('ctl00_txtLoginName', 'Please enter user name .', 2);
        return false;
    }

    if (txtLoginPassword.value == "") {
        inlineMsg('ctl00_txtLoginPassword', 'Please enter password.', 2);
        return false;
    }


    // return true;
}



function ManuHomeLoginValidation() {
    var txtManufacturerName = document.getElementById("ctl00_txtManufacturerName");

    var txtManufacturerPassword = document.getElementById("ctl00_txtManufacturerPassword");
    var nameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
    var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
    var namenumberRegex = /([a-zA-Z0-9]{6})/;
    if (txtManufacturerName.value == "") {
        inlineMsg('ctl00_txtManufacturerName', 'Please enter user name.', 2);
        return false;
    }

    if (txtManufacturerPassword.value == "") {
        inlineMsg('ctl00_txtManufacturerPassword', 'Please enter password.', 2);
        return false;
    }


    // return true;
}

//for manufacturer login and buyer login in post rfq page

function manufacturerLoginValidation() {

    var txtLoginName = document.getElementById("ctl00_ContentPlaceHolder1_txtLoginName");

    var txtLoginPassword = document.getElementById("ctl00_ContentPlaceHolder1_txtLoginPassword");
    var nameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
    var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
    var namenumberRegex = /([a-zA-Z0-9]{6})/;
    if (txtLoginName.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtLoginName', 'Please enter user name.', 2);
        return false;
    }

    if (txtLoginPassword.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtLoginPassword', 'Please enter password.', 2);
        return false;
    }


    // return true;
}


//for manufacturer in post rfq page

function postRFQManuLoginValidation() {

    var txtManufacturerName = document.getElementById("ctl00_ContentPlaceHolder1_txtManufacturerName");

    var txtManufacturerPassword = document.getElementById("ctl00_ContentPlaceHolder1_txtManufacturerPassword");
    var nameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
    var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
    var namenumberRegex = /([a-zA-Z0-9]{6})/;
    if (txtManufacturerName.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtManufacturerName', 'Please enter user name.', 2);
        return false;
    }

    if (txtManufacturerPassword.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtManufacturerPassword', 'Please enter password.', 2);
        return false;
    }


    // return true;
}

//for manufacturer subscriptionDetail

function subscriptionDetailValidation() {

    var ddlSubscription = document.getElementById("ctl00_ContentPlaceHolder1_ddlSubscription");

    if (ddlSubscription.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_ddlSubscription', 'Please select subscription option', 2);
        return false;
    }


    // return true;
}


//Manufacturer's forgot password validation

function forgotPasswordValidation() {

    var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
    var txtEmailId = document.getElementById("ctl00_ContentPlaceHolder1_txtEmailId");

    if (txtEmailId.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtEmailId', 'Please enter email address.', 2);
        return false;
    }
    else if (!txtEmailId.value.match(emailRegex)) {
        inlineMsg('ctl00_ContentPlaceHolder1_txtEmailId', 'You have entered an invalid email address.', 2);
        return false;
    }

}

//Manufacturer's Registration validation

function manufacturerRegistrationValidation() {

    var retValue = true;
    var zipRegex = /^\d{5}(-\d{4})?$/;
    //    var phoneRegex = /^\(?(\d{3})\)?[- ]?(\d{3})[- ]?(\d{4})$/;
    //    var phoneRegex = /^\([1-9]\d{2}\)\s?\d{3}\-\d{4}$/;
    var phoneRegex = /^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/;
    var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;

    var txtCompanyName = document.getElementById("ctl00_ContentPlaceHolder1_txtCompanyName");
    var txtContactName = document.getElementById("ctl00_ContentPlaceHolder1_txtContactName");

    var txtStreet = document.getElementById("ctl00_ContentPlaceHolder1_txtStreet");
    var txtCity = document.getElementById("ctl00_ContentPlaceHolder1_txtCity");
    var selectState = document.getElementById("ctl00_ContentPlaceHolder1_ddlState");
    var txtZipCode = document.getElementById("ctl00_ContentPlaceHolder1_txtZipCode");
    var txtPhone = document.getElementById("ctl00_ContentPlaceHolder1_txtPhone");
    var txtEmailAddr = document.getElementById("ctl00_ContentPlaceHolder1_txtEmailAddr");
    
    var txtUsername = document.getElementById("ctl00_ContentPlaceHolder1_txtUsername");
    var txtPassword = document.getElementById("ctl00_ContentPlaceHolder1_txtPassword");
    var txtConfirmPassword = document.getElementById("ctl00_ContentPlaceHolder1_txtConfirmPassword");
    var namenumberRegex = /([a-zA-Z0-9]{7})/;
  
    var numberRegex = /([0-9]+)/;


    if (txtCompanyName.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtCompanyName', 'Please enter company name .', 2);
        return false;

    }

    if (txtContactName.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtContactName', 'Please enter contact name .', 2);
        return false;
    }
    if (txtStreet.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtStreet', 'Please enter street.', 2);
        return false;
    }


    if (txtCity.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtCity', 'Please enter city.', 2);
        return false;
    }
    if (selectState.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_ddlState', 'Please select state.', 2);
        return false;
    }
    if (txtZipCode.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtZipCode', 'Please enter zip code.', 2);
        return false;
    }

    else if (!txtZipCode.value.match(zipRegex)) {
        inlineMsg('ctl00_ContentPlaceHolder1_txtZipCode', 'Please enter valid zip code.', 2);
        return false;
    }
    if (txtPhone.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtPhone', 'Please enter phone number .', 2);
        return false;
    }

    else if (!txtPhone.value.match(phoneRegex)) {
        inlineMsg('ctl00_ContentPlaceHolder1_txtPhone', 'You have entered an invalid phone number.', 2);
        return false;
    }
    if (txtEmailAddr.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtEmailAddr', 'Please enter email address .', 2);
        return false;
    }

    else if (!txtEmailAddr.value.match(emailRegex)) {
        inlineMsg('ctl00_ContentPlaceHolder1_txtEmailAddr', 'You have entered an invalid email.', 2);
        return false;
    }


    if (txtUsername.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtUsername', 'Please enter user name .', 2);
        return false;
    }
    if (txtPassword.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtPassword', 'Please enter password .', 2);
        return false;
    }
    else if (!txtPassword.value.match(namenumberRegex)) {
    inlineMsg('ctl00_ContentPlaceHolder1_txtPassword', 'Password should be atleast 7 characters.', 2);
    return false;
    }
    // Confirm Password
    if (txtConfirmPassword.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtConfirmPassword', 'Please enter confirm password.', 2);
        return false;
    }

    if (!txtPassword.value.match(txtConfirmPassword.value)) {

        inlineMsg('ctl00_ContentPlaceHolder1_txtConfirmPassword', 'Entered password and confirm password must be same.', 2);
        return false;
    }
    inlineMsg('ctl00_ContentPlaceHolder1_txtWebAddr', 'Buyers will visit your website - should be included.', 2);
    return true;

}
//Manufacturer's do direct payment validations.
function PaymentValidation() {
    var txtFirstName = document.getElementById("ctl00_ContentPlaceHolder1_txtFirstname");
    var txtLastName = document.getElementById("ctl00_ContentPlaceHolder1_txtLastName");
    var drpCardType = document.getElementById("ctl00_ContentPlaceHolder1_ddlCardType");
    var drpMonth = document.getElementById("ctl00_ContentPlaceHolder1_monthDropDown");
    var drpYear = document.getElementById("ctl00_ContentPlaceHolder1_yearDropDown");
    var txtCreditCardNumber = document.getElementById("ctl00_ContentPlaceHolder1_txtCreditCardNumber");    
    var txtCVV = document.getElementById("ctl00_ContentPlaceHolder1_txtCVV");
    var txtCity = document.getElementById("ctl00_ContentPlaceHolder1_txtCity");
    var txtZip = document.getElementById("ctl00_ContentPlaceHolder1_txtZip");
    var txtAmount = document.getElementById("ctl00_ContentPlaceHolder1_txtAmount");

    var nameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
    var zipRegex = /^\d{5}(-\d{4})?$/;
    var numberRegex = /([0-9]+)/;

    if (txtFirstName.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtFirstname', 'Please enter your first name.', 2);
        return false;
    }
    if (!txtFirstName.value.match(nameRegex)) {
        inlineMsg('ctl00_ContentPlaceHolder1_txtFirstname', 'You have entered an invalid first name.', 2);
        return false;
    }
    if (txtLastName.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtLastName', 'Please enter your last name.', 2);
        return false;
    }
    if (!txtLastName.value.match(nameRegex)) {
        inlineMsg('ctl00_ContentPlaceHolder1_txtLastName', 'You have entered an invalid last name.', 2);
        return false;
    }
//    if(drpCardType
    if (drpCardType.value == "0") {
        inlineMsg('ctl00_ContentPlaceHolder1_ddlCardType', 'Please select your card type.', 2);

        return false;
    }

    if (txtCreditCardNumber.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtCreditCardNumber', 'Please enter your credit card number.', 2);
        return false;
    }
    if (!txtCreditCardNumber.value.match(numberRegex)) {
        inlineMsg('ctl00_ContentPlaceHolder1_txtCreditCardNumber', 'You have entered an invalid credit card number.', 2);
        return false;
    }
    if (drpMonth.value == "0") {
        inlineMsg('ctl00_ContentPlaceHolder1_monthDropDown', 'Please select month of expiry.', 2);

        return false;
    }
    if (drpYear.value == "0") {
        inlineMsg('ctl00_ContentPlaceHolder1_yearDropDown', 'Please select year of expiry.', 2);

        return false;
    }
    if (txtCVV.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtCVV', 'Please enter your card verification value.', 2);
        return false;
    }
    if (!txtCVV.value.match(numberRegex)) {
        inlineMsg('ctl00_ContentPlaceHolder1_txtCVV', 'You have entered an invalid card verification value.', 2);
        return false;
    }
    if (txtCity.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtCity', 'Please enter city.', 2);
        return false;
    }
    if (!txtCity.value.match(nameRegex)) {
        inlineMsg('ctl00_ContentPlaceHolder1_txtCity', 'You have entered an invalid city name.', 2);
        return false;
    }

    if (txtZip.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtZip', 'Please enter zip code.', 2);
        return false;
    }
    else if (!txtZip.value.match(zipRegex)) {
    inlineMsg('ctl00_ContentPlaceHolder1_txtZip', 'Please enter valid zip code.', 2);
        return false;
    }

    if (txtAmount.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtAmount', 'Please enter amount.', 2);
        return false;
    }
    else if (!txtAmount.value.match(numberRegex)) {
    inlineMsg('ctl00_ContentPlaceHolder1_txtAmount', 'Please enter valid amount.', 2);
        return false;
    }
}

//End of manufacturer's functions
//Administrator
//Validation for search by in Admin-BuyerManagement
function showBuyerSearch() {

    var txtSearch = document.getElementById("ctl00_ContentPlaceHolder1_txtSearch");
    var drpSearchBy = document.getElementById("ctl00_ContentPlaceHolder1_drpSearchBy");

    if (drpSearchBy.value == "0") {
        inlineMsg('ctl00_ContentPlaceHolder1_drpSearchBy', 'Please select search by.', 2);
        return false;
    }
    else if (txtSearch.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtSearch', 'Please enter the value to search.', 2);
        return false;
    }
    return true;
}
//End of Administrator part
/*Previous functions*/
function ForgotPasswordMessage() {

    var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
    var txtUserName = document.getElementById("ctl00_ContentPlaceHolder1_txtEmailAdd");
    var nameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
    if (txtUserName.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtEmailAdd', 'Please enter email address.', 2);
        return false;
    }
    else if (!txtUserName.value.match(emailRegex)) {
        inlineMsg('ctl00_ContentPlaceHolder1_txtEmailAdd', 'You have entered an invalid email address.', 2);
        return false;
    }
    return true;
}







function errorChangePassword() {
    var txtOldPassword = document.getElementById("ctl00_ContentPlaceHolder1_txtOldPassword").value;
    var txtNewPassword = document.getElementById("ctl00_ContentPlaceHolder1_txtNewPassword").value;
    var txtConfirmPassword = document.getElementById("ctl00_ContentPlaceHolder1_txtConfirmPassword").value;


    var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;

    var messageRegex = new RegExp(/<\/?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)\/?>/gim);
    var numberRegex = /([0-9]+)/;


    // Old Password
    if (txtOldPassword == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtOldPassword', 'please enter your current password.', 2);
        return false;
    }

    // New Password
    if (txtNewPassword == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtNewPassword', 'Please enter your new password.', 2);
        return false;
    }

    // Confirm Password
    if (txtConfirmPassword == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtConfirmPassword', 'Please enter your re-type password.', 2);
        return false;
    }

    if (!txtNewPassword.match(txtConfirmPassword)) {

        inlineMsg('ctl00_ContentPlaceHolder1_txtConfirmPassword', 'Please enter re-type  and new passwords same.', 2);
        return false;
    }

}





var dtCh = "/";
var minYear = 1900;
var maxYear = 2100;

function isInteger(s) {
    var i;
    for (i = 0; i < s.length; i++) {
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}


function checkdate(input) {
    var validformat = /^\d{4}\/\d{2}\/\d{2}$/ //Basic check for format validity
    var returnval = false
    if (validformat.test(input.value)) {
        alert("Invalid Date Format. Please correct and submit again.")
        return false;
    }
    else {
        //Detailed check for valid date ranges
        var yearfield = input.value.split("/")[0]
        var monthfield = input.value.split("/")[1]
        var dayfield = input.value.split("/")[2]
        var dayobj = new Date(yearfield, monthfield - 1, dayfield)
        if ((dayobj.getMonth() + 1 != monthfield) || (dayobj.getDate() != dayfield) || (dayobj.getFullYear() != yearfield))
            alert("Invalid Day, Month, or Year range detected. Please correct and submit again.")
        else
            returnval = true
    }
    if (returnval == false) input.select()
    return returnval
}





/*AJ*/

// form validation function //
function validate_PasswordReset() {


    var txtEmailAddress = document.getElementById("ctl00_MainContent_txtEmailAddress").value;

    var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;

    var messageRegex = new RegExp(/<\/?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)\/?>/gim);
    var numberRegex = /([0-9]+)/;


    // CONTACT EMAIL
    if (txtEmailAddress == "") {
        inlineMsg('ctl00_MainContent_txtEmailAddress', 'You must enter your email.', 2);
        return false;
    }
    if (!txtEmailAddress.match(emailRegex)) {
        inlineMsg('ctl00_MainContent_txtEmailAddress', 'You have entered an invalid email.', 2);
        return false;
    }

    // END
    return true;
}

//validate_ForgetPassword


// form validation function //
function validate_ForgetPassword() {

    var email = document.getElementById("ctl00_MainContent_email").value;
    var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
    // CONTACT EMAIL
    if (email == "") {
        inlineMsg('ctl00_MainContent_email', 'You must enter your email.', 2);
        return false;
    }
    if (!email.match(emailRegex)) {
        inlineMsg('ctl00_MainContent_email', 'You have entered an invalid email.', 2);
        return false;
    }

    return true;
}





// form validation function //
function validate_ChangePassword() {


    var txtOldPassword = document.getElementById("ctl00_MainContent_txtOldPassword").value;
    var txtNewPassword = document.getElementById("ctl00_MainContent_txtNewPassword").value;
    var txtConfirmPassword = document.getElementById("ctl00_MainContent_txtConfirmPassword").value;


    var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;

    var messageRegex = new RegExp(/<\/?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)\/?>/gim);
    var numberRegex = /([0-9]+)/;


    // Old Password
    if (txtOldPassword == "") {
        inlineMsg('ctl00_MainContent_txtOldPassword', 'You must enter your Old Password.', 2);
        return false;
    }

    // New Password
    if (txtNewPassword == "") {
        inlineMsg('ctl00_MainContent_txtNewPassword', 'You must enter your New Password.', 2);
        return false;
    }

    // Confirm Password
    if (txtConfirmPassword == "") {
        inlineMsg('ctl00_MainContent_txtConfirmPassword', 'You must enter your Confirm Password.', 2);
        return false;
    }

    if (!txtNewPassword.match(txtConfirmPassword)) {
        inlineMsg('ctl00_MainContent_txtNewPassword', 'You must enter Confirm and new passwords same.', 2);
        return false;
    }

    //  if(!txtConfirmPassword.match(txtNewPassword)) {
    //    inlineMsg('txtConfirmPassword','You must enter Confirm and new passwords same.',2);
    //    return false;
    //  }



    //  if(!txtEmailAddress.match(emailRegex)) {
    //    inlineMsg('txtEmailAddress','You have entered an invalid email.',2);
    //    return false;
    //  }

    // END
    return true;
}
/*AJ*/

// START OF MESSAGE SCRIPT //

var MSGTIMER = 30;
var MSGSPEED = 5;
var MSGOFFSET = 3;
var MSGHIDE = 3;

// build out the divs, set attributes and call the fade function //
function inlineMsg(target, string, autohide) {
    var msg;
    var msgcontent;
    if (!document.getElementById('msg')) {

        msg = document.createElement('div');
        msg.id = 'msg';
        msg.nowrap = "nowrap";
        msg.setAttribute("WIDTH", "500PX");
        msgcontent = document.createElement('div');
        msgcontent.id = 'msgcontent';

        document.body.appendChild(msg);
        msg.appendChild(msgcontent);
        msg.style.filter = 'alpha(opacity=0)';
        msg.style.opacity = 0;

        msg.alpha = 0;

    } else {

        msg = document.getElementById('msg');
        msgcontent = document.getElementById('msgcontent');
    }
    msgcontent.innerHTML = string;
    msg.style.display = 'block';
    var msgheight = msg.offsetHeight;

    var targetdiv = document.getElementById(target);


    targetdiv.focus();
    var targetheight = targetdiv.offsetHeight;
    var targetwidth = targetdiv.offsetWidth;
    var topposition = topPosition(targetdiv) - ((msgheight - targetheight) / 2);
    var leftposition = leftPosition(targetdiv) + targetwidth + MSGOFFSET;
    msg.style.top = topposition + 'px';
    msg.style.left = leftposition + 'px';
    clearInterval(msg.timer);
    msg.timer = setInterval("fadeMsg(1)", MSGTIMER);
    if (!autohide) {
        autohide = MSGHIDE;
    }
    window.setTimeout("hideMsg()", (autohide * 1000));
}

// hide the form alert //
function hideMsg(msg) {
    var msg = document.getElementById('msg');
    if (!msg.timer) {
        msg.timer = setInterval("fadeMsg(0)", MSGTIMER);
    }
}

// face the message box //
function fadeMsg(flag) {
    if (flag == null) {
        flag = 1;
    }
    var msg = document.getElementById('msg');
    var value;
    if (flag == 1) {
        value = msg.alpha + MSGSPEED;
    } else {
        value = msg.alpha - MSGSPEED;
    }
    msg.alpha = value;
    msg.style.opacity = (value / 100);
    msg.style.filter = 'alpha(opacity=' + value + ')';
    if (value >= 99) {
        clearInterval(msg.timer);
        msg.timer = null;
    } else if (value <= 1) {
        msg.style.display = "none";
        clearInterval(msg.timer);
    }
}

// calculate the position of the element in relation to the left of the browser //
function leftPosition(target) {
    var left = 0;
    if (target.offsetParent) {
        while (1) {
            left += target.offsetLeft;
            if (!target.offsetParent) {
                break;
            }
            target = target.offsetParent;
        }
    } else if (target.x) {
        left += target.x;
    }
    return left;
}

// calculate the position of the element in relation to the top of the browser window //
function topPosition(target) {
    var top = 0;
    if (target.offsetParent) {
        while (1) {
            top += target.offsetTop;
            if (!target.offsetParent) {
                break;
            }
            target = target.offsetParent;
        }
    } else if (target.y) {
        top += target.y;
    }
    return top;
}

// preload the arrow //
if (document.images) {
    arrow = new Image(7, 80);
    arrow.src = "msg_arrow.gif";
}


function TransactionDateValidation() {


    var rdDate = document.getElementById("ctl00_ContentPlaceHolder1_rdodate").checked;
    var rdDateRange = document.getElementById("ctl00_ContentPlaceHolder1_rdoDateRangeTo").checked;
    var fromDate = document.getElementById("ctl00_ContentPlaceHolder1_txtDateRangeFrom").value;
    var toDate = document.getElementById("ctl00_ContentPlaceHolder1_txtDateRangeTo").value;
    if (rdDate == false && rdDateRange == false) {
        inlineMsg('ctl00_ContentPlaceHolder1_rdodate', 'Please select atleast one radio button', 2);
        return false;
    }

    if (rdDateRange == true) {
        if (fromDate == "") {
            inlineMsg('ctl00_ContentPlaceHolder1_txtDateRangeFrom', 'Please enter from date', 2);
            return false;
        }
        else if (toDate == "") {
            inlineMsg('ctl00_ContentPlaceHolder1_txtDateRangeTo', 'Please enter to date', 2);
            return false;
        }
    }
    //return true ;
}





function showAdminHomeMsg() {

    var txtSearch = document.getElementById("ctl00_ContentPlaceHolder1_txtSearch");
    var drpSearch = document.getElementById("ctl00_ContentPlaceHolder1_drpSearch");
    if (drpSearch.value == "0") {
        inlineMsg('ctl00_ContentPlaceHolder1_drpSearch', 'Please select search by.', 2);
        return false;
    }
    else if (txtSearch.value == "") {

        inlineMsg('ctl00_ContentPlaceHolder1_txtSearch', 'Please enter the value to search.', 2);
        return false;
    }


    return true;
}

function showAdminHomeMsg1() {

    var txtSearchOrd = document.getElementById("ctl00_ContentPlaceHolder1_txtSearchOrd");
    var drpSearchOrd = document.getElementById("ctl00_ContentPlaceHolder1_drpSearchOrd");
    if (drpSearchOrd.value == "0") {
        inlineMsg('ctl00_ContentPlaceHolder1_drpSearchOrd', 'Please select search by.', 2);
        return false;
    }
    else if (txtSearchOrd.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtSearchOrd', 'Please enter the value to search.', 2);
        return false;
    }

    return true;
}



function showOrderSearch() {

    var txtSearchOrd = document.getElementById("ctl00_ContentPlaceHolder1_txtSearch");
    var drpSearchOrd = document.getElementById("ctl00_ContentPlaceHolder1_drpSearchBy");

    if (drpSearchOrd.value == "0") {
        inlineMsg('ctl00_ContentPlaceHolder1_drpSearchBy', 'Please select search by.', 2);
        return false;
    }
    else if (txtSearchOrd.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtSearch', 'Please enter the value to search.', 2);
        return false;
    }
    return true;
}





function showEditUserMsg() {


    var drpBrand = document.getElementById("ctl00_ContentPlaceHolder1_drpBrand");


    if (drpBrand.value == "0") {
        inlineMsg('ctl00_ContentPlaceHolder1_drpBrand', 'Please select brand.', 2);
        return false;
    }
    return true;
}

function showCustomerSearch() {

    var txtSearchCust = document.getElementById("ctl00_ContentPlaceHolder1_txtSearch");
    var drpSearchCust = document.getElementById("ctl00_ContentPlaceHolder1_drpSearchBy");
    if (drpSearchCust.value == "0") {
        inlineMsg('ctl00_ContentPlaceHolder1_drpSearchBy', 'Please select search by.', 2);
        return false;
    }
    else if (txtSearchCust.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtSearch', 'Please enter the value to search.', 2);
        return false;
    }
    return true;
}




//sheetal

function showMessageLoginUser() {

    var txtLoginId = document.getElementById("ctl00_ContentPlaceHolder2_txtLoginId");
    var namenumberRegex = /([a-zA-Z0-9]{6})/;
    var txtPassword = document.getElementById("ctl00_ContentPlaceHolder2_txtPassword");
    var nameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
    var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;

    if (txtLoginId.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder2_txtLoginId', 'Please enter login id.', 2);
        return false;
    }
    else if (!txtLoginId.value.match(emailRegex)) {
        inlineMsg('ctl00_ContentPlaceHolder2_txtLoginId', 'You have entered an invalid login id.', 2);
        return false;
    }
    if (txtPassword.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder2_txtPassword', 'Please enter password.', 2);
        return false;
    }
    else if (!txtPassword.value.match(namenumberRegex)) {
        inlineMsg('ctl00_ContentPlaceHolder2_txtPassword', 'Password should be atleast 6 characters.', 2);

        return false;
    }
    return true;
}

function userForgotPasswordMessage() {
    var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
    var txtEmailId = document.getElementById("ctl00_ContentPlaceHolder2_txtEmailId");
    var nameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
    if (txtEmailId.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder2_txtEmailId', 'Please enter email address.', 2);
        return false;
    }
    else if (!txtEmailId.value.match(emailRegex)) {
        inlineMsg('ctl00_ContentPlaceHolder2_txtEmailId', 'You have entered an invalid email address.', 2);
        return false;
    }
    return true;
}


function validateRegistration() {

    var retValue = true;
    var txtFirstNm = document.getElementById("ctl00_ContentPlaceHolder2_txtFirstNm").value;
    var txtLastNm = document.getElementById("ctl00_ContentPlaceHolder2_txtLastNm").value;
    var txtUserNm = document.getElementById("ctl00_ContentPlaceHolder2_txtUserNm").value;
    var txtPassword = document.getElementById("ctl00_ContentPlaceHolder2_txtPassword").value;
    var txtRetypePassword = document.getElementById("ctl00_ContentPlaceHolder2_txtRetypePassword").value;
    var txtAddress = document.getElementById("ctl00_ContentPlaceHolder2_txtAddress").value;
    var txtCity = document.getElementById("ctl00_ContentPlaceHolder2_txtCity").value;
    var drpState = document.getElementById("ctl00_ContentPlaceHolder2_drpState").value;
    var txtZipcode = document.getElementById("ctl00_ContentPlaceHolder2_txtZipcode").value;
    var txtPhoneNo = document.getElementById("ctl00_ContentPlaceHolder2_txtPhoneNo").value;




    var nameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
    var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
    var zipRegex = /^\d{5}(-\d{4})?$/;
    var phoneRegex = /^\(?(\d{3})\)?[- ]?(\d{3})[- ]?(\d{4})$/;
    var messageRegex = new RegExp(/<\/?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)\/?>/gim);
    var numberRegex = /([0-9]+)/;
    var namenumberRegex = /([a-zA-Z0-9]{6})/;



    if (txtFirstNm == "") {
        inlineMsg('ctl00_ContentPlaceHolder2_txtFirstNm', 'Please enter your first name.', 2);

        return false;
    }
    else if (!txtFirstNm.match(nameRegex)) {
        inlineMsg('ctl00_ContentPlaceHolder2_txtFirstNm', 'You have entered an invalid first name.', 2);

        return false;
    }

    if (txtLastNm == "") {
        inlineMsg('ctl00_ContentPlaceHolder2_txtLastNm', 'Please enter your last name.', 2);

        return false;
    }
    else if (!txtLastNm.match(nameRegex)) {
        inlineMsg('ctl00_ContentPlaceHolder2_txtLastNm', 'You have entered an invalid last name.', 2);

        return false;
    }
    if (txtUserNm == "") {
        inlineMsg('ctl00_ContentPlaceHolder2_txtUserNm', 'Please enter your username.', 2);

        return false;
    }
    else if (!txtUserNm.match(emailRegex)) {
        inlineMsg('ctl00_ContentPlaceHolder2_txtUserNm', 'You have entered an invalid username.', 2);
        return false;
    }

    if (txtPassword == "") {
        inlineMsg('ctl00_ContentPlaceHolder2_txtPassword', 'Please enter your password.', 2);
        return false;
    }

    else if (!txtPassword.match(namenumberRegex)) {
        inlineMsg('ctl00_ContentPlaceHolder2_txtPassword', 'Password should be atleast 6 characters.', 2);

        return false;
    }

    if (txtRetypePassword == "") {
        inlineMsg('ctl00_ContentPlaceHolder2_txtRetypePassword', 'Please enter your re-type password.', 2);
        return false;
    }

    if (!txtRetypePassword.match(txtPassword)) {
        inlineMsg('ctl00_ContentPlaceHolder2_txtRetypePassword', 'Please enter password and re-type password same.', 2);
        return false;
    }



    if (txtAddress == "") {
        inlineMsg('ctl00_ContentPlaceHolder2_txtAddress', 'Please enter your address1.', 2);

        return false;
    }


    if (txtCity == "") {
        inlineMsg('ctl00_ContentPlaceHolder2_txtCity', 'Please enter your city.', 2);

        return false;
    }
    else if (!txtCity.match(nameRegex)) {
        inlineMsg('ctl00_ContentPlaceHolder2_txtCity', 'You have entered an invalid city name.', 2);
        return false;
    }

    if (drpState == "Select State") {
        inlineMsg('ctl00_ContentPlaceHolder2_drpState', 'Please select your state.', 2);

        return false;
    }

    if (txtZipcode == "") {
        inlineMsg('ctl00_ContentPlaceHolder2_txtZipcode', 'Please enter your zipcode', 2);

        return false;
    }
    else if (!txtZipcode.match(zipRegex)) {
        inlineMsg('ctl00_ContentPlaceHolder2_txtZipcode', 'You have entered an invalid zip code.', 2);
        return false;
    }

    if (txtPhoneNo == "") {
        inlineMsg('ctl00_ContentPlaceHolder2_txtPhoneNo', 'Please enter your phone number.', 2);

        return false;
    }
    else if (!txtPhoneNo.match(phoneRegex)) {
        inlineMsg('ctl00_ContentPlaceHolder2_txtPhoneNo', 'You have entered an invalid phone number.', 2);
        return false;
    }


    return retValue;

}



function UpdateUserInformationMsg() {
    var retValue = true;
    var txtFirstNm = document.getElementById("ctl00_ContentPlaceHolder2_txtFirstNm").value;
    var txtLastNm = document.getElementById("ctl00_ContentPlaceHolder2_txtLastNm").value;
    var txtUserNm = document.getElementById("ctl00_ContentPlaceHolder2_txtUserNm").value;
    var txtAddress = document.getElementById("ctl00_ContentPlaceHolder2_txtAddress").value;
    var txtCity = document.getElementById("ctl00_ContentPlaceHolder2_txtCity").value;
    var drpState = document.getElementById("ctl00_ContentPlaceHolder2_drpState").value;
    var txtZipcode = document.getElementById("ctl00_ContentPlaceHolder2_txtZipcode").value;
    var txtPhoneNo = document.getElementById("ctl00_ContentPlaceHolder2_txtPhoneNo").value;




    var nameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
    var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
    var zipRegex = /^\d{5}(-\d{4})?$/;
    var phoneRegex = /^\(?(\d{3})\)?[- ]?(\d{3})[- ]?(\d{4})$/;
    var messageRegex = new RegExp(/<\/?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)\/?>/gim);
    var numberRegex = /([0-9]+)/;


    if (txtUserNm == "") {
        inlineMsg('ctl00_ContentPlaceHolder2_txtUserNm', 'Please enter your username.', 2);

        return false;
    }
    else if (!txtUserNm.match(emailRegex)) {
        inlineMsg('ctl00_ContentPlaceHolder2_txtUserNm', 'You have entered an invalid username.', 2);
        return false;
    }


    if (txtFirstNm == "") {
        inlineMsg('ctl00_ContentPlaceHolder2_txtFirstNm', 'Please enter your first name.', 2);

        return false;
    }
    else if (!txtFirstNm.match(nameRegex)) {
        inlineMsg('ctl00_ContentPlaceHolder2_txtFirstNm', 'You have entered an invalid first name.', 2);
        return false;
    }

    if (txtLastNm == "") {
        inlineMsg('ctl00_ContentPlaceHolder2_txtLastNm', 'Please enter your last name.', 2);

        return false;
    }
    else if (!txtLastNm.match(nameRegex)) {
        inlineMsg('ctl00_ContentPlaceHolder2_txtLastNm', 'You have entered an invalid last name.', 2);
        return false;
    }

    if (txtAddress == "") {
        inlineMsg('ctl00_ContentPlaceHolder2_txtAddress', 'Please enter your address.', 2);

        return false;
    }
    if (txtCity == "") {
        inlineMsg('ctl00_ContentPlaceHolder2_txtCity', 'Please enter your city.', 2);

        return false;
    }
    else if (!txtCity.match(nameRegex)) {
        inlineMsg('ctl00_ContentPlaceHolder2_txtCity', 'You have entered an invalid city name.', 2);
        return false;
    }

    if (drpState == "Select State") {
        inlineMsg('ctl00_ContentPlaceHolder2_drpState', 'Please select your state.', 2);

        return false;
    }

    if (txtZipcode == "") {
        inlineMsg('ctl00_ContentPlaceHolder2_txtZipcode', 'Please enter your zipcode', 2);

        return false;
    }
    else if (!txtZipcode.match(zipRegex)) {
        inlineMsg('ctl00_ContentPlaceHolder2_txtZipcode', 'You have entered an invalid zip code.', 2);
        return false;
    }

    if (txtPhoneNo == "") {
        inlineMsg('ctl00_ContentPlaceHolder2_txtPhoneNo', 'Please enter your phone number.', 2);

        return false;
    }
    else if (!txtPhoneNo.match(phoneRegex)) {
        inlineMsg('ctl00_ContentPlaceHolder2_txtPhoneNo', 'You have entered an invalid phone number.', 2);
        return false;
    }





    return retValue;

}



function userErrorChangePassword() {
    var txtCurrentPassword = document.getElementById("ctl00_ContentPlaceHolder2_txtCurrentPassword").value;
    var txtNewPassword = document.getElementById("ctl00_ContentPlaceHolder2_txtNewPassword").value;
    var txtRetypePassword = document.getElementById("ctl00_ContentPlaceHolder2_txtRetypePassword").value;


    var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;

    var messageRegex = new RegExp(/<\/?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)\/?>/gim);
    var numberRegex = /([0-9]+)/;
    var namenumberRegex = /([a-zA-Z0-9]{6})/;

    // Old Password
    if (txtCurrentPassword == "") {
        inlineMsg('ctl00_ContentPlaceHolder2_txtCurrentPassword', 'please enter your current password.', 2);
        return false;
    }

    else if (!txtCurrentPassword.match(namenumberRegex)) {

        inlineMsg('ctl00_ContentPlaceHolder2_txtCurrentPassword', 'Password should be atleast 6 characters.', 2);

        return false;
    }
    // New Password
    if (txtNewPassword == "") {
        inlineMsg('ctl00_ContentPlaceHolder2_txtNewPassword', 'Please enter your new password.', 2);
        return false;
    }
    else if (!txtNewPassword.match(namenumberRegex)) {
        inlineMsg('ctl00_ContentPlaceHolder2_txtNewPassword', 'Password should be atleast 6 characters.', 2);

        return false;
    }

    // Confirm Password
    if (txtRetypePassword == "") {
        inlineMsg('ctl00_ContentPlaceHolder2_txtRetypePassword', 'Please enter your re-type password.', 2);
        return false;
    }

    if (!txtNewPassword.match(txtRetypePassword)) {

        inlineMsg('ctl00_ContentPlaceHolder2_txtNewPassword', 'New password & re-type password should be same.', 2);
        return false;
    }

}


function showProductSearch() {

    var txtSearchPrd = document.getElementById("ctl00_ContentPlaceHolder2_txtSearch");

    var drpSearchBy = document.getElementById("ctl00_ContentPlaceHolder2_drpSearchBy");



    if (txtSearchPrd.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder2_txtSearch', 'Please enter the value to search.', 2);
        return false;
    }

    if (drpSearchBy.value == "0") {
        inlineMsg('ctl00_ContentPlaceHolder2_drpSearchBy', 'Please select the value to search.', 2);
        return false;
    }
    return true;
}
//////For admin searchRfq
function SearchRFQ() {

    var txtSearch = document.getElementById("ctl00_ContentPlaceHolder1_txtSearch");
    var drpSearchBy = document.getElementById("ctl00_ContentPlaceHolder1_drpSearchBy");

    if (drpSearchBy.value == "0") {
        inlineMsg('ctl00_ContentPlaceHolder1_drpSearchBy', 'Please select search by.', 2);
        return false;
    }
    else if (txtSearch.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtSearch', 'Please enter the value to search.', 2);
        return false;
    }
    return true;
}
///tell me more

function TellMeMore() {

    var retValue = true;
    var zipRegex = /^\d{5}(-\d{4})?$/;
    //    var phoneRegex = /^\(?(\d{3})\)?[- ]?(\d{3})[- ]?(\d{4})$/;
    //    var phoneRegex = /^\([1-9]\d{2}\)\s?\d{3}\-\d{4}$/;
    var phoneRegex = /^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/;
    var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;

    var txtName = document.getElementById("ctl00_ContentPlaceHolder1_txtName");
    var txtCompanyName = document.getElementById("ctl00_ContentPlaceHolder1_txtCompanyName");
    var txtEmailAddr = document.getElementById("ctl00_ContentPlaceHolder1_txtEmailAddr");
    var txtPhone = document.getElementById("ctl00_ContentPlaceHolder1_txtPhone");

   
  

     var namenumberRegex = /([a-zA-Z0-9]{7})/;

    var numberRegex = /([0-9]+)/;

    if (txtName.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtName', 'Please enter name .', 2);
        return false;
    }
    if (txtCompanyName.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtCompanyName', 'Please enter company name .', 2);
        return false;

    }
    if (txtEmailAddr.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtEmailAddr', 'Please enter email address .', 2);
        return false;
    }

    else if (!txtEmailAddr.value.match(emailRegex)) {
        inlineMsg('ctl00_ContentPlaceHolder1_txtEmailAddr', 'You have entered an invalid email.', 2);
        return false;
    }
    if (txtPhone.value == "") {
//        inlineMsg('ctl00_ContentPlaceHolder1_txtPhone', 'Please enter phone number .', 2);
        return true;
    }

    else if (!txtPhone.value.match(phoneRegex)) {
        inlineMsg('ctl00_ContentPlaceHolder1_txtPhone', 'You have entered an invalid phone number.', 2);
        return false;
    }
    
    
   
   
    return true;

}
///Sign Up now

function Signupnow() {

    var retValue = true;
    var zipRegex = /^\d{5}(-\d{4})?$/;
    //    var phoneRegex = /^\(?(\d{3})\)?[- ]?(\d{3})[- ]?(\d{4})$/;
    //    var phoneRegex = /^\([1-9]\d{2}\)\s?\d{3}\-\d{4}$/;
    var phoneRegex = /^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/;
    var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;

    var txtName = document.getElementById("ctl00_ContentPlaceHolder1_txtName");
    var txtCompanyName = document.getElementById("ctl00_ContentPlaceHolder1_txtCompanyName");
    var txtEmailAddr = document.getElementById("ctl00_ContentPlaceHolder1_txtEmailAddr");
    var txtPhone = document.getElementById("ctl00_ContentPlaceHolder1_txtPhone");
    var txtbeasttime = document.getElementById("ctl00_ContentPlaceHolder1_txtbeasttime");



    var namenumberRegex = /([a-zA-Z0-9]{7})/;

    var numberRegex = /([0-9]+)/;

    if (txtName.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtName', 'Please enter name .', 2);
        return false;
    }
    if (txtCompanyName.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtCompanyName', 'Please enter company name .', 2);
        return false;

    }
    if (txtPhone.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtPhone', 'Please enter phone number .', 2);
        return false;
    }

    else if (!txtPhone.value.match(phoneRegex)) {
        inlineMsg('ctl00_ContentPlaceHolder1_txtPhone', 'You have entered an invalid phone number.', 2);
        return false;
    }
    if (txtEmailAddr.value == "") {
        inlineMsg('ctl00_ContentPlaceHolder1_txtEmailAddr', 'Please enter email address .', 2);
        return false;
    }

    else if (!txtEmailAddr.value.match(emailRegex)) {
        inlineMsg('ctl00_ContentPlaceHolder1_txtEmailAddr', 'You have entered an invalid email.', 2);
        return false;
    }
    


   if (txtbeasttime.value == "") {
       inlineMsg('ctl00_ContentPlaceHolder1_txtbeasttime', 'Please enter Best time to call.', 2);
        return false;
    }

    return true;

}
