var req = createXMLHttpRequest();

function chkAvailability(){
	if($('user_name').value.trim() != '') 	{
		var url = 'functions.php?event=uavl';
		var pars = 'username='+$F('user_name') ;
		var myAjax = new Ajax.Request(
		url, 
		{
			method: 'POST',
			parameters: pars,
			onComplete: post_chk_username
		});	
	} 
}

function post_chk_username(originalRequest) {
	result = originalRequest.responseText;
	if(result == '<font color="red">Email already exists</font>') {
		document.getElementById('user_available').value = 1;
	} else {
		document.getElementById('user_available').value = 0;	
	}
	document.getElementById('chk').style.display='inline';
	document.getElementById('chk').innerHTML = result;
}



function chkAEvailability(){
	
	
	if($('altemail').value.trim() != '') 	{
		
		if($('user_name').value == $('altemail').value)
			{
				$('msg_div').innerHTML = "Email Adddress and Alternate Email address cannot be same.";
				$('altemail').focus();
				displayAlert();
				return false;		
				
			}
			else
			
			{
		var url = 'functions.php?event=auavl';
		var pars = 'altemail='+$F('altemail') ;
		var myAjax = new Ajax.Request(
		url, 
		{
			method: 'POST',
			parameters: pars,
			onComplete: post_chk_aemail
		});	
	} }
}

function post_chk_aemail(originalRequest) {
	result = originalRequest.responseText;
	
	if(result == '<font color="red">Email address already exists</font>') {
		document.getElementById('auser_available').value = 1;
		//document.getElementById('altemail').focus();
	} else {
		document.getElementById('auser_available').value = 0;	
	}
	
	document.getElementById('achk').style.display='inline';
	document.getElementById('achk').innerHTML = result;
}


function openPinfo(){
	if(document.getElementById('det').style.display == 'none') {
		document.getElementById('det').style.display = 'inline';
	} else {
		document.getElementById('det').style.display = 'none';
	}
}

function openProfinfo(){
	if(document.getElementById('prof').style.display == 'none') {
		document.getElementById('prof').style.display = 'inline';
	} else {
		document.getElementById('prof').style.display = 'none';
	}
}
function openCinfo(){
	if(document.getElementById('det1').style.display == 'none') {
		document.getElementById('det1').style.display = 'inline';
	} else {
		document.getElementById('det1').style.display = 'none';
	}
}

function openBinfo(){
	if(document.getElementById('bud1').style.display == 'none') {
		document.getElementById('bud1').style.display = 'inline';
	} else {
		document.getElementById('bud1').style.display = 'none';
	}
}


function openB1info(id){
	
	if(id == 16) {
		document.getElementById('bud2').style.display = 'inline';
		document.getElementById('bud1').style.display = 'inline';
	} else {
		document.getElementById('bud2').style.display = 'none';
		document.getElementById('bud1').style.display = 'none';
	}
}

// function to check valid file
extArray = new Array(".gif", ".jpg", ".png");
function LimitAttach(form, file) {
allowSubmit = false;
if (!file) return;
while (file.indexOf("\\") != -1)
file = file.slice(file.indexOf("\\") + 1);
ext = file.slice(file.indexOf(".")).toLowerCase();
for (var i = 0; i < extArray.length; i++) {
if (extArray[i] == ext) { allowSubmit = true; break; }
}
if (allowSubmit) {
	document.getElementById('alert_div').style.display = 'none';
	document.getElementById('file_type_ok').value = 1;
	document.getElementById('file_type').style.display = 'none';
	document.getElementById('file_type').innerHTML = "";
} else {
	document.getElementById('file_type_ok').value = 0;
	document.getElementById('file_type').style.display = 'inline';
	document.getElementById('file_type').innerHTML = "Please upload valid (gif/jpg) image file.";
	return false;
}
}

