function getBirthChar(Str)
{
	var month;
	switch(Str)
	{
		case '1':
		month ="Jan";
		break;
		case '2':
		month = "Feb";
		break;
		case '3':
		month ="Mar";
		break;
		case '4':
		month ="Apr";
		break;
		case '5':
		month ="May";
		break;
		case '6':
		month ="Jun";
		break;
		case '7':
		month ="Jul";
		break;
		case '8':
		month ="Aug";
		break;
		case '9':
		month ="Sep";
		break;
		case '10':
		month ="Oct";
		break;
		case '11':
		month ="Nov";
		break;
		case '12':
		month ="Dec";
		break;
	}
	 return month;
}

function isPinProper(str) {
	
	for (var i = 1; i < str.length; i++) 
	{
		var ch = str.substring(i, i + 1);
		if ( ((ch < "a" || "z" < ch) && (ch < "A" || "Z" < ch)) && (ch < "0" || "9" < ch)) 
		{
			//alert("\nThe Pin Code Name field  accepts letters & numbers.\n\nPlease re-enter your Pin Code.");

			//document.RegistrationForm.username.focus();
			return false;
		}
	}
	return true;
}//end of function 

// Birth Date validation function
function isDate()
{
	var yy,mm,dd;
	var im,id,iy;
	var present_date = new Date();
	yy = 1900 + present_date.getYear();
	if (yy > 3000)
	{
		yy = yy - 1900;
	}
	mm = present_date.getMonth();
	dd = present_date.getDate();
	im = document.forms[0].month.selectedIndex;
	id = document.forms[0].day.selectedIndex;
	iy = document.forms[0].year.selectedIndex;
	var entered_month = document.forms[0].month.options[im].value;
	var invalid_month = document.forms[0].month.options[im].value - 1; 
	var entered_day = document.forms[0].day.options[id].value; 
	var entered_year = document.forms[0].year.options[iy].value; 
	if ( (entered_day == 0) || (entered_month == 0) || (entered_year == 0) )
	{
		alert("Please enter your birthday");
		document.forms[0].month.focus();
		return false;
	}
	if ( is_greater_date(entered_year,entered_month,entered_day,yy,mm,dd) && is_valid_day(invalid_month,entered_day,entered_year) )
	{
		return true; 
	}
	return false;
}

//Greater day function
function is_greater_date(entered_year,entered_month,entered_day,yy,mm,dd)
{
	if (entered_year > yy)
	{
		alert("The birthday field is entered incorrectly. The year entered exceeds the current year.");
		return false;
	}
	if (entered_year == yy)
	{
		if (entered_month > mm)
		{
			alert("The birthday field is entered incorrectly.");
			return false;
		}
		if (entered_month == mm)
		{
			if (entered_day > dd)
			{
				alert("The birthday field is entered incorrectly.");
				return false;
			}
		}
	}
	return true;
}

// Valid day function
function is_valid_day(entered_month,entered_day,entered_year)
{
	if ((entered_year % 4) == 0) 
	{ 
		var days_in_month = "312931303130313130313031";
 	}
 	else 
	{ 
		var days_in_month = "312831303130313130313031";
 	} 
	var months = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
	if (entered_month != -1)
	{
		if (entered_day > days_in_month.substring(2*entered_month,2*entered_month+2))
		{
			alert ("The birthday field is entered wrongly (the day field value exceeds the number of days for the month entered).");
			return false;
		}
	}
	return true;
}

/////end of code added by vinod

function getAge(strDate)
{
	var dt   = document.RegistrationForm.dob.value;
	var dy  = dt.substring(0,2);
	var mon  = dt.substring(3,6);
	var yy   =  dt.substring(7,11);
	var tm   = mon+dy+","+yy;
	var strDOBDate = strDate+"12:00:00 GMT-0500";
	birthTime = new Date(tm);
	todaysTime = new Date(strDate);
	todaysYear = todaysTime.getYear();
	if (todaysYear < 2002) todaysYear += 1900;
	todaysMonth = todaysTime.getMonth();
	todaysDate = todaysTime.getDate();
	todaysHour = todaysTime.getHours();
	todaysMinute = todaysTime.getMinutes();
	todaysSecond = todaysTime.getSeconds();
	birthYear = birthTime.getYear();
	if (birthYear < 2002) birthYear += 1900;
	birthMonth = birthTime.getMonth();
	birthDate = birthTime.getDate();
	birthHour = birthTime.getHours();
	birthMinute = birthTime.getMinutes();
	birthSecond = birthTime.getSeconds();
	var monarr = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
	// check for leap year
	if (((todaysYear % 4 == 0) && (todaysYear % 100 != 0)) || (todaysYear % 400 == 0)) monarr[1] = "29";
	countMonth = monarr[todaysTime.getMonth()];
	
	if (todaysMinute > birthMinute)
	{
		diffMinute = todaysMinute - birthMinute;
		calcHour = 0;
	}
	else
	{
		diffMinute = todaysMinute + 60 - birthMinute;
		calcHour = -1;
	}
	if (todaysHour > birthHour)
	{
		diffHour = todaysHour - birthHour + calcHour;
		calcDate = 0;
	}
	else
	{
		diffHour = todaysHour + 24 - birthHour  + calcHour;
		calcDate = -1;
	}
	if (todaysDate > birthDate)
	{
		diffDate = todaysDate - birthDate + calcDate;
		calcMonth = 0;
	}
	else
	{
		diffDate = todaysDate + countMonth - birthDate  + calcDate;
		calcMonth = -1;
	}
	if (todaysMonth > birthMonth)
	{
		diffMonth = todaysMonth - birthMonth + calcMonth;
		calcYear = 0;
	}
	else
	{
		diffMonth = todaysMonth + 12 - birthMonth + calcMonth;
		calcYear = -1;
	}
	diffYear = todaysYear - birthYear + calcYear;
	if (diffMinute == 60) { diffMinute = 0; diffHour ++; }
	if (diffHour == 24) { diffHour = 0; diffDate ++; }
	if (diffDate == countMonth) { diffDate = 0; diffMonth ++; }
	if (diffMonth == 12) { diffMonth = 0; diffYear ++; }
	return diffYear;

}
//CHANDRA SEKHAR/30-JUL-2004/MOD BEGINS
// SHARATH // Struts_Passenger_05 // 24-AUG-2004 / MOD BEGINS
function getAge1(strDate,screen,day,month,year)
{
//	alert(document.PassengerForm.detailScreen.value);
	if(screen=="Update")
	{
		var dy  = day;
		var mon  = getBirthChar(month);
		var yy   = year;
	}
	else
	{	
		var dy  = document.PassengersForm["passenger.day"].value;
		var mon  = getBirthChar(document.PassengersForm["passenger.month"].value);
		var yy   =  document.PassengersForm["passenger.year"].value;
	}
// SHARATH // Struts_Passenger_05 // 24-AUG-2004 / MOD ENDS
	var tm   = mon+dy+","+yy;
	var strDOBDate = strDate+" 12:00:00 GMT-0500";
	birthTime = new Date(tm);
	todaysTime = new Date(strDate);
	todaysYear = todaysTime.getYear();
	if (todaysYear < 2000) todaysYear += 1900;
	todaysMonth = todaysTime.getMonth();
	todaysDate = todaysTime.getDate();
	todaysHour = todaysTime.getHours();
	todaysMinute = todaysTime.getMinutes();
	todaysSecond = todaysTime.getSeconds();
	birthYear = birthTime.getYear();
	if (birthYear < 2000) birthYear += 1900;
	birthMonth = birthTime.getMonth();
	birthDate = birthTime.getDate();
	birthHour = birthTime.getHours();
	birthMinute = birthTime.getMinutes();
	birthSecond = birthTime.getSeconds();
	var monarr = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
	// check for leap year
	if (((todaysYear % 4 == 0) && (todaysYear % 100 != 0)) || (todaysYear % 400 == 0)) monarr[1] = "29";
	countMonth = monarr[todaysTime.getMonth()];
	
	if (todaysMinute > birthMinute)
	{
		diffMinute = todaysMinute - birthMinute;
		calcHour = 0;
	}
	else
	{
		diffMinute = todaysMinute + 60 - birthMinute;
		calcHour = -1;
	}
	if (todaysHour > birthHour)
	{
		diffHour = todaysHour - birthHour + calcHour;
		calcDate = 0;
	}
	else
	{
		diffHour = todaysHour + 24 - birthHour  + calcHour;
		calcDate = -1;
	}
	if (todaysDate > birthDate)
	{
		diffDate = todaysDate - birthDate + calcDate;
		calcMonth = 0;
	}
	else
	{
		diffDate = todaysDate + countMonth - birthDate  + calcDate;
		calcMonth = -1;
	}
	if (todaysMonth > birthMonth)
	{
		diffMonth = todaysMonth - birthMonth + calcMonth;
		calcYear = 0;
	}
	else
	{
		diffMonth = todaysMonth + 12 - birthMonth + calcMonth;
		calcYear = -1;
	}
	diffYear = todaysYear - birthYear + calcYear;
	if (diffMinute == 60) { diffMinute = 0; diffHour ++; }
	if (diffHour == 24) { diffHour = 0; diffDate ++; }
	if (diffDate == countMonth) { diffDate = 0; diffMonth ++; }
	if (diffMonth == 12) { diffMonth = 0; diffYear ++; }
	return diffYear;
	

}

