// Disable Right Click
/*function mousedown() {
return false;
}
function mouseup(e) {
if (e != null && e.type == "mouseup") {
if (e.which == 2 || e.which == 3) {
return false;
} 
} 
}
function contextMenu() {
return false;
}
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown = mousedown;
}
else {
document.onmouseup = mouseup;
}
document.oncontextmenu = contextMenu;
document.ondragstart = new Function("return false")
document.onselectstart = new Function("return false")
// Disable Right Click Ends
*/
function ajaxMTCaste(txtValue) {
    document.Form1.mtcaste.value = document.Form1.ddlcaste.value;
}
function ajaxFunctionMT() {
    var xmlHttp;
    document.Form1.ddlcaste.value = "";
    var id = document.Form1.ddlreligion.value;
    try {  // Firefox, Opera 8.0+, Safari  
        xmlHttp = new XMLHttpRequest();
    }
    catch (e) {  // Internet Explorer  
        try {
            xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e) {
            try {
                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e) {
                alert("Your browser does not support AJAX!");
                return false;
            }
        }
    }
  
    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4) {
            var content = xmlHttp.responseText;
            var cntParts = content.split("~");
            var ids = cntParts[1];
            var prdts = cntParts[0];

            var idList = ids.split(",");
            var prdtList = prdts.split(",");
            var i;
            document.getElementById("ddlcaste").options.length = 0;
            document.Form1.ddlcaste.options[0] = new Option("Select One", 0);
            for (i = 0; i < prdtList.length; i++) {
                document.Form1.ddlcaste.options[i + 1] = new Option(prdtList[i], idList[i]);
            }
        }
    }
    xmlHttp.open("GET", "entry.aspx?mtca=" + id, true);
    xmlHttp.send(null);
}


function ajaxMTDistrict() {
    document.Form1.mtdistrict.value = document.Form1.ddldistrict.value;
}

function ajaxFunctionDT() {
    var xmlHttp;
    document.Form1.ddldistrict.value = "";
    var id = document.Form1.ddlstate.value;
    document.Form1.mtstate.value = document.Form1.ddlstate.value;
    try {  // Firefox, Opera 8.0+, Safari  
        xmlHttp = new XMLHttpRequest();
    }
    catch (e) {  // Internet Explorer  
        try {
            xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e) {
            try {
                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e) {
                alert("Your browser does not support AJAX!");
                return false;
            }
        }
    }

    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4) {
            var content = xmlHttp.responseText;
            var cntParts = content.split("~");
            var ids = cntParts[1];
            var prdts = cntParts[0];

            var idList = ids.split(",");
            var prdtList = prdts.split(",");
            var i;
            document.getElementById("ddldistrict").options.length = 0;
            document.Form1.ddldistrict.options[0] = new Option("Select One", 0);
            for (i = 0; i < prdtList.length; i++) {
                document.Form1.ddldistrict.options[i + 1] = new Option(prdtList[i], idList[i]);
            }
        }
    }
    xmlHttp.open("GET", "entry.aspx?dtid=" + id, true);
    xmlHttp.send(null);
}

function ajaxFunctionST() {
    var xmlHttp;
    document.Form1.ddlstate.value = "";
    document.Form1.ddldistrict.value = "";
    var id = document.Form1.ddlcountry.value;
    try {  // Firefox, Opera 8.0+, Safari  
        xmlHttp = new XMLHttpRequest();
    }
    catch (e) {  // Internet Explorer  
        try {
            xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e) {
            try {
                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e) {
                alert("Your browser does not support AJAX!");
                return false;
            }
        }
    }

    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4) {
            var content = xmlHttp.responseText;
            var cntParts = content.split("~");
            var ids = cntParts[1];
            var prdts = cntParts[0];

            var idList = ids.split(",");
            var prdtList = prdts.split(",");
            var i;
            document.getElementById("ddlstate").options.length = 0;
            document.Form1.ddlstate.options[0] = new Option("Select One", 0);
            for (i = 0; i < prdtList.length; i++) {
                document.Form1.ddlstate.options[i + 1] = new Option(prdtList[i], idList[i]);
            }
        }
    }
    xmlHttp.open("GET", "entry.aspx?cntryid=" + id, true);
    xmlHttp.send(null);
}


