// START OF MESSAGE SCRIPT //

var MSGTIMER = 20;
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';
		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('msg')", (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);
	}
}

function fun_new(f1,d1) {
	
	if (d1== "Mother Tongue") {
		
		if (f1.mother_tongue_code.options[f1.mother_tongue_code.selectedIndex].value == "") {
			
			alert("Please Select The Mother Tongue");
			
			f1.mother_tongue_code.focus();
			
			return false;
		}
	}
	
	if (d1== "Caste") {
		
		if (f1.caste_code.options[f1.caste.selectedIndex].value == "") {
			
			alert("Please Select The Caste");
			
			f1.caste_code.focus();
			
			return false;
		}
	}
	
	if (d1== "Occupation") {
		
		if (f1.occupation_code.options[f1.occupation_code.selectedIndex].value == "") {
			
			alert("Please Select The Occupation");
			
			f1.occupation_code.focus();
			
			return false;
		}
	}
	
	if (d1== "Marital Status") {
		
		if (f1.marital_status_code.options[f1.marital_status_code.selectedIndex].value == "") {
			
			alert("Please Select The Marital Status");
			
			f1.marital_status_code.focus();
			
			return false;
		}
	}
	
	if (d1== "Surname") {
		
		if (f1.lname.options[f1.lname.selectedIndex].value == "") {
			
			alert("Please Select The Surname");
			
			f1.lname.focus();
			
			return false;
		}
	}
	
	if (d1== "Zodiac Sign") {
		
		if (f1.zodiac_sign.options[f1.zodiac_sign.selectedIndex].value == "") {
			
			alert("Please Select The Zodiac Sign");
			
			f1.zodiac_sign.focus();
			
			return false;
		}
	}
	
	if (d1== "State") {
		
		if (f1.state.options[f1.state_code.selectedIndex].value == "") {
			
			alert("Please Select a State");
			
			f1.state_code.focus();
			
			return false;
		}
	}
}

// << chk the search parameters in photo search
function fn2_new() {
	for (var i = 0; i < document.f3.elements.length; i++) {
		ename = document.f3.elements[i].name ;
		if (ename == 'l_religion_code') {
			var n = 0;
			for ( opt = 0; opt < document.f3.elements[i].options.length; opt++) {
				if (document.f3.elements[i].options[opt].selected==true)
				n++;
			}

			if ( n < 1 ) {
				alert("Select Atleast One Religion / Community");
				document.f3.elements[i].focus();
				return false;
				break;
			}
		}

		if (ename == 'l_mstatus_code[]') {
			var n = 0;
			for ( opt = 0; opt < document.f3.elements[i].options.length; opt++) {
				if (document.f3.elements[i].options[opt].selected==true)
				n++;
			}

			if ( n < 1 ) {
				alert("Select Atleast One Marital Status");
				document.f3.elements[i].focus();
				return false;
				break;
			}
		}
	}
}

// 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 = '/images-mi/msg_arrow.gif'; 
}

function chktrim(inputString) {
	if (typeof inputString != "string") { 
		return inputString; 
	}
    var retValue = inputString;
    var ch = retValue.substring(0, 1);
    while (ch == " ") { 
    	retValue = retValue.substring(1, retValue.length);
        ch = retValue.substring(0, 1);
    } 
    ch = retValue.substring(retValue.length-1, retValue.length);
	while (ch == " ") { 
    	retValue = retValue.substring(0, retValue.length-1);
        ch = retValue.substring(retValue.length-1, retValue.length);
	}
    while (retValue.indexOf("  ") != -1) { 
    	retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); // Again, there are two spaces in each of the strings
	}
    return retValue; 
}

var pop = '';

// Below script is used to open popup.somesh
function openwin_new (file, Iwidth, Iheight, popUpWin) {
	
	if (pop && !pop.closed) {
	  	pop.close();
	}
   
	var key1  = ",";
   
	var newStr = Iwidth.replace(/ /gi, key1)
   
	var newStr1 = Iheight.replace(/ /gi, key1)
	
 	pop=eval("window.open('"+file+"&newrows="+newStr+"&newcolumns="+newStr1+"', '"+popUpWin+"', 'chrome[4],toolbar=no,left=10,top=5,width="+Iwidth+",height="+Iheight+",directories=no,menubar=no,SCROLLBARS=yes')");	
   
   if (!pop.opener) popUpWin.opener = self;
         
      
}

// Below script is used to open popup.somesh
function openwin (file,Iwidth,Iheight) {
	
	if (!popname) {
		
		var popname='nWin2';
	}
		
	
      var newWin1=window.open(file,''+popname+'','x=0,y=0,toolbar=no,location=no,directories=no,status=no,scrollbars=yes, copyhistory=no,width='+Iwidth+',height='+Iheight+',screenX=0,screenY=0,left=20,top=20');
}

function livewin(nm,width,height) {
	
	var pop = '';
	
	var name=nm;
	
	if (pop && !pop.closed) {
		
		pop.close();
	}
	
	pop=eval("window.open('"+name+"','NewWIN','chrome[4],toolbar=no,left=10,top=5,width="+width+",height="+height+",directories=no,menubar=no,SCROLLBARS=yes')");
	if (!pop.opener) popUpWin.opener = self;
}

function openwin1(file,Iwidth,Iheight) {
	var pop = '';
	var name=file;
    if (pop && !pop.closed) {
         pop.close();
    }
    
    pop=eval("window.open('"+file+"','NewWIN','chrome[4],toolbar=no,left=10,top=5,width=600,height=450,directories=no,menubar=no,SCROLLBARS=yes')");
    if (!pop.opener) popUpWin.opener = self;
}



function openwin2(nm) {
	
	var pop = '';
	
	var name=nm;
	
	if (pop && !pop.closed) {
		pop.close();
	}
	pop=eval("window.open('"+name+"','NewWIN','toolbar=no,left=5,top=5,width=400,height=375,directories=no,menubar=no,SCROLLBARS=no')");
	if (!pop.opener) popUpWin.opener = self;
}


// Below script is used to hide particular element.somesh
function hide(idname) {
	
	document.getElementById(idname).style.display='none';
}

// Below script is used to unhide particular element.somesh
function unhide(idname) {
	
	document.getElementById(idname).style.display='';
}

// Below script is used to submit any form.somesh
function formsubmit(formname, id) {
	formname.action_name.value = id;
	formname.submit();
	
}

// Below function is used to restrict member to enter character.It will allow member to enter number only.somesh
function isNumberKey(evt){

	var charCode = (evt.which) ? evt.which : event.keyCode;
	
	if (charCode > 31 && (charCode < 48 || charCode > 57)) {
		return false;
	}
	else {
		return true;
	}
}

// Below function is used to restrict member to enter numbers.It will allow member to enter alphabets only.somesh
function isValidAlpha(evt) {
	
	var charCode = (evt.which) ? evt.which : event.keyCode;
	
	if (!((charCode>=65 && charCode<=90) ||(charCode>=97 && charCode<=122) || (charCode==32))) {
		return false;
	}
	else {
		return true;
	}
}

// Below script is used to submit any form.somesh
function form_submit(formname) {
	
	document.formname.submit();
}


// Dynamic function to calculate length for all textareas.somesh
function chkLen(formname, textareaname, textname) {
	
	var texarea = eval('document.'+formname+'.'+textareaname);		
	var tmpStr = texarea.value.length;
	
	var text = eval('document.'+formname+'.'+textname);		
	text.value = tmpStr;
}

function lowerCase1(formn,fieldname) {
	var frmObj = eval('document.'+formn+'.'+fieldname);		

	var index;
	var tmpStr;
	var tmpChar;
	var preString;
	var postString;
	var strlen;
	var string;
	//var searchVars=new Array("In","Suchas","Such","As","Like","If","This","For","Is","Am","Are","That","Fine");	
	//var ReplaceVars=new Array("in","suchas","such","as","like","if","this","for","is","am","are","that","fine");	
	
	tmpStr = frmObj.value.toLowerCase();
	strLen = tmpStr.length;
	if (strLen > 0)  {
		for (index = 0; index < 1; index++)  {
			if (index == 0)  {
				tmpChar = tmpStr.substring(0,1).toUpperCase();
				postString = tmpStr.substring(1,strLen);
				tmpStr = tmpChar + postString;
			}
			else {
				tmpChar = tmpStr.substring(index, index+1);
				if ((tmpChar == " " || tmpChar == ",") && index < (strLen-1))  {
					tmpChar = tmpStr.substring(index+1, index+2).toUpperCase();
					preString = tmpStr.substring(0, index+1);
					postString = tmpStr.substring(index+2,strLen);
					tmpStr = preString + tmpChar + postString;
		         }
		     }
		}
	}
	
	/*for (index = 0; index < searchVars.length; index++)  {
		string=tmpStr.replace(/ +searchVars[index]+ /gi, +' '+ReplaceVars[index]+' ');
		alert(string);
		tmpStr=string;
	}*/
	
	results=tmpStr.replace(/ In /gi,' in ');
	results=results.replace(/ Am /gi,' am ');
	results=results.replace(/ Are /gi,' are ');
	results=results.replace(/ Is /gi,' is ');
	results=results.replace(/ This /gi,' this ');
	results=results.replace(/ That /gi,' that ');
	results=results.replace(/ Like /gi,' like ');
	results=results.replace(/ Suchas /gi,' suchas ');
	results=results.replace(/ Such /gi,' such ');
	results=results.replace(/ As /gi,' as ');
	results=results.replace(/ From /gi,' from ');
	results=results.replace(/ Fine /gi,' fine ');
	results=results.replace(/ If /gi,' if ');
	results=results.replace(/ For /gi,' for ');
	results=results.replace(/ And /gi,' and ');
	results=results.replace(/ Have /gi,' have ');
	results=results.replace(/ With /gi,' with ');
	results=results.replace(/ The /gi,' the ');
	results=results.replace(/ A /gi,' a ');
	results=results.replace(/ To /gi,' to ');
	results=results.replace(/ Of /gi,' of ');
	results=results.replace(/ Upto /gi,' upto ');
	results=results.replace(/ Also /gi,' also ');
	results=results.replace(/ Other /gi,' other ');
	results=results.replace(/ Or /gi,' or ');
	results=results.replace(/ Per /gi,' per ');
	results=results.replace(/ All /gi,' all ');
	results=results.replace(/ Amongst /gi,' amongst ');	
	results=results.replace(/ Among /gi,' among ');			
	results=results.replace(/ Also /gi,' also ');				
	
	frmObj.value=results;
}

// Function To Change Text In To Sentence Case.somesh
function lowerCase(formn,fieldname) {
	var frmObj = eval('document.'+formn+'.'+fieldname);		

	var index;
	var tmpStr;
	var tmpChar;
	var preString;
	var postString;
	var strlen;
	var string;
	//var searchVars=new Array("In","Suchas","Such","As","Like","If","This","For","Is","Am","Are","That","Fine");	
	//var ReplaceVars=new Array("in","suchas","such","as","like","if","this","for","is","am","are","that","fine");	
	
	tmpStr = frmObj.value.toLowerCase();
	strLen = tmpStr.length;
	if (strLen > 0)  {
		for (index = 0; index < strLen; index++)  {
			if (index == 0)  {
				tmpChar = tmpStr.substring(0,1).toUpperCase();
				postString = tmpStr.substring(1,strLen);
				tmpStr = tmpChar + postString;
			}
			else {
				tmpChar = tmpStr.substring(index, index+1);
				if ((tmpChar == " " || tmpChar == ",") && index < (strLen-1))  {
					tmpChar = tmpStr.substring(index+1, index+2).toUpperCase();
					preString = tmpStr.substring(0, index+1);
					postString = tmpStr.substring(index+2,strLen);
					tmpStr = preString + tmpChar + postString;
		         }
		     }
		}
	}
	
	/*for (index = 0; index < searchVars.length; index++)  {
		string=tmpStr.replace(/ +searchVars[index]+ /gi, +' '+ReplaceVars[index]+' ');
		alert(string);
		tmpStr=string;
	}*/
	
	results=tmpStr.replace(/ In /gi,' in ');
	results=results.replace(/ Am /gi,' am ');
	results=results.replace(/ Are /gi,' are ');
	results=results.replace(/ Is /gi,' is ');
	results=results.replace(/ This /gi,' this ');
	results=results.replace(/ That /gi,' that ');
	results=results.replace(/ Like /gi,' like ');
	results=results.replace(/ Suchas /gi,' suchas ');
	results=results.replace(/ Such /gi,' such ');
	results=results.replace(/ As /gi,' as ');
	results=results.replace(/ From /gi,' from ');
	results=results.replace(/ Fine /gi,' fine ');
	results=results.replace(/ If /gi,' if ');
	results=results.replace(/ For /gi,' for ');
	results=results.replace(/ And /gi,' and ');
	results=results.replace(/ Have /gi,' have ');
	results=results.replace(/ With /gi,' with ');
	results=results.replace(/ The /gi,' the ');
	results=results.replace(/ A /gi,' a ');
	results=results.replace(/ To /gi,' to ');
	results=results.replace(/ Of /gi,' of ');
	results=results.replace(/ Upto /gi,' upto ');
	results=results.replace(/ Also /gi,' also ');
	results=results.replace(/ Other /gi,' other ');
	results=results.replace(/ Or /gi,' or ');
	results=results.replace(/ Per /gi,' per ');
	results=results.replace(/ All /gi,' all ');
	results=results.replace(/ Amongst /gi,' amongst ');	
	results=results.replace(/ Among /gi,' among ');			
	results=results.replace(/ Also /gi,' also ');				
	
	frmObj.value=results;
}