// Birth Date validation function
function isDate1()
{
	var yy,mm,dd;
	var im,id,iy;
	var present_date = new Date();
	yy = 1900 + present_date.getYear();
	if (yy > 3000)
	{
		yy = yy - 1900;
	}
	mm = present_date.getMonth();
	dd = present_date.getDate();
	im = document.PassengersForm["passenger.month"].selectedIndex;
	id = document.PassengersForm["passenger.day"].selectedIndex;
	iy = document.PassengersForm["passenger.year"].selectedIndex;
	var entered_month = document.PassengersForm["passenger.month"].options[im].value;
	var invalid_month = document.PassengersForm["passenger.month"].options[im].value - 1; 
	var entered_day = document.PassengersForm["passenger.day"].options[id].value; 
	var entered_year = document.PassengersForm["passenger.year"].options[iy].value; 

	if ( (entered_day == 0) || (entered_month == 0) || (entered_year == 0) )
	{
		alert("Please enter your birthday");
		document.PassengersForm["passenger.month"].focus();
		return false;
	}
	if ( is_greater_date(entered_year,entered_month,entered_day,yy,mm,dd) && is_valid_day(invalid_month,entered_day,entered_year) )
	{
		return true; 
	}
	return false;
}

//CHANDRA SEKHAR/30-JUL-2004/MOD ENDS

function isNotAlphabets(str)
{
	for (var i = 0; i < str.length; i++)
	{
		var ch = str.substring(i, i + 1);
		if((ch < "a" || "z" < ch) && (ch < "A" || "Z" < ch)) 
		{
			return true;
		}
	}
return false;
}//end of isNotAlphabets

function isAlphaSpace(str)
{
	if(str.substring(0,1)==" ")
		return true;
	for (var i = 0; i < str.length; i++)
	{
		var ch = str.substring(i, i + 1);
		if((ch < "a" || "z" < ch) && (ch < "A" || "Z" < ch)&& (ch !=" ")) 
		{
		  
			return true;
		}
	}
	return false;
}//end of isNotAlphabets
function isName(str) 
{
	if (str == "")
	{
		alert("\nThe Login Name field is blank .\n\nPlease re-enter your Login Name.")
		document.RegistrationForm.userName.focus();
		return false;
	}
	
	if((str.substring(0,1)<"a" || str.substring(0,1)>"z") &&  (str.substring(0,1)<"A" || str.substring(0,1)>"Z"))
	{
		alert("The Login Name should begin with an alphabetic character.");
		document.RegistrationForm.userName.focus();
		return false;
	}
	for (var i = 1; i < str.length; i++) 
	{
		var ch = str.substring(i, i + 1);
		if ( ((ch < "a" || "z" < ch) && (ch < "A" || "Z" < ch)) && (ch < "0" || "9" < ch) && (ch != '_')) 
		{
			alert("\nThe Login Name field  accepts letters,numbers & underscore.\n\nPlease re-enter your Login Name.");

			document.RegistrationForm.userName.focus();
			return false;
		}
	}
	return true;
}//end of isname

// Password Validator
function isPass(str,str2) 
{
	if ((str == "") || (str.length < 4)) 
	{
		alert("\nThe Password field is either empty or less than 4 chars.\n\nPlease re-enter your Password.")
		document.RegistrationForm.password.focus();
		return false;
	}
	if (str != str2)
	{
		alert("Passwords typed do not match, please re-enter your passwords.\n\n");
		document.RegistrationForm.confirmpassword.focus();
		return false;
	}
	return true;
} //end of ispass*/
  // date of birth validation;

// Month validation;
function getMonthNum(Str)
{
	var month;
	switch(Str)
	{
		case "Jan":
		month ="1";
		break;
		case "Feb":
		month ="2";
		break;
		case "Mar":
		month ="3";
		break;
		case "Apr":
		month ="4";
		break;
		case "May":
		month ="5";
		break;
		case "Jun":
		month ="6";
		break;
		case "Jul":
		month ="7";
		break;
		case "Aug":
		month ="8";
		break;
		case "Sep":
		month ="9";
		break;
		case "Oct":
		month ="10";
		break;
		case "Nov":
		month ="11";
		break;
		case "Dec":
		month ="12";
		break;
	}
	 return month;
}
function stringTrim(s)
{
   return stringRightTrim(stringLeftTrim(s));
}
function stringLeftTrim(s)
{
   return s.replace(/^ +/, "");
}
function stringRightTrim(s)
{
   return s.replace(/ +$/, "");
}


