//Add and Remove options
var NS4 = (navigator.appName == "Netscape" && parseInt(navigator.appVersion) < 5);

function addOption(theSel, theText, theValue)
{
	var newOpt = new Option(theText, theValue);
	var selLength = theSel.length;
	theSel.options[selLength] = newOpt;
}

function moveOptions(theSelFrom, theSelTo)
{	
//alert("das");
//alert(theSelFrom);	
//alert(theSelTo);	

	var selLength = theSelFrom.length;
	var selectedText = new Array();
	var selectedValues = new Array();
	var selectedCount = 0;
	var cou1=1;
	var adflag=0;
	var i;
	for(i=selLength-1; i>=0; i--)
	{
		if(theSelFrom.options[i].selected)
		{
			for(j=0;j<theSelTo.length;j++)
			{
				cou1=1;
				if(theSelTo.options[j].text==theSelFrom.options[i].text)
				{cou1=0}
			}	
			
			if (cou1==1) {
			selectedText[selectedCount] = theSelFrom.options[i].text;
			selectedValues[selectedCount] = theSelFrom.options[i].value;
			selectedCount++;
			}
		}			
	}
	
	if (theSelTo.length>0)
	{

			for(i=selectedCount-1; i>=0; i--)
			{	
				adflag=0;
				for (j=0;j<theSelTo.length;j++ )
				{
					if(selectedText[i]==theSelTo.options[j].text && adflag==0)
					{adflag=1}
				}
				if(adflag==0){addOption(theSelTo, selectedText[i], selectedValues[i]);}
			}
	}
	else
	{
		for(i=selectedCount-1; i>=0; i--)
		{ addOption(theSelTo, selectedText[i], selectedValues[i]);}	
	}

	if(NS4) history.go(0);
}
function moveOptions1(theSelFrom, theSelTo)
{

	var selLength = theSelFrom.length;
	var selectedText = new Array();
	var selectedValues = new Array();
	var selectedCount = 0;
	var i;

	for(i=selLength-1; i>=0; i--)
	{
		if(theSelFrom.options[i].selected)
		{
			selectedText[selectedCount] = theSelFrom.options[i].text;
			selectedValues[selectedCount] = theSelFrom.options[i].value;
			deleteOption(theSelFrom, i);
			selectedCount++;
		}
	}

	if(NS4) history.go(0);
	
	
	
}
function deleteOption(theSel, theIndex)
{	

	var selLength = theSel.length;
	if(selLength>0)
	{
		theSel.options[theIndex] = null;
	}
}
//trim
function Trim(str){
	
	return str=str.replace(/^ +/,"").replace(/ +$/,"");
}

function TempisValidString(elem)
{
	var elemLength=elem.length;
	
	for(var i=0;i<elemLength;i++)
	{
        
	var ascii=elem.charCodeAt(i); 
	// allowed . _ Number and characters

        if(!((ascii>64 && ascii <91) || (ascii >96 && ascii <123)||(ascii==32)||(ascii==46)||(ascii==95)||(ascii>47 && ascii<59)))
		 {
		
			return true;
		 }
	}
	
	return false;

 }
function isValidName1(str)
{
	var pattern=new RegExp('[^a-zA-Z. ]');
	if(pattern.test(str)) { return false; }else { return true; }
 } 

function isValidName(str)
{
	var pattern=new RegExp('[^a-zA-Z ]');
	if(pattern.test(str)) { return false; }else { return true; }
 }
 function isValideducation(str)
{
	var pattern=new RegExp('[^a-zA-Z0-9 .,]');
	if(pattern.test(str)) { return false; }else { return true; }
 }
 function isValidp_subcaste(str)
{
	var pattern=new RegExp('[^a-zA-Z ,]');
	if(pattern.test(str)) { return false; }else { return true; }
 }
 function isValidOccupation(str)
{
	var pattern=new RegExp('[^a-zA-Z0-9 .,]');
	if(pattern.test(str)) { return false; }else { return true; }
 }