// Below script is used to add values from one select box to second select box.somesh
function Add_Content_In_Selectbox(form_name, addCont, remCont, countriesHidden, submitVal) {
	var selValue;
	var selValueText;
	var countries='';

	addContEval=eval('document.'+form_name+'.'+addCont);
	remContEval=eval('document.'+form_name+'.'+remCont);
	countriesHiddenEval=eval('document.'+form_name+'.'+countriesHidden);
	
	for(i=0; i<addContEval.options.length; i++) { 
		if (addContEval.options[i].selected){
			selValue= addContEval.options[i].value;
			if(selValue==''){
				alert('Select Valid Option to Shift');
			}
			else{
				selValueText= addContEval.options[i].text;
				defaultSelectedValue = addContEval.options[i].defaultSelected;
				SelectedValue = addContEval.options[i].selected;
				for(j=0; j<remContEval.options.length; j++) { 
					if(selValue==remContEval.options[j].value){
						alert(''+selValueText+' already exists');
						return false;  
					}
				}
				remContEval.options[remContEval.options.length] = new Option(selValueText, selValue, 0, 0);
			}
		}
	}
	for(j=1; j<remContEval.options.length; j++) { 
		remContEval.options[j]= new Option(remContEval.options[j].text, remContEval.options[j].value, defaultSelectedValue, SelectedValue);
		countries +='^'+remContEval.options[j].value+'';
	}
	countries = countries.substring(1,countries.length);
	var selected_countries = new Array(countries);
	countriesHiddenEval.value = selected_countries.join('^');
	if(submitVal=='Y'){
		eval('document.'+form_name+'.submit();');
	}
}

// Below script is used to delete values from select box.somesh
function Rem_Content_From_Selectbox(form_name, addCont, remCont, countriesHidden, submitVal) {
	
	var count = 0;
	var countries='';
	var selectedArrayValue = new Array();
	var selectedArrayText = new Array();
	addContEval=eval('document.'+form_name+'.'+addCont);
	remContEval=eval('document.'+form_name+'.'+remCont);
	countriesHiddenEval=eval('document.'+form_name+'.'+countriesHidden);
	if(remContEval.options.length>1){
		for(i=1; i<remContEval.options.length; i++) { 
			if (remContEval.options[i].selected){
			}
			else{
				//alert(i+', '+remContEval.options[i].text);
				selectedArrayValue[count] = remContEval.options[i].value;
				selectedArrayText[count] = remContEval.options[i].text;
				count++;			
				//remContEval.options[i] = null;
			}
		}
		remContEval.length = 1;
	
		for(i=0; i<selectedArrayValue.length; i++) { 
			remContEval.options[remContEval.options.length] = new Option(selectedArrayText[i], selectedArrayValue[i], 0 ,0);
		}
		if (remContEval.options.length == 0) {
			remContEval.options[0] = new Option("   Selections List Here", "", 0 ,0);
		}
	
		for(j=1; j<remContEval.options.length; j++) { 
			var defaultSelectedValue = remContEval.options[i].defaultSelected;
			var SelectedValue = remContEval.options[i].selected;		
			remContEval.options[j]= new Option(remContEval.options[j].text, remContEval.options[j].value, defaultSelectedValue, SelectedValue);
			countries +='^'+remContEval.options[j].value+'';
		}
		countries = countries.substring(1,countries.length);
		var selected_countries = new Array(countries);
		countriesHiddenEval.value = selected_countries.join('^');
		if(submitVal=='Y'){
			eval('document.'+form_name+'.submit();');
		}
	}
}

// Below function is used to hide and unhide element mainly used in advertise.somesh
function hide_unhide(elementname) {
	
	if(document.getElementById(elementname).style.display == 'none'){
				
		document.getElementById(elementname).style.display = 'block';
	}
	else {
		
		document.getElementById(elementname).style.display = 'none';
	}
}

// Below script is to check and uncheck checkboxes.somesh
function checkAll(val) {
	
   	dml=document.form1;
   	len=dml.elements.length;
   	var i=0;
   	
   	for (i=0; i<len; i++) {
	   	
     	if (document.form1.elements[i].type == "checkbox") {
	     	
        	if (val == 1) {
	        	
           		dml.elements[i].checked=true;
        	} 
			else {
				
           		dml.elements[i].checked=false;
        	}
     	}   
   	}
}

function obtainvalue(val) {
	
	var vak;
	
	var radios = document.getElementsByName(val);
	
	for(var i=0;i<radios.length;i++) {
		
		if(radios[i].checked) {
			
			vak = radios[i];
			break;
		}
	}
	
	return vak;
}

// Below script is used to validate paid membership inquiry and order form.brijesh
function renew_order_form_validate(formname) {


	if (!formname.pymt_mode[0].checked && !formname.pymt_mode[1].checked && !formname.pymt_mode[2].checked && !formname.pymt_mode[3].checked && !formname.pymt_mode[4].checked && !formname.pymt_mode[5].checked && !formname.pymt_mode[6].checked && !formname.pymt_mode[7].checked && !formname.pymt_mode[8].checked && !formname.pymt_mode[9].checked && !formname.pymt_mode[10].checked && !formname.pymt_mode[11].checked && !formname.pymt_mode[12].checked) {
		
		inlineMsg('pymt_mode','Please check Your Question.',2);
		return false;
	}
	if (!formname.terms_use.checked) {
		inlineMsg('terms_use','Please check I Accept the Terms Of Use.',2);
		return false;
	}
	
	return true;
}

// Below script is used to validate paid membership inquiry and order form.somesh
function order_form_validate(formname) {
	
	var nameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
	var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
	
	if (formname.check_login.value=='false') {
		
		if (formname.membertype[0].checked) {

			if (chktrim(formname.user_name.value).length == 0) {
				inlineMsg('user_name','E-mail address can\'t be left blank.',2);
		        return false;
			}
		    if (formname.user_name.value.indexOf('@') == -1) {
			    inlineMsg('user_name','Error in e-mail address.',2);
		        return false;
			}
		    if (formname.user_name.value.indexOf('.') == -1) {
			    inlineMsg('user_name','Error in e-mail address.',2);
		        return false;
			}
		    if (formname.user_name.value.indexOf('@') != formname.user_name.value.lastIndexOf('@')) {
			    inlineMsg('user_name','Please Specify One E-mail address only.',2);
		        return false;
			}
		    if (formname.pass_word.value.length==0) {
			    inlineMsg('pass_word','Enter Your Password.',2);
		        return false;
			}
		}
		else {
			
			if(chktrim(formname.your_name.value).length==0) {
				inlineMsg('your_name','Please Enter Your Name.',2);
				return false;
			}
			if (chktrim(formname.email_id.value).length == 0) {
				inlineMsg('email_id','E-mail address can\'t be left blank.',2);
				return false;
			}
			if (formname.email_id.value.indexOf('@') == -1) {
				inlineMsg('email_id','Error in e-mail address.',2);
				return false;
			}
			if (formname.email_id.value.indexOf('.') == -1) {
				inlineMsg('email_id','Error in e-mail address.',2);
				return false;
			}
			if (formname.email_id.value.indexOf('@') != formname.email_id.value.lastIndexOf('@')) {
				inlineMsg('email_id','Please Specify One E-mail address only.',2);
				return false;
			}
			if (formname.religion_code.options[formname.religion_code.selectedIndex].value=="")  {
				inlineMsg('religion_code','Please Select your Religion.',2);
				return false;
			}
			if (formname.country_code.options[formname.country_code.selectedIndex].value=="")  {
				inlineMsg('country_code','Please Select your Country.',2);
				return false;
			}
			if (chktrim(formname.street_address.value).length==0) {
				inlineMsg('street_address','Please Enter Your Address.',2);
				return false;
			}
			if (chktrim(formname.mobile.value).length==0) {
				
				if (chktrim(formname.ph_ccode.value).length==0) {
					inlineMsg('ph_ccode','Please Enter Your Country Code.',2);
					return false;
				}
				if (chktrim(formname.ph_acode.value).length==0) {
					inlineMsg('ph_acode','Please Enter Your Area Code.',2);
					return false;
				}
				if (chktrim(formname.ph_number.value).length==0) {
					inlineMsg('ph_number','Please Enter Your Phone Number.',2);
					return false;
				}
			}
		}
	}
	
	if (chktrim(formname.query.value).length>1 && chktrim(formname.query.value).length<10) {
		inlineMsg('query','Enter Your Comment / Query Minimum Of 10 Characters.',2);
		return false;
	}
    if (chktrim(formname.query.value).length>1000) {
	    inlineMsg('query','Enter Your Comment / Query (max. 1000 characters).',2);
        return false;
	}
	
	if (formname.name=='paid_membership_order') {
	
		if (!formname.pymt_mode[0].checked && !formname.pymt_mode[1].checked && !formname.pymt_mode[2].checked && !formname.pymt_mode[3].checked && !formname.pymt_mode[4].checked && !formname.pymt_mode[5].checked && !formname.pymt_mode[6].checked && !formname.pymt_mode[7].checked && !formname.pymt_mode[8].checked && !formname.pymt_mode[9].checked && !formname.pymt_mode[10].checked && !formname.pymt_mode[11].checked && !formname.pymt_mode[12].checked) {
			
			inlineMsg('pymt_mode','Please check Your Question.',2);
			return false;
		}
		if (!formname.terms_use.checked) {
			inlineMsg('terms_use','Please check I Accept the Terms Of Use.',2);
			return false;
		}
	}
	
	return true;
}

function survey_form_validate(formname) {
	
	if (!formname.q1[0].checked && !formname.q1[1].checked && !formname.q1[2].checked && !formname.q1[3].checked) {
		inlineMsg('q1','Please check Your Question.',1);
		return false;
	}
	
	if (!formname.q2[0].checked && !formname.q2[1].checked && !formname.q2[2].checked && !formname.q2[3].checked) {
		inlineMsg('q2','Please check Your Question.',2);
		return false;
	}
	if (!formname.q31.checked && !formname.q32.checked && !formname.q33.checked && !formname.q34.checked && !formname.q35.checked && !formname.q36.checked && !formname.q37.checked && !formname.q38.checked && !formname.q39.checked && !formname.q310.checked) {
		inlineMsg('q31','Please check Your Question.',3);
		return false;
	}
	if (!formname.q4[0].checked && !formname.q4[1].checked) {
		inlineMsg('q4','Please check Your Question.',4);
		return false;
	}
	if (!formname.q5[0].checked && !formname.q5[1].checked) {
		inlineMsg('q5','Please check Your Question.',5);
		return false;
	}
	if (!formname.q6[0].checked && !formname.q6[1].checked) {
		inlineMsg('q6','Please check Your Question.',6);
		return false;
	}
	if (!formname.q7[0].checked && !formname.q7[1].checked) {
		inlineMsg('q7','Please check Your Question.',7);
		return false;
	}
	if (!formname.q8[0].checked && !formname.q8[1].checked && !formname.q8[2].checked && !formname.q8[3].checked) {
		inlineMsg('q8','Please check Your Question.',8);
		return false;
	}
	
	if (!formname.q9[0].checked && !formname.q9[1].checked && !formname.q9[2].checked && !formname.q9[3].checked && !formname.q9[4].checked && !formname.q9[5].checked && !formname.q9[6].checked && !formname.q9[7].checked && !formname.q9[8].checked && !formname.q9[9].checked ) {
		inlineMsg('q9','Please check Your Question.',9);
		return false;
	}
	
	if (!formname.q10[0].checked && !formname.q10[1].checked) {
		inlineMsg('q10','Please check Question.',10);
		return false;
	}
}

// Below script is used to validate member login form.somesh
function check_login_validate(formname) {

	if (chktrim(formname.username.value).length == 0) {
		inlineMsg('username','E-mail address can\'t be left blank.',2);
		return false;
	}
	if (formname.username.value.indexOf('@') == -1) {
		inlineMsg('username','Error in e-mail address.',2);
		return false;
	}
	if (formname.username.value.indexOf('.') == -1) {
		inlineMsg('username','Error in e-mail address.',2);
		return false;
	}
	if (formname.username.value.indexOf('@') != formname.username.value.lastIndexOf('@')) {
		inlineMsg('username','Please Specify One E-mail address only.',2);
		return false;
	}
	if (chktrim(formname.pass_word.value).length==0) {
		inlineMsg('pass_word','Enter Your Password.',2);
		return false;
	}
}

// Below script is used to align page at the center according to screen resolution like 800*600, 1024*768.somesh
function setWidth() {
	var screenWidth=screen.width;
	if(screenWidth>=1024) {
		document.getElementById('body').style.width='1000px';
	}
	else {
		document.getElementById('body').style.width='770px';
	}	
}

function chk3_new() {
	
	if (document.form3.username.value.length == 0) {
		
		alert("E-mail address can't be left blank");
		
		document.form3.username.focus();
		
		return false;
	}
	
	if (document.form3.username.value.indexOf('@') == -1) {
		
		alert("Error in e-mail address");
		
		document.form3.username.focus();
		
		return false;
	}
	
	if (document.form3.username.value.indexOf('.') == -1) {
		
		alert("Error in e-mail address");
		
		document.form3.username.focus();
		
		return false;
	}
	
	if (document.form3.username.value.indexOf('@') != document.form3.username.value.lastIndexOf('@')) {
		
		alert("Please Specify One E-mail address only");
		
		document.form3.username.focus();
		
		return false;
	}
	
	if (document.form3.pass_word.value.length ==0) {
		
		alert("Plaese Provide Your Password");
		
		document.form3.pass_word.focus();
		
		return false;
	}
}

