// JavaScript Document

function member_validation()
{
	if(document.memberform.fname.value=="")
		{
				document.memberform.fname.focus();
				alert("Please Insert FirstName");
				return false;
		}
		if(document.memberform.lname.value=="")
		{
				document.memberform.lname.focus();
				alert("Please Insert LastName");
				return false;
		}
		if(document.memberform.fathername.value=="")
		{
				document.memberform.fathername.focus();
				alert("Please Insert Father Name");
				return false;
		}
		if(document.memberform.bloodgroup.value=="")
		{
			document.memberform.bloodgroup.focus();
			alert("Please Select Blood Group");
			return false;
		}
		if(document.memberform.day.value=="")
		{
				document.memberform.day.focus();
				alert("Please Select Day");
				return false;
		}
		if(document.memberform.month.value=="")
		{
				document.memberform.month.focus();
				alert("Please Select Month");
				return false;
		}
		if(document.memberform.year.value=="")
		{
				document.memberform.year.focus();
				alert("Please Select Year");
				return false;
		}
		if(document.memberform.mstatus.value=="")
		{
				document.memberform.mstatus.focus();
				alert("Please Select Marital Status");
				return false;
		}
		if(document.memberform.mday.value=="")
		{
				document.memberform.mday.focus();
				alert("Please Select Marriage Anniversary Day");
				return false;
		}
		if(document.memberform.mmonth.value=="")
		{
				document.memberform.mmonth.focus();
				alert("Please Select Marriage Anniversary Month");
				return false;
		}
		if(document.memberform.myear.value=="")
		{
				document.memberform.myear.focus();
				alert("Please Select Marriage Anniversary Year");
				return false;
		}
		if(document.memberform.email.value=="")
		{
			document.memberform.email.focus();
			alert("Please Insert Email Id");
			return false;
		}
		if(document.memberform.pcode.value=="")
		{
			document.memberform.pcode.focus();
			alert("Please Insert Country Code");
			return false;
		}
		if(document.memberform.stdcode.value=="")
		{
			document.memberform.stdcode.focus();
			alert("Please Insert Std Code");
			return false;
		}
		if(document.memberform.phone.value=="")
		{
				document.memberform.phone.focus();
				alert("Please Insert Phone No.");
				return false;
		}
		if(document.memberform.mobile.value=="")
		{
				document.memberform.mobile.focus();
				alert("Please Insert Mobile No.");
				return false;
		}
		
		if(document.memberform.address.value=="")
		{
				document.memberform.address.focus();
				alert("Please Insert Address.");
				return false;
		}
		if(document.memberform.country.value=="")
		{
				document.memberform.country.focus();
				alert("Please Select Country");
				return false;
		}
		if(document.memberform.state.value=="")
		{
				document.memberform.state.focus();
				alert("Please Insert State");
				return false;
		}
		if(document.memberform.city.value=="")
		{
				document.memberform.city.focus();
				alert("Please Insert City");
				return false;
		}
		if(document.memberform.userfile.value=="")
		{
			document.memberform.userfile.focus();
			alert("Please Browse Image");
			return false;
		}
		if(document.memberform.batch.value=="")
		{
				document.memberform.batch.focus();
				alert("Please Select Passing Year");
				return false;
		}
		if(document.memberform.branchname.value=="")
		{
				document.memberform.branchname.focus();
				alert("Please Select Branch Name");
				return false;
		}
		if(document.memberform.degreename.value=="")
		{
				document.memberform.degreename.focus();
				alert("Please Select Degree Name");
				return false;
		}
		if(document.memberform.otherqualification.value=="")
		{
				document.memberform.otherqualification.focus();
				alert("Please Insert Other Qualification");
				return false;
		}
		if(document.memberform.profession.value=="")
		{
				document.memberform.profession.focus();
				alert("Please Insert Profession");
				return false;
		}
		if(document.memberform.companyname.value=="")
		{
				document.memberform.companyname.focus();
				alert("Please Insert Company Name");
				return false;
		}
		if(document.memberform.jobtype.value=="")
		{
				document.memberform.jobtype-focus();
				alert("Please Insert Job Type");
				return false;
		}
		if(document.memberform.offemail.value=="")
		{
				document.memberform.offemail.focus();
				alert("Please Insert Office Email Address");
				return false;
		}
		if(document.memberform.offpcode.value=="")
		{
				document.memberform.offpcode.focus();
				alert("Please Insert Office Country Code");
				return false;
		}
		if(document.memberform.offstdcode.value=="")
		{
				document.memberform.offstdcode.focus();
				alert("Please Insert Office Std Code");
				return false;
		}
		if(document.memberform.offphone.value=="")
		{
				document.memberform.offphone.focus();
				alert("Please Insert Office Phone No.");
				return false;
		}
		if(document.memberform.faxpcode.value=="")
		{
				document.memberform.faxpcode.focus();
				alert("Please Insert Fax Country Code");
				return false;
		}
		if(document.memberform.faxstdcode.value=="")
		{
				document.memberform.faxstdcode.focus();
				alert("Please Insert Fax Std Code");
				return false;
		}
		if(document.memberform.fax.value=="")
		{
				document.memberform.fax.focus();
				alert("Please Insert Fax No.");
				return false;
		}
		if(document.memberform.offmobile.value=="")
		{
				document.memberform.offmobile.focus();
				alert("Please Insert Office Mobile");
				return false;
		}
		if(document.memberform.addworkplace.value=="")
		{
			document.memberform.addworkplace.focus();
			alert("Please Insert office Address");
			return false;
		}
		
		if(document.memberform.spousename.value=="")
		{
				document.memberform.spousename.focus();
				alert("Please Insert Spousename");
		}
		if(document.memberform.sday.value=="")
		{
				document.memberform.sday.focus();
				alert("Please Select Spouse Day");
				return false;
		}
		if(document.memberform.smonth.value=="")
		{
				document.memberform.smonth.focus();
				alert("Please Select Spouse Month");
				return false;
		}
		if(document.memberform.syear.value=="")
		{
				document.memberform.syear.focus();
				alert("Please Select Year");
				return false;
		}
		if(document.memberform.c1name.value=="")
		{
				document.memberform.clname.focus();
				alert("Please Insert First Children Name");
				return false;
		}
		if(document.memberform.c1day.value=="")
		{
				document.memberform.c1day.focus();
				alert("Please Select Birth of Day");
				return false;
		}
		if(document.memberform.c1month.value=="")
		{
				document.memberform.c1month.focus();
				alert("Please Select Birth of Month");
				return false;
		}
		if(document.memberform.c1year.value=="")
		{
				document.memberform.c1year.focus();
				alert("Please Select Birth of Year");
				return false;
		}
		if(document.memberform.c2name.value=="")
		{
				document.memberform.c2name.focus();
				alert("Please Insert Second Children Name");
				return false;
		}
		if(document.memberform.c2day.value=="")
		{
				document.memberform.c2day.focus();
				alert("Please Select Birth of Day");
				return false;
		}
		if(document.memberform.c2month.value=="")
		{
				document.memberform.c2month.focus();
				alert("Please Select Birth of Month");
				return false;
		}
		if(document.memberform.c2year.value=="")
		{
				document.memberform.c2year.focus();
				alert("Please Select Birth of Year");
				return false;
		}
		if(document.memberform.c3name.value=="")
		{
				document.memberform.c3name.focus();
				alert("Please Insert Three Children Name");
				return false;
		}
		if(document.memberform.c3day.value=="")
		{
				document.memberform.c3day.focus();
				alert("Please Select Birth of Day");
				return false;
		}
		if(document.memberform.c3month.value=="")
		{
				document.memberform.c3month.focus();
				alert("Please Select Birth of Month");
				return false;
		}
		if(document.memberform.c3year.value=="")
		{
				document.memberform.c3year.focus();
				alert("Please Select Birth of Year");
				return false;
		}
		else{
			document.memberform.action="save_member.php"
			document.memberform.submit();
		}
}