function matribasic() {
    if (txt('txtname', 'Enter Name') == false)
        return false;
    if ((document.getElementById("ddlday").selectedIndex == 0) || (document.getElementById("ddlmonth").selectedIndex == 0) || (document.getElementById("ddlyear").selectedIndex == 0)) {
        alert("Enter Day");
        document.getElementById("ddlday").focus();
        return false;
    }
    else {
        var mandageField = false;
        var date = document.Form1.ddlday;
        var month = document.Form1.ddlmonth;
        var year = document.Form1.ddlyear;
        if (document.Form1.rdlsex[0].checked == true) {
            mandageField = calculateAge(date.options[date.selectedIndex].value, month.options[month.selectedIndex].value, year.options[year.selectedIndex].value, 21, 100);
        }
        else if (document.Form1.rdlsex[1].checked == true) {
            mandageField = calculateAge(date.options[date.selectedIndex].value, month.options[month.selectedIndex].value, year.options[year.selectedIndex].value, 18, 100);
        }
        else {
            alert("Enter Gender");
            document.getElementById("rdlsex").focus();
            return false;
        }
        if (!mandageField) {
            document.getElementById("ddlday").focus();
            return false;
        }
    }
    if (ddl('ddlheight', 'Select Height') == false)
        return false;
    if (ddl('ddlweight', 'Select Weight') == false)
        return false;
    if (ddl('ddlmarital', 'Select Marital Status') == false)
        return false;
    if (ddl('ddlmothertongue', 'Select Mother Tongue') == false)
        return false;
    if (ddl('ddlreligion', 'Select Religion') == false)
        return false;
    if (ddl('ddlcaste', 'Select Caste') == false)
        return false;
    if (ddl('ddlbloodgrp', 'Select Bloodgroup') == false)
        return false;
    if (ddl('ddlbodytype', 'Select Body Type') == false)
        return false;
    if (ddl('ddlcomplexion', 'Select Complexion') == false)
        return false;
    if (ddl('ddlphysical', 'Select Physical Status') == false)
        return false;
    if (txt('txtabtme', 'Enter About Me') == false)
        return false;
    if (chk('chklang', 'Select Languages Known') == false)
        return false;
    if (txt('txtstd', 'Enter STD Code') == false)
        return false;
    if (txt('txtland', 'Enter Landline No.') == false)
        return false;
    if (txt('txtcntperson', 'Enter Contact Person') == false)
        return false;
    if (ddl('ddlcreate', 'Select Profile Created By') == false)
        return false;
    if (txt('txtadd1', 'Enter Address') == false)
        return false;
    if (ddl('ddldiet', 'Select Diet') == false)
        return false;
    if (ddl('ddlsmoke', 'Select Smoking Status') == false)
        return false;
    if (ddl('ddldrink', 'Select Drinking Status') == false)
        return false;
    if (ddl('ddleduc', 'Select Education') == false)
        return false;
    if (ddl('ddlempin', 'Select Employed In') == false)
        return false;
    if (ddl('ddlocc', 'Select Occupation') == false)
        return false;
    if (ddl('ddlannuinc', 'Select Annual Income') == false)
        return false;
    if (ddl('ddlcountrylive', 'Select Country') == false)
        return false;
    return true;
}
function matrientry() {
    if (txt('txtname', 'Enter Name') == false)
        return false;
    if ((document.getElementById("ddlday").selectedIndex == 0) || (document.getElementById("ddlmonth").selectedIndex == 0) || (document.getElementById("ddlyear").selectedIndex == 0)) {
        alert("Enter Day");
        document.getElementById("ddlday").focus();
        return false;
    }
    else {
        var mandageField = false;
        var date = document.Form1.ddlday;
        var month = document.Form1.ddlmonth;
        var year = document.Form1.ddlyear;
        if (document.Form1.rdlsex[0].checked == true) {
            mandageField = calculateAge(date.options[date.selectedIndex].value, month.options[month.selectedIndex].value, year.options[year.selectedIndex].value, 21, 100);
        }
        else if (document.Form1.rdlsex[1].checked == true) {
            mandageField = calculateAge(date.options[date.selectedIndex].value, month.options[month.selectedIndex].value, year.options[year.selectedIndex].value, 18, 100);
        }
        else {
            alert("Enter Gender");
            document.getElementById("rdlsex").focus();
            return false;
        }
        if (!mandageField) {
            document.getElementById("ddlday").focus();
            return false;
        }
    }
    if (ddl('ddlheight', 'Select Height') == false)
        return false;
    if (ddl('ddlmarital', 'Select Marital Status') == false)
        return false;
    if (ddl('ddlmothertongue', 'Select Mother Tongue') == false)
        return false;
    if (ddl('ddlreligion', 'Select Religion') == false)
        return false;
    if (ddl('ddlcaste', 'Select Caste') == false)
        return false;
    if (txt('txtstd', 'Enter STD Code') == false)
        return false;
    if (txt('txtland', 'Enter Landline No.') == false)
        return false;
    if (ddl('ddlcountry', 'Select Country') == false)
        return false;
    if (ddl('ddlstate', 'Select State') == false)
        return false;
    if (ddl('ddldistrict', 'Select District') == false)
        return false;
    if (txt('txtcntperson', 'Enter Contact Person') == false)
        return false;
    if (ddl('ddlcreate', 'Select Profile Created By') == false)
        return false;
    return true;
}
function chk(ctrl, msg) {
    if ((document.getElementById(ctrl + '_0').checked == false) && (document.getElementById(ctrl + '_1').checked == false) && (document.getElementById(ctrl + '_2').checked == false) && (document.getElementById(ctrl + '_3').checked == false) && (document.getElementById(ctrl + '_4').checked == false) && (document.getElementById(ctrl + '_5').checked == false)) {
        alert(msg);
        document.getElementById(ctrl).focus();
        return false;
    }
    return true;
}
function txt(ctrl, msg) {
    if (document.getElementById(ctrl).value == "") {
        alert(msg);
        document.getElementById(ctrl).focus();
        return false;
    }
    return true;
}
//dropdown validation for selection
function ddl(ctrl, msg) {
    if (document.getElementById(ctrl).value == 0) {
        alert(msg);
        document.getElementById(ctrl).focus();
        return false;
    }
    return true;
}
//dropdown validation for selection
function ddl1(ctrl, msg) {
    if (document.getElementById(ctrl).value == -1) {
        alert(msg);
        document.getElementById(ctrl).focus();
        return false;
    }
    return true;
}
function lst(ctrl, msg) {
    if (document.getElementById(ctrl).length == 0)
    {
        alert(msg);
        document.getElementById(ctrl).focus();
        return false;
    }
    return true;
}
function calculateAge(dd, mm, yy, minAge, maxAge) {
    main = "valid"
    dd = parseInt(dd);
    mm = parseInt(mm);
    yy = parseInt(yy);
    if ((mm < 1) || (mm > 12) || (dd < 1) || (dd > 31) || (yy < 1) || (mm == "") || (dd == "") || (yy == ""))
        main = "Invalid"
    else if (((mm == 4) || (mm == 6) || (mm == 9) || (mm == 11)) && (dd > 30))
        main = "Invalid"
    else if (mm == 2) {
        if (dd > 29)
            main = "Invalid"
        else if ((dd > 28) && (!leapYear(yy)))
            main = "Invalid"
    }
    else if ((yy > 9999) || (yy < 0))
        main = "Invalid"
    else
        main = main
    if (main == "valid") {
        var days;
        try {
            //days = new Date('2000','11','22');	
            days = new Date();
        }
        catch (error) {
            days = new Date();
        }
        gdate = days.getDate()
        gmonth = days.getMonth()
        gyear = days.getFullYear(); //days.getYear()	

        gyear = parseInt(gyear);
        age = gyear - yy;
        gmonth = parseInt(gmonth);
        if ((mm == (gmonth + 1)) && (dd <= parseInt(gdate))) {
            age = age
        }
        else {
            if (mm <= (gmonth)) {
                age = age
            }
            else {
                age = age - 1
            }
        }
        if (age == 0)
            age = age
        if (age < minAge) {
            alert("You should have a minimum of " + minAge + " years to register with us");
            document.Form1.profInt_AGE.value = age
            return false;
        }
        else if (age > maxAge) {
            alert("You should have a maximum of " + maxAge + " years to register with us");
            document.Form1.profInt_AGE.value = age
            return false;
        }
        else {
            document.Form1.profInt_AGE.value = age
            return true;
        }
    }
    else {
        document.Form1.profInt_AGE.value = 0
        return false;
    }
}