function checkform_new() {
	
	if (document.form1.contact_person.value.length == 0) {
		
		alert("CONTACT PERSON can't be left blank");
		
		document.form1.contact_person.focus();
		
		return false;
	}
	
	if (document.form1.username.value.length == 0) {
		
		alert("E-mail address can't be left blank");
		
		document.form1.username.focus();
		
		return false;
	}
	
	if (document.form1.username.value.indexOf('@') == -1) {
		
		alert("Error in e-mail address");
		
		document.form1.username.focus();
		
		return false;
	}
	
	if (document.form1.username.value.indexOf('.') == -1) {
		
		alert("Error in e-mail address");
		
		document.form1.username.focus();
		
		return false;
	}
	
	if (document.form1.username.value.indexOf('@') != document.form1.username.value.lastIndexOf('@')) {
		
		alert("Please Specify One E-mail address only");
		
		document.form1.username.focus();
		
		return false;
	}
	
	if (document.form1.alt_email.value.length!=0) {
		
		if (document.form1.alt_email.value.indexOf('@') == -1) {
			
			alert("Error in Alternate e-mail address");
			
			document.form1.alt_email.focus();
			
			return false;
		}
		
		if (document.form1.alt_email.value.indexOf('.') == -1) {
			
			alert("Error in Alternate e-mail address");
			
			document.form1.alt_email.focus();
			
			return false;
		}
	}
	
	if ((document.form1.cont_code.value==0 || document.form1.city_code.value==0 || isNaN(document.form1.city_code.value) || document.form1.phones.value==0 || isNaN(document.form1.phones.value)) && document.form1.mobile_phone.value==0) {	
		
		alert("Please Provide Valid Landline OR Mobile no. for further Communication.");
		
		document.form1.cont_code.value="";
		
		document.form1.city_code.value="";
		
		document.form1.phones.value="";
		
		document.form1.mobile_phone.value="";
		
		document.form1.mobile_phone.focus();
		
		return false;
	}
	
	if (document.form1.postal_address.value.length == 0) {
		
		alert("POSTAL ADDRESS can't be left blank");
		
		document.form1.postal_address.focus();
		
		return false;
	}
	
	fr = document.form1.country_code.selectedIndex;
	
	fr1 = document.form1.country_code.options[fr].value;
	
	if (fr1 == "") {
		
		alert("Please Select The COUNTRY field");
		
		document.form1.country_code.focus();
		
		return false;
	}
	
	fr2 = document.form1.religion_code.selectedIndex;
	
	fr3=document.form1.religion_code.options[fr2].value;
	
	if (fr3 == "") {
		
		alert("Please Select The RELIGION field");
		
		document.form1.religion_code.focus();
		
		return false;
	}
	
	if (document.form1.pass_word.value.length < 6) {
		
		alert("Password should be minimum of 6 characters");
		
		document.form1.pass_word.focus();
		
		return false;
	}
	
	if ((document.form1.pass_word.value) != (document.form1.repass_word.value)) {
		
		alert("The PASSWORD & RE-ENTERED PASSWORD need to be the same");
		
		document.form1.repass_word.focus();
		
		return false;
	}
	
	if(document.form1.code.value=='') { 
		
		alert('Please enter the string from the displayed image'); 
		
		document.form1.code.value=''; 
		
		document.form1.code.focus(); 
		
		return false; 
	}
	 
	checkcode(document.form1.code.value); 
	
	return false;
}

function openwinsl(chk1) {
	
	if (chk1.member_id.value.length==0) {
		
		alert("Enter Profile Number");
		
		chk1.member_id.focus();
		
		return false;
	} 
}

function frmchkcompanylisting() {

	if (document.frmcomp_listing.email_id.value.length == 0) {
		
		alert("E-mail address can't be left blank");
		
		document.frmcomp_listing.email_id.focus();
		
		return false;
	}
	
	if (document.frmcomp_listing.email_id.value.indexOf('@') == -1) {
		
		alert("Error in e-mail address");
		
		document.frmcomp_listing.email_id.focus();
		
		return false;
	}
	
	if (document.frmcomp_listing.email_id.value.indexOf('.') == -1) {
		
		alert("Error in e-mail address");
		
		document.frmcomp_listing.email_id.focus();
		
		return false;
	}
	
	if (document.frmcomp_listing.email_id.value.indexOf('@') != document.frmcomp_listing.email_id.value.lastIndexOf('@')) {
		
		alert("Please Specify One E-mail address only");
		
		document.frmcomp_listing.email_id.focus();
		
		return false;
	}
	
	if (document.frmcomp_listing.password_txt.value.length == 0) {
		
		alert("Password can't be left blank");
		
		document.frmcomp_listing.password_txt.focus();
		
		return false;
	}
	
	if (document.frmcomp_listing.con_password_txt.value.length == 0) {
		
		alert("Confirm Password can't be left blank");
		
		document.frmcomp_listing.con_password_txt.focus();
		
		return false;
	}
	
	if(document.frmcomp_listing.password_txt.value!=document.frmcomp_listing.con_password_txt.value) {
	
		alert("Both Password Must be Same");
		
		document.frmcomp_listing.password_txt.focus();
		document.frmcomp_listing.password_txt.value='';
		document.frmcomp_listing.con_password_txt.value='';
		
		return false;
	}
	
	if (document.frmcomp_listing.your_name.value.length == 0) {
		
		alert("Name can't be left blank");
		
		document.frmcomp_listing.your_name.focus();
		
		return false;
	}
	
	if (document.frmcomp_listing.comp_name.value.length == 0) {
		
		alert("Company Name can't be left blank");
		
		document.frmcomp_listing.comp_name.focus();
		
		return false;
	}
	
	if (document.frmcomp_listing.address.value.length == 0) {
		
		alert("Address can't be left blank");
		
		document.frmcomp_listing.address.focus();
		
		return false;
	}
	
	if (document.frmcomp_listing.state_id.value==0) {
		
		alert("Select Any State");
		
		document.frmcomp_listing.state_id.focus();
		
		return false;
	}
	
	if (document.frmcomp_listing.comp_desc.value.length == 0) {
		
		alert("Company Description can't be left blank");
		
		document.frmcomp_listing.comp_desc.focus();
		
		return false;
	}
	
}

// Below script is used to add selected value from one select box to another select box.somesh
function addLoc(sel_nm,sel_nm1,opt_type,opt_cnt,sel_nm2) {
	
	var flag = 0;
	
	while(flag<document.mat.elements.length) {
		
		if(document.mat.elements[flag].name==sel_nm) {
			
			obj1 = document.mat.elements[flag];
			
			break;
		}
		
		flag++;
	}
	
	var flag =0;
	
	while(flag<document.mat.elements.length) {
		
		if(document.mat.elements[flag].name==sel_nm1) {
			
			obj2 = document.mat.elements[flag];
			break;
		}
		
		flag++;
	}
	
	var flag = 0;
	
	while(flag<document.mat.elements.length) {
		
		if(document.mat.elements[flag].name==sel_nm2) {
			
			obj3 = document.mat.elements[flag];
			break;
		}
		
		flag++;
	}
	
	sidx = obj2.options.length;
	
	if(sidx >= opt_cnt) {
		
		alert ("You can add only "+opt_cnt+" options for "+opt_type);
		return false;
	}
	
	for (i=0;i<obj1.options.length;i++) {
		
		if(obj1.options[i].selected) {
			
			sidx=obj2.options.length;
			
			if(sidx >= opt_cnt) {
				
				return false;
			}
			
			var add_type = false;
			
			for(ii=0; ii<sidx; ii++) {
				
				if (obj1.options[i].value == obj2.options[ii].value) {
					
					var add_type = true;
					break;
				}
			}
			
			if (add_type!=true) {
				
				if (obj1.options[i].value!="Any") {
					
					if (sidx<opt_cnt) {
						
						for (k=0;k<sidx;k++) {
							
							if (obj2.options[k].value=="Any") {
								
								obj2.options[k] = null;
								sidx=obj2.options.length;
							}
						}
					}
					
					obj2.options[sidx] = new Option(obj1.options[i].text, obj1.options[i].value, 0 ,0);
				}
				else {
					
					obj2.options.length = 0;
					obj2.options[0] = new Option(obj1.options[i].text, obj1.options[i].value, 0 ,0);
				}
			}
		}
	}
	
	var loclist = '';
	
	for(i=0;i<obj2.options.length;i++) {
		
		loclist += obj2.options[i].value + "^";
	}

	obj3.value = loclist;
	
	if (loclist=="^") {
		
		obj3.value = '';
	}
}

// Below script is used to remove selected value from select box.somesh
function remLoc(sel_nm1,sel_nm2) {
	
	var flag = 0;
	
	while(flag<document.mat.elements.length) {
		
		if(document.mat.elements[flag].name==sel_nm1) {
			
			obj2 = document.mat.elements[flag];
			break;
		}
		
		flag++;
	}
	
	var flag =0;
	
	while(flag<document.mat.elements.length) {
		
		if(document.mat.elements[flag].name==sel_nm2) {
			
			obj3 = document.mat.elements[flag];
			break;
		}
		
		flag++;
	}
	
	var i=0;
	
	while (i<obj2.options.length) {
		
		if(obj2.options[i].selected) {
			
			obj2.options[i] = null;
		}
		else {
			
			i++;
		}
	}
	
	if (obj2.options.length == 0) {
		
		obj2.options[0] = new Option("Any", "Any", 0 ,0);
	}
	
	var loclist = '';
	
	for(i=0;i<obj2.options.length;i++) {
		
		loclist += obj2.options[i].value + "^";
	}

	obj3.value = loclist;
	
	if (loclist=="^") {
		
		obj3.value = '';
	}
}

function chk_reg() {
	
	if (document.mat.contact_person.value== 0) {
		
		alert("CONTACT PERSON can't be left blank");
		
		document.mat.contact_person.focus();
		
		return false;
	}
	
	if (document.mat.postal_address.value==0) {
		
		alert("POSTAL ADDRESS can't be left blank");
		
		document.mat.postal_address.focus();
		
		return false;
	}
	
	if (document.mat.pass.value==0) {
		alert("Do not leave the PASSWORD field blank");
		document.mat.pass.focus();
		return false;
	}
	if (document.mat.repass.value==0) {
		alert("Do not leave the RE-ENTER PASSWORD field blank");
		document.mat.repass.focus();
		return false;
	}
	if ((document.mat.pass.value) != (document.mat.repass.value)) {
		alert("The PASSWORD & RE-ENTERED PASSWORD need to be the same");
		document.mat.repass.focus();
		return false;
	}
}


// Below function is used to validate Request For Change Username form.somesh 
function change_username_validate(formname) {
	
	if (formname.new_username.value.length == 0) {
		alert("E-mail address can't be left blank");
		formname.new_username.focus();
		return false;
	}
	if (formname.new_username.value.indexOf('@') == -1) {
		alert("Error in e-mail address.");
		formname.new_username.focus();
		return false;
	}
	if (formname.new_username.value.indexOf('.') == -1) {
		alert("Error in e-mail address.");
		formname.new_username.focus();
		return false;
	}
	if (formname.new_username.value.indexOf('@') != formname.new_username.value.lastIndexOf('@')) {
		alert("Please Specify One E-mail address only.");
		formname.new_username.focus();
		return false;
	} 
	if (formname.new_username.value==formname.username.value) {
		alert("Entered Email address and Existing Email address Is Same");
		formname.reason_for_change.focus();
		return false;
	}
	if (formname.reason_for_change.value.length <1) {
		alert("Please Enter Reason For Change In Username.");
		formname.reason_for_change.focus();
		return false;
	}
	if (formname.reason_for_change.value.length >500) {
		alert("Please Enter Reason For Change In Username within 500 characters.");
		formname.reason_for_change.focus();
		return false;
	}
}

function chk_reg1(chk1) {
	if (chk1.eid.value==0) {
		alert("E-Mail Address can't be Left Blank");
		chk1.eid.focus();
		return false;
	}
	if (chk1.eid.value.indexOf('@') == -1) {
		alert("Error in Your E-Mail Address");
		chk1.eid.focus();
		return false;
	}
	if (chk1.eid.value.indexOf('.') == -1) {
		alert("Error in Your E-Mail Address");
		chk1.eid.focus();
		return false;
	}
	if (chk1.eid.value.indexOf('@') != chk1.eid.value.lastIndexOf('@')) {
		alert("Please Specify One E-mail Address Only");
		chk1.eid.focus();
		return false;
	}
	if (document.mat.email.value==chk1.eid.value) {
		alert("This is Your Existing E-Mail Address");
		chk1.eid.focus();
		return false;
	}
}


function chk_astro_details(chk1) {	
	
	
	if (chk1.hour.options[chk1.hour.selectedIndex].value == "x") {
		
		alert("Please Select Hour");
		
		chk1.hour.focus();
		
		return false;
	}
	
	
	if (chk1.minute.options[chk1.minute.selectedIndex].value == "x") {
		
		alert("Please Select Minutes");
		
		chk1.minute.focus();
		
		return false;
	}
	
	
	
	if (chk1.hour.options[chk1.hour.selectedIndex].value != "x" && chk1.minute.options[chk1.minute.selectedIndex].value == "x") {
		
		alert("Please Select Minutes");
		
		chk1.minute.focus();
		
		return false;
	}
	
	if (chk1.hour.options[chk1.hour.selectedIndex].value != "x" && chk1.minute.options[chk1.minute.selectedIndex].value != "x" && chk1.ampm.options[chk1.ampm.selectedIndex].value == "x") {
		alert("Please Select AM or PM");
		chk1.ampm.focus();
		return false;
	}
	
	if (chk1.horo.value!=0) {
		
		if ((chk1.horo.value.lastIndexOf('.jpg')==-1) && (chk1.horo.value.lastIndexOf('.gif')==-1) && (chk1.horo.value.lastIndexOf('.bmp')==-1) && (chk1.horo.value.lastIndexOf('.png')==-1)) {
			
			alert('Please Upload Only .JPG Or .GIF File in Horoscope Field');
			
			chk1.horo.focus();
			
			return false;
		}
	}
}