function post_info_resp() {
	if(req.readyState == 4){
		result = req.responseText;
		result = result.trim();
		res_arr = result.split('|');
		if(res_arr[0] == 1) {
			$('user_name').value = '';
			$('password').value = '';
			$('confirm_password').value = '';
			$('msg_div').innerHTML = res_arr[1];		
			displayAlert();
			document.getElementById('btn_submit').value = 'Submit';
			document.getElementById('btn_submit').disabled = false;
			document.getElementById('frmDiv').style.display = 'none';
			//document.getElementById('regDiv').style.display = 'inline';
			return false;
		} else if(res_arr[0] == 0) { 
			$('msg_div').innerHTML = res_arr[1];		
			displayAlert();
			document.getElementById('btn_submit').value = 'Submit';
			document.getElementById('btn_submit').disabled = false;
			return false;	
		} 
	}
}


function getsubcategory(fid) { 
	
		req.open('get','functions.php?event=bsc&id='+fid);
		req.onreadystatechange = populatesubject;
		req.send(null);
	
}

function populatesubject() {
		if(req.readyState == 4){
			var response = req.responseText;
			var subList = response.split(',');
			
			ClearOptions(document.frm.TR_SUBCategory_name);
			AddToOptionList(document.frm.TR_SUBCategory_name, '', '--Please Select--');
			
			for(i=0; i < subList.length; i++) {
				//alert(subList[i]);
				if(subList[i] != "" ){
					idnamearr = subList[i].split('|'); 
					AddToOptionList(document.frm.TR_SUBCategory_name, idnamearr[0], idnamearr[1].trim());
				}
			}

	   }
	
	  }


function isURL(argvalue) { 
	urlRegEx = /http[s]?:\/\/([-\w\.]+)+(:\d+)?(\/([\w\/_\.]*(\?\S+)?)?)?/;
	var testVal = argvalue.trim(); 
	if(testVal.length > 9 && urlRegEx.test(testVal)) { 
		return true;
	} else { 
		return false; 
	}
}