function checkVal(strDate)
{ 
	var username=stringTrim(document.RegistrationForm.userName.value);
	var password=stringTrim(document.RegistrationForm.password.value);
	var confirmpassword=stringTrim(document.RegistrationForm.confirmpassword.value);
	var question=document.RegistrationForm.question.selectedIndex;
	var answer=stringTrim(document.RegistrationForm.answer.value);
	var fnme=stringTrim(document.RegistrationForm.firstName.value);
	var lname=stringTrim(document.RegistrationForm.lastName.value);
	 var im = document.forms[0].month.selectedIndex;
	var id = document.forms[0].day.selectedIndex;
	var iy = document.forms[0].year.selectedIndex;
	var occupation=document.RegistrationForm.occupation.selectedIndex;
	var rescity=document.RegistrationForm.resCity.selectedIndex; 
	var otrResCty =stringTrim(document.RegistrationForm.resOtherCity.value);
	var resstate =document.RegistrationForm.resState.selectedIndex;
	var email=stringTrim(document.RegistrationForm.email.value);
	var resaddress=stringTrim(document.RegistrationForm.resAddress1.value);
	var otrResState =stringTrim(document.RegistrationForm.resOtherState.value);
	var respin=stringTrim(document.RegistrationForm.resPinCode.value);
	var rescountry =document.RegistrationForm.resCountry.selectedIndex;
		var resphone=stringTrim(document.RegistrationForm.resPhone.value);
		//	var securityCode=stringTrim(document.RegistrationForm.securityCode.value);
			var entered_month = getBirthChar(document.forms[0].month.options[im].value);
	var entered_day = document.forms[0].day.options[id].value; 
	var entered_year = document.forms[0].year.options[iy].value; 
	var birth = entered_day+"-"+entered_month+"-"+entered_year;
	var offaddress=stringTrim(document.RegistrationForm.offAddress1.value);
	var offpin=stringTrim(document.RegistrationForm.offPinCode.value);
	var offcountry =document.RegistrationForm.offCountry.selectedIndex;
	var offPhone=stringTrim(document.RegistrationForm.offPhone.value);
	var nationality=document.RegistrationForm.nationality.selectedIndex;
    var offcity=document.RegistrationForm.offCity.selectedIndex; 
      var otrOffCty =stringTrim(document.RegistrationForm.offOtherCity.value);
	 var offstate =stringTrim(document.RegistrationForm.offOtherState.value);
	var otrOffState =stringTrim(document.RegistrationForm.offState.value);
	var offfax=stringTrim(document.RegistrationForm.offFax.value);
	var gender=document.RegistrationForm.gender.selectedIndex;
	var maritalStatus=document.RegistrationForm.maritalStatus.selectedIndex;
	
	document.RegistrationForm.dob.value = birth;
	
	var dob=stringTrim(document.RegistrationForm.dob.value);
	var speOfferFlag = 0;
	var newsLetterFlag = 0;

	/*for(var i=0;i<document.RegistrationForm.speRadio.length;i++)
	 {
		if(document.RegistrationForm.speRadio[i].checked == true)
		 {
			speOfferFlag=0;
		 }
	 }//end of for
	for(var i=0;i<document.RegistrationForm.newsRadio.length;i++)
	{
	    if(document.RegistrationForm.newsRadio[i].checked == true)
		{
			newsLetterFlag=0;
		}
	}
	for(var i=0;i<document.RegistrationForm.telRadio.length;i++)
	{
	    if(document.RegistrationForm.newsRadio[i].checked == true)
		{
			newsLetterFlag=0;
		}
	}*/
	
   if(username.length==0)
	{
	   alert("User Name field should be filled");
        document.RegistrationForm.userName.focus();
		return false;
	}  
    if(password.length==0)
	{
	   alert("Password field should be filled");
       document.RegistrationForm.password.focus();
	   return false;
	}  
	if(confirmpassword.length==0)
	{
	   alert("Confirm password field should be filled");
	   document.RegistrationForm.confirmpassword.focus();
	   return false;
	}  

   if(question==0)
		{
			document.RegistrationForm.question.focus();
			alert("The Security Question field should be filled");
			return false;
		}
   	if(answer.length==0)
		{
			document.RegistrationForm.answer .focus();
				alert("The Answer field should be filled");
			return false;
		}

   if(fnme.length==0)
		{
			document.RegistrationForm.firstName.focus();
			alert("The First name field should be filled ");
			return false;
		}

  if(lname.length==0)
   {
	 document.RegistrationForm.lastName.focus();
	 alert("The Last name field should be filled ");
	 return false;
   }	
    if(gender==0)
   {
	 document.RegistrationForm.gender.focus();
	  alert("The Gender field should be filled ");
	 return false;
   }	
  /*  if(maritalStatus==0)
   {
	 document.RegistrationForm.maritalStatus.focus();
	  alert("The Marital Status field should be filled ");
	 return false;
   }	*/

 

  	if(id==0 || im==0 || iy==0)
		{  
			if(id==0)
			{
			document.RegistrationForm.day.focus();
			alert("The Day field should be filled");
			}
			else if(im==0)
			{
			document.RegistrationForm.month.focus();
			alert("The Month field should be filled");
			}
			else
			{
			document.RegistrationForm.year.focus();
			alert("The Year field should be filled");
			}
			return false;
			
		}
 
      if(occupation==0)
		{
			document.RegistrationForm.occupation.focus();
			alert("The Occupation field should be filled");
			return false;
		}
		if(email.length==0)
		{
			document.RegistrationForm.email.focus();
			alert("The E-Mail field should be filled");
			return false;
		}
		if(nationality == 0)
	    {
		    document.RegistrationForm.nationality.focus();
			alert("The nationality field should be filled");
			return false;
		}
		if(resaddress.length==0)
		{
			document.RegistrationForm.resAddress1.focus();
			alert("The Address field should be filled");
			return false;
		}	
	
		if(rescity==0 && otrResCty.length==0)
		{
			document.RegistrationForm.resCity.focus();
			alert("The City field should be filled");
			return false;
		}
		if(resstate==0 && otrResState.length==0)
		{
			document.RegistrationForm.resState.focus();
			alert("The State field should be filled");
			return false;
		}
		
		if(respin.length==0)
		{
			document.RegistrationForm.resPinCode.focus();
			alert("The Pincode field should be filled");
			return false;
		}
	
		if(rescountry==0)
		{
			document.RegistrationForm.resCountry.focus();
			alert("The Country field should be filled");
			return false;
		}
        	if(resphone.length==0)
		{
			document.RegistrationForm.resPhone.focus();
			alert("The Phone field should be filled");
			return false;
		}

      /*	if(securityCode.length==0)
		{
			document.RegistrationForm.securityCode.focus();
			alert("The Security code field should be filled");
			return false;
		}*/
        if(offaddress.length==0)
		{
			document.RegistrationForm.offAddress1.focus();
			alert("The OfficeAddress field should be filled");
			return false;
		}
    	if(offcity==0 && otrOffCty.length==0)
		{		
			document.RegistrationForm.offCity.focus();
				alert("The City field should be filled");
			return false;
		}

       if(offstate==0 && otrOffState.length==0)
		{			
			document.RegistrationForm.offState.focus();
				alert("The State field should be filled");
			return false;
		}
		if(offpin.length==0)
		{
			document.RegistrationForm.offPinCode.focus();
			alert("The Pincode field should be filled");
			return false;
		}
	
		if(offcountry==0)
		{
			document.RegistrationForm.offCountry.focus();
			alert("The Country field should be filled");
			return false;
		}
		if(offPhone.length==0)
		{
			document.RegistrationForm.offPhone.focus();
			alert("The Phone field should be filled");
			return false;
		}
		
		
    
	if(!isLetter(username.charAt(0)))
	{
		alert("The Login Name Should begin with an Alphabetic Character");
		document.RegistrationForm.userName.focus();
		return false;
	}
	if(rescity !=0 && otrResCty.length !=0)
	{
		alert("Enter Value Either one of the fields");
		document.RegistrationForm.resCity.focus();
		return false;
	}
	
	if(resstate!=0 && otrResState.length!=0)
	{
		alert("Enter Value Either one of the fields");
		document.RegistrationForm.resState.focus();
		return false;
	}
	
	if(offcity !=0 && otrOffCty.length!=0)
	{
		alert("Enter Value Either one of the fields");
		document.RegistrationForm.offCity.focus();
		return false;
	}	
	if(offstate !=0 && otrOffState.length !=0)
	{
		alert("Enter Value Either one of the fields");
		document.RegistrationForm.offState.focus();
		return false;
	}
	if(otrResCty.length != 0)
	{
		if(isAlphaSpace(otrResCty))
		{
			alert("Special Characters are not allowed");
			document.RegistrationForm.resOtherCity.focus();
			return false;
		}
	}
	if(otrResState.length != 0)
	{
		if(isAlphaSpace(otrResState))
		{
			alert("Special Characters are not allowed");
			document.RegistrationForm.resOtherState.focus();
			return false;
		}
	}
	if(otrOffCty.length != 0)
	{
		if(isAlphaSpace(otrOffCty))
		{
			alert("Special Characters are not allowed");
			document.RegistrationForm.offOtherCity.focus();
			return false;
		}
	}
	if(otrOffState.length != 0)
	{
		if(isAlphaSpace(otrOffState))
		{
			alert("Special Characters are not allowed");
			document.RegistrationForm.offOtherState.focus();
			return false;
		}
	}
	if(resaddress.length != 0)
	{  
		var resaddone=stringTrim(document.RegistrationForm.resAddress2.value);
		var resaddtwo=stringTrim(document.RegistrationForm.resAddress3.value);
		var offaddone=stringTrim(document.RegistrationForm.offAddress2.value);
		var offaddtwo=stringTrim(document.RegistrationForm.offAddress3.value);

		if( resaddress.indexOf("~") != -1 || resaddress.indexOf("\"") != -1 ||resaddress.indexOf("'") != -1)
		{
			alert("special characters ~ \" ' are not valied in address field");
			document.RegistrationForm.resAddress1.focus();
			return false;
		}
		if( resaddone.indexOf("~") != -1 || resaddone.indexOf("\"") != -1 ||resaddone.indexOf("'")!= -1)
		{
			alert("special characters ~ \" ' are not valied in address field");
			document.RegistrationForm.resAddress2.focus();
			return false;
		}
		if( resaddtwo.indexOf("~") != -1 || resaddtwo.indexOf("\"") != -1 ||resaddtwo.indexOf("'")!= -1)
		{
			alert("special characters ~ \" ' are not valied in address field");
			document.RegistrationForm.resAddress3.focus();
			return false;
		}
		if(offaddress.indexOf("~") != -1 || offaddress.indexOf("\"") != -1 ||offaddress.indexOf("'") != -1 )
		{
			alert("special characters ~ \" ' are not valied in address field");
			document.RegistrationForm.offAddress1.focus();
			return false;
		}
		if(offaddone.indexOf("~") != -1 || offaddone.indexOf("\"") != -1 ||offaddone.indexOf("'")!= -1)
		{
			alert("special characters ~ \" ' are not valied in address field");
			document.RegistrationForm.offAddress2.focus();
			return false;
		}
		if(offaddtwo.indexOf("~") != -1 || offaddtwo.indexOf("\"") != -1 ||offaddtwo.indexOf("'")!= -1)
		{
			alert("special characters ~ \" ' are not valied in address field");
			document.RegistrationForm.offAddress3.focus();
			return false;	  
		}
	}

	var checkAplphaspace="";
	if(isAlphaSpace(fnme))
	checkAplphaspace=checkAplphaspace+"\n   First Name";
	/*if(isAlphaSpace(mname))
	checkAplphaspace=checkAplphaspace+"\n   Middle Name";
	if(isAlphaSpace(lname))
	checkAplphaspace=checkAplphaspace+"\n   Last Name";*/

	if(checkAplphaspace !="")
	{
		alert("The following field contains invalid characters .\n Please re-enter "+checkAplphaspace);
		if(isAlphaSpace(fnme))
		{
			document.RegistrationForm.firstName.focus();
			return false;
		}
		/*if(isAlphaSpace(mname))
		{
			document.RegistrationForm.middleName.focus();
			return false;
		}
		if(isAlphaSpace(lname))
		{
			document.RegistrationForm.lastName.focus();
			return false;
		}*/
	}
	if (isDate() == false)
	{
		return false;
	}

	var beginDateStr = stringTrim(document.RegistrationForm.dob.value);
	if(beginDateStr != "" )
	{	
		var beginDay = beginDateStr.substring(0,2);
		var beginMonth = getMonthNum(beginDateStr.substring(3,6));
		var beginYear = beginDateStr.substring(7,11);
		var currDateStr= new Date(strDate);
		var	todaysYear = strDate.substring(7,11);
		var todaysMonth =getMonthNum(strDate.substring(3,6));
		var todaysDate =strDate.substring(0,2);
		var dateFlag = diffDates(todaysDate, todaysMonth, todaysYear,beginDay, beginMonth, beginYear);

		if(dateFlag >= 0)
		{
			alert("Date of Birth should be Less than the currentdate");
			document.forms[0].month.focus();
			return false;
		}
	}

	if(!validemail(document.RegistrationForm.email.value))
	{
		alert(" Email ID Should contian \"@\" & \".\" And \n end with a three letter domain or 2 letter country");
		document.RegistrationForm.email.focus();
		return false;
	}
	 //StrutsTic28/CHALAMIAH/20-Feb-2004/MOD BEGINS 
	
	if(!isLetter(email.charAt(0)))
	{
		alert("Email ID must start with a character");
		document.RegistrationForm.email.focus();
		return false;
	}
	 //StrutsTic28/CHALAMIAH/20-Feb-2004/MOD BEGINS 

	var numeric1="";	
	
	if(!isPinProper(document.RegistrationForm.resPinCode.value))
	{
		alert("The Pin Code Name field  accepts letters & numbers.\n\nPlease re-enter your Pin Code.");
		document.RegistrationForm.resPinCode.focus();
		return false;
	}
	//renu

//		if((document.RegistrationForm.resPinCode.value.length !=6) && (document.RegistrationForm.resPinCode.value.length !=5))
//		{
//			alert(document.RegistrationForm.resPinCode.value.length);
//			numeric1 =numeric1+"\n Res Pin should be 5 or 6 digits Alphabets/Numbers";
//		}
	if((rescity !=0 && resstate!=0)||(otrResCty.length !=0 && otrResState.length !=0 && rescountry==1))
	
	{ 
		if((document.RegistrationForm.resPinCode.value.length <5) || (document.RegistrationForm.resPinCode.value.length >6))
        {
		alert("\n Residence Pin should be  5 or 6 digits Alphabets/Numbers");
      	document.RegistrationForm.resPinCode.focus();
		return false;
		}
	}
	else
	{
		 
	    if((document.RegistrationForm.resPinCode.value.length <4) || (document.RegistrationForm.resPinCode.value.length >6))
        {
		alert("\n Residence Pin should be 4 or 5 or 6 digits Alphabets/Numbers");
      	document.RegistrationForm.resPinCode.focus();
		return false;
		}

	}
	
	if(!isPinProper(document.RegistrationForm.offPinCode.value))
	{
		alert("The Pin Code field  accepts letters & numbers.\n\nPlease re-enter your Pin Code.");
		document.RegistrationForm.offPinCode.focus();
		return false;
	}
	//kani
//		if((document.RegistrationForm.offPinCode.value.length !=6) && (document.RegistrationForm.offPinCode.value.length !=5))
//			numeric1=numeric1+"\n Off Pin should be 5 or 6 digits Alphabets/Numbers";		
	
	if(offcity !=0 && offstate!=0)
	{ 
		if((document.RegistrationForm.offPinCode.value.length <5) || (document.RegistrationForm.offPinCode.value.length >6))
        {
		alert("\n Office Pin should be 5 or 6 digits Alphabets/Numbers");
      	document.RegistrationForm.offPinCode.focus();
		return false;
		}
	}
	else
	{
		
	if((document.RegistrationForm.offPinCode.value.length <4) || (document.RegistrationForm.offPinCode.value.length >6))
        {
		alert("\n Office Pin should be 4 or  5 or 6 digits Alphabets/Numbers");
      	document.RegistrationForm.offPinCode.focus();
		return false;
		}
	}

	//Ajay Added Alert
if(isNaN(document.RegistrationForm.mobile.value))
	{
		numeric1=numeric1+"\n Mobile no max of 10 digits number";
	}
	else
	{
		if(document.RegistrationForm.mobile.value.length >10)
			numeric1=numeric1+"\n Mobile no max of 10 digits number";
	}

	if((document.RegistrationForm.mobile.value.length <10)&& (document.RegistrationForm.mobile.value.length >0)&& (document.RegistrationForm.mobile.value.length !=null) )
        {
		alert("\n Mobile no should be  10 digits or Null");
      	document.RegistrationForm.mobile.focus();
		return false;
		}
	//Ajay Added Alert
	
	if(isNaN(document.RegistrationForm.resPhone.value))
	{
		numeric1=numeric1+"\n Res Phone max of 12 digits number";
	}
	else
	{
		if(document.RegistrationForm.resPhone.value.length >12)
			numeric1=numeric1+"\n Res Phone max of 12 digits number";
	}
	if(isNaN(document.RegistrationForm.offPhone.value))
	{
		numeric1=numeric1+"\n Off Phone max of 12 digits number";
	}
	else
	{
		if(document.RegistrationForm.offPhone.value.length >12)
		numeric1=numeric1+"\n Off Phone max of 12 digits number";
	}
	if(isNaN(document.RegistrationForm.offPhoneExt.value))
	{
		numeric1=numeric1+"\n Off Phone Extension ";
	}
	if(isNaN(document.RegistrationForm.offFax.value))
	{
		numeric1=numeric1+"\n Fax max of 8 digits number";
	}
	else
	{
		if(document.RegistrationForm.offFax.value.length >8)
		numeric1=numeric1+"\n Fax max of 8 digits number";
	}
	
	if(numeric1 != "")
	{
	//StrutsTic30/CHALAMIAH/23-Feb-2004/MOD BEGINS 
		
		alert("the following Fields Should be Numeric \n"+numeric1);
		return false;

	
	//StrutsTic30/CHALAMIAH/23-Feb-2004/MOD ENDS 

	//Ajay Added Alert
if(isNaN(document.RegistrationForm.mobile.value))
		{
			document.RegistrationForm.mobile.focus();
			return false;
		}
	//Ajay Added Alert
		if(isNaN(document.RegistrationForm.resPhone.value))
		{
			document.RegistrationForm.resPhone.focus();
			return false;
		}
		else
		{
			if(document.RegistrationForm.resPhone.value.length >10)
			{
				 document.RegistrationForm.resPhone.focus();
				 return false;
			}
		}
		if(isNaN(document.RegistrationForm.offPhone.value))
		{
			document.RegistrationForm.offPhone.focus();
			return false;
		}
		else
		{
			if(document.RegistrationForm.offPhone.value.length >10)
			{
				document.RegistrationForm.offPhone.focus();
				return false;
			}
		}
		if(isNaN(document.RegistrationForm.offPhoneExt.value))
		{
			document.RegistrationForm.offPhoneExt.focus();
			return false;
		}
		if(isNaN(document.RegistrationForm.offFax.value))
		{
			document.RegistrationForm.offFax.focus();
			return false;
		}
		else
		{
			if(document.RegistrationForm.offFax.value.length >8)
			{
				document.RegistrationForm.offFax.focus();
				return false;
			}
		}
	
	}

	//SUNIL/29-JUL-2004/Mobile Booking Assignment/ADD BEGINS
	if(document.RegistrationForm.mobileBookingOptionCheck.checked == true)
		{

		var mobileNumberTrim=stringTrim(document.RegistrationForm.mobileNumber.value);

		//if(document.RegistrationForm.mobileOperator.value == "" || document.RegistrationForm.mobileNumber.value == "" || document.RegistrationForm.prefferedPG.value==""){
			if(document.RegistrationForm.mobileOperator.value == "" || document.RegistrationForm.mobileNumber.value == "")
		{
			alert("Enter All Mandatory Fields");

			if(document.RegistrationForm.mobileOperator.value == "")
				{
				alert("Please Select Mobile Operator");
				return false;
			}//end of if
			
			if(document.RegistrationForm.mobileNumber.value == "")
				{
				alert("Please Input Mobile Number");
				return false;
			}//end of if

			/*if(document.RegistrationForm.prefferedPG.value==""){
				alert("Please Select Preffered Payment Option");
				return false;
			}//end of if*/
		}//end of if
		
		if(isNaN(document.RegistrationForm.mobileNumber.value) || document.RegistrationForm.mobileNumber.value.length != 12)
			{
			alert("Mobile Number Should Be Numeric and 12 Digits long\nUse formatt:919845012345, First Two Digits For Country Code");
			return false;
		}//end of if
		
	}//end of if
	//SUNIL/29-JUL-2004/Mobile Booking Assignment/ADD ENDS


	if(!isName(stringTrim(document.RegistrationForm.userName.value)))
	{
		return false;
	}
 //StrutsTic29/CHALAMIAH/20-Feb-2004/MOD BEGINS 
	
 //StrutsTic29/CHALAMIAH/20-Feb-2004/MOD ENDS 

	if(!isPass(stringTrim(document.RegistrationForm.password.value),
	stringTrim(document.RegistrationForm.confirmpassword.value)))
	{
		return false;
	}
	if(document.RegistrationForm.shipAddressPrefer[0].checked==false && document.RegistrationForm.shipAddressPrefer[1].checked==false)
	{
		alert("Please Select Shipping Address Preference");
		document.RegistrationForm.shipAddressPrefer[0].focus();
		return false;
	}


//t&c begin

if (document.RegistrationForm.tmc.checked == false)
{
alert ('You didn\'t choose checkbox!');
return false;
}



	return true;
	}//end of checkVal;


