var httpObj = false;
		try {
			  httpObj = new XMLHttpRequest();
		} catch (trymicrosoft) {
		  try {
				httpObj = new ActiveXObject("Msxml2.XMLHTTP");
		  } catch (othermicrosoft) {
			try {
			  httpObj = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (failed) {
			  httpObj = false;
			}
	  }
	}

var CityName = new Array('Ahmedabad','Bangalore','Bhopal','Bhubaneswar','Calicut','Chandigarh','Chennai','Cochin','Coimbatore','Delhi','Ernakulam','Faridabad','Ghaziabad','Guntur','Gurgaon','Guwahati','Hyderabad','Indore','Jaipur','Kannur','Kanpur','Kolkata','Kottayam','Lucknow','Ludhiana','Madurai','Malapuram','Mangalore','Mumbai','Mysore','Nagpur','Nashik','Navi Mumbai','Noida','Palghat','Patna','Pune','Rajkot','Salem','Secunderabad','Surat','Thane','Thrissur','Tiruchy','Trivandrum','Vadodara','Vijayawada','Vishakhapatnam','Warangal');

function DisplayError(Message){
	document.getElementById("newerror").style.display = "block";
	document.getElementById("newerror").innerHTML = '<p style="margin:0 auto; color:#000000;">' + Message + '</p>';
}

function HideError(){
	document.getElementById("newerror").innerHTML = '';
	document.getElementById("newerror").style.display = "none";
}

function DisplayError1(Message,DivName){
	document.getElementById(DivName).style.display = "block";
	document.getElementById(DivName).innerHTML = '<p style="margin:0 auto; color:#000000;">' + Message + '</p>';
}

function HideError1(DivName){
	document.getElementById(DivName).innerHTML = '';
	document.getElementById(DivName).style.display = "none";
}

function ShowCross(name){
	if(name=='city1'){
		document['city1'].src = urlpath + "images/delete.png";
		document.getElementById('othercity').style.border = "1px solid #d12f19";
		document.getElementById('othercity').style.background = "#f7cbc2";
	}else{
		document[name].src = urlpath + "images/delete.png";
		document.getElementById(name).style.border = "1px solid #d12f19";
		document.getElementById(name).style.background = "#f7cbc2";
	}
}

function RemoveCross(name){
	if(name=='city1'){
		document['city1'].src = urlpath + "images/accept.png";
		document.getElementById('othercity').style.border = "1px solid #a1a1a1";
		document.getElementById('othercity').style.background = "#fff";
	}else{
		document[name].src = urlpath + "images/accept.png";
		document.getElementById(name).style.border = "1px solid #a1a1a1";
		document.getElementById(name).style.background = "#fff";
	}
}

function SetValue(value){
	document.getElementById("seterror").value = value;
}

function GetInputName(name){
	if(name=="f_name"){
		document['l_name'].src = urlpath + "images/blank.gif";
		document.getElementById(name).style.border = "1px solid #a1a1a1";
		document.getElementById(name).style.background = "#fff";
	}else if(name=="day" || name=="month" || name=="year"){
		document['year'].src = urlpath + "images/blank.gif";
		document.getElementById(name).style.border = "1px solid #a1a1a1";
		document.getElementById(name).style.background = "#fff";
	}else if(name=="maritalstatus"){
		document['gender'].src = urlpath + "images/blank.gif";
		document.getElementById(name).style.border = "1px solid #a1a1a1";
		document.getElementById(name).style.background = "#fff";
	}else{
		document[name].src = urlpath + "images/blank.gif";
		document.getElementById(name).style.border = "1px solid #a1a1a1";
		document.getElementById(name).style.background = "#fff";
	}
}

function UserNameDataBaseValidation(){
	var url = urlpath+"registration_step3.php?username="+trim(document.getElementById("username").value);
	httpObj.open("POST",url,true);
	httpObj.onreadystatechange = function(){
		if(httpObj.readyState==4){
			if(httpObj.responseText=='--1--'){
				ShowCross('username');
				DisplayError('Username is already registered. Log-in.');
				SetValue(httpObj.responseText);
			}else if(httpObj.responseText=='--2--'){
				ShowCross('username');
				DisplayError('Username is blocked. Contact Support.');
				SetValue(httpObj.responseText);
			}else{
				RemoveCross('username');
				HideError();
				SetValue(0);
			}
		}
	}
	httpObj.send(null);
}

function UserNameValidation(){
	var UserNameValue = trim(document.getElementById("username").value);
	var value = UserNameValidity(UserNameValue);
	if(UserNameValue == ''){
		ShowCross('username');
		return false;
	}else if(value) {
		ShowCross('username');
		DisplayError(value);
		return false;	
	}else{
		UserNameDataBaseValidation();
		if(document.getElementById("seterror").value=='--1--')	
			return false;
		else if(document.getElementById("seterror").value=='--2--')	
			return false;
	}
	return true;
}

function CheckUserName(){
	if(!UserNameValidation()) return false;
	else return true;
}

function CheckPassword(){
	var PasswordValue = trim(document.getElementById("user_pass").value);
	var value = inValidPassword(PasswordValue);
	var status = 0;
	if(PasswordValue==''){
		ShowCross('user_pass');
	}else if(value){
		ShowCross('user_pass');
		DisplayError(value);
		status = 1;
	}else{
		if(PasswordValue != ''){
			RemoveCross('user_pass');
			HideError();
		}
	}

	if(PasswordValue=='' || status==1){
		return false;
	}
	else{
		return true;
	}
}

function CheckFirstName(){

	var FirstNameValue = trim(document.getElementById("f_name").value);
	var value = NameValidity(FirstNameValue);
	document.getElementById("f_name").value = trim(CapitalizeMe(FirstNameValue));
	
	
	if(FirstNameValue == ''){	
		document['l_name'].src = urlpath + "images/delete.png";
		document.getElementById("f_name").style.border = "1px solid #d12f19";
		document.getElementById("f_name").style.background = "#f7cbc2";
		return false;
	}else if(value){
		document['l_name'].src = urlpath + "images/delete.png";
		document.getElementById("f_name").style.border = "1px solid #d12f19";
		document.getElementById("f_name").style.background = "#f7cbc2";
		DisplayError(value);
		return false;
	}else{
		if(FirstNameValue != ''){
			document['l_name'].src = urlpath + "images/blank.gif";
			document.getElementById("f_name").style.border = "1px solid #a1a1a1";
			document.getElementById("f_name").style.background = "#fff";
			HideError();
			return true;
		}
	}
}

function CheckLastName(){
	var LastNameValue = trim(document.getElementById("l_name").value);
	var value = NameValidity(LastNameValue);
	document.getElementById("l_name").value = trim(CapitalizeMe(LastNameValue));
	
	if(LastNameValue == ''){	
		ShowCross('l_name');
		return false;
	}else if(value){
		ShowCross('l_name');
		DisplayError(value);
		return false;
	}else{ 
		if(LastNameValue != ''){
			document.getElementById("l_name").style.border = "1px solid #a1a1a1";
			document.getElementById("l_name").style.background = "#fff";
			if(CheckFirstName()){
				document['l_name'].src = urlpath + "images/accept.png";
				HideError();
				return true;
			}
		}
	}
}

function EmailDataBaseValidation(){
	var url = urlpath+"CheckEmailTest.php?email="+trim(document.getElementById("email").value);
	httpObj.open("POST",url,true);
	httpObj.onreadystatechange = function(){
		if(httpObj.readyState==4){
			if(httpObj.responseText == '--1--'){
				ShowCross('email');
				DisplayError('Email address is already registered. Log-in.');
				SetValue(httpObj.responseText);
			}else if(httpObj.responseText == '--2--'){
				ShowCross('email');
				DisplayError('Email address seems to be incorrect.');
				SetValue(httpObj.responseText);
			}else{
				RemoveCross('email');
				HideError();
				SetValue(0);
			}
		}
	}
	httpObj.send(null);
}

function EmailValidation(){
	var EmailValue = trim(document.getElementById("email").value);
	var value = EmailValidity(EmailValue);
	
	if(EmailValue == ''){
		ShowCross('email');
		return false;
	}else if(value) {
		ShowCross('email');
		DisplayError(value);
		return false;
	}else{
		EmailDataBaseValidation();
		if(document.getElementById("seterror").value=='--1--')	
			return false;
		else if(document.getElementById("seterror").value=='--2--')	
			return false;
	}
	return true;
}

function CheckEmail(){

	if(document.getElementById('mobile').value==''){
		document.getElementById('mobile').focus();
		document.getElementById('mobile').value = '';
	}else{
		var mobilevalue = document.getElementById('mobile').value;
		document.getElementById('mobile').focus();
		document.getElementById('mobile').value = mobilevalue;
	}

	if(!EmailValidation()) return false;
	else return true;
}

function CheckCountry(name){
	if(name == "country" || name == "city" || name == "gender" || name == "maritalstatus"){
		if(document.getElementById(name).value == '')
		{
			ShowCross(name);
			return false;
		}
		if(document.getElementById(name).value != '')
		{
			RemoveCross(name);
			HideError();
			return true;
		}
	}
}

function CheckDob(name){
	if(name == "month"||name == "day"||name == "year"){
		if(document.getElementById(name).value == '')
		{
			document['year'].src = urlpath + "images/delete.png";
			document.getElementById(name).border = "1px solid #d12f19";
			document.getElementById(name).style.background = "#f7cbc2";
			return false;
		}
		if(document.getElementById(name).value != '')
		{
			if(document.getElementById('day').value!='' || document.getElementById('month').value!='' || document.getElementById('year').value!=''){
				if(!CheckDate())return false;
				else return true;
			}else{
				if(name=="year" && document.getElementById('month').value!='' && document.getElementById('day').value!=''){
					document['year'].src = urlpath + "images/accept.png";
				}
				if(name=="month" && document.getElementById('year').value!='' && document.getElementById('day').value!=''){
					document['year'].src = urlpath + "images/accept.png";
				}
				if(name=="day" && document.getElementById('month').value!='' && document.getElementById('year').value!=''){
					document['year'].src = urlpath + "images/accept.png";
				}
					document.getElementById(name).border = "1px solid #a1a1a1";
					document.getElementById(name).style.background = "#ffffff";
					document.getElementById("error").innerHTML = '';
					document.getElementById("error").style.display = "none";
					return true;
			}
		}
	}
}

function CheckDate(){
	var Day = document.getElementById("day").value;
	var Month = document.getElementById("month").value;
	var Year = document.getElementById("year").value;
	var Dob = Year+"-"+Month+"-"+Day;

	age = qryHowOld(new Date(), Month + '/' + Day + '/' + Year );

		if(age.indexOf('Year') != -1) {
			age_count = age.substring( 0, age.indexOf('Year') );
			age_count = parseInt(age_count);
			if(age_count < 18) {
				ShowCross('year');
				DisplayError("Your age must be 18+ to join!");
				return false;
			}else{
				RemoveCross('year');
				HideError();
			    return true;
			}
		}
	//return true;
}

function qryHowOld(varAsOfDate, varBirthDate)
{
	var dtAsOfDate;
	var dtBirth;
	var dtAnniversary;
	var intSpan;
	var intYears;
	var intMonths;
	var intWeeks;
	var intDays;
	var intHours;
	var intMinutes;
	var intSeconds;
	var strHowOld;

	// get born date
	dtBirth = new Date(varBirthDate);

	// get as of date
	dtAsOfDate = new Date(varAsOfDate);

	// if as of date is on or after born date
	if ( dtAsOfDate >= dtBirth )
	{

		// get time span between as of time and birth time
		intSpan = ( dtAsOfDate.getUTCHours() * 3600000 +
		dtAsOfDate.getUTCMinutes() * 60000 +
		dtAsOfDate.getUTCSeconds() * 1000    ) -
		( dtBirth.getUTCHours() * 3600000 +
		dtBirth.getUTCMinutes() * 60000 +
		dtBirth.getUTCSeconds() * 1000       )

		// start at as of date and look backwards for anniversary

		// if as of day (date) is after birth day (date) or
		//    as of day (date) is birth day (date) and
		//    as of time is on or after birth time
		if ( dtAsOfDate.getUTCDate() > dtBirth.getUTCDate() ||
		( dtAsOfDate.getUTCDate() == dtBirth.getUTCDate() && intSpan >= 0 ) )
		{

			// most recent day (date) anniversary is in as of month
			dtAnniversary =
			new Date( Date.UTC( dtAsOfDate.getUTCFullYear(),
			dtAsOfDate.getUTCMonth(),
			dtBirth.getUTCDate(),
			dtBirth.getUTCHours(),
			dtBirth.getUTCMinutes(),
			dtBirth.getUTCSeconds() ) );

		}

		// if as of day (date) is before birth day (date) or
		//    as of day (date) is birth day (date) and
		//    as of time is before birth time
		else
		{

			// most recent day (date) anniversary is in month before as of month
			dtAnniversary =
			new Date( Date.UTC( dtAsOfDate.getUTCFullYear(),
			dtAsOfDate.getUTCMonth() - 1,
			dtBirth.getUTCDate(),
			dtBirth.getUTCHours(),
			dtBirth.getUTCMinutes(),
			dtBirth.getUTCSeconds() ) );

			// get previous month
			intMonths = dtAsOfDate.getUTCMonth() - 1;
			if ( intMonths == -1 )
			intMonths = 11;

			// while month is not what it is supposed to be (it will be higher)
			while ( dtAnniversary.getUTCMonth() != intMonths )

			// move back one day
			dtAnniversary.setUTCDate( dtAnniversary.getUTCDate() - 1 );

		}

		// if anniversary month is on or after birth month
		if ( dtAnniversary.getUTCMonth() >= dtBirth.getUTCMonth() )
		{

			// months elapsed is anniversary month - birth month
			intMonths = dtAnniversary.getUTCMonth() - dtBirth.getUTCMonth();

			// years elapsed is anniversary year - birth year
			intYears = dtAnniversary.getUTCFullYear() - dtBirth.getUTCFullYear();

		}

		// if birth month is after anniversary month
		else
		{

			// months elapsed is months left in birth year + anniversary month
			intMonths = (11 - dtBirth.getUTCMonth()) + dtAnniversary.getUTCMonth() + 1;

			// years elapsed is year before anniversary year - birth year
			intYears = (dtAnniversary.getUTCFullYear() - 1) - dtBirth.getUTCFullYear();

		}

		// to calculate weeks, days, hours, minutes and seconds
		// we can take the difference from anniversary date and as of date

		// get time span between two dates in milliseconds
		intSpan = dtAsOfDate - dtAnniversary;

		// get number of weeks
		intWeeks = Math.floor(intSpan / 604800000);

		// subtract weeks from time span
		intSpan = intSpan - (intWeeks * 604800000);

		// get number of days
		intDays = Math.floor(intSpan / 86400000);

		// subtract days from time span
		intSpan = intSpan - (intDays * 86400000);

		// get number of hours
		intHours = Math.floor(intSpan / 3600000);

		// subtract hours from time span
		intSpan = intSpan - (intHours * 3600000);

		// get number of minutes
		intMinutes = Math.floor(intSpan / 60000);

		// subtract minutes from time span
		intSpan = intSpan - (intMinutes * 60000);

		// get number of seconds
		intSeconds = Math.floor(intSpan / 1000);

		// create output string
		if ( intYears > 0 )
		if ( intYears > 1 )
		strHowOld = intYears.toString() + ' Years';
		else
		strHowOld = intYears.toString() + ' Year';
		else
		strHowOld = '';

		if ( intMonths > 0 )
		if ( intMonths > 1 )
		strHowOld = strHowOld + ' ' + intMonths.toString() + ' Months';
		else
		strHowOld = strHowOld + ' ' + intMonths.toString() + ' Month';

		if ( intWeeks > 0 )
		if ( intWeeks > 1 )
		strHowOld = strHowOld + ' ' + intWeeks.toString() + ' Weeks';
		else
		strHowOld = strHowOld + ' ' + intWeeks.toString() + ' Week';

		if ( intDays > 0 )
		if ( intDays > 1 )
		strHowOld = strHowOld + ' ' + intDays.toString() + ' Days';
		else
		strHowOld = strHowOld + ' ' + intDays.toString() + ' Day';

		if ( intHours > 0 )
		if ( intHours > 1 )
		strHowOld = strHowOld + ' ' + intHours.toString() + ' Hours';
		else
		strHowOld = strHowOld + ' ' + intHours.toString() + ' Hour';

		if ( intMinutes > 0 )
		if ( intMinutes > 1 )
		strHowOld = strHowOld + ' ' + intMinutes.toString() + ' Minutes';
		else
		strHowOld = strHowOld + ' ' + intMinutes.toString() + ' Minute';

		if ( intSeconds > 0 )
		if ( intSeconds > 1 )
		strHowOld = strHowOld + ' ' + intSeconds.toString() + ' Seconds';
		else
		strHowOld = strHowOld + ' ' + intSeconds.toString() + ' Second';

	}
	else
	strHowOld = 'Not Born Yet'

	// return string representation
	return strHowOld
}

function CheckSexStatus(name){
	if(name == "gender"||name == "maritalstatus"){
		if(document.getElementById(name).value == '')
		{
			document['gender'].src = urlpath + "images/delete.png";
			document.getElementById(name).border = "1px solid #d12f19";
			document.getElementById(name).style.background = "#f7cbc2";
			return false;
		}
		if(document.getElementById(name).value != '')
		{
			if(name=="maritalstatus" && document.getElementById('gender').value!='' ){
				document['gender'].src = urlpath + "images/accept.png";
			}
			if(name=="gender" && document.getElementById('maritalstatus').value!=''){
				document['gender'].src = urlpath + "images/accept.png";
			}
			
			document.getElementById(name).border = "1px solid #a1a1a1";
			document.getElementById(name).style.background = "#ffffff";
			document.getElementById("newerror").innerHTML = '';
			document.getElementById("newerror").style.display = "none";
			return true;
		}
	}
}

function MobileDataBaseValidation(){
	var url = urlpath+"CheckMobileTest.php?mobile="+trim(document.getElementById('mobile').value);
	httpObj.open("POST",url,true);
	httpObj.onreadystatechange = function(){
		if(httpObj.readyState==4){
			if(httpObj.responseText == '--1--'){
				ShowCross('mobile');
				DisplayError('Mobile is already registered. Log-in.');
				SetValue(httpObj.responseText);
			}else if(httpObj.responseText == '--2--'){
				ShowCross('mobile');
				DisplayError('Mobile is blocked. Contact Support.');
				SetValue(httpObj.responseText);
			}else{
				RemoveCross('mobile');
				HideError();
				SetValue(0);
			}
		}
	}
	httpObj.send(null);
}

function MobileValidation(){
	var MobileValue = trim(document.getElementById('mobile').value);
	var value = MobileValidity(MobileValue);
	
	if(MobileValue == ''){
		ShowCross('mobile');
		return false;
	}else if(value){
		ShowCross('mobile');
		DisplayError(value);
		return false;
	}else{
		MobileDataBaseValidation();
		if(document.getElementById("seterror").value=='--1--')	
			return false;
		else if(document.getElementById("seterror").value=='--2--')	
			return false;
	}
	return true;
}

function CheckMobile(){
	if(!MobileValidation()) return false;
	else return true;
}

function NriMobileValidation(){
	var MobileValue = trim(document.getElementById('mobile').value);
	var value = MobileValidityNRI(MobileValue);
	
	
	if(MobileValue == ''){
		ShowCross('mobile');
		return false;
	}else if(value){
		ShowCross('mobile');
		DisplayError(value);
		return false;
	}else{
		MobileDataBaseValidation();
		if(document.getElementById("seterror").value=='--1--')	
			return false;
		else if(document.getElementById("seterror").value=='--2--')	
			return false;
	}
	return true;
}

function CheckNriMobile(){
	if(!NriMobileValidation()) return false;
	else return true;
}

function CallCityValue(value){
	if(value=='Other'){
		var rishi = ': <select name="city" id="city" class="selectstyle" onchange="javascript:ChanageCityOnSelection(this.value);" style=" width:110px; font-family:lucida grande, tahoma, verdana, arial, sans-serif; font-size:11px; border:1px solid #a1a1a1;">';
	}else{
		var rishi = ': <select name="city" id="city" class="selectstyle" onBlur="javascript:CheckCountry(this.name);" onchange="javascript:ChanageCityOnSelection(this.value);" style=" width:217px; font-family:lucida grande, tahoma, verdana, arial, sans-serif; font-size:11px; border:1px solid #a1a1a1; ">';
	}
	for(i=0;i<CityName.length;i++){
		if(CityName[i]==value)
			rishi = rishi + '<option value="'+CityName[i]+'" selected>'+CityName[i]+'</option>';
		else
			rishi = rishi + '<option value="'+CityName[i]+'">'+CityName[i]+'</option>';
	}
	if(value=='Other'){
		rishi = rishi + '<option value="Other" selected>Other City</option>';
		rishi = rishi + '</select>&nbsp;<input name="othercity" id="othercity" type="text" style="width:97px;" onfocus="ClearCity();" onBlur="SetOtherCity();" value="--Enter a city--"/><img width="16" height="16" name="city1" src="'+urlpath+'images/blank.gif" alt="" style="margin:0px 0px 4px 5px; vertical-align:middle;"/>';
	}
	else{
		rishi = rishi + '<option value="Other">Other City</option>';
		rishi = rishi + '</select><img width="16" height="16" name="city" src="'+urlpath+'images/blank.gif" alt="" style="margin:0px 0px 4px 4px; vertical-align:middle;"/>';
	}
	return rishi;
}	

function ClearCity(){
	if(document.getElementById("othercity").value=='--Enter a city--')
		document.getElementById("othercity").value="";
}

function SetCityValue(divName,setcity){
	document.getElementById(divName).innerHTML = setcity;
}

function ChanageCityOnSelection(value){
	if(value!='Other'){
		setcity = CallCityValue(value);
		document.getElementById("show_other_city").style.display = "none";
		document.getElementById("show_city").style.display = "block";
		SetCityValue('show_city',setcity);
		//document.getElementById('show_city').focus();
		document.getElementById('city').focus();
	}else{
		setcity = CallCityValue(value);
		document.getElementById("show_city").style.display = "none";
		document.getElementById("show_other_city").style.display = "block";
		SetCityValue('show_other_city',setcity);
		document.getElementById('othercity').focus();
	}
}

function SetOtherCity(){
	if(document.getElementById("othercity").value=="")
		document.getElementById("othercity").value="--Enter a city--";
		
		var CityValue = document.getElementById('othercity').value;
		var value = CityValidity(CityValue);
		
		if(CityValue == '' || CityValue=='--Enter a city--'){
			ShowCross('city1');
			return false;
		}else if(value){
			ShowCross('city1');
			DisplayError(value);
			return false;
		}else{
			RemoveCross('city1');
			return true;
		}
	return true;
}

function CheckCity(){
	if(document.getElementById("city").value==''){
		ShowCross('city');
		return false;	
	}else if(document.getElementById("city").value=='Other'){
		if(!SetOtherCity()) return false;
		else return true;
	}else
		return true;
}


function CheckTC(){
	if(document.getElementById("agreement").checked == false){
			ShowCross('agreement');
			return false;
	}else{
			RemoveCross('agreement');
			return true;			
	}
}

function CheckCaptchaCode(){
	if(trim(document.getElementById("user_verify").value)==''){
		ShowCross('user_verify');
		return false;
	}else if(trim(document.getElementById("user_verify").value)!=''){
		document['user_verify'].src = urlpath + "images/blank.gif";
		document.getElementById('user_verify').style.border = "1px solid #a1a1a1";
		document.getElementById('user_verify').style.background = "#fff";
		return true;
	}
}

var timer = 0;
var timer1 = 0;

function gotoRegStep2(){
	
	if(!CheckFirstName()) return false;
	else if(!CheckLastName()) return false;
	else if(!EmailValidation()) return false;
	else if(!MobileValidation()) return false;
	else if(!CheckCity()) return false;
	else if(!CheckCountry("city")) return false;
	else if(!CheckDob("day")) return false;
	else if(!CheckDob("month")) return false;
	else if(!CheckDob("year")) return false;
	else if(!CheckSexStatus("gender")) return false;
	else if(!CheckSexStatus("maritalstatus")) return false;
	else if(!UserNameValidation()) return false;
	else if(!CheckPassword()) return false;
	else if(!CheckCaptchaCode()) return false;
	else if(!CheckTC("agreement")) return false;
	
	var username = document.getElementById("username").value;
	var f_name = document.getElementById("f_name").value;
	var l_name = document.getElementById("l_name").value;
	var email = document.getElementById("email").value;
	var pass1 = document.getElementById("user_pass").value;
	
	var city = document.getElementById("city").value;
	if(city=='Other'){
		var othercity = document.getElementById("othercity").value;
	}else{
		var othercity = '';
	}

	var month = document.getElementById("month").value;
	var day = document.getElementById("day").value;
	var year = document.getElementById("year").value;
	var dob = year+'-'+month+'-'+day;	
	
	var gender = document.getElementById("gender").value;
	var maritalstatus = document.getElementById("maritalstatus").value;
	var mobile = document.getElementById("mobile").value;
	var user_verify = document.getElementById("user_verify").value;
	
	document.getElementById('ValidationDiv').style.display = 'block';
	document.getElementById('form').style.display = 'none';
	document.getElementById("signinform").innerHTML = '<p style="margin:0 auto; margin-bottom:0px; font-weight:bold;font-family:lucida grande, tahoma, verdana, arial, sans-serif;font-size:20px; color:#1e56a1;">Verification in progress</p>';

	var url = urlpath+"registration_step1.php?f_name="+f_name+"&l_name="+l_name+"&email="+email+"&pass="+pass1+"&city="+city+"&othercity="+othercity+"&dob="+dob+"&gender="+gender+"&maritalstatus="+maritalstatus+"&mobile="+mobile+"&username="+username+"&user_verify="+user_verify+"&register=yes";
	
	httpObj.open("POST",url,true);
	httpObj.onreadystatechange = function(){
		if(httpObj.readyState==1||httpObj.readyState==2||httpObj.readyState==3){
			document.getElementById('ValidationDiv').innerHTML = "<p style='text-align:center;padding-top:40px;padding-bottom:40px; font-weight:bold; font-family:lucida grande, tahoma, verdana, arial, sans-serif; font-size:12px;'><img src='"+urlpath+"images/loadinfo.net.gif'></p>";
		}
		if(httpObj.readyState==4){
			strContent=httpObj.responseText;
			//alert(strContent);
			if(strContent=='--1--'|| strContent=='--2--'||strContent=='--3--'|| strContent=='--4--'|| strContent=='--5--' || strContent=='--6--' || strContent=='--7--'){
				document.getElementById('ValidationDiv').innerHTML = '';
				document.getElementById('ValidationDiv').style.display = 'none';
				document.getElementById("signinform").innerHTML = '<p style="margin:0 auto; color:#000000; margin-bottom:0px; color:#1e56a1; font-weight:bold;"> <img src="'+urlpath+'images/itsfree.gif" /></p>';
				document.getElementById('form').style.display = 'block';	
				
					if(strContent=='--1--'){
						ShowCross('username');
						DisplayError('UserName is already registered.');
					}
					if(strContent=='--2--'){
						ShowCross('username');
						DisplayError('UserName is blocked.');
					}
					if(strContent=='--3--'){
						ShowCross('email');
						DisplayError('Email is already registered.');
					}
					if(strContent=='--4--'){
						ShowCross('email');
						DisplayError('YouMint email Id cannot be registered.');
					}
					if(strContent=='--5--'){
						ShowCross('mobile');
						DisplayError('Mobile is already registered with us.');
					}
					if(strContent=='--6--'){
						ShowCross('mobile');
						DisplayError('Mobile is blocked.');
					}
					if(strContent=='--7--'){
						ShowCross('user_verify');
						DisplayError('Verification Code is wrong.');
					}
			}else{
				document.getElementById('ValidationDiv').style.display = 'none';
				document.getElementById('RishiRajNigam').innerHTML = strContent;
				
				/* New Code */
				
				document.getElementById("signinform").innerHTML = '<p style="margin:0 auto; margin-bottom:0px; font-weight:bold;font-family:lucida grande, tahoma, verdana, arial, sans-serif;font-size:20px; color:#1e56a1;">Confirm Mobile</p>';
				document.getElementById('form1').style.display = 'block';
				document.getElementById('RishiRajNigam').style.display = 'block';
				
				/* End of New Code */

			}
		}
	}
	httpObj.send(null);
	//return false;
}

function gotoNriRegStep2(){
	
	if(!CheckFirstName()) return false;
	else if(!CheckLastName()) return false;
	else if(!EmailValidation()) return false;
	else if(!NriMobileValidation()) return false;
	else if(!CheckCity()) return false;
	else if(!CheckCountry("city")) return false;
	else if(!CheckDob("day")) return false;
	else if(!CheckDob("month")) return false;
	else if(!CheckDob("year")) return false;
	else if(!CheckSexStatus("gender")) return false;
	else if(!CheckSexStatus("maritalstatus")) return false;
	else if(!UserNameValidation()) return false;
	else if(!CheckPassword()) return false;
	else if(!CheckCaptchaCode()) return false;
	else if(!CheckTC("agreement")) return false;
	
	var username = document.getElementById("username").value;
	var f_name = document.getElementById("f_name").value;
	var l_name = document.getElementById("l_name").value;
	var email = document.getElementById("email").value;
	var pass1 = document.getElementById("user_pass").value;
	
	var city = document.getElementById("city").value;
	if(city=='Other'){
		var othercity = document.getElementById("othercity").value;
	}else{
		var othercity = '';
	}

	var country = document.getElementById("country").value;
	var month = document.getElementById("month").value;
	var day = document.getElementById("day").value;
	var year = document.getElementById("year").value;
	var dob = year+'-'+month+'-'+day;	
	
	var gender = document.getElementById("gender").value;
	var maritalstatus = document.getElementById("maritalstatus").value;
	var mobile = document.getElementById("mobile").value;
	var isdcode = document.getElementById("isdcode").value;
	var countrycode = document.getElementById("countrycode").value;
	var user_verify = document.getElementById("user_verify").value;
	
	document.getElementById('ValidationDiv').style.display = 'block';
	document.getElementById('form').style.display = 'none';
	document.getElementById("signinform").innerHTML = '<p style="margin:0 auto; margin-bottom:0px; font-weight:bold;font-family:lucida grande, tahoma, verdana, arial, sans-serif;font-size:20px; color:#1e56a1;">Verification in progress</p>';

	//var url = urlpath+"registration_step1.php?f_name="+f_name+"&l_name="+l_name+"&email="+email+"&pass="+pass1+"&city="+city+"&country="+country+"&othercity="+othercity+"&dob="+dob+"&gender="+gender+"&maritalstatus="+maritalstatus+"&mobile="+mobile+"&isdcode="+isdcode+"&countrycode="+countrycode+"&username="+username+"&user_verify="+user_verify+"&register=yes";
	var url = urlpath+"nri_registration_step1.php?f_name="+f_name+"&l_name="+l_name+"&email="+email+"&pass="+pass1+"&city="+city+"&country="+country+"&othercity="+othercity+"&dob="+dob+"&gender="+gender+"&maritalstatus="+maritalstatus+"&mobile="+mobile+"&isdcode="+isdcode+"&countrycode="+countrycode+"&username="+username+"&user_verify="+user_verify+"&register=yes";
	
	httpObj.open("POST",url,true);
	httpObj.onreadystatechange = function(){
		if(httpObj.readyState==1||httpObj.readyState==2||httpObj.readyState==3){
			document.getElementById('ValidationDiv').innerHTML = "<p style='text-align:center;padding-top:40px;padding-bottom:40px; font-weight:bold; font-family:lucida grande, tahoma, verdana, arial, sans-serif; font-size:12px;'><img src='"+urlpath+"images/loadinfo.net.gif'></p>";
		}
		if(httpObj.readyState==4){
			strContent=httpObj.responseText;
			if(strContent=='--1--'|| strContent=='--2--'||strContent=='--3--'|| strContent=='--4--'|| strContent=='--5--' || strContent=='--6--' || strContent=='--7--'){
				document.getElementById('ValidationDiv').innerHTML = '';
				document.getElementById('ValidationDiv').style.display = 'none';
				document.getElementById("signinform").innerHTML = '<p style="margin:0 auto; color:#000000; margin-bottom:0px; color:#1e56a1; font-weight:bold;"> <img src="'+urlpath+'images/itsfree.gif" /></p>';
				document.getElementById('form').style.display = 'block';	
				
					if(strContent=='--1--'){
						ShowCross('username');
						DisplayError('UserName is already registered.');
					}
					if(strContent=='--2--'){
						ShowCross('username');
						DisplayError('UserName is blocked.');
					}
					if(strContent=='--3--'){
						ShowCross('email');
						DisplayError('Email is already registered.');
					}
					if(strContent=='--4--'){
						ShowCross('email');
						DisplayError('YouMint email Id cannot be registered.');
					}
					if(strContent=='--5--'){
						ShowCross('mobile');
						DisplayError('Mobile is already registered with us.');
					}
					if(strContent=='--6--'){
						ShowCross('mobile');
						DisplayError('Mobile is blocked.');
					}
					if(strContent=='--7--'){
						ShowCross('user_verify');
						DisplayError('Verification Code is wrong.');
					}
			}else{
				document.getElementById('ValidationDiv').style.display = 'none';
				document.getElementById('RishiRajNigam').innerHTML = strContent;
				
				/* New Code */
				
				document.getElementById("signinform").innerHTML = '<p style="margin:0 auto; margin-bottom:0px; font-weight:bold;font-family:lucida grande, tahoma, verdana, arial, sans-serif;font-size:20px; color:#1e56a1;">Confirm Mobile</p>';
				document.getElementById('form1').style.display = 'block';
				document.getElementById('RishiRajNigam').style.display = 'block';
								
				/* End of New Code */

			}
		}
	}
	httpObj.send(null);

}

/* New Code */
function ShowTimerDivNew(){
	document.getElementById('FirstTimeVerificationCode').style.display = 'block';
}
/* New Code */

function MobileDataBaseValidationSecondStep(name){
	var url = urlpath+"CheckMobileTest.php?mobile="+trim(document.getElementById(name).value);
	httpObj.open("POST",url,true);
	httpObj.onreadystatechange = function(){
		if(httpObj.readyState==4){
			if(httpObj.responseText == '--1--'){
				ShowCross(name);
				DisplayError('Mobile is already registered. Log-in.');
				SetValue(httpObj.responseText);
			}else if(httpObj.responseText == '--2--'){
				ShowCross(name);
				DisplayError('Mobile is blocked. Contact Support.');
				SetValue(httpObj.responseText);
			}else{
				RemoveCross(name);
				HideError();
				SetValue(0);
			}
		}
	}
	httpObj.send(null);
}

function MobileValidationSecondStep(name){
	var MobileValue = trim(document.getElementById(name).value);
	var value = MobileValidity(MobileValue);
	
	if(MobileValue == ''){
		ShowCross(name);
		return false;
	}else if(value){
		ShowCross(name);
		DisplayError(value);
		return false;
	}else{
		MobileDataBaseValidationSecondStep(name);
		if(document.getElementById("seterror").value=='--1--')	
			return false;
		else if(document.getElementById("seterror").value=='--2--')	
			return false;
	}
	return true;
}

function MobileNumberSame(){
	var OldMobile = document.getElementById('enteredmobile').value;
	var NewMobile = document.getElementById('confirmmobile').value;

	if(OldMobile!=NewMobile){
		DisplayError('Mobile number mismatch.');
		return false;
	}else{
		HideError();
		return true;
	}
}

function CheckUserMobileNo(){
	if(!MobileValidationSecondStep('enteredmobile')) return false;
	else if(!MobileValidationSecondStep('confirmmobile')) return false;
		
	var OldMobile = document.getElementById('enteredmobile').value;
	var NewMobile = document.getElementById('confirmmobile').value;

	var url = urlpath+"SendVerificationCode.php?oldmobile="+OldMobile+"&newmobile="+NewMobile;

	httpObj.open("POST",url,true);
	httpObj.onreadystatechange = function(){
		if(httpObj.readyState==1||httpObj.readyState==2||httpObj.readyState==3){
			
			document.getElementById('mobilebutton').value='verifying';
			document.getElementById('mobilebutton').disabled = 'true';
			
		}
		if(httpObj.readyState==4){
			var strContent = httpObj.responseText;
			
			if(strContent=='--1--'||strContent=='--4--'||strContent=='--5--'){
				document.getElementById('form1').style.display = 'block';

				document.getElementById('mobilebutton').value='confirm';
				document.getElementById('mobilebutton').disabled = '';

				if(strContent=='--1--'){
					DisplayError('Mobile number mismatch.');
				}				
				if(strContent=='--4--'){
					ShowCross('confirmmobile');
					DisplayError('Mobile is already registered.');
				}
				if(strContent=='--5--'){
					ShowCross('confirmmobile');
					DisplayError('Mobile is blocked.');
				}
			}else{
				
				document.getElementById('RishiRajNigam').innerHTML = strContent;
				document.getElementById("signinform").innerHTML = '<p style="margin:0 auto; margin-bottom:0px; font-weight:bold;font-family:lucida grande, tahoma, verdana, arial, sans-serif;font-size:20px; color:#1e56a1;">Enter the Code</p>';
				document.getElementById('form1').style.display = 'block';
				document.getElementById('RishiRajNigam').style.display = 'block';
				timer = setTimeout(function(){ShowTimerDivNew()},30000);
			}
		}
	}
	httpObj.send(null);
}

function NriMobileValidationSecondStep(name){
	var MobileValue = trim(document.getElementById(name).value);
	var value = MobileValidityNRI(MobileValue);

	if(MobileValue == ''){
		ShowCross(name);
		return false;
	}else if(value){
		ShowCross(name);
		DisplayError(value);
		return false;
	}else{
		MobileDataBaseValidationSecondStep(name);
		if(document.getElementById("seterror").value=='--1--')	
			return false;
		else if(document.getElementById("seterror").value=='--2--')	
			return false;
	}
	return true;
}

function CheckNriUserMobileNo(){
	if(!NriMobileValidationSecondStep('enteredmobile')) return false;
	else if(!NriMobileValidationSecondStep('confirmmobile')) return false;
		
	var OldMobile = document.getElementById('enteredmobile').value;
	var NewMobile = document.getElementById('confirmmobile').value;

	var url = urlpath+"SendVerificationCode.php?oldmobile="+OldMobile+"&newmobile="+NewMobile;
	httpObj.open("POST",url,true);
	httpObj.onreadystatechange = function(){
		if(httpObj.readyState==1||httpObj.readyState==2||httpObj.readyState==3){
			
			document.getElementById('mobilebutton').value='verifying';
			document.getElementById('mobilebutton').disabled = 'true';
			
		}
		if(httpObj.readyState==4){
			var strContent = httpObj.responseText;
			
			if(strContent=='--1--'||strContent=='--4--'||strContent=='--5--'){
				document.getElementById('form1').style.display = 'block';

				document.getElementById('mobilebutton').value='confirm';
				document.getElementById('mobilebutton').disabled = '';

				if(strContent=='--1--'){
					DisplayError('Mobile number mismatch.');
				}				
				if(strContent=='--4--'){
					ShowCross('confirmmobile');
					DisplayError('Mobile is already registered.');
				}
				if(strContent=='--5--'){
					ShowCross('confirmmobile');
					DisplayError('Mobile is blocked.');
				}
			}else{
				
				document.getElementById('RishiRajNigam').innerHTML = strContent;
				document.getElementById("signinform").innerHTML = '<p style="margin:0 auto; margin-bottom:0px; font-weight:bold;font-family:lucida grande, tahoma, verdana, arial, sans-serif;font-size:20px; color:#1e56a1;">Enter the Code</p>';
				document.getElementById('form1').style.display = 'block';
				document.getElementById('RishiRajNigam').style.display = 'block';
				timer = setTimeout(function(){ShowTimerDivNew()},30000);
			}
		}
	}
	httpObj.send(null);
}



function EmailDataBaseValidation2(name){
	var url = urlpath+"CheckEmailTest.php?email="+trim(document.getElementById(name).value);
	httpObj.open("POST",url,true);
	httpObj.onreadystatechange = function(){
		if(httpObj.readyState==4){
			if(httpObj.responseText == '--1--'){
				ShowCross(name);
				DisplayError('Email address is already registered. Log-in.');
				SetValue(httpObj.responseText);
			}else if(httpObj.responseText == '--2--'){
				ShowCross(name);
				DisplayError('Email address seems to be incorrect.');
				SetValue(httpObj.responseText);
			}else{
				RemoveCross(name);
				HideError();
				SetValue(0);
			}
		}
	}
	httpObj.send(null);
}

function EmailValidationSecondStep(name){
	var EmailValue = trim(document.getElementById(name).value);
	var value = EmailValidity(EmailValue);
	
	if(EmailValue == ''){
		ShowCross(name);
		return false;
	}else if(value){
		ShowCross(name);
		DisplayError(value);
		return false;
	}else{
		EmailDataBaseValidation2(name);
		if(document.getElementById("seterror").value=='--1--')	
			return false;
		else if(document.getElementById("seterror").value=='--2--')	
			return false;
	}
	return true;
}

function CheckUserEmailId(){

	if(!EmailValidationSecondStep('enteredemail')) return false;
	else if(!EmailValidationSecondStep('confirmemail')) return false;
		
	var OldEmail = document.getElementById('enteredemail').value;
	var NewEmail = document.getElementById('confirmemail').value;

	var url = urlpath+"CheckConfirmEmail.php?oldemail="+OldEmail+"&newemail="+NewEmail;
	//alert(url);
	httpObj.open("POST",url,true);
	httpObj.onreadystatechange = function(){
		if(httpObj.readyState==1||httpObj.readyState==2||httpObj.readyState==3){
			
			document.getElementById('emailbutton').value='verifying';
			document.getElementById('emailbutton').disabled = 'true';
			
		}
		if(httpObj.readyState==4){
			var strContent = httpObj.responseText;
			//alert(strContent);
			if(strContent=='--1--'||strContent=='--2--'||strContent=='--4--'||strContent=='--5--'){
				document.getElementById('form3').style.display = 'block';

				document.getElementById('emailbutton').value='confirm';
				document.getElementById('emailbutton').disabled = '';

				if(strContent=='--1--'){
					ShowCross('confirmemail');
					DisplayError('Email mismatch.');
				}
				if(strContent=='--2--'){
					ShowCross('confirmemail');
					DisplayError('Email seems to be incorrect.');
				}
				if(strContent=='--4--'){
					ShowCross('confirmemail');
					DisplayError('Email is already registered.');
				}
				if(strContent=='--5--'){
					ShowCross('confirmemail');
					DisplayError('Email is blocked.');
				}
			}else{
				document.getElementById('form3').style.display = 'none';
				HideError();
				
				document.getElementById('RishiRajNigam3').innerHTML = strContent;
				document.getElementById("signinform").innerHTML = '<p style="margin:0 auto; margin-bottom:0px; font-weight:bold;font-family:lucida grande, tahoma, verdana, arial, sans-serif;font-size:20px; color:#1e56a1;">Enter the Code</p>';
				document.getElementById('form4').style.display = 'block';
				document.getElementById('RishiRajNigam3').style.display = 'block';
				document.getElementById('emailcode').focus();
				timer = setTimeout(function(){ShowEmailTimerDivNew()},30000);
			}
		}
	}
	httpObj.send(null);
	
}

function ShowEmailTimerDivNew(){
	document.getElementById('FirstTimeEmailVerificationCode').style.display = "block";
}

function ResendEmailVerificationCode(Email,EmailCode){
	
	document.getElementById('newerror').style.display = 'none';
	document.getElementById('ValidationDiv').style.display = 'block';
	document.getElementById('form4').style.display = 'none';
	document.getElementById("signinform").innerHTML = '<p style="margin:0 auto; margin-bottom:0px; font-weight:bold;font-family:lucida grande, tahoma, verdana, arial, sans-serif;font-size:20px; color:#1e56a1;">Re-Sending Email Code</p>';

	var url = urlpath+"ResendEmailVerificationCode.php?Email="+Email+"&EmailCode="+EmailCode;
	//alert(url);
	
	httpObj.open("POST",url,true);
	httpObj.onreadystatechange = function(){
		if(httpObj.readyState==1||httpObj.readyState==2||httpObj.readyState==3){
			document.getElementById('ValidationDiv').innerHTML = "<p style='text-align:center;padding-top:40px;padding-bottom:40px;font-weight:bold; font-family:lucida grande, tahoma, verdana, arial, sans-serif; font-size:12px;'><img src='"+urlpath+"images/loadinfo.net.gif'><br><br>Re-sending Code to<br> your email...</p>";
		}
		if(httpObj.readyState==4){
			var strContent=httpObj.responseText;
			document.getElementById('RishiRajNigam3').innerHTML = strContent;
			document.getElementById('ValidationDiv').style.display = 'none';
			
			/* New Code */
			document.getElementById("signinform").innerHTML = '<p style="margin:0 auto; margin-bottom:0px; font-weight:bold;font-family:lucida grande, tahoma, verdana, arial, sans-serif;font-size:20px; color:#1e56a1;">Enter the Code</p>';
			document.getElementById('form4').style.display = 'block';
			document.getElementById('RishiRajNigam3').style.display = 'block';
			//document.getElementById('ShowVerificationDiv').style.display = 'block';
			document.getElementById('emailcode').focus();
			timer1 = setTimeout(function(){ShowEmailTimerDivNew1()},60000);
			/* New Code */

		}	
	}
	httpObj.send(null);

}

function ShowEmailTimerDivNew1(){
	document.getElementById('SecondTimeEmailVerificationCode').style.display = "block";
}

function EmailVerificationCodeDataBaseValidation(){
	var url = urlpath+"registration_step2.php?emailcode="+trim(document.getElementById("emailcode").value);
	alert(url);
	httpObj.open("POST",url,true);
	httpObj.onreadystatechange = function(){
		if(httpObj.readyState==4){
			alert(httpObj.responseText);
			if(httpObj.responseText == '--1--'){
				ShowCross('emailcode');
				DisplayError('Wrong code entered');
				SetValue(httpObj.responseText);	
			}else{
				RemoveCross('emailcode');
				HideError();
				SetValue(0);
			}
		}
	}
	httpObj.send(null);

}

function EmailCodeValidation(){
	var CodeValue = document.getElementById("emailcode").value;
	
		var value = EmailCodeValidity(CodeValue);
		if(CodeValue == ''){
			ShowCross('emailcode');
			return false;
		}else if(value){
			ShowCross('emailcode');
			DisplayError('Verification code entered seems to be incorrect.');
			return false;
		}else{
			EmailVerificationCodeDataBaseValidation();
			if(document.getElementById("seterror").value=='--1--')	
				return false;
		}
	return true;
}

function CheckEmailCode(){
	if(!EmailCodeValidation()) return false;
	else return true;
}

function LastStep(){
	//if(!CheckEmailCode()) return false;
	var CodeValue = trim(document.getElementById("emailcode").value);

	if(CodeValue == ''){
		ShowCross('emailcode');
		return false;
	}else{

		document.getElementById('ValidationDiv').style.display = 'block';
		document.getElementById('form4').style.display = 'none';

		var url = urlpath+"VerifyEmailCode.php?emailcode=" + trim(document.getElementById("emailcode").value);
		//alert(url);
		httpObj.open("POST",url,true);
		httpObj.onreadystatechange = function(){
			if(httpObj.readyState==1||httpObj.readyState==2||httpObj.readyState==3){
				document.getElementById('ValidationDiv').innerHTML = "<p style='text-align:center;margin-top:40px;margin-bottom:40px;'><img src='"+urlpath+"images/loadinfo.net.gif'><br><img src='"+urlpath+"images/loading.gif'></p>";
			}
			if(httpObj.readyState==4){
				var strContent=httpObj.responseText;
				if(httpObj.responseText=='--1--'){
					document.getElementById('ValidationDiv').innerHTML = '';
					document.getElementById('ValidationDiv').style.display = 'none';
					document.getElementById('form4').style.display = 'block';
					ShowCross('emailcode');
					DisplayError('Wrong code entered.');
				}else{
					if(document.getElementById('isdcodevalue').value=='91'){
						location.href = "RegistrationInvite.php";
					}else{
						location.href = "RegistrationInvite.php";
					}
				}
			}
		}
		httpObj.send(null);
	}
}



function LoadLastStep(){
	if(document.getElementById('isdcodevalue').value=='91'){
		location.href = "RegistrationInvite.php";
	}else{
		location.href = "RegistrationInvite.php";
	}
}


function captureHitEnter(e, func_with_param) {
	var characterCode;

	if(e && e.which){
		e = e
		characterCode = e.which
	}
	else{
		e = event
		characterCode = e.keyCode
	}
	if(characterCode == 13){
		eval(func_with_param);
		return false;
	}
	else{
			return true;
	}
}

function VerificationCodeDataBaseValidation(){
	var url = urlpath+"registration_step2.php?code="+trim(document.getElementById("code").value);
	httpObj.open("POST",url,true);
	httpObj.onreadystatechange = function(){
		if(httpObj.readyState==4){
			if(httpObj.responseText == '--1--'){
				ShowCross('code');
				DisplayError('Wrong code entered');
				SetValue(httpObj.responseText);	
			}else{
				RemoveCross('code');
				HideError();
				SetValue(0);
			}
		}
	}
	httpObj.send(null);
}

function CodeValidation(){
		var CodeValue = document.getElementById("code").value;
		var value = CodeValidity(CodeValue);
		if(CodeValue == ''){
			ShowCross('code');
			return false;
		}else if(value){
			ShowCross('code');
			DisplayError('Verification code entered seems to be incorrect.');
			return false;
		}else{
			VerificationCodeDataBaseValidation();
			if(document.getElementById("seterror").value=='--1--')	
				return false;
		}
	return true;
}

function CheckCode(){
	if(!CodeValidation()) return false;
	else return true;
	
}

function gotoRegStep3(){
	if(!CheckCode()) return false;
	
	document.getElementById('ValidationDiv').style.display = 'block';
	
	if(document.getElementById('form1').style.display == 'block'){
		document.getElementById('form1').style.display = 'none';
		var formname = 'form1';
	}

	if(document.getElementById('form2').style.display == 'block'){
		document.getElementById('form2').style.display = 'none';
		var formname = 'form2';
	}
	
	//alert(formname);
	var url = urlpath+"VerifyMobileCode.php?code=" + trim(document.getElementById("code").value);
	httpObj.open("POST",url,true);
	httpObj.onreadystatechange = function(){
		if(httpObj.readyState==1||httpObj.readyState==2||httpObj.readyState==3){
			document.getElementById('ValidationDiv').innerHTML = "<p style='text-align:center;margin-top:40px;margin-bottom:40px;'><img src='"+urlpath+"images/loadinfo.net.gif'><br><img src='"+urlpath+"images/loading.gif'></p>";
		}
		
		if(httpObj.readyState==4){
			var strContent=httpObj.responseText;
			if(httpObj.responseText=='--1--'){
				document.getElementById('ValidationDiv').innerHTML = '';
				document.getElementById('ValidationDiv').style.display = 'none';
				document.getElementById(formname).style.display = 'block';
				ShowCross('code');
				DisplayError('Wrong code entered.');
			}else{
				document.getElementById('ValidationDiv').innerHTML = '';
				document.getElementById('ValidationDiv').style.display = 'none';
				document.getElementById('RishiRajNigam2').innerHTML = strContent;
				document.getElementById("signinform").innerHTML = '<p style="margin:0 auto; margin-bottom:0px; font-weight:bold;font-family:lucida grande, tahoma, verdana, arial, sans-serif;font-size:20px; color:#1e56a1;">Confirm Email</p>';
				document.getElementById('form3').style.display = 'block';
				document.getElementById('RishiRajNigam2').style.display = 'block';

				//timer = setTimeout(function(){ShowTimerDivNew()},30000);

				/*if(document.getElementById('isdcodevalue').value=='91')
					location.href = "RegistrationInvite.php";
				else
					location.href = "nriregistrationstep4.php";*/
			}
		}
	}
	httpObj.send(null);
	//return false;
}

function ResendVerificationCode(mobile,code){
	
	document.getElementById('newerror').style.display = 'none';
	document.getElementById('ValidationDiv').style.display = 'block';
	document.getElementById('form1').style.display = 'none';
	document.getElementById("signinform").innerHTML = '<p style="margin:0 auto; margin-bottom:0px; font-weight:bold;font-family:lucida grande, tahoma, verdana, arial, sans-serif;font-size:20px; color:#1e56a1;">Verification in progress</p>';

	var url = urlpath+"ResendVerificationCode.php?mobile="+mobile+"&code="+code;
	
	httpObj.open("POST",url,true);
	httpObj.onreadystatechange = function(){
		if(httpObj.readyState==1||httpObj.readyState==2||httpObj.readyState==3){
			document.getElementById('ValidationDiv').innerHTML = "<p style='text-align:center;padding-top:40px;padding-bottom:40px;font-weight:bold; font-family:lucida grande, tahoma, verdana, arial, sans-serif; font-size:12px;'><img src='"+urlpath+"images/loadinfo.net.gif'><br><br>Re-sending Code to<br> your mobile...</p>";
		}
		if(httpObj.readyState==4){
			var strContent=httpObj.responseText;
			document.getElementById('RishiRajNigam1').innerHTML = strContent;
			document.getElementById('ValidationDiv').style.display = 'none';
			
			/* New Code */
			document.getElementById("signinform").innerHTML = '<p style="margin:0 auto; margin-bottom:0px; font-weight:bold;font-family:lucida grande, tahoma, verdana, arial, sans-serif;font-size:20px; color:#1e56a1;">Enter the Code</p>';
			document.getElementById('form2').style.display = 'block';
			document.getElementById('RishiRajNigam1').style.display = 'block';
			document.getElementById('ShowVerificationDiv').style.display = 'block';
			timer1 = setTimeout(function(){ShowTimerDivNew1()},30000);
			/* New Code */

		}	
	}
	httpObj.send(null);
}

function ShowTimerDivNew1(){
	document.getElementById('SecondTimeVerificationCode').style.display = 'block';
}

function LoadNextStep(){

	document.getElementById('newerror').style.display = 'none';
	document.getElementById('ValidationDiv').style.display = 'block';
	document.getElementById('form2').style.display = 'none';
	document.getElementById("signinform").innerHTML = '<p style="margin:0 auto; margin-bottom:0px; font-weight:bold;font-family:lucida grande, tahoma, verdana, arial, sans-serif;font-size:20px; color:#1e56a1;">Confirm Email</p>';
	
	var url = urlpath+"EmailConfirmation.php";
	//alert(url);
	httpObj.open("POST",url,true);
	httpObj.onreadystatechange = function(){
		if(httpObj.readyState==1||httpObj.readyState==2||httpObj.readyState==3){
			document.getElementById('ValidationDiv').innerHTML = "<p style='text-align:center;padding-top:40px;padding-bottom:40px;font-weight:bold; font-family:lucida grande, tahoma, verdana, arial, sans-serif; font-size:12px;'><img src='"+urlpath+"images/loadinfo.net.gif'><br><br>Asking for email<br>confirmation.... </p>";
		}
		if(httpObj.readyState==4){
			var strContent=httpObj.responseText;
			//alert(strContent);
			document.getElementById('RishiRajNigam2').innerHTML = strContent;
			document.getElementById('ValidationDiv').style.display = 'none';
			document.getElementById("signinform").innerHTML = '<p style="margin:0 auto; margin-bottom:0px; font-weight:bold;font-family:lucida grande, tahoma, verdana, arial, sans-serif;font-size:20px; color:#1e56a1;">Confirm Email</p>';
			document.getElementById('form3').style.display = 'block';
			document.getElementById('RishiRajNigam2').style.display = 'block';
		}
	}
	httpObj.send(null);
	
	/*if(document.getElementById('isdcodevalue').value=='91')
		location.href = "RegistrationInvite.php";
	else
		location.href = "nriregistrationstep4.php";*/
}

function RedirectRegistration(){
	location.href = "registrationstep4.php";
	return false;
}

function RemoveValue(name){
	if(name=='user_name2' && document.getElementById(name).value=='username')
		document.getElementById(name).value = '';
	if(name=='user_pass2' && document.getElementById(name).value=='password')
		document.getElementById(name).value = '';
}

function getInputLogin(name){
	if(trim(document.getElementById(name).value) == ''){
		document.getElementById(name).style.border = "1px solid #d12f19";
		document.getElementById(name).style.background = "#f7cbc2";
		return false;
	}
	if(document.getElementById(name).value != ''){
		document.getElementById(name).style.border = "1px solid #a1a1a1";
		document.getElementById(name).style.background = "#fff";
		return true;
	}
}

function Login(){
	if(!getInputLogin('user_name2')) return false;
	else if(!getInputLogin('user_pass2')) return false;
	else if(LoginUserNameValidity(trim(document.getElementById('user_name2').value))){
		location.href=urlpath+"LoginError.html";
		return false;
	}

	var name = document.getElementById("user_name2").value;
	var pass = document.getElementById("user_pass2").value;
	var agreement = document.getElementById("agreement2").checked;
	
	var url =  urlpath+"LoginVerification.php?name="+name+"&pass="+pass+"&agreement="+agreement;
	
	document.getElementById('loginbutton').value='Signing In...';
	document.getElementById('loginbutton').disabled = 'true';

	httpObj.open("POST",url,true);
	httpObj.onreadystatechange = function(){
		if(httpObj.readyState==1||httpObj.readyState==2||httpObj.readyState==3){
			document.getElementById('loginbutton').value = 'Signing In...';
			document.getElementById('loginbutton').disabled = 'true';
		}
		if(httpObj.readyState==4){
			var strContent = httpObj.responseText;
			if(strContent==1){
				document.getElementById('loginbutton').value='Login';
				document.getElementById('loginbutton').disabled = '';
				//DisplayError1('Username or Password is not correct!','userloginerror');
				location.href=urlpath+"LoginError.html";
			}else{
				location.href=urlpath+"Profile.html";
				//location.href=urlpath+"Video.html";
				//location.href=urlpath+"Invite.html";
			}
		}
	};
	httpObj.send(null);
	return false;
}

function CheckForgotPasswordUserName(){
	if(!getInputLogin('user_name1')) return false;
	else return true;
}

function CheckForgotPasswordMobile(){
	var MobileValue = trim(document.getElementById('mobile1').value);
	var value = MobileValidity(MobileValue);
	
	if(MobileValue == ''){
		ShowCross('mobile1');
		return false;
	}else if(value){
		ShowCross('mobile1');
		DisplayError1(value,'forgotpassworderror');
		return false;
	}else{
		RemoveCross('mobile1');
		HideError1('forgotpassworderror');
		return true;
	}
}

function ForgotPasswordRegistration(){
	if(!CheckForgotPasswordUserName()) return false;
	else if(!CheckForgotPasswordMobile()) return false;
	
	var username = document.getElementById("user_name1").value;
	var mobile = document.getElementById("mobile1").value;
	var url = urlpath+"ForgotPassword.php?username="+username+"&mobile="+mobile;
	httpObj.open("POST",url,true);
	
	document.getElementById("ForgotPaswordFormDiv").style.display = "none";

	httpObj.onreadystatechange = function(){
		if(httpObj.readyState==1||httpObj.readyState==2||httpObj.readyState==3){
			document.getElementById("ForgotPaswordLoadingDiv").style.display = "block";
		}
		if(httpObj.readyState==4){
			document.getElementById("ForgotPaswordLoadingDiv").style.display = "none";
			if(httpObj.responseText=='--No--'){
				document.getElementById("ForgotPaswordFormDiv").style.display = "block";
				document.getElementById("user_name1").value = username;
				document.getElementById("mobile1").value = mobile;
				DisplayError1('Information provided is not correct!','forgotpassworderror');
				return false;
			}else{
				document.getElementById("ForgotPaswordFormDiv").style.display = "block";
				document.getElementById("ForgotPaswordFormDiv").innerHTML = '<p style=" align:center;margin-top:20px;margin-bottom:20px;  font-size:11px;">Your password has been sent to your email account.</p>';
			}
		}
	}
	httpObj.send(null);
}

function NriCheckForgotPasswordMobile(){
	var MobileValue = trim(document.getElementById('mobile1').value);
	var value = MobileValidityNRI(MobileValue);
	
	if(MobileValue == ''){
		ShowCross('mobile1');
		return false;
	}else if(value){
		ShowCross('mobile1');
		DisplayError1(value,'forgotpassworderror');
		return false;
	}else{
		RemoveCross('mobile1');
		HideError1('forgotpassworderror');
		return true;
	}
}

function NriForgotPasswordRegistration(country){
	if(!CheckForgotPasswordUserName()) return false;
	else if(!NriCheckForgotPasswordMobile()) return false;
	
	var username = document.getElementById("user_name1").value;
	var mobile = document.getElementById("mobile1").value;
	var url = urlpath+"NriForgotPassword.php?username="+username+"&mobile="+mobile+"&country="+country;
	httpObj.open("POST",url,true);
	
	document.getElementById("ForgotPaswordFormDiv").style.display = "none";

	httpObj.onreadystatechange = function(){
		if(httpObj.readyState==1||httpObj.readyState==2||httpObj.readyState==3){
			document.getElementById("ForgotPaswordLoadingDiv").style.display = "block";
		}
		if(httpObj.readyState==4){
			document.getElementById("ForgotPaswordLoadingDiv").style.display = "none";
			if(httpObj.responseText=='--No--'){
				document.getElementById("ForgotPaswordFormDiv").style.display = "block";
				document.getElementById("user_name1").value = username;
				document.getElementById("mobile1").value = mobile;
				DisplayError1('Information provided is not correct!','forgotpassworderror');
				return false;
			}else{
				document.getElementById("ForgotPaswordFormDiv").style.display = "block";
				document.getElementById("ForgotPaswordFormDiv").innerHTML = '<p style=" align:center;margin-top:20px;margin-bottom:20px;  font-size:11px;">Your password has been sent to your email account.</p>';
			}
		}
	}
	httpObj.send(null);
}	

function HideOverDiv(type){
	
	document.getElementById('NetworkAlertDiv').style.display = 'none';
	document.getElementById('mask_div').style.visibility = 'hidden';
	document.getElementById('city').disabled = '';
	document.getElementById('day').disabled = '';
	document.getElementById('month').disabled = '';
	document.getElementById('year').disabled = '';
	document.getElementById('gender').disabled = '';
	document.getElementById('maritalstatus').disabled = '';
	
	if(type=='close' || type =='click'){
		document.getElementById('networkreferer').style.display = 'none';
	}
	
	if(type =='click'){
		document.getElementById('f_name').focus();
	}
	var url = urlpath+"OverlayClick.php?type=" + type;
	httpObj.open("POST",url,true);
	httpObj.onreadystatechange = function(){}
	httpObj.send(null);

}

function OpenCountryList(){
	document.getElementById('countrylist').style.display = 'block';
	document.getElementById('mask_div').style.visibility = 'visible';

	//var url = urlpath+"LoadCountryList.php";
	var url = urlpath+"country.html";
	httpObj.open("POST",url,true);
	httpObj.onreadystatechange = function(){
		if(httpObj.readyState==1 || httpObj.readyState==2 || httpObj.readyState==3){
			document.getElementById('LoadCountryLoadingDiv').style.display = "block";
		}
		if(httpObj.readyState==4){
			document.getElementById('LoadCountryLoadingDiv').style.display = "none";
			document.getElementById('LoadCountry').innerHTML = httpObj.responseText;
		}
	}
	httpObj.send(null);
}

function CloseCountryList(){
	document.getElementById('countrylist').style.display = 'none';
	document.getElementById('mask_div').style.visibility = 'hidden';
}