function leapYear(yyyy) {
    if (((yyyy % 4 == 0) && (yyyy % 100 != 0)) || (yyyy % 400 == 0))
        return true
    else
        return false
}

function checkStartDate() {
    var startDate = document.Form1.ddlday.selectedIndex;
    var startMonth = document.Form1.ddlmonth.selectedIndex;
    var startYear = document.Form1.ddlyear.options[document.Form1.ddlyear.selectedIndex].text;
    if ((startMonth == 4 || startMonth == 6 || startMonth == 9 || startMonth == 11) && (startDate > 30)) {
        alert("Selected Date is incorrect for selected month");
        document.Form1.ddlday.selectedIndex = 0;
        document.Form1.ddlmonth.selectedIndex = 0;
        document.Form1.ddlyear.selectedIndex = 0;
        document.Form1.ddlday.focus();
        return false;
    } //if
    else if ((startMonth == 2) && (startDate > 29)) {
        alert("Selected Date is incorrect for selected month");
        document.Form1.ddlday.selectedIndex = 0;
        document.Form1.ddlmonth.selectedIndex = 0;
        document.Form1.ddlyear.selectedIndex = 0;
        document.Form1.ddlday.focus();
        return false;
    }
    else if ((startYear != 'Year') && (startMonth == 2) && (startDate == 29) && (!leapYear(startYear))) {
        alert("Selected Date is incorrect for selected month");
        document.Form1.ddlday.selectedIndex = 0;
        document.Form1.ddlmonth.selectedIndex = 0;
        document.Form1.ddlyear.selectedIndex = 0;
        document.Form1.ddlday.focus();
        return false;
    }
    return true;
}
// Have Children or not
function callMaritalCond(str1, str2) {
    var obj1 = eval('document.Form1.' + str1);
    var obj2 = eval('document.Form1.' + str2);
    for (var i = 0; i < obj1.length; i++) {
        if ((obj1[i].selected && i == 0) || obj1.selectedIndex == 1) {
            obj2.selectedIndex = 0;
            obj2.disabled = true;
            obj2.style.display = 'none';
            document.getElementById('spanChildren').innerHTML = '';
        }
        else if (obj2.disabled) {
            obj2.disabled = false;
            obj2.style.display = 'block';
            document.getElementById('spanChildren').innerHTML= 'Have Children';
        }
        break;
    }
}

