			//CHECK PEN NUMBER VALIDITY , If SIZE==12

// CHECK FOR ZIPCODE EMPTINESS AND ITS VALIDITY


function zipCode(varObj)
	{
	var theInput = varObj.value
	var theLength = theInput.length
	var goodZip = true
	if (theLength <=5 )
	{
		goodZip = false
	}
	if (theLength>6 )
	{
		goodZip=false
	}
	if (theLength == 6)
	{
		for (var i=0; i<6; i++)
		{
			var theChar = theInput.substring(i,i+1)
			if (theChar >= "0" && theChar <= "9")
				goodZip = true
			else
			{
				goodZip=false
				break;
			}
		}
	}
	if (goodZip == false )
	{
		alert ("\nThis does not appear to be a valid Zip Code\nZipCode Should be in 6 digit.")
		varObj.focus()
	return false;
	}
	return true;
}

			// CHECK FOR e-MAIL EMPTINESS AND ITS VALIDITY


function isEmail(varObj) 
{
	txt=varObj.value
	if (txt == "")
	{
        	alert("\nThe E-Mail field is blank.\nPlease enter your e-mail address.")
                varObj.focus()
                return false
        }
	if ((txt.indexOf(" ")!=-1))
	{
		alert("Sorry, but email address cannot contain spaces!")
		varObj.focus()
		return false
	}
	if ((txt.indexOf("@")==-1))
	{
		alert("Sorry, but email address should contain '@' character!");
		varObj.focus()
		return false
	}
	if (txt.indexOf("@")<2)
	{
		alert("Sorry, but this email address is incorrect!\nPlease verify the text before @' character")
		varObj.focus()
		return false
	}
	var theInput = varObj.value
	var theLength = theInput.length
	if ( (theLength - txt.indexOf(".")) <3 )
	{
		alert("Sorry! but this email address is incorrect! Domain name less than equal to 2 charcters")
		varObj.focus()
		return false
	}
	if ( (theLength - txt.indexOf(".")) >4 )
	{
		alert("Sorry! but this email address is incorrect! Domain name greater than 3 charcters")
		varObj.focus()
		return false
	}
	if (txt.charAt(txt.length-1) == "." )
	{
		alert("Sorry! but this email address is incorrect! dot cannot be the last character")
		varObj.focus()
		return false
	}
	return true
}

//checking Blank field

function CheckBlank(PassedField)
{
	var tmpField=PassedField.value
	if ( tmpField.charAt(0)==" " )
	{
		alert("Please enter value in proper format.");
		PassedField.focus();
		return false;
	} 
	switch (PassedField.name)
	{
		case "name" :
			var msg="Please enter your name"
			break
		case "dob" :
			var msg="Please enter  your date of birth."
			break
		case "nname" :
			var msg="Please enter your nick name."
			break
		case "first" :
			var msg="Please enter first name."
			break
		case "last" :
			var msg="Please enter the last name."
			break
		case "address" :
			var msg="Please enter the address."
			break
			case "products" :
			var msg="Please select product range."
			break
			case "resume" :
			var msg="Please paste your resume."
			break
		case "qdetails" :
			var msg="Please enter the Query Details."
			break
		case "nofquery" :
			var msg="Please select nature of query."
			break
		case "business" :	
			var msg="Please enter the type of business."
			break
		case "hotel" :
			var msg="Please enter the hotel name."
			break
		case "city" :
			var msg="Please enter the city name."
			break
		case "password" :
			var msg="Please enter the password."
			break
		case "prname" :
			var msg="Please enter the product name."
			break
		case "time" :
			var msg="Please enter the time."
			break
		case "occupation" :
			var msg="Please fill your occupation."
			break
		case "user" :
			var msg="Please enter user ID."
			break
		case "price" :
			var msg="Please enter the price."
			break
		case "state" :
			var msg="Please enter the state name."
			break
		case "from" :
		case "to"  :		
			var msg="Please enter date ."
			break
		case "no_room" :
			var msg="Please fill no.of rooms booking required."
			break
		case "username" :
			var msg="Please enter username."
			break
		case "password" :
			var msg="Please enter Password"
			break
		case "passwd" :
			var msg="Please enter Password"
			break		
		case "voucherno" :
			var msg="Please enter VoucherNo."
			break
		case "zipcode" :
			var msg="Please enter the zip code."
			break
		case "cname" :
			var msg="Please enter the Company Name."
			break		
		case "desti" :
			var msg="Please enter the Designation."
			break
		case "cperson" :
			var msg="Please enter the contact person's name."
			break
		case "phone" :
			var msg="Please enter phone number."
			break
		case "mobile" :
			var msg="Please enter mobile number."
			break
			case "SposID" :
			var msg="Please enter your Sponser ID number."
			break
			case "frmno" :
			var msg="Please enter your pin number."
			break
			case "login" :
			var msg="Please enter Login."
			break
		case "fname" :
			var msg="Please enter the fathers name."
			break
		case "jobcode" :
			var msg="Please enter the job code."
			break
		case "minquali" :
		case "academic" :
		case "prof" :
			var msg="Please enter qualification."
			break
		case "post" :
			var msg="Please enter no of posts."
			break
		case "minexp" :
			var msg="Please enter minimum experience required\nIf freshers then write Freshers."
			break
		case "age" :
			var msg="Please Fill age  field."
			break
		case "height" :
		case "ftheight" :
		case "inheight" :
			var msg="Please fill height."
			break
		case "toname" :
			var msg="Please Fill Receiver's name."
			break		
		case "fromname" :
			var msg="Please Fill Senders's name."
			break	
		case "file1" :
			var msg="Photograph is not attached\n Pl. attach a photograph"
			break

		case "month" :
			var msg="Please enter month in Numbers."
			break

		case "year" :
			var msg="Please enter year in Numbers."
			break
		case "fullname" :
			var msg="Please fill your full name."
			break
		case "question" :
			var msg="Please enter a question\nIt will help you to when you forget your password."
			break
		case "answer" :
			var msg="Please fill your question's answer."
			break
		default :
			var msg="Required field missing"
	}

	if ( tmpField == "" )
	{
		alert(msg)
		PassedField.focus()
		return false
	}
	else
		return true
}

		// Checking for "Only char value"


