function myvalidation(){
	var strValidChars = "0123456789.";
	var iChars = "0123456789!@#$%^&*()+=-[]\\\';,./{}|\":<>?";
 	
	if(document.myform.ifirst_name.value=="" || document.myform.ifirst_name.value=="First Name") {
 		alert("Please enter your First Name.");
 		document.myform.ifirst_name.style.border ="1px solid #000000";
 		document.myform.ifirst_name.focus();	
 		return false;
	}
	if(document.myform.ilast_name.value=="" || document.myform.ilast_name.value=="Last Name") {
 		alert("Please enter your Last Name.");
 		document.myform.ilast_name.style.border ="1px solid #000000";
 		document.myform.ilast_name.focus();	
 		return false;
	}
	
 	
	for (var a = 0; a < document.myform.ifirst_name.value.length; a++) {
 		if (iChars.indexOf(document.myform.ifirst_name.value.charAt(a)) != -1) {
 			alert ("Your Name has special characters. \nThese are not allowed.\n Please remove them and try again.");
 			document.myform.ifirst_name.style.border ="1px solid #000000"; 
 			document.myform.ifirst_name.focus();	
 			return false;
		}
	}
	for (var c = 0; c < document.myform.ilast_name.value.length; c++) {
 		if (iChars.indexOf(document.myform.ilast_name.value.charAt(c)) != -1) {
 			alert ("Your Name has special characters. \nThese are not allowed.\n Please remove them and try again.");
 			document.myform.ilast_name.style.border ="1px solid #000000"; 
 			document.myform.ilast_name.focus();	
 			return false;
		}
	}
	
	if(document.myform.imob_contact_no.value=="" && document.myform.iland_contact_no.value=="") {
 		alert("Please enter your Contact no.");
 		document.myform.imob_contact_no.style.border ="1px solid #000000";
 		document.myform.imob_contact_no.focus();	
 		return false;
	}
	var i;
	p = document.myform.imob_contact_no.value.toString();
    for (i = 0; i < p.length; i++){
    	var strChar = p.charAt(i);
    	if (strValidChars.indexOf(strChar) == -1) 
		{
			alert("Given Contact no (Mob) is not a number");
			document.myform.imob_contact_no.focus();
			document.myform.imob_contact_no.style.border ="1px solid #000000"; 
			return false;
	   	}
     }
	 
	 var u;
	v = document.myform.iland_contact_no.value.toString();
    for (u = 0; u < p.length; u++){
    	var strChar = v.charAt(u);
    	if (strValidChars.indexOf(strChar) == -1) 
		{
			alert("Given Contact no (Landline) is not a number");
			document.myform.iland_contact_no.focus();
			document.myform.iland_contact_no.style.border ="1px solid #000000"; 
			return false;
	   	}
     }
	
	 var raj = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
 	 if(document.myform['iemail'].value.length<1){
 			alert("Please enter your Valid Email Id.");
 			document.myform.iemail.style.border ="1px solid #000000";  
			document.myform.iemail.focus();			
			return false;
	 }else if(!raj.test(document.myform['iemail'].value)){
 			alert("Invalid Email Id");
 			document.myform.iemail.style.border ="1px solid #000000"; 
 			document.myform.iemail.focus();
			return false;
	 }
	 
	if(document.myform.project_type.value=="") {
 		alert("Please select your Project Type.");
 		document.myform.project_type.style.border ="1px solid #000000";
 		document.myform.project_type.focus();	
 		return false;
	}
	
	if(document.myform.name_of_project.value=="") {
 		alert("Please enter your Name of the project/Building.");
 		document.myform.name_of_project.style.border ="1px solid #000000";
 		document.myform.name_of_project.focus();	
 		return false;
	}
	if(document.myform.flat_no.value=="") {
 		alert("Please enter your Flat No./Shop No./Office No.");
 		document.myform.flat_no.style.border ="1px solid #000000";
 		document.myform.flat_no.focus();	
 		return false;
	}
	
	
//////////////// FIRST REFER VALIDATION   ////////////////////////////
	
	if(document.myform.fr_first_name.value=="" || document.myform.fr_first_name.value=="First name") {
 		alert("Please enter your First name.");
 		document.myform.fr_first_name.style.border ="1px solid #000000";
 		document.myform.fr_first_name.focus();	
 		return false;
	}
	
	var jChars = "0123456789!@#$%^&*()+=-[]\\\';,./{}|\":<>?";
 	
 	for (var d = 0; d < document.myform.fr_first_name.value.length; d++) {
 		if (jChars.indexOf(document.myform.fr_first_name.value.charAt(d)) != -1) {
 			alert ("Your Name has special characters. \nThese are not allowed.\n Please remove them and try again.");
 			document.myform.fr_first_name.style.border ="1px solid #000000"; 
 			document.myform.fr_first_name.focus();	
 			return false;
		}
	}
	
	if(document.myform.fr_last_name.value=="" || document.myform.fr_last_name.value=="Last name") {
 		alert("Please enter your Last name.");
 		document.myform.fr_last_name.style.border ="1px solid #000000";
 		document.myform.fr_last_name.focus();	
 		return false;
	}
	
 	for (var f = 0; f < document.myform.fr_last_name.value.length; f++) {
 		if (jChars.indexOf(document.myform.fr_last_name.value.charAt(f)) != -1) {
 			alert ("Your Name has special characters. \nThese are not allowed.\n Please remove them and try again.");
 			document.myform.fr_last_name.style.border ="1px solid #000000"; 
 			document.myform.fr_last_name.focus();	
 			return false;
		}
	}
	
	if(document.myform.fr_mob_contact_no.value=="" && document.myform.fr_land_contact_no.value=="") {
 		alert("Please enter your Contact no.");
 		document.myform.fr_mob_contact_no.style.border ="1px solid #000000";
 		document.myform.fr_mob_contact_no.focus();	
 		return false;
	}
	
	var fm;
	frmob = document.myform.fr_mob_contact_no.value.toString();
    for (fm = 0; fm < frmob.length; fm++){
    	var strChar = frmob.charAt(fm);
    	if (strValidChars.indexOf(strChar) == -1) 
		{
			alert("Given Contact no (Mob) is not a number");
			document.myform.fr_mob_contact_no.focus();
			document.myform.fr_mob_contact_no.style.border ="1px solid #000000"; 
			return false;
	   	}
     }
	 
	var fl;
	frland = document.myform.fr_land_contact_no.value.toString();
    for (fl = 0; fl < frland.length; fl++){
    	var strChar = frland.charAt(fl);
    	if (strValidChars.indexOf(strChar) == -1) 
		{
			alert("Given Contact no (Mob) is not a number");
			document.myform.fr_land_contact_no.focus();
			document.myform.fr_land_contact_no.style.border ="1px solid #000000"; 
			return false;
	   	}
     }
	
	 var rajfr = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
 	 if(document.myform['fr_email_id'].value.length<1){
 			alert("Please enter your Valid Email Id.");
 			document.myform.fr_email_id.style.border ="1px solid #000000";  
			document.myform.fr_email_id.focus();			
			return false;
	 }else if(!rajfr.test(document.myform['fr_email_id'].value)){
 			alert("Invalid Email Id");
 			document.myform.fr_email_id.style.border ="1px solid #000000"; 
 			document.myform.fr_email_id.focus();
			return false;
	 }
	 
	 if(document.myform.fr_relation_person.value=="") {
 		alert("Please select your relation with the person .");
 		document.myform.fr_relation_person.style.border ="1px solid #000000";
 		document.myform.fr_relation_person.focus();	
 		return false;
	}
	
	if(document.myform.fr_relation_person.value=="Others(pls specify below)" && document.myform.fr_remarks.value=="") {
 		alert("Please enter your specify relation with the person .");
 		document.myform.fr_remarks.style.border ="1px solid #000000";
 		document.myform.fr_remarks.focus();	
 		return false;
	}
	
	
//////////////// SECOND REFER VALIDATION   ////////////////////////////
	
	if(document.myform.sr_first_name.value!="" && document.myform.sr_first_name.value!="First name") {
			
			if(document.myform.sr_first_name.value=="" || document.myform.sr_first_name.value=="First name") {
				alert("Please enter your First name.");
				document.myform.sr_first_name.style.border ="1px solid #000000";
				document.myform.sr_first_name.focus();	
				return false;
			}
			
			var kChars = "0123456789!@#$%^&*()+=-[]\\\';,./{}|\":<>?";
			
			for (var e = 0; e < document.myform.sr_first_name.value.length; e++) {
				if (jChars.indexOf(document.myform.sr_first_name.value.charAt(e)) != -1) {
					alert ("Your Name has special characters. \nThese are not allowed.\n Please remove them and try again.");
					document.myform.sr_first_name.style.border ="1px solid #000000"; 
					document.myform.sr_first_name.focus();	
					return false;
				}
			}
			
			if(document.myform.sr_last_name.value=="" || document.myform.sr_last_name.value=="Last name") {
				alert("Please enter your Last name.");
				document.myform.sr_last_name.style.border ="1px solid #000000";
				document.myform.sr_last_name.focus();	
				return false;
			}
			
			for (var k = 0; k < document.myform.sr_last_name.value.length; k++) {
				if (jChars.indexOf(document.myform.sr_last_name.value.charAt(k)) != -1) {
					alert ("Your Name has special characters. \nThese are not allowed.\n Please remove them and try again.");
					document.myform.sr_last_name.style.border ="1px solid #000000"; 
					document.myform.sr_last_name.focus();	
					return false;
				}
			}
			
			if(document.myform.sr_mob_contact_no.value=="" && document.myform.sr_land_contact_no.value=="") {
				alert("Please enter your Contact no.");
				document.myform.sr_mob_contact_no.style.border ="1px solid #000000";
				document.myform.sr_mob_contact_no.focus();	
				return false;
			}
			
			var sm;
			srmob = document.myform.sr_mob_contact_no.value.toString();
			for (sm = 0; sm < srmob.length; sm++){
				var strChar = srmob.charAt(sm);
				if (strValidChars.indexOf(strChar) == -1) 
				{
					alert("Given Contact no (Mob) is not a number");
					document.myform.sr_mob_contact_no.focus();
					document.myform.sr_mob_contact_no.style.border ="1px solid #000000"; 
					return false;
				}
			 }
			 
			var sl;
			srland = document.myform.sr_land_contact_no.value.toString();
			for (sl = 0; sl < srland.length; sl++){
				var strChar = srland.charAt(sl);
				if (strValidChars.indexOf(strChar) == -1) 
				{
					alert("Given Contact no (Mob) is not a number");
					document.myform.sr_land_contact_no.focus();
					document.myform.sr_land_contact_no.style.border ="1px solid #000000"; 
					return false;
				}
			 }
			
			 var rajsr = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
			 if(document.myform['sr_email_id'].value.length<1){
					alert("Please enter your Valid Email Id.");
					document.myform.sr_email_id.style.border ="1px solid #000000";  
					document.myform.sr_email_id.focus();			
					return false;
			 }else if(!rajsr.test(document.myform['sr_email_id'].value)){
					alert("Invalid Email Id");
					document.myform.sr_email_id.style.border ="1px solid #000000"; 
					document.myform.sr_email_id.focus();
					return false;
			 }
			 
			 if(document.myform.sr_relation_person.value=="") {
				alert("Please select your relation with the person .");
				document.myform.sr_relation_person.style.border ="1px solid #000000";
				document.myform.sr_relation_person.focus();	
				return false;
			}
			
			if(document.myform.sr_relation_person.value=="Others(pls specify below)" && document.myform.sr_remarks.value=="") {
				alert("Please enter your specify relation with the person .");
				document.myform.sr_remarks.style.border ="1px solid #000000";
				document.myform.sr_remarks.focus();	
				return false;
			}
	
	
	}
	
	
	//////////////// THIRD REFER VALIDATION   ////////////////////////////
	
	if(document.myform.tr_first_name.value!="" && document.myform.tr_first_name.value!="First name") {
			
			if(document.myform.tr_first_name.value=="" || document.myform.tr_first_name.value=="First name") {
				alert("Please enter your First name.");
				document.myform.tr_first_name.style.border ="1px solid #000000";
				document.myform.tr_first_name.focus();	
				return false;
			}
			
			var lChars = "0123456789!@#$%^&*()+=-[]\\\';,./{}|\":<>?";
			
			for (var m = 0; m < document.myform.tr_first_name.value.length; m++) {
				if (jChars.indexOf(document.myform.tr_first_name.value.charAt(m)) != -1) {
					alert ("Your Name has special characters. \nThese are not allowed.\n Please remove them and try again.");
					document.myform.tr_first_name.style.border ="1px solid #000000"; 
					document.myform.tr_first_name.focus();	
					return false;
				}
			}
			
			if(document.myform.tr_last_name.value=="" || document.myform.tr_last_name.value=="Last name") {
				alert("Please enter your Last name.");
				document.myform.tr_last_name.style.border ="1px solid #000000";
				document.myform.tr_last_name.focus();	
				return false;
			}
			
			for (var n = 0; n < document.myform.tr_last_name.value.length; n++) {
				if (lChars.indexOf(document.myform.tr_last_name.value.charAt(n)) != -1) {
					alert ("Your Name has special characters. \nThese are not allowed.\n Please remove them and try again.");
					document.myform.tr_last_name.style.border ="1px solid #000000"; 
					document.myform.tr_last_name.focus();	
					return false;
				}
			}
			
			if(document.myform.tr_mob_contact_no.value=="" && document.myform.tr_land_contact_no.value=="") {
				alert("Please enter your Contact no.");
				document.myform.tr_mob_contact_no.style.border ="1px solid #000000";
				document.myform.tr_mob_contact_no.focus();	
				return false;
			}
			
			var tm;
			trmob = document.myform.tr_mob_contact_no.value.toString();
			for (tm = 0; tm < trmob.length; tm++){
				var strChar = trmob.charAt(tm);
				if (strValidChars.indexOf(strChar) == -1) 
				{
					alert("Given Contact no (Mob) is not a number");
					document.myform.tr_mob_contact_no.focus();
					document.myform.tr_mob_contact_no.style.border ="1px solid #000000"; 
					return false;
				}
			 }
			 
			var tl;
			trland = document.myform.tr_land_contact_no.value.toString();
			for (tl = 0; tl < trland.length; tl++){
				var strChar = srland.charAt(tl);
				if (strValidChars.indexOf(strChar) == -1) 
				{
					alert("Given Contact no (Mob) is not a number");
					document.myform.tr_land_contact_no.focus();
					document.myform.tr_land_contact_no.style.border ="1px solid #000000"; 
					return false;
				}
			 }
			
			 var rajtr = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
			 if(document.myform['tr_email_id'].value.length<1){
					alert("Please enter your Valid Email Id.");
					document.myform.tr_email_id.style.border ="1px solid #000000";  
					document.myform.tr_email_id.focus();			
					return false;
			 }else if(!rajtr.test(document.myform['tr_email_id'].value)){
					alert("Invalid Email Id");
					document.myform.tr_email_id.style.border ="1px solid #000000"; 
					document.myform.tr_email_id.focus();
					return false;
			 }
			 
			 if(document.myform.tr_relation_person.value=="") {
				alert("Please select your relation with the person .");
				document.myform.tr_relation_person.style.border ="1px solid #000000";
				document.myform.tr_relation_person.focus();	
				return false;
			}
			
			if(document.myform.tr_relation_person.value=="Others(pls specify below)" && document.myform.tr_remarks.value==""){
				alert("Please enter your specify relation with the person .");
				document.myform.tr_remarks.style.border ="1px solid #000000";
				document.myform.tr_remarks.focus();	
				return false;
			}
	
	}
	
	return true;
}

///////// CAPS LOCK VALIDATION /////////////////

function checkCapsLock( e ) {
	var myKeyCode=0;
	var myShiftKey=false;
	var myMsg='Caps Lock is On.\n\nTo prevent entering your password incorrectly,\nyou should press Caps Lock to turn it off.';

	// Internet Explorer 4+
	if ( document.all ) {
		myKeyCode=e.keyCode;
		myShiftKey=e.shiftKey;

	// Netscape 4
	} else if ( document.layers ) {
		myKeyCode=e.which;
		myShiftKey=( myKeyCode == 16 ) ? true : false;

	// Netscape 6
	} else if ( document.getElementById ) {
		myKeyCode=e.which;
		myShiftKey=( myKeyCode == 16 ) ? true : false;

	}

	// Upper case letters are seen without depressing the Shift key, therefore Caps Lock is on
	if ( ( myKeyCode >= 65 && myKeyCode <= 90 ) && !myShiftKey ) {
		alert( myMsg );

	// Lower case letters are seen while depressing the Shift key, therefore Caps Lock is on
	} else if ( ( myKeyCode >= 97 && myKeyCode <= 122 ) && myShiftKey ) {
		alert( myMsg );

	}
}