//List Box Bind Ajax
function AjaxValueLB() {
    var selValue = new Array();
    for (j = 0; j < document.Form1.lbcaste.length; j++) {
        if (document.Form1.lbcaste.options[j].selected) {
            selValue += "," + document.Form1.lbcaste.options[j].text;
        }
        document.Form1.mtcaste.value = selValue;
    }
}
function AjaxBindLB() {
    var xmlHttp;
    var id = document.Form1.ddlreligion.value;
    document.Form1.lbcaste.value = "";
    try {
        xmlHttp = new XMLHttpRequest();
    }
    catch (e) {
        try {
            xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e) {
            try {
                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e) {
                alert("Your browser does not support AJAX!");
                return false;
            }
        }
    }
    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4) {
            var content = xmlHttp.responseText;
            var cntParts = content.split("~");
            var ids = cntParts[1];
            var prdts = cntParts[0];

            var idList = ids.split(",");
            var prdtList = prdts.split(",");
            var i;
            document.getElementById("lbcaste").options.length = 0;
            for (i = 0; i < prdtList.length; i++) {
                document.Form1.lbcaste.options[i] = new Option(prdtList[i], idList[i]);
            }
        }
    }
    xmlHttp.open("GET", "fillajax.aspx?mtca=" + id, true);
    xmlHttp.send(null);
}
//Checking UserName
function ValidateNum(e) {
    var keyCode = window.event.which ? window.event.which : window.event.keyCode;
    if (parseInt(keyCode) == 95 || parseInt(keyCode) == 46)
    { return true; } // _ underscore
    if (parseInt(keyCode) == 9 || parseInt(keyCode) == 8)
    { return true; }
    if (parseInt(keyCode) >= 48 && parseInt(keyCode) <= 57)
    { return true; } // 0 to 9
    if (parseInt(keyCode) >= 64 && parseInt(keyCode) <= 90)
    { return true; } // A to Z
    if (parseInt(keyCode) >= 97 && parseInt(keyCode) <= 122)
    { return true; } // a to z
    return false;
}

//button click
function validate() {
    var logid = document.Form1.txtusername.value;
    if (logid.length == 0) {
        alert("Enter Your Login Id");
        document.Form1.txtusername.focus();
        return false;
    }
    else if (logid.length < 5) {
        alert("Your ID must be between 5 and 30 characters long");
        document.Form1.txtusername.focus();
        return false;
    }
    var pass = document.Form1.txtpwdreg.value;
    if (pass.length == 0) {
        alert("Enter password");
        document.Form1.txtpwdreg.focus();
        return false;
    }
    var conPass = document.Form1.txtconfpwd.value;
    if (conPass.length == 0) {
        alert("Enter confirm password");
        document.Form1.txtconfpwd.focus();
        return false;
    }
    if (conPass != pass) {
        alert("Both Passwords are not matching");
        return false;
    }
    var variable = document.Form1.txtemail.value;
    if (variable.length == 0) {
        alert("Enter Your Email Id");
        document.Form1.txtemail.focus();
        return false;
    }
    //var emailID=document.Form1.txtemail;
    var emailfilter = /^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i;
    if (emailfilter.test(document.Form1.txtemail.value) == false) {
        document.Form1.txtemail.value = "";
        document.Form1.txtemail.focus();
        return false;
    }
    return true;
}
/*function MatrimonialPopUp(arg,arg1)
{
var moredetailswin = window.open(arg1 +"?View=" + arg ,"detailswindow","height=500,width=850,status=no,toolbar=no,menubar=no,location=no,scrollbars=no,resizable=yes;");
return(false);
}*/
//Popup window Opening //viewmyprofile
function MatrimonialPopUp(QueryString, PageName, PWidth, PHeight) {
    var moredetailswin = window.open(PageName + "?View=" + QueryString, "detailswindow", "height=" + PHeight + "px,width=" + PWidth + "px,status=no,toolbar=no,menubar=no,location=no,scrollbars=no,resizable=yes;");
    return (false);
}
function dispBigImage(src) {
    try {
        document.getElementById("imgbig").src = src;
    }
    catch (e) {
        document.getElementById("imgbig").src = src;
    }
}