function chk_family_details(chk1) {
	
	if (!chk1.cultural_value[0].checked && !chk1.cultural_value[1].checked && !chk1.cultural_value[2].checked) {
		alert("Please Select The Family  Values field");
		chk1.cultural_value[0].focus();
		return false;
	}
	
	if (!chk1.family_type[0].checked && !chk1.family_type[1].checked && !chk1.family_type[2].checked) {
		alert("Please Select The Family Type field");
		chk1.family_type[0].focus();
		return false;
	}
	
	if (!chk1.family_status[0].checked && !chk1.family_status[1].checked && !chk1.family_status[2].checked && !chk1.family_status[3].checked) {
		alert("Please Select The Family  Status field");
		chk1.family_status[0].focus();
		return false;
	}
	
	if ((chk1.father.options[chk1.father.selectedIndex].value) == "x") {
		alert("Please select about your Father");
		chk1.father.focus();
		return false;
	}
	
	if ((chk1.mother.options[chk1.mother.selectedIndex].value) == "x") {
		alert("Please select about your Mother");
		chk1.mother.focus();
		return false;
	}
	
	if ((chk1.brothers_married.options[chk1.brothers_married.selectedIndex].value) > 0 && chk1.brothers_married.disabled=="false") {
		alert("Please select Brothers Married field");
		chk1.brothers_married.focus();
		return false;
	}
	
	if ((chk1.brothers_married.options[chk1.brothers_married.selectedIndex].value) > (chk1.brothers.options[chk1.brothers.selectedIndex].value)) {
		alert("Your Married Brothers can not be more than your total number of brothers");
		chk1.brothers_married.focus();
		return false;
	}	
	
	if ((chk1.sisters_married.options[chk1.sisters_married.selectedIndex].value) > 0 && chk1.sisters_married.disabled=="false") {
		alert("Please select Sisters Married field");
		chk1.sisters_married.focus();
		return false;
	}
	
	if ((chk1.sisters_married.options[chk1.sisters_married.selectedIndex].value) > (chk1.sisters.options[chk1.sisters.selectedIndex].value)) {
		alert("Your Married Sisters can not be more than your total number of sisters");
		chk1.sisters_married.focus();
		return false;
	}

	if (chk1.family_background.value == 0) {
		alert("Please specify details about your family. This field can not be left blank.");
		chk1.char_len.value=0;
		chk1.family_background.focus();
		return false;
	}

	if (chk1.family_background.value.length >= 750) {
		alert("Details about family cannot exceed 750 characters");
		chk1.family_background.focus();
		return false;
	}
}

function chk_siblings() {
	//alert("hi"+document.mat.brothers.options[document.mat.brothers.selectedIndex].value);
	if ((document.mat.brothers.options[document.mat.brothers.selectedIndex].value) == "0") {
		document.mat.brothers_married.value="0";
		document.mat.brothers_married.disabled=true;
	}
	else {
		document.mat.brothers_married.disabled=false;
	}
	
	if ((document.mat.sisters.options[document.mat.sisters.selectedIndex].value) == "0") {
		document.mat.sisters_married.value="0";
		document.mat.sisters_married.disabled=true;
	}
	else {
		document.mat.sisters_married.disabled=false;
	}		
}

function chk_siblings1() {
	//alert("hi"+document.mat.brothers_married.options[document.mat.brothers_married.selectedIndex].value);
	if ((document.mat.brothers_married.options[document.mat.brothers_married.selectedIndex].value) > (document.mat.brothers.options[document.mat.brothers.selectedIndex].value)) {
		alert("Your Married Brothers can not be more than your total number of brothers");
		document.mat.brothers_married.focus();
		return false;
	}
	else if ((document.mat.sisters_married.options[document.mat.sisters_married.selectedIndex].value) > (document.mat.sisters.options[document.mat.sisters.selectedIndex].value)) {
		alert("Your Married Sisters can not be more than your total number of sisters");
		document.mat.sisters_married.focus();
		return false;
	}		
}

// Below script is used to validate serach by profile number form.somesh
function search_by_profile_number_validate(formname) {
	
	if (formname.sl.value.length==0) {
		
		alert("Please Enter Profile Number");
		
		formname.sl.focus();
		
		return false;
	} 
}

function getLoc(sel_nm1,sel_nm2) {
	
	var flag =0;
	
	while(flag<document.mat.elements.length) {
		
		if(document.mat.elements[flag].name==sel_nm1) {
			
			obj2 = document.mat.elements[flag];
			
			break;
		}
		
		flag++;
	}
	
	var flag =0;
	
	while(flag<document.mat.elements.length) {
		
		if(document.mat.elements[flag].name==sel_nm2) {
			
			obj3 = document.mat.elements[flag];
			
			break;
		}
		
		flag++;
	}
	
	var loclist = '';
	
	for(i=0;i<obj2.options.length;i++) {
		
		loclist += obj2.options[i].value + "^";
	}

	obj3.value = loclist;
	
	if (loclist=="^") {
		
		obj3.value="";
	}
}

function chk_mem_profile(chk1, selcont,selrel,upd_sts)  {	

	
	getLoc('l_reli1[]','l_reli2');

	if (selrel=="100001" || selrel=="100002" || selrel=="100005" || selrel=="100003" || selrel=="100004") {
		
		getLoc('l_caste1[]','l_caste2');
	}
	
	getLoc('l_tong1[]','l_tong2');
	
	getLoc('l_occu1[]','l_occu2');
	
	getLoc('l_cont1[]','l_cont2');
	
	getLoc('l_state1[]','l_state2');
	
	getLoc('l_citizenship1[]','l_citizenship2');
	
	getLoc('l_spcases1[]','l_spcases2');	
	
	if (!chk1.posted_for[0].checked && !chk1.posted_for[1].checked && !chk1.posted_for[2].checked && !chk1.posted_for[3].checked && !chk1.posted_for[4].checked) {
		
		alert("Please Select The Posted For field");
		
		chk1.posted_for[0].focus();
		
		return false;
	}

	//if (chk1.org_frm.value!="update") {
		
	if (upd_sts!="Y") {		
		
		if (!chk1.gender_type[0].checked && !chk1.gender_type[1].checked) {
			
			alert("Please Select The Gender field");
			
			chk1.gender_type[0].focus();
			
			return false;
		}		

		if (chk1.gender_type.checked==true) {
			
			form_11 = chk1.gender_type.value;
		}
		else {
			
			form_11 = chk1.gender_type.value;
		}
	}
	else {
		
		form_11 = chk1.gender_type.value;
	}

	if (chktrim(chk1.cname.value)==0) {
		
		alert("Select The First Name field");
		
		chk1.cname.focus();
		
		return false;
	}

	if (chktrim(chk1.lname.value)==0) {
		
		alert("Select The Last Name field");
		
		chk1.lname.focus();
		
		return false;
	}

	//if (chk1.org_frm.value!="update") {
	if (upd_sts!="Y") {
		
		form_2  = chk1.day.selectedIndex;
		
		form_22 = chk1.day.options[form_2].value;
		
		dy = chk1.day.options[form_2].value;
		
		if (form_22 == "x") {
			
			alert("Select The Day field");
			
			chk1.day.focus();
			
			return false;
		}
		
		form_222  = chk1.month.selectedIndex;
		
		form_2222 = chk1.month.options[form_222].value;
		
		mn = chk1.month.options[form_222].value;
		
		if (form_2222 == "x") {
			
			alert("Select The Month field");
			
			chk1.month.focus();
			
			return false;
		}

		form_2222  = chk1.year.selectedIndex;
		
		form_22222 = chk1.year.options[form_2222].value;
		
		yr = chk1.year.options[form_2222].value;
		
		if (form_22222 == "x") {
			
			alert("Select The Year field");
			
			chk1.year.focus();
			
			return false;
		}

		if ((form_222 ==4)||(form_222 ==6)||(form_222 ==9)||(form_222 ==11)) {
			
			if (form_22 > 30) {
				
				alert ("The date selected is not valid");
				
				chk1.day.focus();
				
				return false;
			}
		}

		if (form_222 ==2) {
			
			if ((form_22222 % 4 == 0 && form_22222 % 100 != 0) || (form_22222 % 400 == 0)) {
				
				if (form_22 > 29) {
					
					alert ("The date selected is not valid. It should be less than 30");
					
					chk1.day.focus();
					
					return false;
				}
			}
			else {
				
				if (form_22 > 28) {
					
					alert ("The date selected is not valid. It should be less than 29");
					
					chk1.day.focus();
					
					return false;
				}
			}
		}
		
		curyr = chk1.curyr.value;
		
		curmn = chk1.curmn.value;
		
		curdy = chk1.curdy.value;

		if (selcont=="IN") {
			
			if (form_11 =="F") {
				
				acc_age = 18;
			}
			else {
				
				acc_age = 21;
			}
			
			if(mn<10) {
				
				mn=mn.substring(1,2);
			}
			
			jmn = mn;
			
			jmn = parseInt(jmn);

			if (curyr-yr<acc_age) {
				
				alert("Error In Date of Birth!! Acceptable Age is "+acc_age+" yrs or above");
				
				chk1.year.focus();
				
				return false;
			}
			else if (curyr-yr==acc_age) {
				
				if (curmn<jmn) {
					
					alert("Error In Date of Birth!! Acceptable Age is "+acc_age+" yrs or above");
					
					chk1.year.focus();
					
					return false;
				}
				else if (curmn==jmn) {
					
					if (curdy < dy) {
						
						alert("Error In Date of Birth!! Acceptable Age is "+acc_age+" yrs or above");
						
						chk1.year.focus();
						
						return false;
					}
				}
			}
		}
		else {
			
			acc_age = 18;
			
			if(mn<10) {
				
				mn = mn.substring(1,2);
			}
			
			jmn = mn;
			
			jmn = parseInt(jmn);

			if (curyr-yr<acc_age) {
				
				alert("Error In Date of Birth!! Acceptable Age is "+acc_age+" yrs or above");
				
				chk1.year.focus();
				
				return false;
			}
			else if (curyr-yr==acc_age) {
				
				if (curmn<jmn) {
					
					alert("Error In Date of Birth!! Acceptable Age is "+acc_age+" yrs or above");
					
					chk1.year.focus();
					
					return false;
				}
				else if (curmn==jmn) {
					
					if (curdy < dy) {
						
						alert("Error In Date of Birth!! Acceptable Age is "+acc_age+" yrs or above");
						
						chk1.year.focus();
						
						return false;
					}
				}
			}
		}
	}
	
	
	
	if (selrel == "100004") {
		
		if (!chk1.marital_status_code[0].checked && !chk1.marital_status_code[1].checked && !chk1.marital_status_code[2].checked && !chk1.marital_status_code[3].checked) {
			
			alert("Select The Marital Status");
			
			chk1.marital_status_code[0].focus();
			
			return false;
		}
	}
	else {
		
		if (!chk1.marital_status_code[0].checked && !chk1.marital_status_code[1].checked && !chk1.marital_status_code[2].checked) {
			
			alert("Select The Marital Status");
			
			chk1.marital_status_code[0].focus();
			
			return false;
		}
	}	

	if (selcont == "IN") {
		
		form_3  = chk1.state_code.selectedIndex;
		
		form_33 = chk1.state_code.options[form_3].value;

		if (form_33 == "x") {
			
			alert("Select The State field");
			
			chk1.state_code.focus();
			
			return false;
		}		

		form_4  = chk1.city_code.selectedIndex;
		
		form_44 = chk1.city_code.options[form_4].value;
		
		if (form_44 == 'x') {
			
			alert("Select The City field");
			
			chk1.city_code.focus();
			
			return false;
		}
		
		if (form_44 == "Others") {
			
			if (chk1.oth_city.value==0) {
				
				alert("Enter your City");
				
				chk1.oth_city.focus();
				
				return false;
			}
		}		
	}
	else {
		
		if (chk1.oth_city.value==0) {
			
			alert("Enter your City");
			
			chk1.oth_city.focus();
			
			return false;
		}
	}

	if (!chk1.citizenship[0].checked && !chk1.citizenship[1].checked && !chk1.citizenship[2].checked) {
		
		alert("Select Citizenship field");
		
		chk1.citizenship[0].focus();
		
		return false;
	}	

	if ((chk1.living_situation.options[chk1.living_situation.selectedIndex].value) == "x") {
		
		alert("Select Living Situation field");
		
   		chk1.living_situation.focus();
   		
   		return false;
	}

	if ((chk1.house_ownership.options[chk1.house_ownership.selectedIndex].value) == "x") {
		
		
		alert("Select House Ownership field");
		
		chk1.house_ownership.focus();
		
		return false;
	}

	

	if (selrel == "100004" || selrel == "100001" || selrel == "100003" || selrel == "100005" || selrel == "100002") {
		
		if (selrel == "100004") {
			
			form_81  = chk1.caste_code.selectedIndex;
			
			form_881 = chk1.caste_code.options[form_81].value;
			
			if (form_881 == "x") {
				
				alert("Select The Mazhab field");
				
				chk1.caste_code.focus();
				
				return false;
			}
		}
		else {
			
			form_81  = chk1.caste_code.selectedIndex;
			
			form_881 = chk1.caste_code.options[form_81].value;
			
			if (form_881 == "x") {
				
				alert("Select The Caste field");
				
				chk1.caste_code.focus();
				
				return false;
			}
		}
	}

	form_8  = chk1.mother_tongue_code.selectedIndex;
	
	form_88 = chk1.mother_tongue_code.options[form_8].value;
	
	if (form_88 == "x") {
		
		alert("Select The Mother Tongue field");
		
		chk1.mother_tongue_code.focus();
		
		return false;
	}
	
	
	
	form_101 = chk1.education_code.selectedIndex;
	
	form_121 = chk1.education_code.options[form_101].value;
	
	if (form_121 == "x") {
		
		alert("Select The Education field");
		
		chk1.education_code.focus();
		
		return false;
	}

	form_11  = chk1.occupation_code.selectedIndex;
	
	form_111 = chk1.occupation_code.options[form_11].value;
	
	if (form_111 == "x") {
		
		alert("Select The Occupation field");
		
		chk1.occupation_code.focus();
		
		return false;
	}
	
	if (chk1.occupation_type_code.options[chk1.occupation_type_code.selectedIndex].value == "x") {
		
		alert("Select The Occupation field");
		
		chk1.occupation_type_code.focus();
		
		return false;
	}

	form_12  = chk1.income.selectedIndex;
	
	form_122 = chk1.income.options[form_12].value;
	
	if (form_122 == "x") {
		
		alert("Select The Monthly Income field");
		
		chk1.income.focus();
		
		return false;
	}

	if ((form_122==0) && (form_111!=100019) && (form_111!=100026)) {
		
		alert("Income can't be selected as Nil for the Selected Occupation");
		
		chk1.income.focus();
		
		return false;
	}
	
	if ((form_122!=0) && ((form_111==100019) || (form_111==100026))) {
		
		alert("Income has to be selected as Nil for the Selected Occupation");
		
		chk1.income.focus();
		
		return false;
	}

	if (!chk1.features[0].checked && !chk1.features[1].checked && !chk1.features[2].checked && !chk1.features[3].checked && !chk1.features[4].checked) {
		
		alert("Select The Features field");
		
		chk1.features[0].focus();
		
		return false;
	}

	if (!chk1.complexion[0].checked && !chk1.complexion[1].checked && !chk1.complexion[2].checked && !chk1.complexion[3].checked) {
		
		alert("Select The Complexion field");
		
		chk1.complexion[0].focus();
		
		return false;
	}

	if (!chk1.built[0].checked && !chk1.built[1].checked && !chk1.built[2].checked && !chk1.built[3].checked && !chk1.built[4].checked && !chk1.built[5].checked && !chk1.built[6].checked) {
		
		alert("Select The Built field");
		
		chk1.built[0].focus();
		
		return false;
	}

	form_13  = chk1.height.selectedIndex;
	
	form_133 = chk1.height.options[form_13].value;
	
	if (form_133 == "x") {
		
		alert("Select The Height field");
		
		chk1.height.focus();
		
		return false;
	}
	
	if (chk1.weight.value == 0) {
		
		alert("Do not leave the Weight field blank");
		
		chk1.weight.focus();
		
		return false;
	}
	
	if (chk1.weight.value < 30) {
		
		alert("This seems to be a wrong value. enter the correct value");
		
		chk1.weight.focus();
		
		return false;
	}

	if (isNaN(chk1.weight.value)) {
		
		alert("Weight must be Numeric only");
		
		chk1.weight.focus();
		
		return false;
	}

	if (chk1.about_self.value== 0) {
		
		alert("Specify details about yourself. This field can not be left blank.");
		
		chk1.ch_len.value=0;
		
		chk1.about_self.focus();
		
		return false;
	}
	
	if (chk1.about_self.value.length >= 750) {
		
		alert("Details about yourself cannot exceed 750 characters");
		
		chk1.about_self.focus();
		
		return false;
	}
	
	if (chk1.photo.value!=0) {
		
		if ((chk1.photo.value.lastIndexOf('.jpg')==-1) && (chk1.photo.value.lastIndexOf('.gif')==-1) && (chk1.photo.value.lastIndexOf('.bmp')==-1) && (chk1.photo.value.lastIndexOf('.png')==-1)) {
			
			alert('Upload Only .JPG Or .GIF File in Photograph Field');
			
			chk1.photo.focus();
			
			return false;
		}
	}
	
	if ((chk1.l_dob1.options[chk1.l_dob1.selectedIndex].value) == "x") {
		
		alert("Select Age [From] field");
		
		chk1.l_dob1.focus();
		
		return false;
	}

	if ((chk1.l_dob2.options[chk1.l_dob2.selectedIndex].value) == "x") {
		
		alert("Select Age [To] field");
		
		chk1.l_dob2.focus();
		
		return false;
	}

	if ((chk1.l_dob2.options[chk1.l_dob2.selectedIndex].value) < (chk1.l_dob1.options[chk1.l_dob1.selectedIndex].value)) {
		
		alert("Age [To] has to be greater than Age [From]");
		
		chk1.l_dob2.focus();
		
		return false;
	}

	if ((chk1.l_height1.options[chk1.l_height1.selectedIndex].value) == "x") {
		
	  	alert("Select Height [From] field");
	  	
	   	chk1.l_height1.focus();
	   	
	   	return false;
	}

	if ((chk1.l_height2.options[chk1.l_height2.selectedIndex].value) == "x") {
		
	  	alert("Select Height [To] field");
	  	
	   	chk1.l_height2.focus();
	   	
	   	return false;
	}

	if ((chk1.l_height2.options[chk1.l_height2.selectedIndex].value) < (chk1.l_height1.options[chk1.l_height1.selectedIndex].value)) {
		
		alert("Height [To] has to be greater than Height [From]");
		
		chk1.l_height2.focus();
		
		return false;
	}	

	if (selrel=="100004") {
		
		if ((!chk1.l_mstatus_code_0.checked) && (!chk1.l_mstatus_code_1.checked) && (!chk1.l_mstatus_code_2.checked) && (!chk1.l_mstatus_code_3.checked) && (!chk1.l_mstatus_code_4.checked)) {
			
			alert("Check the Martial Status that you are Looking For");
			
			chk1.l_mstatus_code_0.focus();
			
			return false;
		}
	}
	else {
		
		if ((!chk1.l_mstatus_code_0.checked) && (!chk1.l_mstatus_code_1.checked) && (!chk1.l_mstatus_code_2.checked) && (!chk1.l_mstatus_code_3.checked)) {
			
			alert("Check the Martial Status that you are Looking For");
			
			chk1.l_mstatus_code_0.focus();
			
			return false;
		}
	}
	
	if (chk1.l_reli2.value=="") {
		
	 	alert ("Select atleast one Religion");
	 	
		chk1.addrel.focus();
		
	 	return false;
	}

	if (selrel == "100004") {
		
		if (chk1.l_caste2.value=="") {
			
	 		alert ("Select atleast one Mazhab");
	 		
	 		chk1.addcaste.focus();
	 		
	 		return false;
		}
	}
	else if (selrel == "100001" || selrel == "100002" || selrel == "100003" || selrel == "100005") {
		
		if (chk1.l_caste2.value=="") {
			
	 		alert ("Select atleast one Caste");
	 		
	 		chk1.addcaste.focus();
	 		
	 		return false;
		}
	}

	if (chk1.l_tong2.value=="") {
		
		alert ("Select atleast one Mother Tongue");
		
	 	chk1.addtong.focus();
	 	
	 	return false;
	}

	if (chk1.l_occu2.value=="") {
		
	 	alert ("Select atleast one Occupation");
	 	
	 	chk1.addocc.focus();
	 	
	 	return false;
	}
	
	if (chk1.l_cont2.value=="") {
		
	 	alert ("Select atleast one Country");
	 	
	 	chk1.addcont.focus();
	 	
	 	return false;
	}
	
	if (chk1.l_cont2.value.indexOf('India^') != -1) {
		
		if (chk1.l_state2.value=="") {
			
			alert ("Select a State of your choice");
			
			chk1.addstate.focus();
			
			return false;
		}
	}
	
	if (chk1.l_citizenship2.value=="") {
		
	 	alert ("Select atleast one Citizenship");
	 	
	 	chk1.addczship.focus();
	 	
	 	return false;
	}
	
	if (chk1.l_spcases2.value=="") {
		
	 	alert ("Select atleast one Option");
	 	
	 	chk1.addspcases.focus();
	 	
	 	return false;
	}
	
	form_1122  = chk1.l_income.selectedIndex;
	
	form_11222 = chk1.l_income.options[form_1122].value;
	
	if (form_11222 == "x") {
		
		alert("Select The MONTHLY INCOME field");
		
		chk1.l_income.focus();
		
		return false;
	}

	if (!chk1.terms.checked) {
		
		alert("Read the terms of use and check the box to proceed");
		
		chk1.terms.focus();
		
		return false;
  }

  var msg = "\nDo not leave the following fields blank\n";
  
  var key = "";
}