function saveFormData() {
	
	if($('user_name').value.trim() == '') 	{
		$('msg_div').innerHTML = "Please enter Email address.";
		$('user_name').focus();
		displayAlert();
		return false;
	}
	if($F('user_name') != '') {
		var reEmail = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
		if($F('user_name').length > 5 && reEmail.test($F('user_name'))) {
		} else {
			$('msg_div').innerHTML = "Please enter valid Email address.";
			$('user_name').focus();
			displayAlert();
			return false;
		}
	}

	if($F('password') == '') 	{
		$('msg_div').innerHTML = "Please enter Password.";
		$('password').focus();
		displayAlert();
		return false;
	}
	if($F('password') != '' && $F('password').indexOf(" ") != -1) {
		$('msg_div').innerHTML = "Spaces are not allowed in Password.";
		$('password').focus();
		displayAlert();
		return false;
	}
	if($F('password') != '' && $F('password').length<6) {
		$('msg_div').innerHTML = "Password can not be less then 6 character.";
		$('password').focus();
		displayAlert();
		return false;
	}
	if($F('confirm_password') == '') 	{ 
		$('msg_div').innerHTML = "Please enter Confirm Password.";
		$('confirm_password').focus();
		displayAlert();
		return false;
	}
	
	if($F('confirm_password') != '' && $F('password') != '' && $F('password') != $F('confirm_password')) 	{ 
		$('msg_div').innerHTML = "Password and Confirm Password do not match.";
		$('confirm_password').focus();
		displayAlert();
		return false;
	}
	if($F('user_available') == 1) 	{ 
		$('msg_div').innerHTML = "Email address already exits.";
		$('user_name').focus();
		displayAlert();
		return false;
	}
	
	if($F('auser_available') == 1) 	{ 
		$('msg_div').innerHTML = "Email address already exits.";
		$('user_name').focus();
		displayAlert();
		return false;
	}
	
	
	if($F('altemail') != '') {
		var reAEmail = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
		if($F('altemail').length > 5 && reAEmail.test($F('altemail'))) {
		} else {
			$('msg_div').innerHTML = "Please enter valid Alternate Email address.";
			$('altemail').focus();
			displayAlert();
			return false;
		}
	}
	
	
	if($('first_name').value.trim() == '') 	{ 
		$('msg_div').innerHTML = "Please enter First Name.";
		displayAlert();
		document.getElementById('det').style.display = 'inline';
		$('first_name').focus();
		return false;
	}
	if($('last_name').value.trim() == '') 	{ 
		$('msg_div').innerHTML = "Please enter Last Name.";
		$('last_name').focus();
		displayAlert();
		return false;
	}
	
	if($F('dd') != '' || $F('mm') != '' || $F('yy') != '') 	{ 
		var dob = $F('yy') + '-' + $F('mm') + '-' + $F('dd');
		if(!IsValidDate(dob)) {
			$('msg_div').innerHTML = "Please enter valid Date Of Birth.";
			$('dd').focus();
			displayAlert();
			return false;
		}
	}
	
	
	
	
	var radio_choice = false;
	
	for (counter = 0; counter < document.frm.gender.length; counter++)
	{
	
	if (document.frm.gender[counter].checked)
		radio_choice = true; 
		
	}
	
	if (!radio_choice)	{
		$('msg_div').innerHTML = "Please choose school type.";
		displayAlert();
		return (false);
	}
	
	
	
	if($('roll').value.trim() == '') 	{ 
		$('msg_div').innerHTML = "Please enter Roll No.";
		$('roll').focus();
		displayAlert();
		return false;
	}
	
	if($F('pass_year') == '') 	{ 
		$('msg_div').innerHTML = "Year you joined school.";
		$('pass_year').focus();
		displayAlert();
		return false;
	}
	
	if($F('year_of_passing') == '') 	{ 
		$('msg_div').innerHTML = "Please select Year of passing.";
		$('year_of_passing').focus();
		displayAlert();
		return false;
	}
	
	if($F('batch_of_passing') == '') 	{ 
		$('msg_div').innerHTML = "Please select Batch of passing.";
		$('batch_of_passing').focus();
		displayAlert();
		return false;
	}
	
	if($('last_house').value.trim() == '') 	{ 
		$('msg_div').innerHTML = "Please enter Last House.";
		$('last_house').focus();
		displayAlert();
		return false;
	}
	
	
	var married_choice = false;
	
	for (counter = 0; counter < document.frm.married.length; counter++)
	{
	
	if (document.frm.married[counter].checked)
		married_choice = true; 
		
	}
	
	if (!married_choice)	{
		$('msg_div').innerHTML = "Please choose marital status.";
		displayAlert();
		return (false);
	}
		
	
	
	if($F('add') != '' || $F('amm') != '' || $F('ayy') != '') 	{ 
		var dob = $F('ayy') + '-' + $F('amm') + '-' + $F('add');
		if(!IsValidDate(dob)) {
			$('msg_div').innerHTML = "Please enter valid Anniversary.";
			$('add').focus();
			displayAlert();
			return false;
		}
	}
	
	/*if($F('profession') == '') 	{ 
		
		$('msg_div').innerHTML = "Please select Profession.";
		document.getElementById('prof').style.display = 'inline';
		$('profession').focus();
		displayAlert();
		return false;
	}*/
	
	//Business directory validation
	if($F('TR_Category_name') != '') 	{ 
		if($F('TR_SUBCategory_name') == '') 	{ 
					$('msg_div').innerHTML = "Please select Sub Category Name.";
					document.getElementById('bud1').style.display = 'inline';
					
					$('TR_SUBCategory_name').focus();
					displayAlert();
					return false;
		}
	}
	
	
	if($F('TR_Business_description') != '') 	{ 
		if($F('TR_Business_description').length > 250)	{
						$('msg_div').innerHTML = "Description maximum 250 characters.";
						document.getElementById('bud1').style.display = 'inline';
						
						$('TR_Business_description').focus();
						displayAlert();
						return false;
		}
	}
	
	
	if($F('TR_Bus_Email') != '') {
				var reEmail = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
				if($F('TR_Bus_Email').length > 5 && reEmail.test($F('TR_Bus_Email'))) {
				} else {
					$('msg_div').innerHTML = "Please enter valid Business Email address.";
					document.getElementById('bud1').style.display = 'inline';
					
					$('TR_Bus_Email').focus();
					displayAlert();
					return false;
				}
	}
	
	if($F('TR_Url') != '')	{
				if(!isURL($F('TR_Url'))){
					$('msg_div').innerHTML = "Please enter valid Url";
					$('TR_Url').focus();
					displayAlert();
					return false;
				}
	}
	
	
	if($F('TR_image') != '')	{
				if(!ValidateImageExtension($F('TR_image'))){
					document.getElementById('bud1').style.display = 'inline';
					
					$('msg_div').innerHTML = "Only jpg and gif files are allowed";
					displayAlert();
					return false;
				}
		}
		
		if($F('address') != '' && $F('address').length > 250) 	{ 
		$('msg_div').innerHTML = "Address can not be more than 250 characters.";
		$('address').focus();
		displayAlert();
		return false;
	}
	
	if(!IsOnlyNumbers($F('zip')) ) 	{

		$('msg_div').innerHTML = "Please enter valid Zip/Pin code.";
		$('zip').focus();
		displayAlert();
		return false;
	}
	
	
	if($F('taddress') != '' && $F('taddress').length > 250) 	{ 
		$('msg_div').innerHTML = "Temporary Address can not be more than 250 charactera.";
		$('taddress').focus();
		displayAlert();
		return false;
	}
	
	if(!IsOnlyNumbers($F('tzip')) ) 	{
		$('msg_div').innerHTML = "Please enter valid Zip/Pin code.";
		$('tzip').focus();
		displayAlert();
		return false;
	}
	
	if($('phone').value.trim() != '') 	{ 
		if(!ValidatePhone($F('phone')) ) 	{
			$('msg_div').innerHTML = "Please enter valid Phone number.";
			$('phone').focus();
			displayAlert();
			return false;
		}
	}
	
	if($('fax').value.trim() != '' && !ValidatePhone($F('fax'))) 	{ 
		$('msg_div').innerHTML = "Please enter valid Fax.";
		$('fax').focus();
		displayAlert();
		return false;
	}
	
	if($F('user_image') != '')	{
				if(!ValidateImageExtension($F('user_image'))){
					
					$('msg_div').innerHTML = "Only jpg and gif files are allowed";
					document.getElementById('det1').style.display = 'inline';
					$('user_image').focus();
					displayAlert();
					return false;
				}
	}
	
	
	
	if($F('capture') == '') 	{ 
		
		$('msg_div').innerHTML = "Please enter Security code.";
		
		document.getElementById('det1').style.display = 'inline';
		$('capture').focus();
		displayAlert();
		return false;
	}
	
	/*if($F('user_image') != '' && $F('file_type_ok') == 0) 	{ 
		$('msg_div').innerHTML = "Please upload valide (gif/jpg) image file.";
		$('user_image').focus();
		displayAlert();
		return false;
	}
	
	if($F('profession') == 16) 	{ 
	
			if($F('TR_Category_name') == '') 	{ 
				$('msg_div').innerHTML = "Please enter Category Name.";
				document.getElementById('bud1').style.display = 'inline';
				document.getElementById('bud2').style.display = 'inline';
				$('TR_Category_name').focus();
				displayAlert();
				return false;
			}
			
			
			if($F('TR_SUBCategory_name') == '') 	{ 
				$('msg_div').innerHTML = "Please enter Sub Category Name.";
				document.getElementById('bud1').style.display = 'inline';
				document.getElementById('bud2').style.display = 'inline';
				$('TR_SUBCategory_name').focus();
				displayAlert();
				return false;
			}
			
			
			if($F('TR_Package_name') == '') 	{ 
				$('msg_div').innerHTML = "Please select Package Name.";
				document.getElementById('bud1').style.display = 'inline';
				document.getElementById('bud2').style.display = 'inline';
				$('TR_Package_name').focus();
				displayAlert();
				return false;
			}
			
				
			if($F('TR_Company_name') == '') 	{ 
				$('msg_div').innerHTML = "Please enter Company Name.";
				document.getElementById('bud1').style.display = 'inline';
				document.getElementById('bud2').style.display = 'inline';
				$('TR_Company_name').focus();
				displayAlert();
				return false;
			}
			
			if($F('TR_Business_description') == '') 	{ 
				$('msg_div').innerHTML = "Please enter Description.";
				document.getElementById('bud1').style.display = 'inline';
				document.getElementById('bud2').style.display = 'inline';
				$('TR_Business_description').focus();
				displayAlert();
				return false;
			}
			
			
			if($F('TR_Business_description').length > 250)	{
				$('msg_div').innerHTML = "Description maximum 250 characters.";
				document.getElementById('bud1').style.display = 'inline';
				document.getElementById('bud2').style.display = 'inline';
				$('TR_Business_description').focus();
				displayAlert();
				return false;
			}
			
			
			
			if($('TR_Contact_name').value.trim() == '')	{
				$('msg_div').innerHTML = "Please enter Contact Person.";
				document.getElementById('bud1').style.display = 'inline';
				document.getElementById('bud2').style.display = 'inline';
				$('TR_Contact_name').focus();
				displayAlert();
				return false;
			}
			
			if($('TR_Bus_Email').value.trim() == '') 	{
				$('msg_div').innerHTML = "Please enter Business Email address.";
				document.getElementById('bud1').style.display = 'inline';
				document.getElementById('bud2').style.display = 'inline';
				$('TR_Bus_Email').focus();
				displayAlert();
				return false;
			}
			
			if($F('TR_Bus_Email') != '') {
				var reEmail = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
				if($F('TR_Bus_Email').length > 5 && reEmail.test($F('TR_Bus_Email'))) {
				} else {
					$('msg_div').innerHTML = "Please enter valid Business Email address.";
					document.getElementById('bud1').style.display = 'inline';
					document.getElementById('bud2').style.display = 'inline';
					$('TR_Bus_Email').focus();
					displayAlert();
					return false;
				}
			}

			
			
			if($F('TR_Url') != '')	{
				if(!isURL($F('TR_Url'))){
					$('msg_div').innerHTML = "Please enter valid Url";
					$('TR_Url').focus();
					displayAlert();
					return false;
				}
			}
			
			if($F('TR_image') =='')	{
				$('msg_div').innerHTML = "Please Upload Company Logo.";
				document.getElementById('bud1').style.display = 'inline';
				document.getElementById('bud2').style.display = 'inline';
				displayAlert();
				return false;
			}
		
			if($F('TR_image') != '')	{
				if(!ValidateImageExtension($F('TR_image'))){
					document.getElementById('bud1').style.display = 'inline';
					document.getElementById('bud2').style.display = 'inline';
					$('msg_div').innerHTML = "Only jpg and gif files are allowed";
					displayAlert();
					return false;
				}
			}	
	
	
	}
	
	//end here
	
	
	
	
	if($('address').value.trim() == '') 	{ 
		document.getElementById('det1').style.display = 'inline';
		$('msg_div').innerHTML = "Please enter Address.";
		$('address').focus();
		displayAlert();
		return false;
	}
	
	//alert( $F('address').length);
	if($F('address') != '' && $F('address').length > 100) 	{ 
		$('msg_div').innerHTML = "Address can not be more than 100 character.";
		$('address').focus();
		displayAlert();
		return false;
	}
	
	if($('city').value.trim() == '') 	{ 
		$('msg_div').innerHTML = "Please enter City.";
		$('city').focus();
		displayAlert();
		return false;
	}
	
	if($('state').value.trim() == '') 	{ 
		$('msg_div').innerHTML = "Please enter State.";
		$('state').focus();
		displayAlert();
		return false;
	}
	
	if($('zip').value.trim() == '') 	{ 
		$('msg_div').innerHTML = "Please enter Zip/Pin.";
		$('zip').focus();
		displayAlert();
		return false;
	}
	
	if(!IsOnlyNumbers($F('zip')) ) 	{
		$('msg_div').innerHTML = "Please enter valid Zip/Pin code.";
		$('zip').focus();
		displayAlert();
		return false;
	}
	
	
	if($F('country') == '') 	{ 
		$('msg_div').innerHTML = "Please select Country.";
		$('country').focus();
		displayAlert();
		return false;
	}
	
	if($('taddress').value.trim() == '') 	{ 
		document.getElementById('det1').style.display = 'inline';
		$('msg_div').innerHTML = "Please enter Temporary Address.";
		$('taddress').focus();
		displayAlert();
		return false;
	}
	
	//alert( $F('address').length);
	if($F('taddress') != '' && $F('taddress').length > 100) 	{ 
		$('msg_div').innerHTML = "Temporary Address can not be more than 100 character.";
		$('taddress').focus();
		displayAlert();
		return false;
	}
	
	if($('tcity').value.trim() == '') 	{ 
		$('msg_div').innerHTML = "Please enter City.";
		$('tcity').focus();
		displayAlert();
		return false;
	}
	
	if($('tstate').value.trim() == '') 	{ 
		$('msg_div').innerHTML = "Please enter State.";
		$('tstate').focus();
		displayAlert();
		return false;
	}
	
	if($('tzip').value.trim() == '') 	{ 
		$('msg_div').innerHTML = "Please enter Zip/Pin.";
		$('tzip').focus();
		displayAlert();
		return false;
	}
	
	if(!IsOnlyNumbers($F('tzip')) ) 	{
		$('msg_div').innerHTML = "Please enter valid Zip/Pin code.";
		$('tzip').focus();
		displayAlert();
		return false;
	}
	
	
	if($F('tcountry') == '') 	{ 
		$('msg_div').innerHTML = "Please select Country.";
		$('tcountry').focus();
		displayAlert();
		return false;
	}
	
	
	
	
	
	
	if($('phone').value.trim() == '') 	{ 
		$('msg_div').innerHTML = "Please enter Phone number.";
		$('phone').focus();
		displayAlert();
		return false;
	}
	
	if(!ValidatePhone($F('phone')) ) 	{
		$('msg_div').innerHTML = "Please enter valid Phone number.";
		$('phone').focus();
		displayAlert();
		return false;
	}
	
	if($('fax').value.trim() != '' && !ValidatePhone($F('fax'))) 	{ 
		$('msg_div').innerHTML = "Please enter valid Fax.";
		$('fax').focus();
		displayAlert();
		return false;
	}
	
	
	if($F('user_image') != '' && $F('file_type_ok') == 0) 	{ 
		$('msg_div').innerHTML = "Please upload valide (gif/jpg) image file.";
		$('user_image').focus();
		displayAlert();
		return false;
	}*/
	
		
	//var url = 'user-registration.php?event=pinfo';
	
	
	///youliveAjaxUpload(document.frm, url, '','Error in upload', 'main_action_div', 'temp_div');
	
	
	
	
	document.frm.action ="user-registration.php?event=pinfo";
	document.frm.submit();
}