function PersonalityValidate() {
    if (ddl('ddlflytype', 'Select Family Type') == false)
        return false;
    if (ddl1('ddlbronum', 'Select No. of Brothers') == false)
        return false;
    if (ddl1('ddlsisnum', 'Select No. of Sisters') == false)
        return false;
    if (ddl('ddlagefrm', 'Select Age from') == false)
        return false;
    if (ddl('ddlageto', 'Select Age to') == false)
        return false;
    if (ddl('ddlhtfrm', 'Select Height from') == false)
        return false;
    if (ddl('ddlhtto', 'Select Height to') == false)
        return false;
    if (txt('lbedu', 'Select Education') == false)
        return false;
    if (txt('lbocc', 'Select Occupation') == false)
        return false;
    if (ddl('ddlmtongue', 'Select Mother Tongue') == false)
        return false;
    if (txt('txtabtprtnr', 'Enter About Partner') == false)
        return false;
    return true;
}
function AdvancedSearchValidate() {
//    if (ddl('ddlLookingfor', 'Select one you lookingfor') == false)
//        return false;
    if (ddl('ddlReligion', 'Select Religion') == false)
        return false;

    if (lst('lstSelectedCaste', 'Select any caste') == false)
        return false;

    if (document.getElementById('lstSelectedCaste').options.length != 0) {
        var count = document.getElementById('lstSelectedCaste').options.length;
        var i;
        var cast=",";
        var castid = ",";

        for (i = 0; i < count; i++) {
            cast += document.getElementById('lstSelectedCaste').options[i].text + ',';
            castid += document.getElementById('lstSelectedCaste').options[i].value + ',';
        }
       //document.Form1.hidCast.value = cast + ";" + castid;
        document.Form1.hidCast.value =castid;
    }
    if (document.getElementById('lstSelectedStar').options.length != 0) {
        var count = document.getElementById('lstSelectedStar').options.length;
        var i;
        var star = ",";
        var starid = ",";

        for (i = 0; i < count; i++) {
            star += document.getElementById('lstSelectedStar').options[i].text + ',';
            starid += document.getElementById('lstSelectedStar').options[i].value + ',';
        }
        //document.Form1.hidStar.value = star + ";" + starid;
        document.Form1.hidStar.value = starid;
    }
    if (document.getElementById('lstselctedMothertong').options.length != 0) {
        var count = document.getElementById('lstselctedMothertong').options.length;
        var i;
        var motrtng = ",";
        var motrtngid = ",";

        for (i = 0; i < count; i++) {
            motrtng += document.getElementById('lstselctedMothertong').options[i].text + ',';
            motrtngid += document.getElementById('lstselctedMothertong').options[i].value + ',';
        }
        //document.Form1.hidMothertong.value = motrtng + ";" + motrtngid;
        document.Form1.hidMothertong.value = motrtngid; 
    }
    if (document.getElementById('lstEduSelected').options.length != 0) {
        var count = document.getElementById('lstEduSelected').options.length;
        var i;
        var Edu = ",";
        var Eduid = ",";

        for (i = 0; i < count; i++) {
            Edu += document.getElementById('lstEduSelected').options[i].text + ',';
            Eduid += document.getElementById('lstEduSelected').options[i].value + ',';
        }
        //document.Form1.hidEdu.value = Edu + ";" + Eduid;
        document.Form1.hidEdu.value = Eduid;
    }
    if (document.getElementById('lstselOccupation').options.length != 0) {
        var count = document.getElementById('lstselOccupation').options.length;
        var i;
        var Occu = ",";
        var Occuid = ",";

        for (i = 0; i < count; i++) {
            Occu += document.getElementById('lstselOccupation').options[i].text + ',';
            Occuid += document.getElementById('lstselOccupation').options[i].value + ',';
        }
        //document.Form1.hidOccu.value = Occu + ";" + Occuid;
        document.Form1.hidOccu.value = Occuid;
    }
    if (document.getElementById('lstselectdnationality').options.length != 0) {
        var count = document.getElementById('lstselectdnationality').options.length;
        var i;
        var nation = ",";
        var nationid = ",";

        for (i = 0; i < count; i++) {
            nation += document.getElementById('lstselectdnationality').options[i].text + ',';
            nationid += document.getElementById('lstselectdnationality').options[i].value + ',';
        }
        //document.Form1.hidNation.value = nation + ";" + nationid;
        document.Form1.hidNation.value = nationid;
    }
    if (document.getElementById('lstselectedState').options.length != 0) {
        var count = document.getElementById('lstselectedState').options.length;
        var i;
        var State = ",";
        var Stateid = ",";

        for (i = 0; i < count; i++) {
            State += document.getElementById('lstselectedState').options[i].text + ',';
            Stateid += document.getElementById('lstselectedState').options[i].value + ',';
        }
        //        document.Form1.hidState.value = State + ";" + Stateid;
        document.Form1.hidState.value = Stateid;
    }
    return true;
}
function validchgpwd() {
    if (txt('txtPwd', 'Enter Old Password') && txt('txtNewPwd', 'Enter New Password') && txt('txtCnfmPwd', 'Confirm New Password') == true)
        if (document.getElementById('txtNewPwd').value == document.getElementById('txtCnfmPwd').value) {
        return true;
    }
    else {
        alert('Both password are not matching');
        document.getElementById('txtNewPwd').value = "";
        document.getElementById('txtCnfmPwd').value = "";
        document.getElementById('txtNewPwd').focus();
    }
    return false;
}
function txtcheck(ctrl, msg) {
    if (document.getElementById(ctrl).value == msg)
        document.getElementById(ctrl).value = "";
}
function email(ctrl, msg) {
    var emailfilter = /^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i;
    if (emailfilter.test(document.getElementById(ctrl).value) == false) {
        alert(msg);
        document.getElementById(ctrl).value = "";
        document.getElementById(ctrl).focus();
        return false;
    }
    return true;
}
function chktest(ctrl, n, msg) {
    var i;
    for (i = 0; i < n; i++)
        if (document.getElementById(ctrl + '_' + i).checked == true)
        return true;
    alert(msg);
    return false;
}
function interestvalidation() {
    if (txt('txtName', 'Enter Name') && email('txtEmail', 'Invalid Email-Id') && txt('txtAddress', 'Enter Address') == true) {
        txtcheck('txtCtryCode', ' ');
        txtcheck('txtStdCode', 'STD Code');
        txtcheck('txtPhone', 'Phone Number');
        return true;
    }
    return false;
}
function requestvalidation() {
    if (txt('txtName', 'Enter Name') && email('txtEmail', 'Invalid Email-Id') && chktest('chkRequest', '8', 'Select Request') == true) {
        if ((txt('txtCtryCode', 'Enter Country Code') && txtchk('txtStdCode', 'STD Code', 'Enter STD Code') && txtchk('txtPhone', 'Phone Number', 'Enter Telephone Number')) || (txt('txtMobile', 'Enter Mobile Number')) == true) {
            txtcheck('txtCtryCode', ' ');
            txtcheck('txtStdCode', 'STD Code');
            txtcheck('txtPhone', 'Phone Number');
            return true;
        }
    }
    return false;
}