// phone verification form check

function ph_veri_chk(chk1) {

	if (chk1.country_code.options[chk1.country_code.selectedIndex].value== "x") {
		
		alert("Please Select The Country");
		
		chk1.country_code.focus();
		
	    return false;
	}
	

	if (chk1.mphone.value!=0) {
		
		if (isNaN(chk1.mphone.value)) {
			
			alert("Mobile Number Can Be Only Numeric");
			
			chk1.mphone.focus();
			
			return false;
		}
	}
	
	if ((chk1.ph_ccode.value==0 || chk1.ph_acode.value==0 || chk1.ph_number.value==0) && (chk1.mphone.value==0)) {
		
		alert("Please specify either a Landline Number or a Mobile Number for Verification");
		
		chk1.ph_ccode.focus();
		
		return false;

	}

	if (chktrim(chk1.contact_person).value== 0) {
		
		alert("Contact Person can't be left blank");
		
		chk1.contact_person.focus();
		
		return false;
	}


	if (chktrim(chk1.con_time.value)== 0) {
		
		alert("Convenient Time To Contact can't be left blank");
		
		chk1.con_time.focus();
		
		return false;
	}
}

// Send PMS for single profile
function pms_chk1(chk1, spl_val) {
	
	if (spl_val=="free") {

		if (chk1.to_em.value.length <= 0) {
			alert('Please Enter your E-mail address');
			chk1.to_em.focus();
			return false;
		}
		if (chk1.to_em.value.indexOf('@') == -1) {
			alert('Error in E-mail address');
			chk1.to_em.focus();
			return false;
		}
		if (chk1.to_em.value.indexOf('.') == -1) {
			alert('Error in E-mail address');
			chk1.to_em.focus();
			return false;
		}
		if (chktrim(chk1.to_pass.value).length <= 0) {
			alert('Please Enter your Password');
			chk1.to_pass.focus();
			return false;
		}
	}
	if (chktrim(chk1.to_desc.value).length <= 0) {
		
		alert("Please Enter your Message.");
		
		chk1.to_desc.focus();
		
		return false;
	}
}

function show(a) {
	//alert(a);	
	n = 1; // number of hidden layers
	for(i=1;i<=n;i++) {
		//alert(document.getElementById('t'+a).style.display);		
		if(i==a) {
			if(document.getElementById('t'+a).style.display == 'none') {
				document.getElementById('t'+a).style.display = 'block';
			}
			else {
				document.getElementById('t'+a).style.display = 'none';
			}
		}
		else{
			document.getElementById('t'+i).style.display = 'none';
		}
	}
}

// This function is for when member searches the party and he not logged in or a guest member.somesh
function chk_login(chk2) { 
   if (chk2.username.value.length == 0) {
      alert("E-mail ID can't be left blank");
      chk2.username.focus();
      return false;
   }
   if (chk2.username.value.indexOf('@') == -1) {
      alert("Error in Email ID");
      chk2.username.focus();
      return false;
   }
   if (chk2.username.value.indexOf('.') == -1) {
      alert("Error in Email ID");
      chk2.username.focus();
      return false;
   }
   if (chk2.username.value.indexOf('@') !=  chk2.username.value.lastIndexOf('@')) {
      alert("Please Specify One Email ID only");
      chk2.username.focus();
      return false;
   }  
    
   if (chk2.pass_word.value.length==0) {
      alert("Enter Your Password ");
      chk2.pass_word.focus();
      return false; 
   }   
}


function chk2() {
	document.mat.char_len.value=document.mat.family_background.value.length;
	if (document.mat.family_background.value.length>=750) {
  		alert("You can't enter more information. You can't exceed the limit of 750.");
   		document.mat.family_background.focus();
   		return false;
  	}
}

function chk3() {
	document.mat.ch_len.value=document.mat.about_self.value.length;
	if (document.mat.about_self.value.length>=750) {
	 	alert("You can't enter more information. You can't exceed the limit of 750.");
		document.mat.about_self.focus();
	  	return false;
	}
}



function chk_contact_friend(chk2) {
	
	if (chktrim(chk2.your_name.value).length <= 0) {
		
		alert("Please Enter your Name");
		
		chk2.your_name.focus();
		
		return false;
	}	

	if (chk2.your_username.value.length == 0) {
		
		alert("Your E-mail ID can't be left blank");
		
		chk2.your_username.focus();
		
		return false;
	}
	
	if (chk2.your_username.value.indexOf('@') == -1) {
		
		alert("Error in Your Email ID");
		
		chk2.your_username.focus();
		
		return false;
	}
	
	if (chk2.your_username.value.indexOf('.') == -1) {
		
		alert("Error in Your Email ID");
		
		chk2.your_username.focus();
		
		return false;
	}
	
	if (chk2.your_username.value.indexOf('@') !=  chk2.your_username.value.lastIndexOf('@')) {
		
		alert("Please Specify Your One Email ID only");
		
		chk2.your_username.focus();
		
		return false;
	} 
	
	if (chktrim(chk2.friend_name.value).length <= 0) {
		
		alert("Please Enter Friend Name");
		
		chk2.friend_name.focus();
		
		return false;
	}	

	if (chk2.friend_username.value.length == 0) {
		
		alert("Friend E-mail ID can't be left blank");
		
		chk2.friend_username.focus();
		
		return false;
	}
	
	if (chk2.friend_username.value.indexOf('@') == -1) {
		
		alert("Error in Your Friend Email ID");
		
		chk2.friend_username.focus();
		
		return false;
	}
	
	if (chk2.friend_username.value.indexOf('.') == -1) {
		
		alert("Error in Your Friend Email ID");
		
		chk2.friend_username.focus();
		
		return false;
	}
	
	if (chk2.friend_username.value.indexOf('@') !=  chk2.friend_username.value.lastIndexOf('@')) {
		
		alert("Please Specify Your Friend One Email ID only");
		
		chk2.friend_username.focus();
		
		return false;
	} 
}

// <<<<< Refresh the Parent Window >>>> //
function RefreshParent(val) {
	window.opener.location = val
	window.self.close();
}

// <<<<<<<<< Sorting >>>>>>> //

function sort_criteria () {
   if (document.frs.arrange.options[document.frs.arrange.selectedIndex].value == "") {
	  alert("Please Select a Sort Criteria");
	  document.frs.arrange.focus();
	  return false;
   }
}



function remove_basket_func() {
	
    var pp=1;
    
    dml = document.form1;
    
    len = dml.elements.length;
    
    var i=0;
    
    for(i=0; i<len; i++) {
	    
       if (dml.elements[i].type == "checkbox" && dml.elements[i].name != "checked_1" && dml.elements[i].checked==true) {
          pp=2;
       }
    }
    
    if (pp==1) {   
	    
      alert("You have not selected any profiles.\n\nPlease Select The profiles && then proceed");
      return false;
    }
    else {
	    
	    document.form1.id.value="remove_basket";
	    
	    document.form1.target="";	
	    
	    document.form1.submit();
    }
}