function isValidUName(str)
{
	var pattern=new RegExp('[^a-zA-Z0-9]');
	if(pattern.test(str)) { return false; }else { return true; }
 } 
 function isValidhobbies(str)
{
	var pattern=new RegExp('[^a-zA-Z0-9 ,.]');                                                     
	if(pattern.test(str)) { return false; }else { return true; }
 } 
 function isName(str)
{
	var pattern=new RegExp('[^a-zA-Z_.-]');
	if(pattern.test(escape(str))) { return false; }else { return true; }
 } 
 
function isValidString(str)
{
	var pattern=new RegExp('[^a-zA-Z0-9 ,.():;*$@!?-]');                                                     
	if(pattern.test(str)) { return false; }else { return true; }
 }
function isValidPassword(str)
{

	var pattern=new RegExp('[^a-zA-Z0-9 .*$@\-]');
	if(pattern.test(str)) { return false; }else { return true; }

 } 
function isValidPhone(str)
{
var pattern=new RegExp('[^0-9 ,_\-]');
if(pattern.test(str)) { return false; }else { return true; }
}
function isValidIncome(str)
{
var pattern=new RegExp('[^0-9,]');
if(pattern.test(str)) { return false; }else { return true; }
}
function isAlphaNumeric(str)
{

	var pattern=new RegExp('[^a-zA-Z0-9]');
	if(pattern.test(str)) { return false; }else { return true; }

 }  
function inString(str)
{
	
	var pattern=/[A-Za-z0-9]/;
	if(str.match(pattern)!=null) { return true; } else { return false; }

}
function isTag(str)
{
	if(str.indexOf("<")!=-1 || str.indexOf(">")!=-1)
	{
		return true;
	}
	else
	{
		return false;
	}
}
function isInteger(s)
	{
			var i;
			for (i = 0; i < s.length; i++)
				{   
				// Check that current character is number.
				var c = s.charAt(i);
				if (((c < "0") || (c > "9"))) return false;
			   }
			// All characters are numbers.
			return true;
}

function isCharsInBag (s, bag)
{  
    var i;
    for (i = 0; i < s.length; i++)
    {   
       
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) return false;
    }
    return true;
}

function checkURL(elem)
	{
		//alert(elem);
		
		var sp=elem.split(".");
		//alert(sp.length);
		//alert(sp[1]);
		//alert(sp[2]);
		if(sp.length<3) return true;
		if(sp.length>4) return true;
		if(sp[1]=='') return true;
		if(sp[2]=='') return true;
		if(sp[2].length<=2) return true;
		//if(sp[2].length>2) return true;
		
		
	var elemLength=elem.length;
	for(var i=0;i<=3;i++)
		{
		var ascii=elem.charCodeAt(i);
		if(!(ascii==87 || ascii==119))
			{
			if(i=4)
				{
			     if(!(ascii==46))
			return true;
				}
			}
		}
	}

function FileType( fileName, fileTypes )
{
if (!fileName) return;

dots = fileName.split(".")

//get the part AFTER the LAST period.
fileType = "." + dots[dots.length-1];

		if((fileTypes.join(".").indexOf(fileType) != -1))
		{
		 return true;
		}
		else
		{
		alert("Invalid file Type. Only " + (fileTypes.join(" .")) + " files are allowed.\n\nPlease select a new file and try again.");
		return false;
		}
}

function Temp_FileType( fileName, fileTypes )
{
if (!fileName) return;

dots = fileName.split(".")

//get the part AFTER the LAST period.
fileType = "." + dots[dots.length-1];

return (fileTypes.join(".").indexOf(fileType) != -1) ?
s=1 : 
alert("Invalid file Type. Only " + (fileTypes.join(" .")) + " files are allowed.\n\nPlease select a new file and try again.");
return false;
}