function register(strDate,mode)
{   
	
	
	if(mode==0 && checkVal(strDate))
	{
		var diff = getAge(strDate);
		if(diff <18)
		{
			alert("You Have to be 18 years to Register");
			document.forms[0].month.focus();
			document.RegistrationForm.dob.focus();
		}
		//MALAY 22 NOV 05 STARTS
       if(diff >=60)
		{
			alert("You can not Register ,as your age is more than 60");
			document.forms[0].month.focus();
			document.RegistrationForm.dob.focus();
		 }
		//MALAY 22 NOV 05 ENDS		
		return true;
	}
	else if(mode==1)
	{
		var username=stringTrim(document.RegistrationForm.userName.value);
		var password=stringTrim(document.RegistrationForm.password.value);
		var confirmpassword=stringTrim(document.RegistrationForm.confirmpassword.value);
		if(username.length==0)
		{
			document.RegistrationForm.userName.focus();
			return false;
		}
		if(password.length==0)
		{
			document.RegistrationForm.password.focus();
			return false;
		}
		if(confirmpassword.length==0)
		{
			document.RegistrationForm.confirmpassword.focus();
			return false;
		}
		if(!isName(stringTrim(username)))
		{
			return false;
		}
		if(!isPass(stringTrim(password),
		stringTrim(confirmpassword)))
		{
			return false;
		}
		return true;
	}
	else return false;
}