// Send PMS for single profile
function send_pms_msg() {
	
	if (chktrim(form1.to_desc.value).length <= 0) {
		
		alert("Please Enter your Message.");
		
		form1.to_desc.focus();
		
		return false;
	}
	
	var pp=1;
    
    dml = document.form1;
    
    len = dml.elements.length;
    
    var i=0;
    
    for(i=0; i<len; i++) {
	    
       if (dml.elements[i].type == "checkbox" && dml.elements[i].name != "checked_1" && dml.elements[i].checked==true) {
          pp=2;
       }
    }
    
    if (pp==1) {   
	    
      alert("You have not selected any Profile.\n\nPlease Select The profiles && then proceed");
      return false;
    }	
	
	else {
		
		document.form1.id.value="basket";
		
		document.form1.target="";
		
		document.form1.submit();
    }	
}

// Below script is used to validate update Member Profile With Detail at control panel.somesh
function cp_member_profile_validate(country_code, religion_code, upd_sts)  {
	
	// Function getLoc() defined in /mi.js.somesh
	getLoc('l_religion2[]','l_religion_code');
	
	// For Hindu, Muslim, Sikh, Christian and Jain.somesh
	if (religion_code==100001 || religion_code==100004 || religion_code==100002 || religion_code==100003 || religion_code==100005) {
		
		getLoc('l_caste2[]','l_caste_code');
	}
	
	// Function getLoc() defined in /mi.js.somesh
	getLoc('l_mother_tongue2[]','l_mother_tongue_code');
	getLoc('l_occupation_code2[]','l_occupation_code');
	getLoc('l_country_code2[]','l_country_code');
	getLoc('l_state_code2[]','l_state_code');
	getLoc('l_citizenship2[]','l_citizenship');
	getLoc('l_spcases2[]','l_spcases');
	
	if (!document.mat.posted_for[0].checked && !document.mat.posted_for[1].checked && !document.mat.posted_for[2].checked && !document.mat.posted_for[3].checked && !document.mat.posted_for[4].checked) {
		
		alert("Please Select The Posted For Field");
		document.mat.posted_for[0].focus();
		return false;
	}

	if (chktrim(document.mat.cname.value).length==0) {
		
		alert("Please Select The First Name Field");
		document.mat.cname.focus();
		return false;
	}

	if (chktrim(document.mat.lname.value).length==0) {
		
		alert("Please Select The Last Name Field");
		document.mat.lname.focus();
		return false;
	}

	if (!document.mat.marital_status_code[0].checked && !document.mat.marital_status_code[1].checked && !document.mat.marital_status_code[2].checked && !document.mat.marital_status_code[3].checked) {
			
		alert("Please Select The Marital Status");
		document.mat.marital_status_code[0].focus();
		return false;
	}
	
	/*
	if (chktrim(document.mat.title.value).length == 0) {
		
		alert("Please Enter The Profile Title");
		document.mat.title.focus();
		return false;
	}
	*/

	if (chktrim(document.mat.title.value).length>0 && chktrim(document.mat.title.value).length>50) {
		
		alert("Please Enter The Profile Title Maximum of 50 Characters");
		document.mat.title.focus();
		return false;
	}
	
	if (country_code=='IN') {
		
		state_code_selected  = document.mat.state_code.selectedIndex;
		state_code = document.mat.state_code.options[state_code_selected].value;

		if (state_code=='') {
			
			alert("Please Select The State Field");
			document.mat.state_code.focus();
			return false;
		}

		city_code_selected  = document.mat.city_code.selectedIndex;
		city_code  = document.mat.city_code.options[city_code_selected].value;
		
		if (city_code=='') {
			
			alert("Please Select The City Field");
			document.mat.city_code.focus();
			return false;
		}
		
		if (city_code=='999999') {
			
			if (chktrim(document.mat.other_city.value).length==0) {
				
				alert("Please Enter Your City");
				document.mat.other_city.focus();
				return false;
			}
		}
	}
	else {
		
		if (chktrim(document.mat.other_city.value).length==0) {
			
			alert("Please Enter Your City");
			document.mat.other_city.focus();
			return false;
		}
	}

	if (!document.mat.citizenship[0].checked && !document.mat.citizenship[1].checked && !document.mat.citizenship[2].checked) {
		
		alert("Please Select Citizenship Field");
		document.mat.citizenship[0].focus();
		return false;
	}

	/*
	if ((document.mat.immigration_status.options[document.mat.immigration_status.selectedIndex].value)=='') {
		
		alert("Please select Immigration Status field");
   		document.mat.immigration_status.focus();
   		return false;
	}
	*/

	if ((document.mat.living_situation.options[document.mat.living_situation.selectedIndex].value)=='') {
		
		alert("Please Select Living Situation Field");
   		document.mat.living_situation.focus();
   		return false;
	}

	if ((document.mat.house_ownership.options[document.mat.house_ownership.selectedIndex].value)=='') {
		
		alert("Please Select House Ownership Field");
		document.mat.house_ownership.focus();
		return false;
	}

	/*
	if (religion_code == "Other Religion") {
		if (!document.mat.oth_religion.value.length) {
			alert("Do not leave the Specific Religion field blank");
			document.mat.oth_religion.focus();
			return false;
		}
	}
	*/
	
	// For Hindu, Muslim, Sikh, Christian and Jain.somesh
	if (religion_code==100001 || religion_code==100004 || religion_code==100002 || religion_code==100003 || religion_code==100005) {
		
		if (religion_code=='100004') {
			
			caste_code_selected  = document.mat.caste_code.selectedIndex;
			caste_code = document.mat.caste_code.options[caste_code_selected].value;
			
			if (caste_code=='') {
				
				alert("Please Select The Mazhab Field");
				document.mat.caste_code.focus();
				return false;
			}
		}
		else {
			
			caste_code_selected  = document.mat.caste_code.selectedIndex;
			caste_code = document.mat.caste_code.options[caste_code_selected].value;
			
			if (caste_code=='') {
				
				alert("Please Select The Caste Field");
				document.mat.caste_code.focus();
				return false;
			}
		}
	}

	mother_tongue_code_selected  = document.mat.mother_tongue_code.selectedIndex;
	mother_tongue_code = document.mat.mother_tongue_code.options[mother_tongue_code_selected].value;
	
	if (mother_tongue_code=='') {
		
		alert("Please Select The Mother Tongue Field");
		document.mat.mother_tongue_code.focus();
		return false;
	}
	
	/*
	// For Hindu, Sikh, Jain, Buddhist.somesh
	if (religion_code=="100001" || religion_code=="100002" || religion_code=="100005" || religion_code=="100006") {
		
		if (document.mat.hour.options[document.mat.hour.selectedIndex].value!='' && document.mat.minute.options[document.mat.minute.selectedIndex].value=='') {
			
			alert("Please Select Minutes");
			document.mat.minute.focus();
			return false;
		}
		if (document.mat.hour.options[document.mat.hour.selectedIndex].value!='' && document.mat.minute.options[document.mat.minute.selectedIndex].value!='' && document.mat.am_pm.options[document.mat.am_pm.selectedIndex].value=='') {
			
			alert("Please Select AM or PM");
			document.mat.am_pm.focus();
			return false;
		}
		if (document.mat.horo_path.value!=0) {
			
			if ((document.mat.horo_path.value.lastIndexOf('.jpg')==-1) && (document.mat.horo_path.value.lastIndexOf('.gif')==-1) && (document.mat.horo_path.value.lastIndexOf('.bmp')==-1) && (document.mat.horo_path.value.lastIndexOf('.png')==-1)) {
				
				alert('Please Upload Only .JPG Or .GIF File in Horoscope Field');
				document.mat.horo_path.focus();
				return false;
			}
		}
	}
	*/
	
	education_code_selected = document.mat.education_code.selectedIndex;
	education_code = document.mat.education_code.options[education_code_selected].value;
	
	if (education_code=='') {
		
	  	alert("Please Select The Education Field");
	   	document.mat.education_code.focus();
	   	return false;
	}

	occupation_code_selected  = document.mat.occupation_code.selectedIndex;
	occupation_code = document.mat.occupation_code.options[occupation_code_selected].value;
	
	if (occupation_code=='') {
		
		alert("Please Select The Occupation Field");
		document.mat.occupation_code.focus();
		return false;
	}
	
	monthly_income_selected  = document.mat.monthly_income.selectedIndex;
	monthly_income = document.mat.monthly_income.options[monthly_income_selected].value;
	
	if (monthly_income=='') {
		
		alert("Please Select The Monthly Income Field");
		document.mat.monthly_income.focus();
		return false;
	}

	if ((monthly_income=='0') && (occupation_code!=100019) && (occupation_code!=100026)) {
		
		alert("Income can't be selected as Nil for the Selected Occupation");
		document.mat.monthly_income.focus();
		return false;
	}
	
	if ((monthly_income!=0) && ((occupation_code==100019) || (occupation_code==100026))) {
		
		alert("Income has to be selected as Nil for the Selected Occupation");
		document.mat.monthly_income.focus();
		return false;
	}

	if (!document.mat.features[0].checked && !document.mat.features[1].checked && !document.mat.features[2].checked && !document.mat.features[3].checked && !document.mat.features[4].checked) {
		
		alert("Please Select The Features Field");
		document.mat.features[0].focus();
		return false;
	}

	if (!document.mat.complexion[0].checked && !document.mat.complexion[1].checked && !document.mat.complexion[2].checked && !document.mat.complexion[3].checked) {
		
		alert("Please Select The Complexion Field");
		document.mat.complexion[0].focus();
		return false;
	}

	if (!document.mat.built[0].checked && !document.mat.built[1].checked && !document.mat.built[2].checked && !document.mat.built[3].checked && !document.mat.built[4].checked && !document.mat.built[5].checked && !document.mat.built[6].checked) {
		
		alert("Please Select The Built Field");
		document.mat.built[0].focus();
		return false;
	}

	height_selected  = document.mat.height.selectedIndex;
	height = document.mat.height.options[height_selected].value;
	
	if (height=='') {
		
		alert("Please Select The Height Field");
		document.mat.height.focus();
		return false;
	}
	if (chktrim(document.mat.weight.value).length==0) {
		
		alert("Do not leave the Weight field blank");
		document.mat.weight.focus();
		return false;
	}
	
	if (document.mat.weight.value < 30) {
		
		alert("This seems to be a wrong value. Please enter the correct value");
		document.mat.weight.focus();
		return false;
	}

	if (isNaN(document.mat.weight.value)) {
	
		alert("Weight must be Numeric only");
		document.mat.weight.focus();
		return false;
	}

	/*
	if (document.mat.spcases.options[document.mat.spcases.selectedIndex].value=='') {
		
		alert("Please Select Special Cases Field");
		document.mat.spcases.focus();
		return false;
	}	
	
	if (document.mat.blood_group.options[document.mat.blood_group.selectedIndex].value=='') {
		
		alert("Please Select Your Blood Group");
		document.mat.blood_group.focus();
		return false;
	}	

	if ((document.mat.vehicle_ownership.options[document.mat.vehicle_ownership.selectedIndex].value)=='') {
		
		alert("Please Select Vehicle Ownership Field");
		document.mat.vehicle_ownership.focus();
		return false;
	}
	*/

	if (chktrim(document.mat.hobbies.value).length>0 && chktrim(document.mat.hobbies.value).length>200) {
		
		alert("Please Enter The Hobbies Maximum of 200 Characters");
		document.mat.hobbies.focus();
		return false;
	}
	
	if (chktrim(document.mat.about_self.value).length==0) {
		
		alert("Please Specify Details About Yourself. This Field Can Not Be Left Blank.");
		document.mat.about_self.focus();
		return false;
	}
	
	if (chktrim(document.mat.about_self.value).length>0 && chktrim(document.mat.about_self.value).length>= 750) {
		
		alert("Details About Yourself Cannot Exceed 750 Characters");
		document.mat.about_self.focus();
		return false;
	}
	
	if (document.mat.photopath.value!=0) {
		
		if ((document.mat.photopath.value.lastIndexOf('.jpg')==-1) && (document.mat.photopath.value.lastIndexOf('.gif')==-1) && (document.mat.photopath.value.lastIndexOf('.bmp')==-1) && (document.mat.photopath.value.lastIndexOf('.png')==-1)) {
			
			alert('Please Upload Only .JPG Or .GIF File in Photograph Field');
			document.mat.photopath.focus();
			return false;
		}
	}
	
	if (chktrim(document.mat.family_background.value).length>0 && chktrim(document.mat.family_background.value).length>750) {
		
		alert("Please Enter The About Your Family Maximum of 750 Characters");
		document.mat.family_background.focus();
		return false;
	}
	
	if ((document.mat.l_dob1.options[document.mat.l_dob1.selectedIndex].value)=='') {
		
		alert("Please Select Age [From] Field");
		document.mat.l_dob1.focus();
		return false;
	}

	if ((document.mat.l_dob2.options[document.mat.l_dob2.selectedIndex].value)=='') {
		
		alert("Please Select Age [To] Field");
		document.mat.l_dob2.focus();
		return false;
	}

	if ((document.mat.l_dob2.options[document.mat.l_dob2.selectedIndex].value) < (document.mat.l_dob1.options[document.mat.l_dob1.selectedIndex].value)) {
		
		alert("Age [To] Has To Be Greater Than Age [From]");
		document.mat.l_dob2.focus();
		return false;
	}

	if ((document.mat.l_height1.options[document.mat.l_height1.selectedIndex].value)=='') {
		
		alert("Please Select Height [From] Field");
		document.mat.l_height1.focus();
		return false;
	}

	if ((document.mat.l_height2.options[document.mat.l_height2.selectedIndex].value)=='') {
		
	  	alert("Please Select Height [To] Field");
	   	document.mat.l_height2.focus();
	   	return false;
	}

	if ((document.mat.l_height2.options[document.mat.l_height2.selectedIndex].value) < (document.mat.l_height1.options[document.mat.l_height1.selectedIndex].value)) {
		
		alert("Height [To] Has To Be Greater Than Height [From]");
		document.mat.l_height2.focus();
		return false;
	}

	/*
	if ((!document.mat.l_feature[0].checked) && (!document.mat.l_feature[1].checked) && (!document.mat.l_feature[2].checked) && (!document.mat.l_feature[3].checked) && (!document.mat.l_feature[4].checked)) {
		
		alert("Check The Features That You Are Looking For");
		document.mat.l_feature[0].focus();
		return false;
	}
	
	if ((!document.mat.l_complexion[0].checked) && (!document.mat.l_complexion[1].checked) && (!document.mat.l_complexion[2].checked) && (!document.mat.l_complexion[3].checked)) {
		
		alert("Check The Complexion That You Are Looking For");
		document.mat.l_complexion[0].focus();
		return false;
	}

	if ((!document.mat.l_built[0].checked) && (!document.mat.l_built[1].checked) && (!document.mat.l_built[2].checked) && (!document.mat.l_built[3].checked) && (!document.mat.l_built[4].checked) && (!document.mat.l_built[5].checked) && (!document.mat.l_built[6].checked)) {
		
	  	alert("Check The Built That You Are Looking For");
	   	document.mat.l_built[0].focus();
	   	return false;
	}
	*/

	if ((!document.mat.l_mstatus_code[0].checked) && (!document.mat.l_mstatus_code[1].checked) && (!document.mat.l_mstatus_code[2].checked) && (!document.mat.l_mstatus_code[3].checked) && (!document.mat.l_mstatus_code[4].checked)) {
		
		alert("Check The Martial Status That You Are Looking For");
		document.mat.l_mstatus_code[0].focus();
		return false;
	}
	
	if (document.mat.l_religion_code.value=="") {
		
	 	alert ("Please Select Atleast One Religion");
		document.mat.addrel.focus();
	 	return false;
	}

	if (religion_code==100004) {
		
		if (document.mat.l_religion_code.value=='') {
			
	 		alert ("Please Select Atleast One Mazhab");
	 		document.mat.addcaste.focus();
	 		return false;
		}
	}
	else if (religion_code==100001 || religion_code==100002 || religion_code==100005 || religion_code==100003) {
		
		if (document.mat.l_religion_code.value=='') {
			
	 		alert ("Please Select Atleast One Caste");
	 		document.mat.addcaste.focus();
	 		return false;
		}
	}

	if (document.mat.l_mother_tongue_code.value=='') {
		
		alert ("Please Select Atleast One Mother Tongue");
	 	document.mat.add_mother_tongue.focus();
	 	return false;
	}

	if (document.mat.l_occupation_code.value=='') {
		
	 	alert ("Please Select Atleast One Occupation");
	 	document.mat.addoccupation.focus();
	 	return false;
	}
	if (document.mat.l_country_code.value=='') {
		
	 	alert ("Please Select Atleast One Country");
	 	document.mat.addcountry.focus();
	 	return false;
	}
	if (document.mat.l_country_code.value.indexOf('IN^')!=-1) {
		
		if (document.mat.l_state_code.value=='') {
			
			alert ("Please Select A State Of Your Choice");
			document.mat.addstate.focus();
			return false;
		}
	}
	
	if (document.mat.l_citizenship.value=='') {
		
	 	alert ("Please Select Atleast One Citizenship");
	 	document.mat.add_citizenship.focus();
	 	return false;
	}
	
	if (document.mat.l_spcases.value=='') {
		
	 	alert ("Please Select Atleast One Option");
	 	document.mat.add_special_case.focus();
	 	return false;
	}
	
	l_income_selected  = document.mat.l_income.selectedIndex;
	l_income = document.mat.l_income.options[l_income_selected].value;
	
	if (l_income=='') {
		
		alert("Please Select The MONTHLY INCOME field");
		document.mat.l_income.focus();
		return false;
	}
	
	if (chktrim(document.mat.l_other_requirements.value).length>0 && chktrim(document.mat.l_other_requirements.value).length>200) {
		
		alert("Please Enter Other Requirements Maximum of 200 Characters");
		document.mat.l_other_requirements.focus();
		return false;
	}
	
  var msg = "\nDo not leave the following fields blank\n";
  var key = "";
}