function trim(strinput)
{
    var i;
					 while(strinput.charAt(0)==' '||strinput.charAt(0)=='\t'||strinput.charAt(0)=='\n'||strinput.charAt(0)=='\r')
					{
					strinput= strinput.substring(1);
					}
					i = strinput.length-1;
					while(strinput.charAt(i)==' '||strinput.charAt(i)=='\t'||strinput.charAt(i)=='\n'||strinput.charAt(i)=='\r')
					{
					strinput = strinput.substring(0,i);
					i = i-1;
					}
return strinput;
}

//priya

function issame(lenObj,lenObj1,lenobjMsg)
{
	str=lenObj.value;
	str1=lenObj1.value;
	if(str!=str1)
	{
		alert(lenobjMsg);
		lenObj.focus();
		return false;
	}
	return true;
}
// Suchitra - Used for checking whether from date is greater then to date
function dateCheck(dt)
{
    var dtArr = dt.split('/');
    var dtStr =  dtArr[2]+dtArr[1]+dtArr[0];
    return dtStr
}

//sree
function ForceEntry(strObject,strMessage)
{
var Charss = " -_ /:,.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
var Chars = " +-()0123456789";
tti = strObject.value;
 if (trim(tti) != '')
 {
	for (var i = 0; i < tti.length; i++)
	{
		if (i == 0)
		{
			if (Charss.indexOf(tti.charAt(i)) == 0)
			{
				alert(strMessage);
				strObject.focus();
				return false;
			}
		}
		if (Charss.indexOf(tti.charAt(i)) == -1)
		{
			alert(strMessage);
				strObject.focus();
			return false;
		}
	}
}
else
{
		alert(strMessage);
		strObject.focus();
  return false;
  }
  return true;
}
//priya

//email
function EmailValid(emailtext,MsgErr)
{

	if (trim(emailtext.value) == "")
	{
		MsgErr="Email cannot be blank";
		alert(MsgErr);
		emailtext.focus();
		return false;
	}
	
	emailStr=emailtext.value;

	var emailPat=/^(.+)@(.+)$/

	var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"

	var validChars="\[^\\s" + specialChars + "\]"

	var quotedUser="(\"[^\"]*\")"

	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/

	var atom=validChars + '+'

	var word="(" + atom + "|" + quotedUser + ")"

	var userPat=new RegExp("^" + word + "(\\." + word + ")*$")

	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")

	var matchArray=emailStr.match(emailPat)
		if (matchArray==null) 
	{
	  	MsgErr="Email address seems incorrect (check @ and .'s)";
		alert(MsgErr);
		emailtext.focus();
	return false
	}
	
	var user=matchArray[1]
	var domain=matchArray[2]


	if (user.match(userPat)==null) 
	{

		MsgErr="The username in Email doesn't seem to be valid.";
		alert(MsgErr);
		emailtext.focus();
		return false
	}


	var IPArray=domain.match(ipDomainPat)
		if (IPArray!=null) 
	{   
		  for (var i=1;i<=4;i++) 
		  {
			if (IPArray[i]>255) 
			{
				MsgErr="--Destination IP address is invalid!";
						alert(MsgErr);
				emailtext.focus();
				return false;
			}
		}
			return true;
	
	}

	var domainArray=domain.match(domainPat)
if (domainArray==null) 
	{
		MsgErr="The email doesn't seem to be valid.";
				alert(MsgErr);
		emailtext.focus();
		 return false;
	}

	var atomPat=new RegExp(atom,"g");
	var domArr=domain.match(atomPat);
	var len=domArr.length;
	if (domArr[domArr.length-1].length < 2 || 
	 domArr[domArr.length-1].length>3) {
	   
	 MsgErr="The address must end in a three-letter domain, or two letter country.";
	 		alert(MsgErr);
	  emailtext.focus();
	  return false;

	}

	if (len<2) {
	   var errStr="This address is missing a hostname!"
	  MsgErr="--"+errStr;
	  		alert(MsgErr);
			emailtext.focus();
		return false;
	}
	if (domArr[domArr.length-2].length < 2 ) {
		MsgErr="-- Hostname in the email address should be atleast two";
	 		alert(MsgErr);
	  emailtext.focus();
	  return false;
	}
	return true;
	}