function edit_validation()
{
	if(document.msgform.fname.value=="")
		{
				document.msgform.fname.focus();
				alert("Please Insert FirstName");
				return false;
		}
		if(document.msgform.lname.value=="")
		{
				document.msgform.lname.focus();
				alert("Please Insert LastName");
				return false;
		}
		if(document.msgform.fathername.value=="")
		{
				document.msgform.fathername.focus();
				alert("Please Insert Father Name");
				return false;
		}
		if(document.msgform.bloodgroup.value=="")
		{
			document.msgform.bloodgroup.focus();
			alert("Please Select Blood Group");
			return false;
		}
		if(document.msgform.day.value=="")
		{
				document.msgform.day.focus();
				alert("Please Select Day");
				return false;
		}
		if(document.msgform.month.value=="")
		{
				document.msgform.month.focus();
				alert("Please Select Month");
				return false;
		}
		if(document.msgform.year.value=="")
		{
				document.memberform.year.focus();
				alert("Please Select Year");
				return false;
		}
		if(document.msgform.mstatus.value=="")
		{
				document.msgform.mstatus.focus();
				alert("Please Select Marital Status");
				return false;
		}
		if(document.msgform.mday.value=="")
		{
				document.msgform.mday.focus();
				alert("Please Select Marriage Anniversary Day");
				return false;
		}
		if(document.msgform.mmonth.value=="")
		{
				document.msgform.mmonth.focus();
				alert("Please Select Marriage Anniversary Month");
				return false;
		}
		if(document.msgform.myear.value=="")
		{
				document.msgform.myear.focus();
				alert("Please Select Marriage Anniversary Year");
				return false;
		}
		if(document.msgform.email.value=="")
		{
			document.msgform.email.focus();
			alert("Please Insert Email Id");
			return false;
		}
		if(document.msgform.pcode.value=="")
		{
			document.msgform.pcode.focus();
			alert("Please Insert Country Code");
			return false;
		}
		if(document.msgform.stdcode.value=="")
		{
			document.msgform.stdcode.focus();
			alert("Please Insert Std Code");
			return false;
		}
		if(document.msgform.phone.value=="")
		{
				document.msgform.phone.focus();
				alert("Please Insert Phone No.");
				return false;
		}
		if(document.msgform.mobile.value=="")
		{
				document.msgform.mobile.focus();
				alert("Please Insert Mobile No.");
				return false;
		}
		
		if(document.msgform.address.value=="")
		{
				document.msgform.address.focus();
				alert("Please Insert Address.");
				return false;
		}
		if(document.msgform.country.value=="")
		{
				document.msgform.country.focus();
				alert("Please Select Country");
				return false;
		}
		if(document.msgform.state.value=="")
		{
				document.msgform.state.focus();
				alert("Please Insert State");
				return false;
		}
		if(document.msgform.city.value=="")
		{
				document.msgform.city.focus();
				alert("Please Insert City");
				return false;
		}
		if(document.msgform.userfile.value=="")
		{
			document.msgform.userfile.focus();
			alert("Please Browse Image");
			return false;
		}
		if(document.msgform.batch.value=="")
		{
				document.msgform.batch.focus();
				alert("Please Select Passing Year");
				return false;
		}
		if(document.msgform.branchname.value=="")
		{
				document.msgform.branchname.focus();
				alert("Please Select Branch Name");
				return false;
		}
		if(document.msgform.degreename.value=="")
		{
				document.msgform.degreename.focus();
				alert("Please Select Degree Name");
				return false;
		}
		if(document.memberform.otherqualification.value=="")
		{
				document.msgform.otherqualification.focus();
				alert("Please Insert Other Qualification");
				return false;
		}
		if(document.msgform.profession.value=="")
		{
				document.msgform.profession.focus();
				alert("Please Insert Profession");
				return false;
		}
		if(document.msgform.companyname.value=="")
		{
				document.msgform.companyname.focus();
				alert("Please Insert Company Name");
				return false;
		}
		if(document.msgform.jobtype.value=="")
		{
				document.msgform.jobtype-focus();
				alert("Please Insert Job Type");
				return false;
		}
		if(document.msgform.offemail.value=="")
		{
				document.msgform.offemail.focus();
				alert("Please Insert Office Email Address");
				return false;
		}
		if(document.msgform.offpcode.value=="")
		{
				document.msgform.offpcode.focus();
				alert("Please Insert Office Country Code");
				return false;
		}
		if(document.msgform.offstdcode.value=="")
		{
				document.msgform.offstdcode.focus();
				alert("Please Insert Office Std Code");
				return false;
		}
		if(document.msgform.offphone.value=="")
		{
				document.msgform.offphone.focus();
				alert("Please Insert Office Phone No.");
				return false;
		}
		if(document.msgform.faxpcode.value=="")
		{
				document.msgform.faxpcode.focus();
				alert("Please Insert Fax Country Code");
				return false;
		}
		if(document.msgform.faxstdcode.value=="")
		{
				document.msgform.faxstdcode.focus();
				alert("Please Insert Fax Std Code");
				return false;
		}
		if(document.msgform.fax.value=="")
		{
				document.msgform.fax.focus();
				alert("Please Insert Fax No.");
				return false;
		}
		if(document.msgform.offmobile.value=="")
		{
				document.msgform.offmobile.focus();
				alert("Please Insert Office Mobile");
				return false;
		}
		if(document.msgform.addworkplace.value=="")
		{
			document.msgform.addworkplace.focus();
			alert("Please Insert office Address");
			return false;
		}
		
		if(document.msgform.spousename.value=="")
		{
				document.msgform.spousename.focus();
				alert("Please Insert Spousename");
		}
		if(document.msgform.sday.value=="")
		{
				document.msgform.sday.focus();
				alert("Please Select Spouse Day");
				return false;
		}
		if(document.msgform.smonth.value=="")
		{
				document.msgform.smonth.focus();
				alert("Please Select Spouse Month");
				return false;
		}
		if(document.msgform.syear.value=="")
		{
				document.msgform.syear.focus();
				alert("Please Select Year");
				return false;
		}
		if(document.msgform.c1name.value=="")
		{
				document.msgform.clname.focus();
				alert("Please Insert First Children Name");
				return false;
		}
		if(document.msgform.c1day.value=="")
		{
				document.msgform.c1day.focus();
				alert("Please Select Birth of Day");
				return false;
		}
		if(document.msgform.c1month.value=="")
		{
				document.msgform.c1month.focus();
				alert("Please Select Birth of Month");
				return false;
		}
		if(document.msgform.c1year.value=="")
		{
				document.msgform.c1year.focus();
				alert("Please Select Birth of Year");
				return false;
		}
		if(document.msgform.c2name.value=="")
		{
				document.msgform.c2name.focus();
				alert("Please Insert Second Children Name");
				return false;
		}
		if(document.msgform.c2day.value=="")
		{
				document.msgform.c2day.focus();
				alert("Please Select Birth of Day");
				return false;
		}
		if(document.msgform.c2month.value=="")
		{
				document.msgform.c2month.focus();
				alert("Please Select Birth of Month");
				return false;
		}
		if(document.msgform.c2year.value=="")
		{
				document.msgform.c2year.focus();
				alert("Please Select Birth of Year");
				return false;
		}
		if(document.msgform.c3name.value=="")
		{
				document.msgform.c3name.focus();
				alert("Please Insert Three Children Name");
				return false;
		}
		if(document.msgform.c3day.value=="")
		{
				document.msgform.c3day.focus();
				alert("Please Select Birth of Day");
				return false;
		}
		if(document.msgform.c3month.value=="")
		{
				document.msgform.c3month.focus();
				alert("Please Select Birth of Month");
				return false;
		}
		if(document.msgform.c3year.value=="")
		{
				document.msgform.c3year.focus();
				alert("Please Select Birth of Year");
				return false;
		}
		else{
			document.msgform.action="save_update.php"
			document.msgform.submit();
		}
}
//Numeric value feild validation
function numbersonly(e){
var unicode=e.charCode? e.charCode : e.keyCode
if (unicode!=8){ //if the key isn't the backspace key (which we should allow)
if (unicode<48||unicode>57) //if not a number
return false //disable key press
}
}
function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
	}