function chk_exp_interest() {
	
	var pp=1;
    
    dml = document.form1;
    
    len = dml.elements.length;
    
    var i=0;
    
    for(i=0; i<len; i++) {
	    
       if (dml.elements[i].type == "checkbox" && dml.elements[i].name != "checked_1" && dml.elements[i].checked==true) {
          pp=2;
       }
    }
    
    if (pp==1) {   
	    
      alert("You have not selected any Profile.\n\nPlease Select The profiles && then proceed");
      return false;
    }
    
	if (chktrim(form1.to_desc.value).length <= 0) {
	
		alert("Please Enter your Message.");
	
		form1.to_desc.focus();
	
		return false;
	}	
}

function addOption_list() {
	
	for(i=document.frmcomp_listing.temp_bus_catg.options.length-1;i>=0;i--) {
		
		var temp_bus_catg = document.frmcomp_listing.temp_bus_catg;		
		
		if(document.frmcomp_listing.temp_bus_catg[i].selected) {						
			
			addOption(document.frmcomp_listing.temp_bus_catg1, document.frmcomp_listing.temp_bus_catg[i].text, document.frmcomp_listing.temp_bus_catg[i].value);
			
			//removeOption(outboundtour,i);
		}
	}
}

function addOption(selectbox,text,value ) {
	
	if((document.getElementById("buisness_catg").value).indexOf(value)=="-1") {
	
		var optn = document.createElement("OPTION");
		
		optn.text = text;
		optn.value = value;	
		selectbox.options.add(optn);
		document.getElementById("buisness_catg").value = value + '^' + document.getElementById("buisness_catg").value;
	}
}

function remove_list()
{
	for(i=document.frmcomp_listing.temp_bus_catg1.options.length-1;i>=0;i--) {
		
		var temp_bus_catg1 = document.frmcomp_listing.temp_bus_catg1;		
		
		if(document.frmcomp_listing.temp_bus_catg1[i].selected) {						
			var str = document.getElementById("buisness_catg").value
			document.getElementById("buisness_catg").value = str.replace(document.frmcomp_listing.temp_bus_catg1[i].value + '^', "");
			temp_bus_catg1.remove(i);
		}
	}
}

function removeAllOptions(selectbox)
{
	var i;
	for(i=selectbox.options.length-1;i>=0;i--) {
		
		selectbox.remove(i);
		
	}
	
} 



function chk_personal_msg(chk1) {
	
	if (chktrim(chk1.msg_detail.value).length == 0) {
	
		alert("Please Enter your Message.");
	
		chk1.msg_detail.focus();
	
		return false;
	}
	
	if (chktrim(chk1.msg_detail.value).length < 20) {
	
		alert("Your message can not be less than 20 characters.");
	
		chk1.msg_detail.focus();
	
		return false;
	}
		
}

function feedback_valid(chk1) {
	
	var pp=1;
    
    feedback_type1=document.form1;
    
    len=feedback_type1.elements.length;
    
    var i=0;
    
    for(i=0; i<len; i++) {
	    
      if ((document.form1.elements[i].type == "radio") && (feedback_type1.elements[i].checked==true)) {
	      
         pp=2;
      }
    }
    
    if (pp==1) {
	    
      alert("You have not selected any Feedback Type.");
      
      return false;
    }	
	
	if (chk1.feedback.value.length<5) {
		
		alert("Enter your Feedback / Suggestions");
		
	    chk1.feedback.focus();
	    
		return false; 
	}	
}

function chkinqform(chk1) {

	if (chktrim(chk1.subject.value).length == 0) {
	
		alert("Fill Your Subject.");
	
		chk1.subject.focus();
	
		return false;
	}
	
	if (chktrim(chk1.inq_dtl.value).length == 0) {
	
		alert("Fill Your Inquiry Detail.");
	
		chk1.inq_dtl.focus();
	
		return false;
	}
	
	if (chktrim(chk1.your_name.value).length == 0) {
	
		alert("Fill Your Name.");
	
		chk1.your_name.focus();
	
		return false;
	}
	
	if (chktrim(chk1.email_id.value).length == 0) {
	
		alert("Fill Your Email ID.");
	
		chk1.email_id.focus();
	
		return false;
	}
	
	if (chk1.email_id.value.indexOf('@') == -1) {
		
		alert("Error in e-mail address.");
	
		chk1.email_id.focus();
	
		return false;
	}
	
	if (chk1.email_id.value.indexOf('.') == -1) {
		
		alert("Error in e-mail address.");
	
		chk1.email_id.focus();
	
		return false;
	}
	
	if (chk1.email_id.value.indexOf('@') != chk1.email_id.value.lastIndexOf('@')) {
		
		alert("Please Specify One E-mail address only.");
	
		chk1.email_id.focus();
	
		return false;
	}
	
	if (chktrim(chk1.country.value).length == 0) {
	
		alert("Select Your Country.");
	
		chk1.country.focus();
	
		return false;
	}
	
	if (chktrim(chk1.address.value).length == 0) {
	
		alert("Fill Your Address.");
	
		chk1.address.focus();
	
		return false;
	}
	
	if (chktrim(chk1.contact_no.value).length == 0) {
	
		alert("Fill Your Contact Number.");
	
		chk1.contact_no.focus();
	
		return false;
	}
}



function abuse_chk(chk1) {
	
	if (chktrim(chk1.phone.value).length == 0) {
		
		alert("Phone can't be left blank");
		
		chk1.phone.focus();
		
		return false;
	}
	
	if (chktrim(chk1.username.value).length == 0) {
		
		alert("E-mail can't be left blank");
		
		chk1.username.focus();
		
		return false;
	}
	if (chk1.username.value.indexOf('@') == -1) {
		
		alert("Error in e-mail address");
		
		chk1.username.focus();
		
		return false;
	}
	if (chk1.username.value.indexOf('.') == -1) {
		
		alert("Error in e-mail address");
		
		chk1.username.focus();
		
		return false;
	}
	if (chk1.username.value.indexOf('@') != chk1.username.value.lastIndexOf('@')) {
		
		alert("Please Specify One E-mail address only");
		
		chk1.username.focus();
		
		return false;
	}
	if (chktrim(chk1.message.value).length == 0) {
		
		alert("Please enter the Message");
		
		chk1.message.focus();
		
		return false;
	}
}

function horo_chk1() {
	
	if (!document.form1.horo.value.length) {
		
		alert("Please Select Your Horoscope");
		
		document.form1.horo.focus();
		
		return false;
	}
}

function horo_chk2() {
	
	if (!document.form2.del_horo.checked) {
		
		alert("Please Check the box to Delete the Horoscope");
		
		document.form2.del_horo.focus();
		
		return false;
	}
}

function addOption_list_religion_code() {
	
	for(i=document.frmsmartsearch.temp_religion_code.options.length-1;i>=0;i--) {
		
		var temp_religion_code = document.frmsmartsearch.temp_religion_code;		
		
		if(document.frmsmartsearch.temp_religion_code[i].selected) {						
			
			addOption_religion_code(document.frmsmartsearch.temp_religion_code1, document.frmsmartsearch.temp_religion_code[i].text, document.frmsmartsearch.temp_religion_code[i].value);
			
			//removeOption(outboundtour,i);
		}
	}
}

function addOption_religion_code(selectbox,text,value ) {
	
	if((document.getElementById("religion_code").value).indexOf(value)=="-1") {
	
		var optn = document.createElement("OPTION");
		
		optn.text = text;
		optn.value = value;	
		selectbox.options.add(optn);
		document.getElementById("religion_code").value = value + '^' + document.getElementById("religion_code").value;
	}
}

function remove_list_religion_code()
{
	for(i=document.frmsmartsearch.temp_religion_code1.options.length-1;i>=0;i--) {
		
		var temp_religion_code1 = document.frmsmartsearch.temp_religion_code1;		
		
		if(document.frmsmartsearch.temp_religion_code1[i].selected) {						
			var str = document.getElementById("religion_code").value
			document.getElementById("religion_code").value = str.replace(document.frmsmartsearch.temp_religion_code1[i].value + '^', "");
			temp_religion_code1.remove(i);
		}
	}
}


function addOption_list_mother_tongue_code() {
	
	for(i=document.frmsmartsearch.temp_mother_tongue_code.options.length-1;i>=0;i--) {
		
		var temp_mother_tongue_code = document.frmsmartsearch.temp_mother_tongue_code;		
		
		if(document.frmsmartsearch.temp_mother_tongue_code[i].selected) {						
			
			addOption_mother_tongue_code(document.frmsmartsearch.temp_mother_tongue_code1, document.frmsmartsearch.temp_mother_tongue_code[i].text, document.frmsmartsearch.temp_mother_tongue_code[i].value);
			
			//removeOption(outboundtour,i);
		}
	}
}

function addOption_mother_tongue_code(selectbox,text,value ) {
	
	if((document.getElementById("mother_tongue_code").value).indexOf(value)=="-1") {
	
		var optn = document.createElement("OPTION");
		
		optn.text = text;
		optn.value = value;	
		selectbox.options.add(optn);
		document.getElementById("mother_tongue_code").value = value + '^' + document.getElementById("mother_tongue_code").value;
	}
}

function remove_list_mother_tongue_code()
{
	for(i=document.frmsmartsearch.temp_mother_tongue_code1.options.length-1;i>=0;i--) {
		
		var temp_mother_tongue_code1 = document.frmsmartsearch.temp_mother_tongue_code1;		
		
		if(document.frmsmartsearch.temp_mother_tongue_code1[i].selected) {						
			var str = document.getElementById("mother_tongue_code").value
			document.getElementById("mother_tongue_code").value = str.replace(document.frmsmartsearch.temp_mother_tongue_code1[i].value + '^', "");
			temp_mother_tongue_code1.remove(i);
		}
	}
}