function CheckOnlyChar(varObj)
 {
        var str1 = varObj.value
	switch (varObj.name)
	{
	case "hotel":
		var msg="Hotel name should contain only letters & spaces."
		break
	case "fname":
		var msg="Name should contain only letters & spaces."
		break
	case "city":
		var msg="City name should contain only letters & spaces."
		break
	case "cperson":
		var msg="Contact Person name should contain only letters & spaces."
		break
	case "state":
		var msg="State name should contain only letters & spaces."
		break
	} 

        for (var i = 0; i < str1.length; i++)
	 {
            var ch = str1.substring(i, i + 1);
            if (((ch < "a" || "z" < ch) && (ch < "A" || "Z" < ch)) && ch != '.' && ch != ' ') {
                   alert(msg);
                   varObj.focus();
                   return false;
             }
        }
   return true;
}

		//Checking for "only number value"

function CheckOnlyNum(varObj)
{ 
 	var str1=varObj.value
	switch (varObj.name)
	{
	case "voucherno" :
		str1= str1.substring(5,(str1.length))
		var msg="Invalid Voucher no.\nPlease enter valid voucher no." 
		break
	case "no_room":
		var msg="Hotel room should be in numbers."
		break
	case "age":
		var msg="Age should be in numbers."
		break
	case "phone":
		var msg="Phone number should be in digits only."
		break
	case "mobile":
		var msg="Mobile number should be in digits only."
		break
	case "SposID":
		var msg="Sponser number should be in digits only."
		break
	case "frmno":
		var msg="Pin number should be in digits only."
		break
	case "month":
		var msg="month should be in numbers."
		break
	case "user" :
		var msg="User ID should be in digits only."
		break
	case "year":
		var msg="year should be in numbers."
		break
	default :
		var msg="Fill here digits only."
	
	}
	for (var i = 0; i < str1.length; i++)
	 {
            var ch = str1.substring(i,i + 1);
            if (!(0 <= ch || ch <= 9 ))
            {
                  alert(msg);
                   varObj.focus();
                   return false;
            }
            if (ch==" ")
            {
                  alert(msg);
                   varObj.focus();
                   return false;
            }

         }
   return true;	 
}

		

// Checking if an item is selected from a combo box


function CheckComboBoxValue(PassedField)	
{
	
	switch (PassedField.name)
	{
	case "education" :
		var msg= "Please select your education level."
		break
	case "job" :
		var msg= "Please select your job status."
		break	
	}
	if ( PassedField.value > 0 )
		return true
	else
	{	
		alert(msg)
		PassedField.focus()
		return false
	}
}

	
function JobSelected(Value)
{
	if (Value==3)
	{
		document.form1.comp.value="Not Applicable";
		document.form1.post.value="Not Applicable";
		document.form1.inc.value="Not Applicable";
	}
	else
	{
		document.form1.comp.value="";
		document.form1.post.value="";
		document.form1.inc.value= 0;
	}
	return true;
}