function txtchk(ctrl, Condition, msg) {
    if (document.getElementById(ctrl).value == Condition) {
        alert(msg);
        document.getElementById(ctrl).focus();
        return false;
    }
    return true;
}

function matriedit() {
    if (txt('txtname', 'Enter Name') == false)
        return false;
    if ((document.getElementById("ddlday").selectedIndex == 0) || (document.getElementById("ddlmonth").selectedIndex == 0) || (document.getElementById("ddlyear").selectedIndex == 0)) {
        alert("Enter Day");
        document.getElementById("ddlday").focus();
        return false;
    }
    else {
        var mandageField = false;
        var date = document.Form1.ddlday;
        var month = document.Form1.ddlmonth;
        var year = document.Form1.ddlyear;
        if (document.Form1.rdlsex[0].checked == true) {
            mandageField = calculateAge(date.options[date.selectedIndex].value, month.options[month.selectedIndex].value, year.options[year.selectedIndex].value, 21, 100);
        }
        else if (document.Form1.rdlsex[1].checked == true) {
            mandageField = calculateAge(date.options[date.selectedIndex].value, month.options[month.selectedIndex].value, year.options[year.selectedIndex].value, 18, 100);
        }
        else {
            alert("Enter Gender");
            document.getElementById("rdlsex").focus();
            return false;
        }
        if (!mandageField) {
            document.getElementById("ddlday").focus();
            return false;
        }
    }
    if (ddl('ddlheight', 'Select Height') == false)
        return false;
    if (ddl('ddlweight', 'Select Weight') == false)
        return false;
    if (ddl('ddlmarital', 'Select Marital Status') == false)
        return false;
    if (ddl('ddlmothertongue', 'Select Mother Tongue') == false)
        return false;
    if (ddl('ddlreligion', 'Select Religion') == false)
        return false;
    if (ddl('ddlcaste', 'Select Caste') == false)
        return false;
    if (ddl('ddlbloodgrp', 'Select Bloodgroup') == false)
        return false;
    if (ddl('ddlbodytype', 'Select Body Type') == false)
        return false;
    if (ddl('ddlcomplexion', 'Select Complexion') == false)
        return false;
    if (ddl('ddlphysical', 'Select Physical Status') == false)
        return false;
    if (txt('txtabtme', 'Enter About Me') == false)
        return false;
    if (chk('chklang', 'Select Languages Known') == false)
        return false;
    if (txt('txtcntperson', 'Enter Contact Person') == false)
        return false;
    if (ddl('ddlcreate', 'Select Profile Created By') == false)
        return false;
    if (txt('txtadd1', 'Enter Address') == false)
        return false;
    if (ddl('ddldiet', 'Select Diet') == false)
        return false;
    if (ddl('ddlsmoke', 'Select Smoking Status') == false)
        return false;
    if (ddl('ddldrink', 'Select Drinking Status') == false)
        return false;
    if (ddl('ddleduc', 'Select Education') == false)
        return false;
    if (ddl('ddlempin', 'Select Employed In') == false)
        return false;
    if (ddl('ddlocc', 'Select Occupation') == false)
        return false;
    if (ddl('ddlannuinc', 'Select Annual Income') == false)
        return false;
    if (ddl('ddlcountrylive', 'Select Country') == false)
        return false;
    return true;
}