function countdescChar(fobj,id) {
	
	var total = 250;
	var used = fobj.value.length;
	if(total >= used) {
		document.getElementById("dsc_cnt"+id).innerHTML = total - used;
	} else {
		fobj.value = fobj.value.substring(0, total);
	}
}


function uinfo(){
	if($('user_id').value.trim() != '') {
		var url = 'user-registration.php?event=uinfo'; 
		var pars = 'id='+$F('user_id');
		document.getElementById('btn_submit').value = 'Wait....';
		document.getElementById('btn_submit').disabled = true;
		var myAjax = new Ajax.Request(
		url, 
		{
			method: 'POST',
			parameters: pars,
			onComplete: uinfo_response
		});
	}
}

function uinfo_response(originalRequest){
	result = originalRequest.responseText;
	result = result.trim();
	res_arr = result.split('|');
	if(res_arr[0] == 1) {
		$('user_name').value = res_arr[1];
		$('password').value = '';
		$('confirm_password').value = '';
		$('msg_div').innerHTML = '';		
		$('user_id').value = res_arr[2];
		displayAlert();
		document.getElementById('btn_submit').value = 'Submit';
		document.getElementById('btn_submit').disabled = false;
		document.getElementById('frmDiv').style.display = 'block';
		document.getElementById('regDiv').style.display = 'inline';
		document.getElementById('alert_div').style.display = 'none';
		return false;
	} else if(res_arr[0] == 0) { 
		$('msg_div').innerHTML = res_arr[1];		
		displayAlert();
		document.getElementById('btn_submit').value = 'Submit';
		document.getElementById('btn_submit').disabled = false;
		return false;	
	} 
}