//email
function isValidEmail(emailStr)
{

	if (emailStr == ""){ return false; }
	
	var emailPat=/^(.+)@(.+)$/

	var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"

	var validChars="\[^\\s" + specialChars + "\]"

	var quotedUser="(\"[^\"]*\")"

	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/

	var atom=validChars + '+'

	var word="(" + atom + "|" + quotedUser + ")"

	var userPat=new RegExp("^" + word + "(\\." + word + ")*$")

	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")

	var matchArray=emailStr.match(emailPat)

	if (matchArray==null) 
	{
		return false;
	}
	
	var user=matchArray[1]
	var domain=matchArray[2]

	if (user.match(userPat)==null) 
	{
		return false
	}


	var IPArray=domain.match(ipDomainPat)
	if (IPArray!=null) 
	{   
		  for (var i=1;i<=4;i++) 
		  {
			if (IPArray[i]>255) 
			{
				return false;
			}
		}
			return true;
	
	}

	var domainArray=domain.match(domainPat)
	if (domainArray==null) 
	{
		 return false;
	}

	var atomPat=new RegExp(atom,"g");
	var domArr=domain.match(atomPat);
	var len=domArr.length;
	if (domArr[domArr.length-1].length < 2 || 
	 domArr[domArr.length-1].length>3) {
	  
	  return false;

	}

	if (len<2) {
		return false;
	}
	if (domArr[domArr.length-2].length < 2 ) {
	  return false;
	}
	return true;

}
//email

function MinLen(lenObj,Msg)
{
	str=lenObj.value;
	if(str.length < 6)
	{
		alert(Msg);
		lenObj.focus();
		return false;
	}
	return true;
}

function isName(names)
{
	 var i=0

	 for(i;i<names.length;i++)
	 {
	 	var c=names.charAt(i)
//	 	if (!(((c >= "a") && (c <= "z")) || ((c >= "A") && (c <= "Z")) || ((c >= "0") && (c <= "9")) || (c == ".") || (c == "_") || (c == "-"))
		if (!(((c >= "a") && (c <= "z")) || ((c >= "A") && (c <= "Z"))||((c >= "0") && (c <= "9")) ||(c == ".")  || (c == "_") || (c == "-") || (c == " ")))
	 	{
			return false;
	 	}
	 }
     	 return true;
}


 function isname(nameObj,nameMsg)
{
	 var i=0
		 names=nameObj.value;
	 for(i;i<names.length;i++)
	 {
	 	var c=names.charAt(i)
//	 	if (!(((c >= "a") && (c <= "z")) || ((c >= "A") && (c <= "Z")) || ((c >= "0") && (c <= "9")) || (c == ".") || (c == "_") || (c == "-"))
		if (!(((c >= "a") && (c <= "z")) || ((c >= "A") && (c <= "Z"))||((c >= "0") && (c <= "9")) ||(c == ".")  || (c == "_") || (c == "-")))
	 	{
	 		alert(nameMsg);
			nameObj.focus();
			return false;
	 	}
	 }
     	 return true;
}

function DateValid()
{
	
	var from_date=new Date(document.frmReg.mem_dob.value);
	var curr_date=new Date();
	//alert("ss"+document.frmReg.mem_dob.value+" dob");
	if (document.frmReg.mem_dob.value =="")
	{
		alert("Enter Your Date of Birth");
		return false;
	}
	else
	{
		if (curr_date.getTime() < from_date.getTime())
		{
			alert("Your Date of Birth should be Lesser than Current date");
			return false;
		}
	}
	return true;
}
	