//List Box Bind Ajax
function AjaxValueLBpart() {
    var selValue = new Array();
    for (var j = 0; j < document.Form1.lbcaste.length; j++) {
        if (document.Form1.lbcaste.options[j].selected) {
            selValue += "," + document.Form1.lbcaste.options[j].text;
        }
        document.Form1.mtcastepart.value = selValue;
    }
}
//Refer this site validation
function matri_refer_validate() {
    if (txt('tbRecName', 'Enter Recepient Name') && txt('tbRecEma', 'Enter Recepient Email') && email('tbRecEma', 'Recepient email-id is Invalid') && txt('tbYouName', 'Enter Your Name') && txt('tbYouEma', 'Enter Your Email') && email('tbYouEma', 'Your email-id is Invalid') && txt('tbCom', 'Comment Pls..!') == true)
        return true;
    return false;
}
function hidevisible(ctrl, show) {//debugger;
    if (show == 0) {
        document.getElementById(ctrl).style.visibility = "hidden";
        document.getElementById(ctrl).style.display = "none";
    }
    else if (show == 1) {
        document.getElementById(ctrl).style.visibility = "visible";
        document.getElementById(ctrl).style.display = "block";
    }
}
function SelectPayment() {
    if (document.getElementById('rblpayment_1').checked == true) {
        hidevisible('divPayment', 1);
        document.getElementById('divPaymentLbl').innerHTML = "DD Number";
    }
    else if (document.getElementById('rblpayment_2').checked == true) {
        hidevisible('divPayment', 1);
        document.getElementById('divPaymentLbl').innerHTML = "Cheque Details";
    }
    else if (document.getElementById('rblpayment_3').checked == true) {
        hidevisible('divPayment', 1);
        document.getElementById('divPaymentLbl').innerHTML = "Bank Remittance Details";
    }
    else if (document.getElementById('rblpayment_4').checked == true) {
        hidevisible('divPayment', 1);
        document.getElementById('divPaymentLbl').innerHTML = "Franchisee Details";
    }
    else if (document.getElementById('rblpayment_0').checked == true) {
        hidevisible('divPayment', 0);
    }
}

function PaidSelect() {
    if (document.getElementById('divPaymentPnl').style.visibility == "hidden")
        hidevisible('divPaymentPnl', 1);
    else
        hidevisible('divPaymentPnl', 0);
}

function PaidValidate() {
    debugger;
    if (CheckPaid() && rdoPayment('rblPayment', 'Select Payment Method') == true)
        return true;
    return false;
}

function CheckPaid() {
    if ((document.getElementById('rblpayment_1').checked == true) || (document.getElementById('rblpayment_2').checked == true)
	|| (document.getElementById('rblpayment_3').checked == true) || (document.getElementById('rblpayment_4').checked == true)) {
        if (txt('txtPayment', 'Enter Details') == false)
            return false;
    }
    return true;
}
function rdoPayment(ctrl, msg) {
    if (document.getElementById('rblpayment_0').checked == true)
        return true;
    if (document.getElementById('rblpayment_1').checked == true)
        return true;
    if (document.getElementById('rblpayment_2').checked == true)
        return true;
    if (document.getElementById('rblpayment_3').checked == true)
        return true;
    if (document.getElementById('rblpayment_4').checked == true)
        return true;
    alert(msg);
    return false;
}
function RegisterValidate() {
    var logid = document.form1.txtUserName.value;
    if ((logid.length == 0) || (logid == '* User Name')) {
        alert("Enter Your Login Id");
        document.form1.txtUserName.focus();
        return false;
    }
    else if (logid.length < 5) {
        alert("Your ID must be between 5 and 30 characters long");
        document.form1.txtUserName.focus();
        return false;
    }
    var pass = document.form1.txtPwdReg.value;
    if (pass.length == 0) {
        alert("Enter password");
        document.form1.txtPwdReg.focus();
        return false;
    }
    var conPass = document.form1.txtConfPwd.value;
    if (conPass.length == 0) {
        alert("Enter confirm password");
        document.form1.txtConfPwd.focus();
        return false;
    }
    if (conPass != pass) {
        alert("Both Passwords are not matching");
        return false;
    }
    var variable = document.form1.txtEmail.value;
    if (variable.length == 0) {
        alert("Enter Your Email Id");
        document.form1.txtEmail.focus();
        return false;
    }
    //var emailID=document.Form1.txtemail;
    var emailfilter = /^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i;
    if (emailfilter.test(document.form1.txtEmail.value) == false) {
        document.form1.txtEmail.value = "";
        document.form1.txtEmail.focus();
        return false;
    }
    return true;
}
function ajaxfillCaste() {
    var xmlHttp;
    document.Form1.lstCaste.value = "";
    document.Form1.lstSelectedCaste.value = "";
    var id = document.Form1.ddlReligion.value;
    try {  // Firefox, Opera 8.0+, Safari  
        xmlHttp = new XMLHttpRequest();
    }
    catch (e) {  // Internet Explorer  
        try {
            xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e) {
            try {
                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e) {
                alert("Your browser does not support AJAX!");
                return false;
            }
        }
    }

    xmlHttp.onreadystatechange = function() {
    if (xmlHttp.readyState == 4) {
            
            var content = xmlHttp.responseText;
            var cntParts = content.split("~");
            var ids = cntParts[1];
            var prdts = cntParts[0];
           
            var idList = ids.split(",");
            var prdtList = prdts.split(",");
            var i;
            document.getElementById("lstCaste").options.length = 0;
            document.getElementById("lstSelectedCaste").options.length = 0;
            document.Form1.lstCaste.options[0] = new Option("-Any-", 0);
            for (i = 0; i < prdtList.length; i++) {
                document.Form1.lstCaste.options[i + 1] = new Option(prdtList[i], idList[i]);
            }
        }
    }
    xmlHttp.open("GET", "AdvancedSearch.aspx?rId=" + id, true);
    xmlHttp.send(null);
}