function addOption_list_occupation_code() {
	
	for(i=document.frmsmartsearch.temp_occupation_code.options.length-1;i>=0;i--) {
		
		var temp_occupation_code = document.frmsmartsearch.temp_occupation_code;		
		
		if(document.frmsmartsearch.temp_occupation_code[i].selected) {						
			
			addOption_occupation_code(document.frmsmartsearch.temp_occupation_code1, document.frmsmartsearch.temp_occupation_code[i].text, document.frmsmartsearch.temp_occupation_code[i].value);
			
			//removeOption(outboundtour,i);
		}
	}
}

function addOption_occupation_code(selectbox,text,value ) {
	
	if((document.getElementById("occupation_code").value).indexOf(value)=="-1") {
	
		var optn = document.createElement("OPTION");
		
		optn.text = text;
		optn.value = value;	
		selectbox.options.add(optn);
		document.getElementById("occupation_code").value = value + '^' + document.getElementById("occupation_code").value;
	}
}

function remove_list_occupation_code()
{
	for(i=document.frmsmartsearch.temp_occupation_code1.options.length-1;i>=0;i--) {
		
		var temp_occupation_code1 = document.frmsmartsearch.temp_occupation_code1;		
		
		if(document.frmsmartsearch.temp_occupation_code1[i].selected) {						
			var str = document.getElementById("occupation_code").value
			document.getElementById("occupation_code").value = str.replace(document.frmsmartsearch.temp_occupation_code1[i].value + '^', "");
			temp_occupation_code1.remove(i);
		}
	}
}

function addOption_list_country_code() {
	
	for(i=document.frmsmartsearch.temp_country_code.options.length-1;i>=0;i--) {
		
		var temp_country_code = document.frmsmartsearch.temp_country_code;		
		
		if(document.frmsmartsearch.temp_country_code[i].selected) {						
			
			addOption_country_code(document.frmsmartsearch.temp_country_code1, document.frmsmartsearch.temp_country_code[i].text, document.frmsmartsearch.temp_country_code[i].value);
			
			//removeOption(outboundtour,i);
		}
	}
}

function addOption_country_code(selectbox,text,value ) {
	
	if((document.getElementById("country_code").value).indexOf(value)=="-1") {
	
		var optn = document.createElement("OPTION");
		
		optn.text = text;
		optn.value = value;	
		selectbox.options.add(optn);
		document.getElementById("country_code").value = value + '^' + document.getElementById("country_code").value;
	}
}

function remove_list_country_code()
{
	for(i=document.frmsmartsearch.temp_country_code1.options.length-1;i>=0;i--) {
		
		var temp_country_code1 = document.frmsmartsearch.temp_country_code1;		
		
		if(document.frmsmartsearch.temp_country_code1[i].selected) {						
			var str = document.getElementById("country_code").value
			document.getElementById("country_code").value = str.replace(document.frmsmartsearch.temp_country_code1[i].value + '^', "");
			temp_country_code1.remove(i);
		}
	}
}

function addOption_list_caste_code() {
	
	for(i=document.frmsmartsearch.temp_caste_code.options.length-1;i>=0;i--) {
		
		var temp_caste_code = document.frmsmartsearch.temp_caste_code;		
		
		if(document.frmsmartsearch.temp_caste_code[i].selected) {						
			
			addOption_caste_code(document.frmsmartsearch.temp_caste_code1, document.frmsmartsearch.temp_caste_code[i].text, document.frmsmartsearch.temp_caste_code[i].value);
			
			//removeOption(outboundtour,i);
		}
	}
}

function addOption_caste_code(selectbox,text,value ) {
	
	if((document.getElementById("caste_code").value).indexOf(value)=="-1") {
	
		var optn = document.createElement("OPTION");
		
		optn.text = text;
		optn.value = value;	
		selectbox.options.add(optn);
		document.getElementById("caste_code").value = value + '^' + document.getElementById("caste_code").value;
	}
}

function remove_list_caste_code()
{
	for(i=document.frmsmartsearch.temp_caste_code1.options.length-1;i>=0;i--) {
		
		var temp_caste_code1 = document.frmsmartsearch.temp_caste_code1;		
		
		if(document.frmsmartsearch.temp_caste_code1[i].selected) {						
			var str = document.getElementById("caste_code").value
			document.getElementById("caste_code").value = str.replace(document.frmsmartsearch.temp_caste_code1[i].value + '^', "");
			temp_caste_code1.remove(i);
		}
	}
}


function GetXmlHttpObject() {
	
	var xmlHttp=null;
	
	try {
		
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e) {
		
		// Internet Explorer
		try {
			
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e) {
			
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}

function short_des(mid) {
	
	if(document.getElementById('des_'+mid).style.display=='block'){
		
		document.getElementById('des_'+mid).style.display='none';
		document.getElementById('mem'+mid).innerHTML = "Click Here to Restore Detail";
		
		
	} else if(document.getElementById('des_'+mid).style.display=='none'){
		
		document.getElementById('des_'+mid).style.display='block';
		document.getElementById('mem'+mid).innerHTML = "Click Here to Full Detail";
		
	}
	
	xmlHttp=GetXmlHttpObject();
	
	var disid = mid;
	
	if (xmlHttp==null) {
		
		alert ("Browser does not support HTTP Request");
		return;
	}
	
	document.getElementById("contdisp"+mid).innerHTML="<center><img src=\"/images-mi/loading.gif\"></center>";
	
	var url= "/getfullprofile.php?mid="+mid;
	
	xmlHttp.onreadystatechange = function dispcont(disid) {
	
		if(xmlHttp.readyState==4) {
			
			document.getElementById("contdisp"+mid).innerHTML=xmlHttp.responseText;
		}
	};
	
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	
}


var xmlHttp

function dynshowHint(str,sitename,geturl,element_name) {
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null) {
		alert ("Browser does not support HTTP Request");
		return;
	}
	
	document.getElementById(element_name).innerHTML="<b>Please Wait....</b>";
	
	var url=sitename+geturl;
	url=url+"&q="+str;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=
	function dynstateChanged() {
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
			document.getElementById(element_name).innerHTML=xmlHttp.responseText;
		} 
	};
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null)
}


// ============= used in ccard.php ================

function orderChk2(formname, chksession) {

	if(chktrim(formname.payment_for.value).length==0) {
		
		alert("Please Select Membership Options");
				
		formname.payment_for.focus();
		
		return false;
	}	

	if(formname.payment_for.value=="othPay") {
		
		if (formname.curr_type.options[formname.curr_type.selectedIndex].value == "") {
			
			alert("Please Specify The Currency Type");
			
			formname.curr_type.focus();
			
			return false;
		}
		if(formname.oth_amt.value==0) {
			alert("Please Specify The Amount");
			formname.oth_amt.focus();
			return false;
		}
	}
	
	if (chksession=="false") {
	
	

	    if (formname.your_name.value==0) {
		   alert("Please Specify Your Name.");
		   formname.your_name.focus();
		   return false;
		}
	
		if (formname.address.value==0) {
		   alert("Please Specify Your Address");
		   formname.address.focus();
		   return false;
		}
		
		if (formname.country.value==0) {
			alert("Please Select Your Country");
			formname.country.focus();
			return false;
		}

		if (formname.postal_code.value==0) {
			alert("Please Specify The Zip / Postal Code");
			formname.postal_code.focus();
			return false;
		}
		else {
			if (isNaN(formname.postal_code.value)) {
		   		alert(" Zip / Postal Code Can Be Numeric Only");
		   		formname.postal_code.focus();
		   		return false;
			}
		}
	
		if (formname.religion.value==0) {
			alert("Please Select Your Religion");
			formname.religion.focus();
			return false;
		}

		if (formname.ph_ccode.value==0) {
			alert("Please Specify The Country Code");
			formname.ph_ccode.focus();
			return false;
		}
		else {
			if (isNaN(formname.ph_ccode.value)) {
				alert("Country Code Can Be Only Numeric");
				formname.ph_ccode.focus();
				return false;
			}
		}

		if (formname.ph_acode.value==0) {
			alert("Please Specify The City Code");
			formname.ph_acode.focus();
			return false;
		}
		else {
			if (isNaN(formname.ph_acode.value)) {
				alert("City Code Can Be Only Numeric");
				formname.ph_acode.focus();
				return false;
			}
		}
	
		if (formname.ph_number.value==0) {
			alert("Please Specify Your Phone number");
			formname.ph_number.focus();
			return false;
		}
		else {
			if (isNaN(formname.ph_number.value)) {
				alert("Phone Number Can Be Only Numeric");
				formname.ph_number.focus();
				return false;
			}
		}
	
		if (!formname.username.value.length) {
			alert ("Please Specify Your Email Address");
			formname.username.focus();
			return false;
		}
	
		if (formname.username.value.indexOf('@') == -1) {
			alert("Error in Email Address");
			formname.username.focus();
			return false;
		}
	
		if (formname.username.value.indexOf('.') == -1) {
			alert("Error in Email Address");
			formname.username.focus();
			return false;
		}
	
		if (formname.username.value.indexOf('@') != formname.username.value.lastIndexOf('@')) {
			alert("Please Specify One Email Address Only");
			formname.username.focus();
			return false;
		}
	}
	
	if (!formname.pymt_mode[0].checked && !formname.pymt_mode[1].checked && !formname.pymt_mode[2].checked && !formname.pymt_mode[3].checked && !formname.pymt_mode[4].checked && !formname.pymt_mode[5].checked && !formname.pymt_mode[6].checked && !formname.pymt_mode[7].checked && !formname.pymt_mode[8].checked && !formname.pymt_mode[9].checked && !formname.pymt_mode[10].checked && !formname.pymt_mode[11].checked && !formname.pymt_mode[12].checked) {
			
		formname.pymt_mode[0].focus();
		
		alert("Please Check Your Mode Of Payment");
		
		return false;
	}

}


// Turning on / off any as per other selections //
function F_Selected(obj) {

	var docF=document.mat;
	if(obj.checked) {
		if (obj.name=="l_feature_0") {
			docF.l_feature_1.checked=false;
			docF.l_feature_2.checked=false;
			docF.l_feature_3.checked=false;
			docF.l_feature_4.checked=false;
		}
		if (obj.name=="l_feature_1" || obj.name=="l_feature_2" || obj.name=="l_feature_3" || obj.name=="l_feature_4") {
			docF.l_feature_0.checked=false;
		}
	}
}
function C_Selected(obj) {

	var docF=document.mat;
	if(obj.checked) {
		if (obj.name=="l_complexion_0") {
			docF.l_complexion_1.checked=false;
			docF.l_complexion_2.checked=false;
			docF.l_complexion_3.checked=false;
		}
		if (obj.name=="l_complexion_1" || obj.name=="l_complexion_2" || obj.name=="l_complexion_3") {
			docF.l_complexion_0.checked=false;
		}
	}
}
function B_Selected(obj) {

	var docF=document.mat;
	if(obj.checked) {
		if (obj.name=="l_built_0") {
			docF.l_built_1.checked=false;
			docF.l_built_2.checked=false;
			docF.l_built_3.checked=false;
			docF.l_built_4.checked=false;
			docF.l_built_5.checked=false;
			docF.l_built_6.checked=false;
		}
		if (obj.name=="l_built_1" || obj.name=="l_built_2" || obj.name=="l_built_3" || obj.name=="l_built_4" || obj.name=="l_built_5" || obj.name=="l_built_6") {
			docF.l_built_0.checked=false;
		}
	}
}
function M_Selected(obj) {

	var docF=document.mat;
	if(obj.checked) {
		if (obj.name=="l_mstatus_0") {
			docF.l_mstatus_1.checked=false;
			docF.l_mstatus_2.checked=false;
			docF.l_mstatus_3.checked=false;
		}
		if (obj.name=="l_mstatus_1" || obj.name=="l_mstatus_2" || obj.name=="l_mstatus_3") {
			docF.l_mstatus_0.checked=false;
		}
	}
}
function MM_Selected(obj) {

	var docF=document.mat;
	if(obj.checked) {
		if (obj.name=="l_mstatus_0") {
			docF.l_mstatus_1.checked=false;
			docF.l_mstatus_2.checked=false;
			docF.l_mstatus_3.checked=false;
			docF.l_mstatus_4.checked=false;
		}
		if (obj.name=="l_mstatus_1" || obj.name=="l_mstatus_2" || obj.name=="l_mstatus_3" || obj.name=="l_mstatus_4") {
			docF.l_mstatus_0.checked=false;
		}
	}
}

// Below script is used to open multiple popup.somesh
function multiple_openwin (file,Iwidth,Iheight,popup_name) {
	
      var newWin = open(file, popup_name, 'x=0,y=0,toolbar=no,location=no,directories=no,status=no,scrollbars=yes, copyhistory=no,width='+Iwidth+',height='+Iheight+',screenX=0,screenY=0,left=20,top=20');
      
      newWin.focus();
      
}

// Function to validate verify mobile / phone number form.somesh
function verify_phone_validate(formname) {
	
	if (chktrim(formname.mobile_phone.value).length==0 && chktrim(formname.ph_ccode.value).length==0 && chktrim(formname.ph_acode.value).length==0 && chktrim(formname.ph_number.value).length==0) {
		
		inlineMsg('mobile_phone','Please Enter Either Mobile Number Or Phone Number.',2);
		return false;
	}
	if (chktrim(formname.mobile_phone.value).length==0) {
		
		if (chktrim(formname.ph_ccode.value).length==0) {
			inlineMsg('ph_ccode','Please Enter Phone Number - Country Code.',2);
			return false;
		}
		if (chktrim(formname.ph_acode.value).length==0) {
			inlineMsg('ph_acode','Please Enter Phone Number - Area Code.',2);
			return false;
		}
		if (chktrim(formname.ph_number.value).length==0) {
			inlineMsg('ph_number','Please Enter Phone Number.',2);
			return false;
		}
	}
	if (chktrim(formname.contact_person.value).length==0) {
		
		inlineMsg('contact_person','Please Enter Contact Person\'s Name.',2);
		return false;
	}
}