function isDate(ThisDay,ThisMon,ThisYear)
{
	var ValidDay;
	ThisDay=parseInt(ThisDay);
	ThisMon=parseInt(ThisMon);
	ThisYear=parseInt(ThisYear);
	if(ThisDay>31||ThisMon>12||ThisYear>4000||ThisYear<1||ThisDay<1||ThisMon<1)
		{
		return false;
		}
	switch (ThisMon)
		{
		case 1:
		case 3:
		case 5:
		case 7:
		case 8:
		case 10:
		case 12:
				ValidDay=31;
				break;
		case 2:ValidDay=28;
				if(ThisYear%4==0)
					{
					if(ThisYear%400==0)
						ValidDay=29;
					else
						{
						if(ThisYear%100==0)
							ValidDay=28;
						else
							ValidDay=29;
						}
					}
				break;
		case 4:
		case 6:
		case 9:
		case 11:
				ValidDay=30;
				break;
		default:
				return false;
		}
	if(ValidDay<ThisDay)
		return false;
	else
		return true;
}


function isPost(strObject,strMessage)
{
var Charss = " -_/:,.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
var Chars = " +-()0123456789";
tti = strObject.value;
 if (trim(tti) != '')
 {
	for (var i = 0; i < tti.length; i++)
	{
		if (i == 0)
		{
			if (Chars.indexOf(tti.charAt(i)) == 0)
			{
				alert(strMessage);
				strObject.focus();
				return false;
			}
		}
		if (Chars.indexOf(tti.charAt(i)) == -1)
		{
			alert(strMessage);
				strObject.focus();
			return false;
		}
	}
}
else
{
		alert(strMessage);
		strObject.focus();
  return false;
  }
  return true;
}

function isdifferent(lenObj,lenObj1,lenobjMsg)
{
	str=lenObj.value;
	str1=lenObj1.value;
	if(str!=str1)
	{
		alert(lenobjMsg);
		lenObj.focus();
		return false;
	}
	return true;
}

function isAlphanumeric(alpObj,alpObjMsg)
{
	alp=alpObj.value;
	alps=alpObj.value.search(/[^a-zA-Z\s]/);
	
	if (alp==null || alp=="" || alps != -1)
	{
		alert(alpObjMsg);
		alpObj.focus();
		return false;
	}
	return true;
}

//Sree
function FirstChar(strObject,strMessage)
{
var Charss = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
//var Chars = " +-()0123456789";
tti = strObject.value;
 if (trim(tti) != '')
 {
	if (Charss.indexOf(tti.charAt(0)) == -1){
		alert(strMessage);
				strObject.focus();
			return false;
	}
}
 return true;
}
//Sree
function LastChar(strObject,strMessage)
{
//var Charss = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
var Chars = "_-";
tti = strObject.value;

 if (trim(tti) != '')
 {
	if (Chars.indexOf(tti.charAt((tti.length) -1)) != -1){

		alert(strMessage);
				strObject.focus();
			return false;
	}
}
 return true;
}

//Sree
//To change the date format
function changeDate(dt)
{
	var day1 = dt.substring(0,2);
	var mon1 = dt.substring(3,5);
	var year1 = dt.substring(6);
	var date1 = mon1+"/"+day1+"/"+year1;
	return date1;
}


function isValidTitle(str)
{

        var pattern=new RegExp('[^a-zA-Z0-9 _.-\'"]');
        if(pattern.test(escape(str))) { return false; }else { return true; }

 }