function listbox_move(listID, direction) {

    var listbox = document.getElementById(listID);
    var selIndex = listbox.selectedIndex;
    if (-1 == selIndex) {
        alert("Please select an option to move.");
        return;
    }
    var increment = -1;
    if (direction == 'up')
        increment = -1;
    else
        increment = 1;
    if ((selIndex + increment) < 0 || (selIndex + increment) > (listbox.options.length - 1)) {
        return;
    }
    var selValue = listbox.options[selIndex].value;
    var selText = listbox.options[selIndex].text;
    listbox.options[selIndex].value = listbox.options[selIndex + increment].value
    listbox.options[selIndex].text = listbox.options[selIndex + increment].text
    listbox.options[selIndex + increment].value = selValue;
    listbox.options[selIndex + increment].text = selText;
    listbox.selectedIndex = selIndex + increment;
}
function listbox_moveacross(sourceID, destID) {
    var src = document.getElementById(sourceID);
    var dest = document.getElementById(destID);
    for (var count = 0; count < src.options.length; count++) {

        if (src.options[count].selected == true) {
            var option = src.options[count];
            var newOption = document.createElement("option");
            newOption.value = option.value;
            newOption.text = option.text;
            newOption.selected = true;
            try {
                document.Form1.countryid.value = newOption.value;
                dest.add(newOption, null); //Standard
                src.remove(count, null);
                if (sourceID == "lstnationality") {
                   
                    return ajaxfillstate(newOption.value);
                }
                if (sourceID == "lstselectdnationality") {
                    return ajaxremovestate(newOption.value);
                }
                
            } catch (error) {
                dest.add(newOption); // IE only
                src.remove(count);
            }
            count--;

        }

    }
    return false;
}
function listbox_selectall(listID, isSelect) {
    var listbox = document.getElementById(listID);
    for (var count = 0; count < listbox.options.length; count++) {
        listbox.options[count].selected = isSelect;
    }
}
function ajaxfillstate(cntryid) {
    
    var xmlHttp;
    document.Form1.lstState.value = "";
    var id = cntryid;
    try {  // Firefox, Opera 8.0+, Safari  
        xmlHttp = new XMLHttpRequest();
    }
    catch (e) {  // Internet Explorer  
        try {
            xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e) {
            try {
                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e) {
                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
                alert("Your browser does not support AJAX!");
                return false;
            }
        }
    }

    xmlHttp.onreadystatechange = function() {

        if (xmlHttp.readyState == 4) {
            var content = xmlHttp.responseText;
            var cntParts = content.split("~");
            var ids = cntParts[1];
            var prdts = cntParts[0];

            var idList = ids.split(",");
            var prdtList = prdts.split(",");
            var i;
            var statelength = (document.getElementById('lstState').options.length);
            if (document.getElementById('lstState').options.length == 0) {
                document.Form1.lstState.options[0] = new Option("-Any-", 0);
            }
            var index;
            if (statelength == 0) {
                index = statelength;

            } else {
                index = statelength - 1;

            }

            for (i=0,j=index; i < prdtList.length; i++,j++) {
                
                document.getElementById('lstState').options[j + 1] = new Option(prdtList[i], idList[i]);
            }
            //alert(document.getElementById('lstState').length);
        }
    }
    xmlHttp.open("GET", "AdvancedSearch.aspx?cid=" + id, true);
    xmlHttp.send(null);
    return false;
}


//function for remove states while removing country selection

function ajaxremovestate(cntryid) {

    var xmlHttp;
//    document.Form1.lstState.value = "";
    var id = cntryid;
    try {  // Firefox, Opera 8.0+, Safari  
        xmlHttp = new XMLHttpRequest();
    }
    catch (e) {  // Internet Explorer  
        try {
            xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e) {
            try {
                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e) {
                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
                alert("Your browser does not support AJAX!");
                return false;
            }
        }
    }
    xmlHttp.onreadystatechange = function() {

        if (xmlHttp.readyState == 4) {
            var content = xmlHttp.responseText;
            var cntParts = content.split("~");
            var ids = cntParts[1];
            var prdts = cntParts[0];
            var idList = ids.split(",");
            var prdtList = prdts.split(",");
            var i;
            if (document.getElementById('lstState').options.length == 0) {
                document.Form1.lstState.options[0] = new Option("-Any-", 0);
            }
            for (i = 0; i < prdtList.length; i++) {
                var newOption1 = document.createElement("option");
                newOption1.value = idList[i];
                newOption1.text = prdtList[i];
                for (j = 0; j < document.getElementById('lstState').options.length; j++) {
                
                   if (document.getElementById('lstState').options[j].text == newOption1.text) {
                       document.getElementById('lstState').remove(j, null);
                    }
                }
                for (j = 0; j < document.getElementById('lstselectedState').options.length; j++) {

                    if (document.getElementById('lstselectedState').options[j].text == newOption1.text) {
                        document.getElementById('lstselectedState').remove(j, null);
                    }
                }

            }
            if ((document.getElementById('lstselectdnationality').options.length) == 0) {
                document.getElementById('lstState').remove(0, null);
                
            }
        }
    }
    xmlHttp.open("GET", "AdvancedSearch.aspx?cid=" + id, true);
    xmlHttp.send(null);
    return false;
}


  