function resoffval()
{
	if(document.RegistrationForm.res[0].checked==true)
	{
		document.RegistrationForm.offAddress1.value = document.RegistrationForm.resAddress1.value;
		document.RegistrationForm.offCity.selectedIndex = document.RegistrationForm.resCity.selectedIndex;
		document.RegistrationForm.offState.selectedIndex = document.RegistrationForm.resState.selectedIndex;
		document.RegistrationForm.offPinCode.value = document.RegistrationForm.resPinCode.value;
		document.RegistrationForm.offCountry.selectedIndex = document.RegistrationForm.resCountry.selectedIndex;
		document.RegistrationForm.offPhone.value = document.RegistrationForm.resPhone.value;
		document.RegistrationForm.offAddress2.value = document.RegistrationForm.resAddress2.value;
		document.RegistrationForm.offAddress3.value = document.RegistrationForm.resAddress3.value;
		document.RegistrationForm.offOtherCity.value = document.RegistrationForm.resOtherCity.value;
		document.RegistrationForm.offOtherState.value = document.RegistrationForm.resOtherState.value;
	}         
	else 
	{
		document.RegistrationForm.offAddress1.value="";
		document.RegistrationForm.offCity.selectedIndex=0;
		document.RegistrationForm.offState.selectedIndex=0;
		document.RegistrationForm.offPinCode.value="";
		document.RegistrationForm.offCountry.selectedIndex=0;
		document.RegistrationForm.offPhone.value="";
		document.RegistrationForm.offAddress2.value="";
		document.RegistrationForm.offAddress3.value="";
		document.RegistrationForm.offOtherCity.value="";
		document.RegistrationForm.offOtherState.value="";
	}
	return true;
}//end of resoffval