function ValidateForm(){
	var emailID=document.memberform.email
	
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please Enter your Email ID")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}
	return true
 }
 /**/


function deleteitem()
{
var i=0; 
if(document.all['che[]']){
while(document.all['che[]'])
	{ 
	if(document.all['che[]'].checked)
		{
		y=confirm("Are you sure want to Delete these messages");
		break;
		}
	else
	{
	y=false;
var	noitem=true;
	}
	i++;	
}
if (noitem==true){
alert("hey you haven't selected anything to delete");	
}
if (y==true)
	{
		return true;
	}
	else
	{
		if(document.all['checkbox'])
		{
			document.all['checkbox'].checked=false;
		}
			var chkbx=1;
			for(i=0;chkbx!=0;++i)
			{ 
				if(document.all['che[]'])
				{	
//				alert(document.all['che'+i])
					document.all['che[]'].checked=false;
				}
				else
				{
					chkbx=0;
				}
			}
			return false;
		}
	}
	alert("There are no messages to delete");
	return false;

}
function deleterecord()
{
	
				y=confirm("Are you sure want to delete this message");
				if (y==true)
				{
					return true;
				}
				else
				{
				return false;
				}
}



function checkitem()
{


			for (i=0;i<document.msgform.bookmark.length;i++)
		{
					if (document.msgform.bookmark[i].checked)
					{
					var		test=9;
						
					}
		}
		if ((document.msgform.to.value=="")&&(test!=9))
		{
					alert("please type the username in the to box");
					return false;		
		}
					
			
			if (document.msgform.subject.value=="")
			{
				alert("Please enter the subject");
				return false;
			}
			else	if (document.msgform.message.value=="")
			{
				alert("Please enter the message");
				return false;
			}
			else
			{
				return true;
			}

}
function hh1(i,j)
{
	var k=i.value;
	if (k=="mbm" || k=="all") 
	{
		j.style.display='none';
	}
	else
	{
		j.style.display='inline';
	}
}
function hh2(i,j,m)
{
	var k=i.value;
	if (k=="") 
	{
		j.style.display='inline';
		m.style.display='inline';
	}
	else
	{
		j.style.display='none';
		m.style.display='none';
	}
	
}
function hh3(i,j,m)
{
	var k=i.value;
	
	if(k!="Married")
	{
		j.style.display='none';
		m.style.display='none';
		
	}
	else
	{
		j.style.display='inline';
		m.style.display='inline';
	}
}
function showhide(divid, value)
{
//	alert(divid);
	document.all[divid].style.display = value
}
function hh5(i,j,m)
{
	var k=i.value;
	if(k ="country")
	{
		j.style.display='none';
		m.style.display='none';
	}
	else
	{
		j.style.display='inline';
		m.style.display='inline';
	}
}
 /**/