function validateTextArea()
{
	 var f =document.frm;
     updateTextArea('contentvalue');
     var textval=f.contentvalue.value;
     f.editordata.value=textval;
	 
	 if (Trim(f.editordata.value) == "" || (f.editordata.value) == "<font color=\"#000000\" face=\"arial\" size=\"2\"></font>" || (f.editordata.value =="<div></div> ")  || Trim(f.editordata.value) == "<div></div><font color=\"#000000\" face=\"arial\" size=\"2\"></font> "|| Trim(f.editordata.value) == "<span style=\"color: rgb(0, 0, 0);\"><span style=\"font-family: Arial;\"><font size=\"2\"><br></font></span></span>" || Trim(f.editordata.value) == "<span style=\"color: rgb(0, 0, 0);\"><span style=\"font-family: Arial;\"><br></span></span>"  || Trim(f.editordata.value) == "<FONT face=arial color=#000000 size=2></FONT>" || Trim(f.editordata.value) == "<P><FONT face=arial color=#000000 size=2></FONT>&nbsp;</P>")
	  {
                alert("Please enter the description");
                if(document.all)
                       window.frames[0].focus();
                //else
                 //      document.getElementById('contentvalue').contentWindow.focus()
                return false;
        }
	
	 if(Trim(f.editordata.value) != '')
	 {
		var strlen = f.editordata.value.length;
		var foundTag = 0,position=0;
		for(i=0;i<strlen;i++)
		{
			if(f.editordata.value[i]!='<' && foundTag!=1)
			{
				position++;
			}
			else if(f.editordata.value[i]=='<')
			{
				foundTag = 1;
			}
			else if(f.editordata.value[i]=='>')
			{
				foundTag = 0;
			}
		}
		if(position > 5000)
		{
			alert("Please enter characters less than 5000");
			return false;
		}
	}
	return true;
}

function check_url(address) {
  if ((address == "")
    || (address.indexOf ('http://') == -1)
    || (address.indexOf ('.') == -1) || (address.indexOf ('.') <= 8) || address.length<12)
      return false;
  var alphanumeric = new RegExp('[^a-zA-Z0-9]');
  if(alphanumeric.test(address.substr(7,2)))
	return false;

  var sp = address.split(".");
  if(sp[1]=='') return false;
  if(sp[2]=='') return false;
  return true;
 }


function isAlpha(str)
{

        var pattern=new RegExp('[^a-zA-Z \.]');
        if(pattern.test(str)) { return false; }else { return true; }

 }
function isValidCont(str)
{
var pattern=new RegExp('[^a-zA-Z0-9 \.:@!?\_\'\"-]');
if(pattern.test(str)) { return false; }else { return true; }
}
 