function displayAlert2(msg){
	if(msg) $('msg_div_2').innerHTML = msg;
	$('alert_div_2').className = 'alert_show';
}

function displayAlert3(msg){
	if(msg) $('msg_div_3').innerHTML = msg;
	$('alert_div_3').className = 'alert_show';
}

function post_info_other(){
	if($('first_name').value.trim() == '') 	{
		$('msg_div_2').innerHTML = "Please Enter First Name.";
		displayAlert2();
		return false;
	}
	if($('last_name').value.trim() == '') 	{
		$('msg_div_2').innerHTML = "Please Enter Last Name.";
		displayAlert2();
		return false;
	}
	if($('date_of_birth').value.trim() == '') 	{
		$('msg_div_2').innerHTML = "Please Enter Date Of Birth.";
		displayAlert2();
		return false;
	}
	if($('roll').value.trim() == '') 	{
		$('msg_div_2').innerHTML = "Please Enter Roll Number.";
		displayAlert2();
		return false;
	}
	if($('year_of_passing').value.trim() == '') 	{
		$('msg_div_2').innerHTML = "Please Enter Year of Passing.";
		displayAlert2();
		return false;
	}
	
	var url = 'user-registration.php?event=oinfo'; 
	var pars = 'first_name='+$F('first_name') + '&last_name=' + $F('last_name') + '&nick_name=' + $F('nick_name') +'&dob='+
				$F('date_of_birth')+'&roll='+ $F('roll') + '&year_of_passingh='+ $F('year_of_passing') + '&batch_of_passing='+
				$F('batch_of_passing')+ '&last_house=' + $F('last_house')+ '&anniversary='+ $F('anniversary')+ '&spouse='+
				$F('spouse')+ '&no_of_child='+ $F('no_of_child');
	document.getElementById('btn_submit_det').value = 'Wait....';
	document.getElementById('btn_submit_det').disabled = true;
	var myAjax = new Ajax.Request(
	url, 
	{
		method: 'POST',
		parameters: pars,
		onComplete: post_other_resp
	});
}

function post_other_resp(originalRequest) {
	result = originalRequest.responseText;
	result = result.trim();
	res_arr = result.split('|');
	if(res_arr[0] == 1) {
		$('first_name').value = '';
		$('last_name').value = '';
		$('nick_name').value = '';
		$('date_of_birth').value = '';
		$('roll').value = '';
		$('year_of_passingh').value = '';
		$('batch_of_passing').value = '';
		$('last_house').value = '';
		$('anniversary').value = '';
		$('spouse').value = '';
		$('no_of_child').value = '';
		$('msg_div').innerHTML = res_arr[1];		
		displayAlert();
		document.getElementById('btn_submit_det').value = 'Submit';
		document.getElementById('btn_submit_det').disabled = false;
		document.getElementById('det').style.display = 'none';
		return false;
	} else if(res_arr[0] == 0) { 
		$('msg_div').innerHTML = res_arr[1];		
		displayAlert();
		document.getElementById('btn_submit').value = 'Submit';
		document.getElementById('btn_submit').disabled = false;
		return false;	
	} 
}