function reset12()
{
	document.RegistrationForm.fname.value="";
//	document.RegistrationForm.mname.value="";
//	document.RegistrationForm.lname.value="";
	document.RegistrationForm.dob.value="";
	document.forms[0].month.selectedIndex=0;
	document.forms[0].day.selectedIndex=0;
	document.forms[0].year.selectedIndex=0;
	document.RegistrationForm.email.value="";
	document.RegistrationForm.resaddress.value="";
	document.RegistrationForm.respin.value="";
	document.RegistrationForm.resphone.value="";
	document.RegistrationForm.offpin.value="";
	document.RegistrationForm.offPhone.value="";
	document.RegistrationForm.offdesidept.value="";
	document.RegistrationForm.offaddress.value="";
	document.RegistrationForm.offfax.value="";
	document.RegistrationForm.username.value="";
	document.RegistrationForm.password.value="";
	document.RegistrationForm.confirmpassword.value="";
	document.RegistrationForm.answer.value="";
	document.RegistrationForm.resaddressone.value="";
	document.RegistrationForm.resaddresstwo.value="";
	document.RegistrationForm.offaddressone.value="";
	document.RegistrationForm.offaddresstwo.value="";
	document.RegistrationForm.gender.selectedIndex=0;
	document.RegistrationForm.occupation.selectedIndex=0;
	document.RegistrationForm.rescountry.selectedIndex=0;
	document.RegistrationForm.offcountry.selectedIndex=0;
	document.RegistrationForm.offPhoneExt.value="";
	document.RegistrationForm.rescity.selectedIndex=0;
	document.RegistrationForm.resstate.selectedIndex=0;
	document.RegistrationForm.offcity.selectedIndex=0;
	document.RegistrationForm.offstate.selectedIndex=0;
	document.RegistrationForm.question.selectedIndex=0;
	document.RegistrationForm.res[0].checked=false;
	document.RegistrationForm.res[1].checked=false;
	document.RegistrationForm.otroffcity.value="";
	document.RegistrationForm.otrrescity.value="";
	document.RegistrationForm.otroffstate.value="";
	document.RegistrationForm.otrresstate.value="";
	document.RegistrationForm.passport.value="";//SURENDRA 19-DEC-O4//PASSPORT

	return false;

}//end of reset12
//atulya/16/12/2005/Starts
function ChkText(strDate)
{
	
	if(document.RegistrationForm.softType.checked)
		document.RegistrationForm.softTypeStatus.value="CHECKED";
	else
		document.RegistrationForm.softTypeStatus.value="UNCHECKED";
	//ATULYA ADDED FOR SOFT CHECK  23/NOV/05 STARTS
 	var diff = getAge2(strDate);
   if(diff <18)
	{
	   	alert("Your are less than 18 years old,you can not be registered!");
	return false;
	}
	if(diff>=60) 
		{
	alert("Your are more than 60 years old,you can not be registered!");
	return false;
	}
	 if (document.RegistrationForm.occupation.value==10)
	{
	  alert("The Occupation field should be filled")
      	document.RegistrationForm.occupation.focus();
		return false;
	}
	 if (document.RegistrationForm.email.value==0)
	{
	  alert("The E-Mail field should be filled")
      	document.RegistrationForm.email.focus();
		return false;
	}
	 
	  	var email=stringTrim(document.RegistrationForm.email.value);
	if(!isLetter(email.charAt(0)))
	{
		alert("Email ID must start with a character");
		document.RegistrationForm.email.focus();
		return false;
	}
	   var splitted = email.match("^(.+)@(.+)$");
	       if(splitted == null) 
	{
			   alert("Please Check The E-Mail  Format");
			   	document.RegistrationForm.email.focus();
			   return false;
	}
	  if(splitted[1] != null )
    {
      var regexp_user=/^\"?[\w-_\.]*\"?$/;
      if(splitted[1].match(regexp_user) == null)
		{
	 alert("Please Check The E-Mail  Format");
	document.RegistrationForm.email.focus();
	  return false;
		}
    }
    if(splitted[2] != null)
    {
      var regexp_domain=/^[\w-\.]*\.[A-Za-z]{2,4}$/;
      if(splitted[2].match(regexp_domain) == null) 
      {
	    var regexp_ip =/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/;
	    if(splitted[2].match(regexp_ip) == null)
		  {
		 alert("Please Check The E-Mail  Format");
			   	document.RegistrationForm.email.focus();	
		return false;
		  }
      }
	}
	var resaddress=stringTrim(document.RegistrationForm.resAddress1.value);
     if (resaddress.length==0)
	{
	  alert("The ResiAddress Line 1 field should be filled")
      	document.RegistrationForm.resAddress1.focus();
		return false;
	}
	
   	if(resaddress.length != 0)
	{  
		var resaddone=stringTrim(document.RegistrationForm.resAddress2.value);
		var resaddtwo=stringTrim(document.RegistrationForm.resAddress3.value);
	
      if( resaddress.indexOf("~") != -1 || resaddress.indexOf("\"") != -1 ||resaddress.indexOf("'") != -1 ||resaddress.indexOf("@") != -1 ||resaddress.indexOf("#") != -1||resaddress.indexOf("$") != -1 ||resaddress.indexOf("*") != -1)
		{
			alert("special characters are not valid in address field");
			document.RegistrationForm.resAddress1.focus();
			return false;
		}
		if( resaddone.indexOf("~") != -1 || resaddone.indexOf("\"") != -1 ||resaddone.indexOf("'")!= -1||resaddone.indexOf("@") != -1 ||resaddone.indexOf("#") != -1||resaddone.indexOf("$") != -1 ||resaddone.indexOf("*") != -1)
		{
			alert("special characters not valid in address field");
			document.RegistrationForm.resAddress2.focus();
			return false;
		}
		if( resaddtwo.indexOf("~") != -1 || resaddtwo.indexOf("\"") != -1 ||resaddtwo.indexOf("'")!= -1||resaddtwo.indexOf("@") != -1 ||resaddtwo.indexOf("#") != -1||resaddtwo.indexOf("$") != -1 ||resaddtwo.indexOf("*") != -1)
		{
			alert("special characters are not valid in address field");
			document.RegistrationForm.resAddress3.focus();
			return false;
		}
	}

		var rescity=document.RegistrationForm.resCity.selectedIndex; 
	var otrResCty =stringTrim(document.RegistrationForm.resOtherCity.value);
	if(rescity==0 && otrResCty.length==0)
		{
			document.RegistrationForm.resCity.focus();
			alert("The City field should be filled");
			return false;
		}
			if(rescity !=0 && otrResCty.length !=0)
	{
		alert("Enter Value Either one of the fields");
		document.RegistrationForm.resCity.focus();
		return false;
	}
		if(otrResCty.length != 0)
	{
		if(isAlphaSpace(otrResCty))
		{
			alert("Special Characters/Number are not allowed in City Field");
			document.RegistrationForm.resOtherCity.focus();
			return false;
		}
	}
	
		var resstate =document.RegistrationForm.resState.selectedIndex;
		var otrResState =stringTrim(document.RegistrationForm.resOtherState.value);
	if(resstate==0 && otrResState.length==0)
		{
			document.RegistrationForm.resState.focus();
			alert("The res State field should be filled");
			return false;
		}
	
	
   
	if(resstate!=0 && otrResState.length!=0)
	{
		alert("Enter Value Either one of the fields");
		document.RegistrationForm.resState.focus();
		return false;
	}
	if(otrResState.length != 0)
	{
		if(isAlphaSpace(otrResState))
		{
			alert("Special Characters/Number are not allowed in State Field");
			document.RegistrationForm.resOtherState.focus();
			return false;
		}
	}
		var resPinCode=stringTrim(document.RegistrationForm.resPinCode.value);
	  if (document.RegistrationForm.resPinCode.value==0)
	{
	  alert("The ResiPinCode field should be filled")
      	document.RegistrationForm.resPinCode.focus();
		return false;
	}
	 
	if(isPassengerAlphabet(document.RegistrationForm.resPinCode.value))
		{
			alert("Numeric values  is only allowed");
			document.RegistrationForm.resPinCode.focus();
			return false;
		}
		
	if((document.RegistrationForm.resPinCode.value.length !=6) && (document.RegistrationForm.resPinCode.value.length !=5))
		{
			alert("\n Res Pin should be 5 or 6 digits Alphabets/Numbers");
		   document.RegistrationForm.resPinCode.focus();
		   return false
		}
	
			var rescountry =document.RegistrationForm.resCountry.selectedIndex;
		if (rescountry==0)
	{
	  alert("The resi country field should be filledaaaaaaaaa")
      	document.RegistrationForm.resCountry.focus();
		return false;
	}
	
	
	      if (document.RegistrationForm.resPhone.value==0)
	{
	  alert("The Res. Phone no. field should be filled")
      	document.RegistrationForm.resPhone.focus();
		return false;
	}
	
	if(isNaN(document.RegistrationForm.resPhone.value))
		{   
			alert("Res Phone  should be numeric")
			document.RegistrationForm.resPhone.focus();
			return false;
		}
if (document.RegistrationForm.resPhone.value.length <6 || document.RegistrationForm.resPhone.value.length>12)
	{
	  alert("Please check the Res. phone no")
      	document.RegistrationForm.resPhone.focus();
		return false;
	}
	var offaddress=stringTrim(document.RegistrationForm.offAddress1.value);
 	 if (offaddress.length==0)
	{
	  alert("The OfficeAddress Line 1 field should be filled")
      	document.RegistrationForm.offAddress1.focus();
		return false;
	}
		if(offaddress.length != 0)
	{  
		
		var offaddone=stringTrim(document.RegistrationForm.offAddress2.value);
		var offaddtwo=stringTrim(document.RegistrationForm.offAddress3.value);

		
		if(offaddress.indexOf("~") != -1 || offaddress.indexOf("\"") != -1 ||offaddress.indexOf("'") != -1||offaddress.indexOf("@") != -1||offaddress.indexOf("#") != -1||offaddress.indexOf("$") != -1||offaddress.indexOf("*") != -1 )
		{
			alert("special characters  are not valid in address field");
			document.RegistrationForm.offAddress1.focus();
			return false;
		}
		if(offaddone.indexOf("~") != -1 || offaddone.indexOf("\"") != -1 ||offaddone.indexOf("'")!= -1||offaddone.indexOf("@")!=-1||offaddone.indexOf("#")!=-1||offaddone.indexOf("$")!=-1||offaddone.indexOf("*")!=-1)
		{
			alert("special characters  are not valid in address field");
			document.RegistrationForm.offAddress2.focus();
			return false;
		}
		if(offaddtwo.indexOf("~") != -1 || offaddtwo.indexOf("\"") != -1 ||offaddtwo.indexOf("'")!= -1 ||offaddtwo.indexOf("@")!= -1 ||offaddtwo.indexOf("#")!= -1 ||offaddtwo.indexOf("$")!= -1 ||offaddtwo.indexOf("*")!= -1)
		{
			alert("special characters are not valid in address field");
			document.RegistrationForm.offAddress3.focus();
			return false;	  
		}
	}
		
	var otrOffCty =stringTrim(document.RegistrationForm.offOtherCity.value);
	if(offcity==0 && otrOffCty.length==0)
		{
			document.RegistrationForm.offCity.focus();
			alert("The office City field should be filled");
			return false;
		}
			if(offcity !=0 && otrOffCty.length!=0)
	{
		alert("Enter Value Either one of the fields");
		document.RegistrationForm.offCity.focus();
		return false;
	}	
			if(otrOffCty.length != 0)
	{
		if(isAlphaSpace(otrOffCty))
		{
			alert("Special Characters are not allowed in City Field");
			document.RegistrationForm.offOtherCity.focus();
			return false;
		}
	}	
			var offstate =document.RegistrationForm.offState.selectedIndex;
		var otrOffState =stringTrim(document.RegistrationForm.offOtherState.value);
	if(offstate==0 && otrOffState.length==0)
		{
			document.RegistrationForm.offState.focus();
			alert("The office State field should be filled");
			return false;
		}
	
	if(offstate !=0 && otrOffState.length !=0)
	{
		alert("Enter Value Either one of the fields");
		document.RegistrationForm.offState.focus();
		return false;
	}
	if(otrOffState.length != 0)
	{
		if(isAlphaSpace(otrOffState))
		{
			alert("Special Characters are not allowed in State Field");
			document.RegistrationForm.offOtherState.focus();
			return false;
		}
	}
	   var offPinCode=stringTrim(document.RegistrationForm.offPinCode.value);
	  if (document.RegistrationForm.offPinCode.value==0)
	{
	  alert("The office PinCode field should be filled")
      	document.RegistrationForm.offPinCode.focus();
		return false;
	}
	if(isPassengerAlphabet(document.RegistrationForm.offPinCode.value))
		{
			alert("Numeric values  is only allowed");
			document.RegistrationForm.offPinCode.focus();
			return false;
		}
	if(isLetter(offPinCode.charAt(0)))
	{
		alert("office PinCode must start with a number");
		document.RegistrationForm.offPinCode.focus();
		return false;
	}
	//kani
	if(offcity !=0 && offstate!=0)
	{ 
		if((document.RegistrationForm.offPinCode.value.length <5) || (document.RegistrationForm.offPinCode.value.length >6))
        {
		alert("\n Office Pin should be 5 or 6 digits Alphabets/Numbers");
      	document.RegistrationForm.offPinCode.focus();
		return false;
		}
	}
	else
	{
		 
	if((document.RegistrationForm.offPinCode.value.length <4) || (document.RegistrationForm.offPinCode.value.length >6))
        {
		alert("\n Office Pin should be 5 or 6 digits Alphabets/Numbers");
      	document.RegistrationForm.offPinCode.focus();
		return false;
		}
	}
	//kani

//	if((document.RegistrationForm.offPinCode.value.length !=6) && (document.RegistrationForm.offPinCode.value.length !=5))
//		{
//			alert("\n Office Pin should be 5 or 6 digits Alphabets/Numbers");
//		   document.RegistrationForm.offPinCode.focus();
//		   return false
//		}
		if (document.RegistrationForm.offCountry.value==0)
	{
	  alert("The office country field should be filled")
      	document.RegistrationForm.offCountry.focus();
		return false;
	}
    
     if (document.RegistrationForm.offPhone.value==0)
	{
	  alert("The officePhone no. field should be filled")
      	document.RegistrationForm.offPhone.focus();
		return false;
	}
	if(isNaN(document.RegistrationForm.offPhone.value))
		{   
			alert("office Phone  should be numeric")
			document.RegistrationForm.offPhone.focus();
			return false;
		}
if (document.RegistrationForm.offPhone.value.length <6 || document.RegistrationForm.offPhone.value.length>12)      
	{
	  alert("Please check the Office Phone")
      	document.RegistrationForm.offPhone.focus();
		return false;
	}
		if(isNaN(document.RegistrationForm.offPhoneExt.value))
		{   
			alert("office Phone Ext should be numeric")
			document.RegistrationForm.offPhoneExt.focus();
			return false;
		}

	if(isSpace(document.RegistrationForm.motherMaiden.value))
		{
			alert("Enter the value for Mothers Maiden name");
			return false;
		}
	
	if(!isPassengerAlphabet(document.RegistrationForm.motherMaiden.value)){
			alert("Numeric values & Special Characters  are not allowed");
			return false;
		}
	
	if(isSpace(document.RegistrationForm.emboName.value))
		{
			alert("Enter the value for Card Holder's Name");
			return false;
		}
	
	if(!isPassengerAlphabet(document.RegistrationForm.emboName.value))
		{
			alert("Numeric values & Special Characters  are not allowed");
			return false;
		}

if (document.RegistrationForm.motherMaiden.value!=document.RegistrationForm.confMaiden.value)
	{
		alert("Mother's Maiden name entered do not match, Please Re-enter values");
			return false;
	}

if (document.RegistrationForm.emboName.value!=document.RegistrationForm.emboConf.value)
	{
		alert("Card Holder's name entered do not match, Please Re-enter values");
			return false;
	}
     
    var ename=document.RegistrationForm.emboName.value;
	
	var Ename = confirm(" Your Card Holder's name is  '"+ename+"' .\n\n Critical as this would be printed on your Membership Card & on passenger lists for all future travel.\n Please ensure you fill this in correctly as this cannot be modified later.\n Do you wish to continue ?");
	if (Ename==0)
	{
		return false;
	}

	
}
function getAge2(strDate)
{ 
	var dy  =document.RegistrationForm.day.value;
	var mon  = document.RegistrationForm.month.value;
	var yy  = document.RegistrationForm.year.value;
    var month;
	if(mon==1)
			month="jan";
		if(mon==2)
			month="feb";
		if(mon==3)
			month="mar";
		if(mon==4)
			month="apr";
		if(mon==5)
			month="may";
		if(mon==6)
			month="jun";
		if(mon==7)
			month="jul";
		if(mon==8)
			month="aug";
		if(mon==9)
			month="sep";
		if(mon==10)
			month="oct";
		if(mon==11)
			month="nov";
		if(mon==12)
			month="dec";
		var tm   = dy+month+yy;
	var strDOBDate = strDate+" 12:00:00 GMT-0500";
  
	birthTime = new Date(tm);
	
	todaysTime = new Date(strDate);
 todaysYear = todaysTime.getYear();
	if (todaysYear < 2002) todaysYear += 1900;
	todaysMonth = todaysTime.getMonth();
	todaysDate = todaysTime.getDate();
	todaysHour = todaysTime.getHours();
	todaysMinute = todaysTime.getMinutes();
	todaysSecond = todaysTime.getSeconds();
	birthYear = birthTime.getYear();
	if (birthYear < 2002) birthYear += 1900;
	birthMonth = birthTime.getMonth();
	birthDate = birthTime.getDate();
	birthHour = birthTime.getHours();
	birthMinute = birthTime.getMinutes();
	birthSecond = birthTime.getSeconds();
	var monarr = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
	// check for leap year
	if (((todaysYear % 4 == 0) && (todaysYear % 100 != 0)) || (todaysYear % 400 == 0)) monarr[1] = "29";
	countMonth = monarr[todaysTime.getMonth()];
	
	if (todaysMinute > birthMinute)
	{
		diffMinute = todaysMinute - birthMinute;
		calcHour = 0;
	}
	else
	{
		diffMinute = todaysMinute + 60 - birthMinute;
		calcHour = -1;
	}
	if (todaysHour > birthHour)
	{
		diffHour = todaysHour - birthHour + calcHour;
		calcDate = 0;
	}
	else
	{
		diffHour = todaysHour + 24 - birthHour  + calcHour;
		calcDate = -1;
	}
	if (todaysDate > birthDate)
	{ 
		diffDate = todaysDate - birthDate + calcDate;
		calcMonth = 0;
	}
	else
	{
		diffDate = todaysDate + countMonth - birthDate  + calcDate;
		calcMonth = -1;
	}
	if (todaysMonth > birthMonth)
	{
		diffMonth = todaysMonth - birthMonth + calcMonth;
		calcYear = 0;
	}
	else
	{
		diffMonth = todaysMonth + 12 - birthMonth + calcMonth;
		calcYear = -1;
	}
	diffYear = todaysYear - birthYear + calcYear;
	if (diffMinute == 60) { diffMinute = 0; diffHour ++; }
	if (diffHour == 24) { diffHour = 0; diffDate ++; }
	if (diffDate == countMonth) { diffDate = 0; diffMonth ++; }
	if (diffMonth == 12) { diffMonth = 0; diffYear ++; }
	return diffYear;
}

//atulya/16/12/2005/Ends