function reset_form1(name)
{
document.getElementById(name).reset();
frm.user_name.style.background="white";
document.getElementById("error_user_name").innerHTML="";
frm.pass.style.background="white";
frm.rpass.style.background="white"; 
document.getElementById("error_rpass").innerHTML="";
frm.email.style.background="white";   
document.getElementById("error_email").innerHTML="";
document.getElementById("error_pass").innerHTML="";
frm.firstname.style.background="white"; 
document.getElementById("error_firstname").innerHTML="";
document.getElementById("male").bgColor="white";
document.getElementById("female").bgColor="white";
document.getElementById("error_gender").innerHTML="";
frm.dob_month.style.background="white";
frm.dob_day.style.background="white"; 
frm.dob_year.style.background="white";
frm.age.style.background="white";
document.getElementById("error_age").innerHTML="";
document.getElementById("error_age").innerHTML="";
frm.religion.style.background="white"; 
document.getElementById("error_religion").innerHTML="";
frm.caste1.style.background="white";
document.getElementById("error_caste").innerHTML="";
frm.other.style.background="white"; 
document.getElementById("error_caste").innerHTML="";
frm.subcast.style.background="white"; 
document.getElementById("error_subcast").innerHTML="";
frm.gothram.style.background="white";	
document.getElementById("error_gothram").innerHTML="";
frm.mother_tongue.style.background="white"; 
document.getElementById("error_mother_tongue").innerHTML="";
document.getElementById("unmarried").bgColor="white";
document.getElementById("widow").bgColor="white";
document.getElementById("Divorced").bgColor="white";
document.getElementById("separated").bgColor="white"; 
document.getElementById("error_marital_status").innerHTML="";
if (frm.marital_status[0].checked == false)
{
frm.numche.disabled=false;
}
frm.numche.style.background="white"; 
document.getElementById("error_numche").innerHTML="";

if(trim(frm.numche.value)=="Select" || trim(frm.numche.value)=="NO")
{ 
frm.child_live_status[0].disabled=true;
frm.child_live_status[1].disabled=true;
}
else
{ 
frm.child_live_status[0].disabled=false;
frm.child_live_status[1].disabled=false;
}
document.getElementById("live").bgColor="white";
document.getElementById("notlive").bgColor="white";	 
document.getElementById("error_child_live_status").innerHTML="";

frm.citizen.style.background="white";
document.getElementById("error_citizen").innerHTML="";
var country=document.getElementById("country");
frm.country.style.background="white";
document.getElementById("error_country").innerHTML="";
if((trim(country.options[country.selectedIndex].text)!="India"))
	{
		if(frm.state_residence.disabled==false)
		{	
		frm.state_residence.value="Select";
		frm.state_residence.disabled=true; 
		frm.state_residence2.disabled=false; 
		frm.state_residence2.focus();
		}
	}
		
   if(trim(country.options[country.selectedIndex].text)=="India")
   {
   frm.state_residence2.value="";
   frm.state_residence.disabled=false;
   frm.state_residence2.disabled=true;
   frm.state_residence.focus();
   }
frm.state_residence.style.background="white";
frm.state_residence2.style.background="white";
document.getElementById("error_state_residence").innerHTML="";
frm.city.style.background="white";	
document.getElementById("error_city").innerHTML="";
document.getElementById("citizen1").bgColor="white";
document.getElementById("permanent").bgColor="white";
document.getElementById("work").bgColor="white";
document.getElementById("student").bgColor="white";   
document.getElementById("temporary").bgColor="white";
document.getElementById("government").bgColor="white";
document.getElementById("private").bgColor="white";
document.getElementById("business").bgColor="white";
document.getElementById("defence").bgColor="white";
document.getElementById("notworking").bgColor="white";
document.getElementById("error_employed_in").innerHTML="";
document.getElementById("error_resident_status").innerHTML="";
frm.registered_by.style.background="white"; 
document.getElementById("error_registered_by").innerHTML="";
document.getElementById("terms").bgColor="white"; 
document.getElementById("error_terms").innerHTML="";
return casteoptions(document.getElementById('religion').value);
}


function reset_form2(name)
{
document.getElementById(name).reset();
frm.feet.style.background="white";	
document.getElementById("error_feet").innerHTML="";
frm.kgs.style.background="white";	
document.getElementById("error_weight").innerHTML="";
document.getElementById("normal").bgColor="white";
document.getElementById("challenged").bgColor="white";
document.getElementById("mental").bgColor="white";
document.getElementById("pmental").bgColor="white";
document.getElementById("hiv").bgColor="white";
document.getElementById("error_special_case").innerHTML="";
frm.special_case[0].style.background="white";
frm.special_case[1].style.background="white";
frm.special_case[2].style.background="white";
frm.special_case[3].style.background="white";
frm.special_case[4].style.background="white"; 
document.getElementById("error_special_case").innerHTML="";
frm.comments.style.background="white";	
document.getElementById("error_comments").innerHTML="";
frm.comments.style.background="white";
document.getElementById("error_comments").innerHTML="";
frm.education.style.background="white";	
document.getElementById("error_education").innerHTML="";
frm.othereducation.style.background="white";	
document.getElementById("error_othereducation").innerHTML="";
frm.occupation.style.background="white";	
document.getElementById("error_occupation").innerHTML="";
frm.occupationdetail.style.background="white";	
document.getElementById("error_occupationdetail").innerHTML="";
frm.income_currency.style.background="white";
frm.in_come.style.background="white";
document.getElementById("error_in_come").innerHTML="";
frm.contact_person.style.background="white";	
document.getElementById("error_contact_person").innerHTML="";
frm.relationship.style.background="white";	 
document.getElementById("error_relationship").innerHTML="";
frm.contact_address.style.background="white";	 
document.getElementById("error_contact_address").innerHTML="";
frm.mobile_no.style.background="white";
document.getElementById("error_mobile").innerHTML="";
frm.country_code.style.background="white";
frm.area_code.style.background="white";
frm.phone_number.style.background="white";
document.getElementById("error_phone").innerHTML="";	
frm.time_tocall.style.background="white";	
document.getElementById("error_time_tocall").innerHTML="";
}

function reset_form3(name)
{
document.getElementById(name).reset();
document.getElementById("ortho").bgColor="white";
document.getElementById("traditional").bgColor="white";
document.getElementById("moderate").bgColor="white";
document.getElementById("liberal").bgColor="white";
document.getElementById("error_family_value").innerHTML="";
document.getElementById("joint_family").bgColor="white";
document.getElementById("nuclear_family").bgColor="white";
document.getElementById("others_family").bgColor="white";
document.getElementById("error_family_type").innerHTML="";
frm.fathername.style.background="white";
document.getElementById("error_fathername").innerHTML="";
frm.mothername.style.background="white"; 
document.getElementById("error_mothername").innerHTML="";
frm.father_occupation.style.background="white"; 
document.getElementById("error_father_occupation").innerHTML="";
frm.mother_occupation.style.background="white"; 
document.getElementById("error_mother_occupation").innerHTML="";
frm.Bro_married.style.background="white";
frm.Bro_unmarried.style.background="white";   
document.getElementById("error_Brother").innerHTML="";
frm.Sis_married.style.background="white";
frm.Sis_unmarried.style.background="white";
document.getElementById("error_Sister").innerHTML="";
}

function reset_form4(name)
{
document.getElementById(name).reset();
frm.hobbies_des.style.background="white";   
document.getElementById("error_hobbies_des").innerHTML="";
frm.interest_des.style.background="white";	
document.getElementById("error_interest_des").innerHTML="";
frm.music_des.style.background="white";
document.getElementById("error_music_des").innerHTML="";
frm.read_des.style.background="white";
document.getElementById("error_read_des").innerHTML="";
frm.movie_des.style.background="white";
document.getElementById("error_movie_des").innerHTML="";
frm.sports_des.style.background="white";	
document.getElementById("error_sports_des").innerHTML="";
frm.food_des.style.background="white"; 
document.getElementById("error_food_des").innerHTML="";
frm.dress_des.style.background="white";	
document.getElementById("error_dress_des").innerHTML="";
frm.spoken_des.style.background="white";	
document.getElementById("error_spoken_des").innerHTML="";
}

function reset_form5(name)
{
	document.getElementById(name).reset();
	    for(x=0;x<500;x++)
    {
	frm.p_religion2.options[0]=null;
	frm.p_caste2.options[0]=null;
	frm.moth_tong2.options[0]=null;
	frm.p_education2.options[0]=null;
	frm.p_citizenship2.options[0]=null;
	frm.p_country2.options[0]=null;	
	frm.p_state_residence2.options[0]=null;
	frm.p_residentstatus2.options[0]=null;
	} 
frm.p_age_from.style.background="white";
frm.p_age_to.style.background="white";
document.getElementById("error_p_age").innerHTML="";
frm.height_from.style.background="white";
frm.height_to.style.background="white";
document.getElementById("error_height").innerHTML="";
frm.p_subcast.style.background="white"; 
document.getElementById("error_p_subcast").innerHTML="";
frm.p_other_state.style.background="white"; 
document.getElementById("error_p_other_state").innerHTML="";
document.getElementById("p_residentstatus2").value="";
moveOptions1(document.Form5.p_residentstatus2,document.Form5.p_residentstatus1);
}

function reset_searchform(name)
{
document.getElementById(name).reset();
window.location.reload();
}
