	/**
	*	process_user.js defines all the functions that has been used in
	*   jumpdates projects. it uses process.js to send and receive the AJAX calls.
	**/
	
	// Send the login details to server
	var attachment_counter = 1;
	function login_process()
	{
		var username = document.getElementById('username').value;
		var pass = document.getElementById('pass').value;
		var remember = document.getElementById('chk_remember');
		var chk_status = 'N';
		if(remember.checked == true)
		{
			chk_status = 'Y';
		}
		if(username == "")
		{
			alert('username is empty');
			return false;
		}
		if(pass == "")
		{
			alert('Password is empty');
			return false;
		}
		
		show_processing_image();
		var query_string = "action=login_request&username="+escape(username)+"&password="+escape(pass)+"&chk_remember="+escape(chk_status);
		var script_name = "login_process.php";
		send_request(script_name, query_string);
	}
	
	// get the servers login response and accordingly show alerts or member home page
	function response_user_login(status_text)
	{
		var response = status_text.split("~");
		if(response[0] == 'Error')
		{
			alert(response[1]);
		}
		else
		{
			
			 var obj_redirect = document.getElementById('redirect').value;
			 var resp = response[1].split("#");
			 if (resp[1] == 'y')
			 {
				var user_name = resp[2];
				var member_id = resp[3]; 
				var chk_status = 'N';
				var query_string = "user_name="+escape(user_name)+"&member_id="+escape(member_id)+"&chk_remember="+escape(chk_status)+"&autologin=y";
				var im_path = resp[4]+'IM/main.php?'+query_string;
				if(obj_redirect != "")
				{
					window.location.href= obj_redirect;
				}
				else
				{
					window.location.href='member_home.php';
					
				}
				window.open(im_path, 'IM', 'height=580, width=225, menu=0, scroll=0, location=0, status=0,resizable=0');
				
			 }
			 else 
			 { 
				if(obj_redirect != "")
				{
					window.location.href= obj_redirect;
				}
				else
				{
					window.location.href='member_home.php';
				}
			 }
		}
	}
	
	// clear the content of text box.
	function clearTextLogin(control)
	{
		var obj_control = document.getElementById(control);
		if(obj_control.value == 'Your Username' || obj_control.value == 'Password')
		{
			obj_control.value = '';
		}
	}
	// sned request to load the page
	function load_page(page)
	{
		show_processing_image();
		switch(page)
		{
			case 'forgot_pass':
				var query_string = "action=load_forgot_pass";
				var script_name = "forgot_pass.php";
				break;
			default:
				alert('parameter is missing in load_page');
		}
		
		
		send_request(script_name, query_string);
	}
	// response to load the forgot password page
	function response_load_page(status_text)
	{
		hide_processing_image();
		var content = document.getElementById('content');
		content.innerHTML = status_text;
	}
	// send request to reset the password
	function reset_password()
	{
		var email = document.getElementById('email');
		if(trim(email.value) == "")
		{
			alert('Please Enter The Email Id');
			return false;
		}
		show_processing_image();
		var query_string = "action=reset_password&email="+escape(trim(email.value));
		var script_name = "forgot_pass.php";
		send_request(script_name, query_string);
	}

	//REGISTRATION ONE VALIDATION
	function reg_one_process()
	{
		//HIDE ERROR MSG
		document.getElementById("divFirstName").style.display = "none";
		document.getElementById("divLastName").style.display = "none";
		document.getElementById("divUserName").style.display = "none";
		document.getElementById("divPassword").style.display = "none";
		document.getElementById("divRePassword").style.display = "none";
		document.getElementById("divReEmail").style.display = "none";
		document.getElementById("divEmail").style.display = "none";
		document.getElementById("divDOB").style.display = "none";
		document.getElementById("divCountry").style.display = "none";
		document.getElementById("divRaceEthnicity").style.display = "none";
		document.getElementById("divZipCode").style.display = "none";
		document.getElementById("divState").style.display = "none";
		document.getElementById("divCity").style.display = "none";

		//HIDE ERROR MSG

		var txtFirstName = document.getElementById('txtFirstName').value;
		var txtLastName  = document.getElementById('txtLastName').value;
		var txtUserName  = document.getElementById('txtUserName').value;
		var txtPassword  = document.getElementById('txtPassword').value;
		var txtRePassword = document.getElementById('txtRePassword').value;
		var txtEmail = document.getElementById('txtEmail').value;
		var txtReTypeEmail = document.getElementById('txtReTypeEmail').value;
		var txtZipCode = document.getElementById('txtZipCode').value;
		var txtCountry = document.getElementById('txtCountry').value;
		var txtGender = document.getElementById('txtGender').value;
		var cmbYear = document.getElementById('cmbYear').value;
		var cmbMonth = document.getElementById('cmbMonth').value;
		var cmbDate = document.getElementById('cmbDate').value;
		var cmbRaceEthnicity = document.getElementById('cmbRaceEthnicity').value;
		var txtDatingHeadLine = document.getElementById('txtDatingHeadLine').value;
		
		// if ethnicity is Other
		if(cmbRaceEthnicity == 'Other (specify)')
		{
		var cmbRaceEthnicity_other = document.getElementById('cmbRaceEthnicity_other').value;
		cmbRaceEthnicity = cmbRaceEthnicity_other;
		}

		if ( txtFirstName == '')
		{
			alert("Please enter your First Name.");
			return false;
		}
		else if(!is_string(txtFirstName, 'First Name is not valid.'))
		{
			return false;
		}
		if ( txtLastName == '')
		{
			alert("Please enter your Last Name.");
			return false;
		}
		else if(!is_string(txtLastName, 'Last Name is not valid.'))
		{
			return false;
		}
		
		if ( txtUserName == '')
		{
			alert("Please enter your Username.");
			return false;
		}
		if(!validate_username(txtUserName))
		{
			alert("Please enter only number or letters for username\n No special characters or blank space is allowed");
			return false;
		}
		if ( txtPassword == '')
		{
			alert("Please enter your Password.");
			return false;
		}

		
		if ( txtRePassword == '')
		{
			alert("Please enter Re-type Password.");
			return false;
		}

		if (txtPassword != txtRePassword )
		{
			alert("Password and  Re-type Password must be same.");
			return false;
		}
		
		if(txtZipCode == '')
		{
			alert('Please enter the Zipcode/Postcode.');
			return false;
		}
		if ( txtEmail == '')
		{
			alert("Please enter Email.");
			return false;
		}

		if ( txtReTypeEmail == '')
		{
			alert("Please enter Re-type Email.");
			return false;
		}


		if (txtEmail != txtReTypeEmail )
		{
			alert("Email and Re-type Email must be same.");
			return false;
		}
	// if country is 'Other'
		if(txtCountry == 'Other')
		{
			var txtCountry_other = document.getElementById('txtCountry_other').value;
			txtCountry = txtCountry_other;
		}
		
		if( txtCountry == '')
		{
			alert("Please select the Country.");
			return false;
		}
		else if(!is_string(txtCountry, 'Country is not valid.'))
		{
			return false;
		}

		if(txtCountry == 'United States')
		{
			var state_text = document.getElementById('txtusstate').value;
			state  = '';
			if(state_text != '')
			{
				var split_text = state_text.split('_');
				state  = split_text[1];
			}
			var city = document.getElementById('txtuscity').value;
			if (state == '')
			{
				alert("Please select the State.");
				return false;
			}
			if ( city == '')
			{
				alert("Please select the City.");
				return false;
			}
		}
		else
		{
			var state = document.getElementById('txtotherstate').value;
			var city = document.getElementById('txtothercity').value;
			if (state == '')
			{
				alert("Please enter the State.");
				return false;
			}
			if(!is_string(state, "State not valid."))
			{
				return false;
			}

			if (city == '')
			{
				alert("Please enter the City.");
				return false;
			}
			else if(!is_string(city , "City not valid."))
			{
				
				return false;
			}
		}
		

		if ( cmbYear == '' || cmbMonth == '' || cmbDate == '')
		{
			alert("Please enter correct Birthday.");
			return false;
		}
		
		if (isLeapYear(cmbYear) == true)
		{
			if (cmbMonth == 2 && cmbDate > 29)
			{
				alert("Please enter correct Birthday.");
				return false;
			}
			else if((cmbMonth==4 || cmbMonth==6 || cmbMonth==9 || cmbMonth==11) && cmbDate > 30)
			{
				alert("Please enter correct Birthday.");
				return false;
			}
		}
		else
		{
			if (cmbMonth == 2 && cmbDate > 28)
			{
				alert("Please enter correct Birthday.");
				return false;
			}
			else if((cmbMonth==4 || cmbMonth==6 || cmbMonth==9 || cmbMonth==11) && cmbDate > 30)
			{
				alert("Please enter correct Birthday.");
				return false;
			}
		}
		
		if ( cmbRaceEthnicity == '')
		{
			alert("Please select the Race/Ethnicity.");
			return false;
		}
		else if(!is_race(cmbRaceEthnicity, 'Race/Ethnicity is not valid'))
		{
			return false;
		}

		if(trim(txtDatingHeadLine) == "")
		{
			alert('Please specify Your Dating Headline.');
			return false;
		}

		// validate dating hedline
		if(txtDatingHeadLine != "")
		{
			if(!is_valid_dating(txtDatingHeadLine))
			{
				
				return false;
				
			}
		}

		var query_string = "action=registration_one_request";
		query_string = query_string + "&txtFirstName="+escape(txtFirstName)+"&txtLastName="+escape(txtLastName)+"&txtUserName="+escape(txtUserName)+"&txtPassword="+escape(txtPassword)+"&txtRePassword="+escape(txtRePassword)+"&txtEmail="+escape(txtEmail)+"&txtReTypeEmail="+escape(txtReTypeEmail)+"&txtZipCode="+escape(txtZipCode)+"&txtCountry="+escape(txtCountry)+"&txtGender="+escape(txtGender)+"&cmbYear="+escape(cmbYear)+"&cmbMonth="+escape(cmbMonth)+"&cmbDate="+escape(cmbDate)+"&cmbRaceEthnicity="+escape(cmbRaceEthnicity)+"&txtDatingHeadLine="+escape(txtDatingHeadLine)+"&btn_submit=Y"+"&state="+escape(state)+"&city="+escape(city);
		
		show_processing_image();
		var script_name = "registration_one_process.php";
		send_request(script_name, query_string);

	}

	//END REGISTRATION ONE VALIDATION
	function check_country(country)
	{
		var obj_country = document.getElementById('other_country');			
		 
			if(country == 'United States')
			{
				var obj_us_state = document.getElementById('us_state');
				var obj_us_city = document.getElementById('us_city');
				obj_us_state.style.display = "inline";
				obj_us_city.style.display = "inline";
				var obj_other_state = document.getElementById('other_state');
				var obj_other_city = document.getElementById('other_city');
				obj_other_state.style.display = "none";
				obj_other_city.style.display = "none";
				obj_country.style.display = "none";
			/*
				var query_string = "action=fetch_us_state";
				query_string = query_string + "&country="+escape(country);
				show_processing_image();
				var script_name = "chang_state_city.php";
				send_request(script_name, query_string);
			*/
			}
			else
			{
				if(country == 'Other')
				{
					
					obj_country.style.display = "inline";
				}
				else
				{
					obj_country.style.display = "none";
				}
	
					var obj_us_state = document.getElementById('us_state');
					var obj_us_city = document.getElementById('us_city');
					obj_us_state.style.display = "none";
					obj_us_city.style.display = "none";
					var obj_other_state = document.getElementById('other_state');
					var obj_other_city = document.getElementById('other_city');
					obj_other_state.style.display = "inline";
					obj_other_city.style.display = "inline";
			}
	}
	
	function responce_fetch_us_state_city(response_text)
	{
		hide_processing_image();
		var obj_city_details = document.getElementById('us_city');

		obj_city_details.innerHTML = response_text;
 	}

	function change_us_state()
	{
		var state_text = document.getElementById('txtusstate').value;
		var split_text = state_text.split('_');
		state_id = split_text[0];
		if(state_id == '')
		{
			hide_processing_image();
			return;
		}
		var query_string = "action=fetch_us_city";
		query_string = query_string + "&state_id="+escape(state_id);
		show_processing_image();
		var script_name = "chang_state_city.php";
		send_request(script_name, query_string);
	}
	
	function call_all_city_state()
	{
		var txtCountry = document.getElementById('txtCountry').value;
		 if(txtCountry == 'United States')
		 {
		 	check_country(txtCountry);
		 	change_us_state();
		 }
	}
	function check_ethnicity(ethnicity)
	{
		var obj_ethnicity = document.getElementById('other_ethnicity');
		if(ethnicity == 'Other (specify)')
		{
			
			obj_ethnicity.style.display = "inline";
		}
		else
		{
			obj_ethnicity.style.display = "none";
		}
	}
	// response of registration process
	function response_reg_one(response_text)
	{
		var status_text = response_text.split('~');
		if(status_text[0] == 'Error')
		{
			//var arrMsg = status_text[1].split("[]");
			//document.getElementById(arrMsg[1]).style.display = "";
			var status_error = status_text[1].split("\n");
			if(status_error)
			{
				for(i=0; i<status_error.length; i++)
				{
					var error_group = status_error[i];
					var array_error_group = error_group.split("_");
					if(document.getElementById(array_error_group[0]))
					{
						document.getElementById(array_error_group[0]).style.display="";
						document.getElementById(array_error_group[0]).innerHTML = array_error_group[1];
						
						var control_array = array_error_group[0].split('div');
						if(document.getElementById("txt"+control_array[1]))
						{
							
							document.getElementById("txt"+control_array[1]).style.backgroundColor = "silver";
						}

					}
				}
			}

		}
		else
		{
			window.location.href = "registration_two.php";
		}
	}
	function recaptcha()
	{
		img = document.getElementById('imgCaptcha'); 
		var server_name = document.getElementById('server_name').value;
		//Change the image
		img.src = server_name+"captcha.php?" + Math.random();
	}

	function reg_two_process()
	{
		//HIDE ERROR MSG
		document.getElementById("divHeight").style.display = "none";
		document.getElementById("divHairColor").style.display = "none";
		document.getElementById("divEyeColor").style.display = "none";
		document.getElementById("divLookingFor").style.display = "none";
		document.getElementById("divRelationType").style.display = "none";
		document.getElementById("divRelationStatus").style.display = "none";
		document.getElementById("divHearAbout").style.display = "none";
		document.getElementById("divCreatedBy").style.display = "none";
		document.getElementById("divCaptch").style.display = "none";
		
		//HIDE ERROR MSG

		var txtFeet = document.getElementById('txtFeet').value;
		var txtInc = document.getElementById('txtInc').value;
		var txtCm = document.getElementById('txtCm').value;
		var cmbHairColor = document.getElementById('cmbHairColor').value;
		var cmbEyeColor = document.getElementById('cmbEyeColor').value;
		var cmbLookingFor = document.getElementById('cmbLookingFor').value;
		var cmbRelation = document.getElementById('cmbRelation').value;
		var cmbRelationshipStatus = document.getElementById('cmbRelationshipStatus').value;
		var cmbHearAbout = document.getElementById('cmbHearAbout').value;
		var cmbProfileCreated = document.getElementById('cmbProfileCreated').value;
		var txtCaptch = document.getElementById('txtCaptch').value;
		var txtReferral = document.getElementById('txt_ref_code').value;

		if((txtFeet == "" || txtInc == "") && txtCm == "" )
		{
			alert('Please enter your Height');
			return false;
		}
		if(txtCm !="")
		{
			if(IsNumeric(txtCm) == false)
			{
				alert('Please enter correct Height.');
				return false;
			}
		}

		if(cmbHairColor == "")
		{
			alert('Please specify your Hair Color.');
			return false;
		}
		if(cmbEyeColor == "")
		{
			alert('Please specify your Eye Color');
			return false;
		}
		if(cmbLookingFor == "")
		{
			alert('Please specify Who you are looking for?');
			return false;
		}
		if(cmbRelation == "")
		{
			alert('Please specify What type of relationship are you looking for?');
			return false;
		}
		if(cmbRelationshipStatus == "")
		{
			alert('Please specify What is your relationship status?');
			return false;
		}
		if(cmbHearAbout == "")
		{
			alert('Please specify How did you hear about us?');
			return false;
		}
		if(cmbProfileCreated == "")
		{
			alert('Please specify Profile Created By?');
			return false;
		}
		if(txtCaptch == "")
		{
			alert('Please enter the Verification Code');
			return false;
		}

		var query_string = "action=registration_two_request";
		query_string = query_string + "&txtFeet="+escape(txtFeet)+"&txtInc="+escape(txtInc)+"&txtCm="+escape(txtCm)+"&cmbHairColor="+escape(cmbHairColor)+"&cmbEyeColor="+escape(cmbEyeColor)+"&cmbLookingFor="+escape(cmbLookingFor)+"&cmbRelation="+escape(cmbRelation)+"&cmbRelationshipStatus="+escape(cmbRelationshipStatus)+"&cmbHearAbout="+escape(cmbHearAbout)+"&txtCaptch="+escape(txtCaptch)+"&cmbProfileCreated="+escape(cmbProfileCreated)+"&referralCode="+escape(txtReferral);

		show_processing_image();
		var script_name = "registration_two.php";
		send_request(script_name, query_string);
	}
	function response_reg_two(response_text)
	{
		var status_text = response_text.split('~');
		if(status_text[0] == 'Error')
		{
			//var arrMsg = status_text[1].split("[]");
			//document.getElementById(arrMsg[1]).style.display = "";
			var status_error = status_text[1].split("\n");
			if(status_error)
			{
				for(i=0; i<status_error.length; i++)
				{
					var error_group = status_error[i];
					var array_error_group = error_group.split("_");
					if(document.getElementById(array_error_group[0]))
					{
						document.getElementById(array_error_group[0]).style.display="";
						document.getElementById(array_error_group[0]).innerHTML = array_error_group[1];
						
						var control_array = array_error_group[0].split('div');
						if(document.getElementById("txt"+control_array[1]))
						{
						
							document.getElementById("txt"+control_array[1]).style.backgroundColor = "silver";
						}

					}
				}
			}

		}
		else
		{
			// submit the form
			document.frmRegistrationTwo.submit();

		}
	}

	function update_status(user_message_id)
	{
		var query_string = "action=update_message_status&user_message_id="+escape(user_message_id);
		var script_name = "messages.php";
		send_request(script_name, query_string);
	}
	function response_update_message_status(status_text)
	{
		// dont delete this function
	}
	function load_user_details(username)
	{
		if(document.getElementById('status_mess'))
		{
			var status_msg = document.getElementById('status_mess');
			status_msg.innerHTML = "";
		}
		
		
	
		if(username != "")
		{
			show_processing_image();
			var query_string = "action=print_user_details&username="+escape(username);
			var script_name = "compose_mail.php";
			send_request(script_name, query_string);
		}
	}

	function response_user_details(status_text)
	{
		
		var response_text = status_text.split('~');
		var obj_send_button = document.getElementById('send_button');
		if(trim(response_text[0]) == 'Error')
		{
			alert(response_text[1]);
			//obj_send_button.disabled = true;
			obj_send_button.style.display = "none";
		}
		else
		{
			var obj_profile_details = document.getElementById('profile_details');
			obj_profile_details.innerHTML = response_text[1];
			//obj_send_button.disabled = false;
			obj_send_button.style.display = "";
		}
	}
	
	// commony used in messages(inbox) page to determine that which message 
	// has been selected.
	function selected_checkbox()
	{
		var chk_length = document.frm_inbox.length;
		var counter = 0;
		var query_string = '';
		for(i=0; i<chk_length; i++)
		{
			var element = document.frm_inbox.elements[i];
			if(element.type == 'checkbox')
			{
				if(element.checked == true)
				{
					var element_name = element.name;
					var element_value = element.value;
					query_string = query_string + 
									"&"+element_name+"="+element_value;
				counter++;
				}
			}
		}
		if(counter == 0)
		{
			alert('No record is selected');
			return false;
		}
		else
		{
			
			return query_string;
		}
	}
	function delete_messages()
	{
		
		var query_string = "action=delete_message";
		var sel_check = selected_checkbox();
		if(!sel_check)
		{
			return false;
		}
		query_string +=sel_check;

		var conf = confirm('Do you really want to delete ?');
		if(conf)
		{
			show_processing_image();
			var script_name = "messages.php";
			send_request(script_name, query_string);
		}


	}

	// update the inbox messages
	function response_delete_message(status_text)
	{
		hide_processing_image();
		var response_text = status_text.split('~');
		if(response_text[0] == 'Error')
		{
			alert(response_text[1]);
		}
		else
		{
			var obj_inbox = document.getElementById('inbox_message');
			obj_inbox.innerHTML = response_text[1];
		}
	}
	// request to add items to favorites
	function add_to_favorites()
	{
		var query_string = "action=add_to_favorites";
		var sel_check = selected_checkbox();
		if(!sel_check)
		{
			return false;
		}
		query_string +=sel_check;
		show_processing_image();
		var script_name = "messages.php";
		send_request(script_name, query_string);
	}
	// response add favorites
	function response_add_favorites(status_text)
	{
		var response_text = status_text.split('~');
		alert(response_text[1]);
	}
	// request to accept the member
	function accept_member()
	{
		var query_string = "action=accept_member";
		var sel_check = selected_checkbox();
		if(!sel_check)
		{
			return false;
		}
		query_string +=sel_check;
		show_processing_image();
		var script_name = "messages.php";
		send_request(script_name, query_string);
	}

	//////////////////SHREE WORKING AREA///////////////////////

	//Edit Profile>>Basic
	function Edit_Profile_Basic_process()
	{
		//alert("hi");

		var txtFirstName = document.getElementById('txtFirstName').value;
		var txtLastName = document.getElementById('txtLastName').value;
		//var txtUserName = document.getElementById('txtUserName').value;
		//var txtPassword = document.getElementById('txtPassword').value;
		var txtEmail = document.getElementById('txtEmail').value;
		//var txtState = document.getElementById('txtState').value;
	 
		var txtNationality = document.getElementById('txtNationality').value;
		//var txtCity = document.getElementById('txtCity').value;
		var txtResidingIn = document.getElementById('txtResidingIn').value;
		var txtWeight = document.getElementById('txtWeight').value;
		var cmbMaritalStatus = document.getElementById('cmbMaritalStatus').value;
		var cmbBodyType = document.getElementById('cmbBodyType').value;
		var txtZipCode = document.getElementById('txtZipCode').value;
		var txtCountry = document.getElementById('txtCountry').value;
		var txtDatingHeadLine = document.getElementById('txtDatingHeadLine').value;
		var txtFeet = document.getElementById('txtFeet').value;
		var txtInc = document.getElementById('txtInc').value;
		var txtCm = document.getElementById('txtCm').value;
		
		var cmbGender = document.getElementById('cmbGender').value;
		var cmbYear = document.getElementById('cmbYear').value;
		var cmbMonth = document.getElementById('cmbMonth').value;
		var cmbDate = document.getElementById('cmbDate').value;
		var cmbBodyType = document.getElementById('cmbBodyType').value;
		var cmbHairColor = document.getElementById('cmbHairColor').value;
		var cmbEyeColor = document.getElementById('cmbEyeColor').value;
		var cmbLookingFor = document.getElementById('cmbLookingFor').value;
		var cmbRelation = document.getElementById('cmbRelation').value;
		var cmbRelationshipStatus = document.getElementById('cmbRelationshipStatus').value;
		var cmbLongRelation = document.getElementById('cmbLongRelation').value;
		//var txtComplexion = document.getElementById('txtComplexion').value;

		var chkAddFree = 'n';
		/*
		if (document.getElementById('chkAddFree').checked)
		{
			chkAddFree = 'y'
		}
		*/
		/*
		// if country is 'Other'
		if(txtCountry == 'Other')
		{
			var txtCountry_other = document.getElementById('txtCountry_other').value;
			txtCountry = txtCountry_other;
		}
*/
		if ( txtFirstName == '')
		{
			alert("Please enter your First Name.");
			return false;
		}
		else if(!is_string(txtFirstName, 'First name is not valid'))
		{
			return false;
		}
		if ( txtLastName == '')
		{
			alert("Please enter your Last Name.");
			return false;
		}
		else if(!is_string(txtLastName, 'Last name is not valid'))
		{
			return false;
		}
/*
		if ( txtUserName == '')
		{
			alert("Please enter User Name.");
			return false;
		}
		if ( txtPassword == '')
		{
			alert("Please enter Password.");
			return false;
		}
		*/
		if ( txtEmail == '')
		{
			alert("Please enter your Email Address.");
			return false;
		}
		
		if (validateEmail(txtEmail)==false)
		{
			return false;
		}
		
		if ( cmbGender == '')
		{
			alert("PleaseSelect Gender.");
			return false;
		}

		if ( cmbYear == '' || cmbMonth == '' || cmbDate == '')
		{
			alert("Please enter correct birth date");
			return false;
		}
		
		if (isLeapYear(cmbYear) == true)
		{
			if (cmbMonth == 2 && cmbDate > 29)
			{
				alert("Please enter correct birth date");
				return false;
			}
			else if((cmbMonth==4 || cmbMonth==6 || cmbMonth==9 || cmbMonth==11) && cmbDate > 30)
			{
				alert("Please enter correct birth date");
				return false;
			}
		}
		else
		{
			if (cmbMonth == 2 && cmbDate > 28)
			{
				alert("Please enter correct birth date");
				return false;
			}
			else if((cmbMonth==4 || cmbMonth==6 || cmbMonth==9 || cmbMonth==11) && cmbDate > 30)
			{
				alert("Please enter correct birth date");
				return false;
			}
		}
		/////
		// if country is 'Other'
		if(txtCountry == 'Other')
		{
			var txtCountry_other = document.getElementById('txtCountry_other').value;
			txtCountry = txtCountry_other;
		}
		
		if( txtCountry == '')
		{
			alert("Please select the country.");
			return false;
		}
		else if(!is_string(txtCountry, 'Country is not valid'))
		{
			return false;
		}

		if(txtCountry == 'United States')
		{
			var state_text = document.getElementById('txtusstate').value;
			txtState  = '';
			if(state_text != '')
			{
				var split_text = state_text.split('_');
				txtState  = split_text[1];
			}
			var txtCity = document.getElementById('txtuscity').value;
			if (txtState == '')
			{
				alert("Please select the state.");
				return false;
			}
			if ( txtCity == '')
			{
				alert("Please select the city.");
				return false;
			}
		}
		else
		{
			var txtState = document.getElementById('txtotherstate').value;
			var txtCity = document.getElementById('txtothercity').value;
			if (txtState == '')
			{
				alert("Please enter the state.");
				return false;
			}
			if(!is_string(txtState, "State not valid."))
			{
				return false;
			}

			if (txtCity == '')
			{
				alert("Please enter the city.");
				return false;
			}
			else if(!is_string(txtCity , "City not valid."))
			{
				
				return false;
			}
		}
	
		/////
	/*	if ( txtCountry == '')
		{
			alert("Please select the country.");
			return false;
		}
		else if(!is_string(txtCountry, 'Country is not valid'))
		{
			return false;
		}*/
		if ( txtZipCode == '')
		{
			alert("Please enter Zip Code.");
			return false;
		}
	/*	if ( txtState == '')
		{
			alert("Please enter State.");
			return false;
		}
		else if(!is_string(txtState, 'State is not valid'))
		{
			return false;
		} 
		if ( txtCity == '')
		{
			alert("Please enter City.");
			return false;
		}
		else if(!is_string(txtCity, 'City is not valid'))
		{
			return false;
		} 
		*/
		if ( txtNationality == '')
		{
			alert("Please enter Nationality.");
			return false;
		}
		else if(!is_string(txtNationality, 'Nationality is not valid'))
		{
			return false;
		} 
		if ( txtResidingIn == '')
		{
			alert("Please enter Residing in.");
			return false;
		}
		else if(!is_string(txtResidingIn, 'Residing in is not valid'))
		{
			return false;
		} 
		if(cmbBodyType == "")
		{
			alert('Please specify your Body Type');
			return false;
		}
		
		if((txtFeet == "" || txtInc == "") && txtCm == "")
		{
			
			alert('Please enter your height');
			return false;
		}
		
		if ( (IsNumeric(txtFeet)==false || IsNumeric(txtInc)==false) && txtCm == "" )
		{
			alert("Please enter only numeric value for Height.");
			return false;
		}
		if(txtCm != "" && IsNumeric(txtCm) == false)
		{
			alert("Please enter only numeric value for Height.");
			return false;
		}
		if ( txtWeight == '')
		{
			alert("Please enter Weight.");
			return false;
		}

/*		if (IsNumeric(txtWeight)==false)
		{
			alert("Please enter only numeric value for Weight.");
			return false;
		}
*/		
		if(cmbHairColor == "")
		{
			alert('Please specify your hair color');
			return false;
		}
		if(cmbEyeColor == "")
		{
			alert('Please specify your eye color');
			return false;
		}
		if ( cmbMaritalStatus == '')
		{
			alert("Please Select Marital Status.");
			return false;
		}
		if(cmbLookingFor == "")
		{
			alert('Please specify who you are looking for?');
			return false;
		}
		if(cmbRelation == "")
		{
			alert('Please specify your relationship type');
			return false;
		}
		if(cmbLongRelation == "")
		{
			alert('Select How long was your longest relationship?');
			return false;
		}
		if(cmbRelationshipStatus == "")
		{
			alert('Select your relationship status');
			return false;
		}
		if(trim(txtDatingHeadLine) == "")
		{
			alert('Please specify your dating headline');
			return false;
		}

		// validate dating hedline
		if(txtDatingHeadLine != "")
		{
			if(!is_valid_dating(txtDatingHeadLine))
			{
				
				return false;
				
			}
		}

		var query_string = "action=EditProfile_Basic";
		query_string +=	"&txtFirstName="+escape(txtFirstName );
		query_string +=	"&txtLastName="+escape(txtLastName  );
//		query_string +=	"&txtUserName="+escape(txtUserName  );
//		query_string +=	"&txtPassword="+escape(txtPassword  );
		query_string +=	"&txtEmail="+escape(txtEmail  );
		query_string +=	"&txtState="+escape(txtState  );
		query_string +=	"&txtNationality="+escape(txtNationality  );
		query_string +=	"&txtCity="+escape(txtCity  );
		query_string +=	"&txtResidingIn="+escape(txtResidingIn  );
		query_string +=	"&txtWeight="+escape(txtWeight  );
		query_string +=	"&cmbMaritalStatus="+escape(cmbMaritalStatus  );
		query_string += "&txtFeet="+escape(txtFeet);
		query_string += "&txtInc="+escape(txtInc);
		query_string += "&txtCm="+escape(txtCm);
		query_string += "&cmbHairColor="+escape(cmbHairColor);
		query_string += "&cmbEyeColor="+escape(cmbEyeColor);
		query_string += "&cmbLookingFor="+escape(cmbLookingFor);
		query_string += "&cmbRelation="+escape(cmbRelation);
		query_string += "&cmbRelationshipStatus="+escape(cmbRelationshipStatus);
		query_string += "&cmbLongRelation="+escape(cmbLongRelation);
		query_string += "&txtZipCode="+escape(txtZipCode);
		query_string += "&txtCountry="+escape(txtCountry);
		query_string += "&txtGender="+escape(cmbGender);
		query_string += "&cmbYear="+escape(cmbYear);
		query_string += "&cmbMonth="+escape(cmbMonth);
		query_string += "&cmbDate="+escape(cmbDate);
		query_string += "&cmbBodyType="+escape(cmbBodyType);
		query_string += "&txtDatingHeadLine="+escape(txtDatingHeadLine);
		//query_string += "&txtComplexion="+escape(txtComplexion);
		//query_string += "&chkAddFree="+escape(chkAddFree);
		query_string += "&btn_submit=Y";
	 
		show_processing_image();
		var script_name = "edit_profile_basics.php";
		send_request(script_name, query_string);
	}

	function is_valid_dating(dating_content)
	{
		var email =  /([A-Za-z0-9_\-\.\s])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})/gi;

		if(dating_content.search(email) != -1)
		{
			alert('E-mail or instant messenger (IM) addresses, website addresses or URLs, phone numbers, profane or sexual content is not allowed');
			return false;
		}

		var phno = /[0-9]{8}/gi;
		if(dating_content.search(phno) != -1)
		{
			alert('E-mail or instant messenger (IM) addresses, website addresses or URLs, phone numbers, profane or sexual content is not allowed');
			return false;
		}

		// validate web address
		var web_add = /[A-Za-z]+:\/\/[A-Za-z0-9-]+\.[A-Za-z0-9]+/gi;
		if(dating_content.search(web_add) != -1)
		{
			alert('E-mail or instant messenger (IM) addresses, website addresses or URLs, phone numbers, profane or sexual content is not allowed');
			return false;
		}
		var web_add = /[A-Za-z0-9-]+\.[A-Za-z0-9]+/gi;
		if(dating_content.search(web_add) != -1)
		{
			alert('E-mail or instant messenger (IM) addresses, website addresses or URLs, phone numbers, profane or sexual content is not allowed');
			return false;
		}
		var web_add = /www\.[A-Za-z0-9-]+\.[A-Za-z0-9]+/gi;
		if(dating_content.search(web_add) != -1)
		{
			alert('E-mail or instant messenger (IM) addresses, website addresses or URLs, phone numbers, profane or sexual content is not allowed');
			return false;
		}	

		return true;
	}
	function response_EditProfile_Basic(response_text)
	{
		var status_text = response_text.split('~');
		if(status_text[0] == 'Error')
		{
			alert(status_text[1]);
		}
		else
		{
			// submit the form
			window.location.href="edit_profile_aboutme.php"

		}
	}


	//Edit Profile >> About Me
	function Edit_Profile_AoutMe_process()
	{
		
		var txtAboutMe = document.getElementById('txtAboutMe').value;
		var txtDescribeBest = document.getElementById('txtDescribeBest').value;

		if (txtDescribeBest == '' )
		{
			alert("Please write few words that describe you best");
			document.getElementById('txtDescribeBest').focus();
			return false;
		}

		if (trim(txtAboutMe) == '' )
		{
			alert("Tell us about yourself and the type of person you would like to date");
			document.getElementById('txtAboutMe').focus();
			return false;
		}
		
		// validate dating hedline
		if(txtAboutMe != "")
		{
			if(!is_valid_dating(txtAboutMe))
			{
				
				return false;
				
			}
		}

		var query_string = "action=EditProfile_AboutMe";
		query_string = query_string + "&txtDescribeBest="+txtDescribeBest+"&txtAboutMe="+escape(txtAboutMe)+"&btn_submit=Y";

		show_processing_image();
		var script_name = "edit_profile_aboutme.php";
		send_request(script_name, query_string);
	
	}
	function response_EditProfile_AboutMe(response_text)
	{
		var status_text = response_text.split('~');
		if(status_text[0] == 'Error')
		{
			alert(status_text[1]);
		}
		else
		{
			// submit the form
			window.location.href="edit_profile_interest.php"

		}
	
	}
	//Edit Profile >> About Me

	//Edit Profile >> LifeStyle
	function Edit_Profile_LifeStyle_process()
	{
		
		
		var cmbExerciseHabit = document.getElementById('cmbExerciseHabit').value;
		var cmbEatHealthy = document.getElementById('cmbEatHealthy').value;
		var cmbSmoke = document.getElementById('cmbSmoke').value;
		var cmbDrink = document.getElementById('cmbDrink').value;
		var cmbHaveChild = document.getElementById('cmbHaveChild').value;
		
		var cmbChildUnder18 = document.getElementById('cmbChildUnder18').value;
		
		var cmbWantChild = document.getElementById('cmbWantChild').value;
		
		var txtLifeStyle = document.getElementById('txtLifeStyle').value;

		if (cmbExerciseHabit=='')
		{
			alert("Please choose how often do you exercise?");
			document.getElementById('cmbExerciseHabit').focus();
			return false;
		}

		if (cmbEatHealthy=='')
		{
			alert("Please choose do you eat healthy?");
			document.getElementById('cmbEatHealthy').focus();
			return false;
		}

		if (cmbSmoke=='')
		{
			alert("Please choose how often do you smoke? ");
			document.getElementById('cmbSmoke').focus();
			return false;
		}

		if (cmbDrink=='')
		{
			alert("Please choose how often do you drink?");
			document.getElementById('cmbDrink').focus();
			return false;
		}

		if (cmbWantChild=='')
		{
			alert("Please choose do you want children?");
			document.getElementById('cmbWantChild').focus();
			return false;
		}
		
		if (cmbHaveChild=='')
		{
			alert("Please choose do you have any children?");
			document.getElementById('cmbHaveChild').focus();
			return false;
		}

		if (cmbHaveChild=="Yes")
		{

			if (cmbChildUnder18=='')
			{
				alert("Please choose do you have any children who are under 18 and living with you?");
				document.getElementById('cmbChildUnder18').focus();
				return false;
			}
		}
		
		if (trim(txtLifeStyle)=='')
		{
			alert("Please specify your lifestyle details.");
			document.getElementById('txtLifeStyle').focus();
			return false;
		}

		var query_string = "action=EditProfile_LifeStyle";
		query_string =	query_string 
		query_string +=	"&cmbExerciseHabit="+escape(cmbExerciseHabit)
		query_string +=	"&cmbEatHealthy="+escape(cmbEatHealthy)
		query_string +=	"&cmbSmoke="+escape(cmbSmoke)
		query_string +=	"&cmbDrink="+escape(cmbDrink)
		query_string +=	"&cmbHaveChild="+escape(cmbHaveChild)
		query_string +=	"&cmbChildUnder18="+escape(cmbChildUnder18)
		query_string +=	"&cmbWantChild="+escape(cmbWantChild)
		query_string +=	"&txtLifeStyle="+escape(txtLifeStyle)
		query_string +=	"&btn_submit=Y";
		
		show_processing_image();
		var script_name = "edit_profile_lifestyle.php";
		send_request(script_name, query_string);
	}
	function response_EditProfile_LifeStyle(response_text)
	{
		var status_text = response_text.split('~');
		if(status_text[0] == 'Error')
		{
			alert(status_text[1]);
		}
		else
		{
			// submit the form
			//document.frmEditProfileLifeStyle.submit();
			window.location.href="edit_profile_background.php"

		}
	
	}
	//Edit Profile >> LifeStyle

	//Edit Profile >> background/Value
	function Edit_Profile_background_process()
	{
		//var txtCultural = document.getElementById('txtCultural').value;
		var cmbEthnicities = document.getElementById('cmbEthnicities').value;
		var obj_txt_ethni = document.getElementById('txt_ethnicity');
		if( cmbEthnicities == 'Other (specify)')
		{
			var cmbEthnicities = obj_txt_ethni.value;
		}
		var chkLanguages = "";//document.getElementById('chkLanguages').value;

		var txtSiblings = document.getElementById('txtSiblings').value;
		var cmbReligions = document.getElementById('cmbReligions').value;
		var cmbPolitical = document.getElementById('cmbPolitical').value;
		var txtBackgroundValue = document.getElementById('txtBackgroundValue').value;
		var txtBornReverted = document.getElementById('txtBornReverted').value;

/***********************************/
		var chk_length = document.frmEditProfileBackground.length;
		var counter = 0;
		var query_string = '';
		for(i=0; i<chk_length; i++)
		{
			var element = document.frmEditProfileBackground.elements[i];
			if(element.type == 'checkbox')
			{
				if(element.checked == true)
				{
					var element_name = element.name;
					var element_value = element.value;
					query_string = query_string + 
									"&"+element_name+"="+element_value;
				counter++;
				}
			}
		}
		
		if (cmbEthnicities=="" && obj_txt_ethni.value=="")
		{
			alert("Please select Which of the following ethnicities describe you best?");
			document.getElementById('cmbEthnicities').focus();
			return false;
		}
		else if (obj_txt_ethni.value !="" && !is_string(obj_txt_ethni.value, 'Ethnicity is not valid'))
		{
			return false;
		}

		if (txtBornReverted=="")
		{
			alert("Please select Born/Reverted.");
			document.getElementById('txtBornReverted').focus();
			return false;
		}
		if (cmbReligions=="")
		{
			alert("Please select Which of the following religions do you follow?");
			document.getElementById('cmbReligions').focus();
			return false;
		}
		if (txtSiblings=="")
		{
			alert("Please select How many siblings do you have?");
			document.getElementById('txtSiblings').focus();
			return false;
		}

		if (cmbPolitical=="")
		{
			alert("Please select Where do you sit on the political spectrum?");
			document.getElementById('cmbPolitical').focus();
			return false;
		}
		if (counter==0)
		{
			alert("Please select What languages do you speak? ");
			//document.getElementById('cmbEthnicities').focus();
			return false;
		}
		
		if(trim(txtBackgroundValue)=='')
		{
			alert("Please specify your background and values details.");
			document.getElementById('txtBackgroundValue').focus();
			return false;
		}
		query_string = "action=EditProfile_LifeStyle" + query_string;
//		query_string +=	query_string 
		query_string +=	"&cmbEthnicities="+escape(cmbEthnicities);
		//query_string +=	"&chkLanguages="+escape(chkLanguages);
		query_string +=	"&txtSiblings="+escape(txtSiblings);
		query_string +=	"&cmbReligions="+escape(cmbReligions);
		query_string +=	"&cmbPolitical="+escape(cmbPolitical);
		query_string +=	"&txtBackgroundValue="+escape(txtBackgroundValue);
		query_string +=	"&txtBornReverted="+escape(txtBornReverted);
		//query_string +=	"&txtCultural="+escape(txtCultural);
		query_string +=	"&btn_submit=Y";
		//alert(query_string);
		show_processing_image();
		var script_name = "edit_profile_background.php";
		send_request(script_name, query_string);
	}
	function response_EditProfile_Background(response_text)
	{
		var status_text = response_text.split('~');
		if(status_text[0] == 'Error')
		{
			alert(status_text[1]);
		}
		else
		{
			// submit the form
			window.location.href="edit_profile_education.php"

		}
	
	}
	//Edit Profile >> background/Value

	//Edit Profile >> EducationCareer
	function Edit_Profile_EducationCareer_process()
	{
		//alert("hi");
		var education = document.getElementById('education').value;
				
		var txtCollege = document.getElementById('txtCollege').value;
		var txtDegree = document.getElementById('txtDegree').value;
		var cmbOccupation = document.getElementById('cmbOccupation').value;
		var txtDescribeOccupation = document.getElementById('txtDescribeOccupation').value;
		var cmbAnnualIncome = document.getElementById('cmbAnnualIncome').value;

		if(education == "")
		{
			alert("Please select What is your highest level of education?");
			document.getElementById('education').focus();
			return false;
		}
 		if(education !='Less than high school' && education !='High School' && education != 'Some College')
		{
			if (txtCollege=="")
			{
				alert("Please enter What college(s) did or do you attend? ");
				document.getElementById('txtCollege').focus();
				return false;
			}

			if (txtDegree=="")
			{
				alert("Please enter What degree(s) do you have?");
				document.getElementById('txtDegree').focus();
				return false;
			}
		}
	
		if (cmbOccupation=="")
		{
			alert("Please select What is your current occupation?");
			document.getElementById('cmbOccupation').focus();
			return false;
		}


		if ( cmbAnnualIncome == "" )
		{
			alert("Please select What is your annual income?");
			document.getElementById('cmbAnnualIncome').focus();
			return false;
		}
		
		if ( trim(txtDescribeOccupation) == "" )
		{
			alert("Please describe your occupation.");
			document.getElementById('txtDescribeOccupation').focus();
			return false;
		}

		var query_string = "action=EditProfile_LifeStyle";
		query_string =	query_string 
		query_string +=	"&education="+escape(education)
		query_string +=	"&txtCollege="+escape(txtCollege)
		query_string +=	"&txtDegree="+escape(txtDegree)
		query_string +=	"&cmbOccupation="+escape(cmbOccupation)
		query_string +=	"&txtDescribeOccupation="+escape(txtDescribeOccupation)
		query_string +=	"&cmbAnnualIncome="+escape(cmbAnnualIncome)
		query_string +=	"&btn_submit=Y";
		
		
		show_processing_image();
		var script_name = "edit_profile_education.php";
		send_request(script_name, query_string);
	}
	function response_EditProfile_Education(response_text)
	{
		var status_text = response_text.split('~');
		if(status_text[0] == 'Error')
		{
			alert(status_text[1]);
		}
		else
		{
			// submit the form
			window.location.href="edit_profile_home.php"

		}
	
	}

	//Edit Profile >> EducationCareer

	
	function Edit_Profile_Interest_process()
	{
		var interest = document.getElementById('interest').value;
				
		var txtForFun = document.getElementById('txtForFun').value;
		var cmbArt = document.getElementById('cmbArt').value;
		var txtFavoritesBooks = document.getElementById('txtFavoritesBooks').value;
		var txtFavoriteFood = document.getElementById('txtFavoriteFood').value;
		var txtFavoriteMovies = document.getElementById('txtFavoriteMovies').value;
		var cmbTypesOfPets = document.getElementById('cmbTypesOfPets').value;
		var cmbSportExercise = document.getElementById('cmbSportExercise').value;
		var cmbWatchingSports = document.getElementById('cmbWatchingSports').value;

		if (interest=='')
		{
			alert("Please choose which activities you like to do");
			return false;
		}

		if(txtForFun=='') 
		{
			alert("Please enter about what you like to do for fun");
			document.getElementById('txtForFun').focus();
			return false;
		}

		if(interest ==  "Museums and Art")
		{
			if (cmbArt=='')
			{
				alert("Please choose which types of art you enjoy");
				document.getElementById('cmbArt').focus();
				return false;
			}
		}
		
		if(interest == "Book club/Reading")
		{
			if (txtFavoritesBooks=='')
			{
				alert("Please enter what are your favorites books or types of books");
				document.getElementById('txtFavoritesBooks').focus();
				return false;
			}
		}

		if (interest == "Dining out")
		{
			if (txtFavoriteFood=='')
			{
				alert("Please enter what are your favorite food dishes or types of dishes.");
				document.getElementById('txtFavoriteFood').focus();
				return false;
			}

		}

		if (interest == "Movies")
		{
			if (txtFavoriteMovies=="")
			{
				alert("Please enter What are your favorite movies or types of movies");
				document.getElementById('txtFavoriteMovies').focus();
				return false;
			}
		}

		if (interest=="Pets")
		{
			if (cmbTypesOfPets=="")
			{
				alert("Please Choose which types of pets you like");
				document.getElementById('cmbTypesOfPets').focus();
				return false;
			}
		}

		if (interest=="Playing Sports")
		{
			if (cmbSportExercise=="")
			{
				alert("Please Choose what sports and exercise you like to do");
				document.getElementById('cmbSportExercise').focus();
				return false;
			}
		}

		if (interest=="Watching Sports")
		{
			if (cmbWatchingSports=="")
			{
				alert("Please choose which sports you like to watch.");
				return false;
			}

		}


/*
//var txtFavoriteMusicArtists = document.getElementById('txtFavoriteMusicArtists').value;
if (interest=="Music")
		{
			if (txtFavoriteMusicArtists=="")
			{
				alert("Please enter What types of music do you like");
				document.getElementById('txtFavoriteMusicArtists').focus();
				return false;
			}
		}
query_string +="&txtFavoriteMusicArtists="+escape(txtFavoriteMusicArtists)*/
		
		var query_string = "action=EditProfile_Interest";
		query_string =	query_string 
		query_string +=	"&interest="+escape(interest)
		query_string +=	"&txtForFun="+escape(txtForFun)
		query_string +=	"&cmbArt="+escape(cmbArt)
		query_string +=	"&txtFavoritesBooks="+escape(txtFavoritesBooks)
		query_string +=	"&txtFavoriteFood="+escape(txtFavoriteFood)
		query_string +=	"&txtFavoriteMovies="+escape(txtFavoriteMovies)
		query_string +=	"&cmbTypesOfPets="+escape(cmbTypesOfPets)
		query_string +=	"&cmbSportExercise="+escape(cmbSportExercise)
		query_string +=	"&cmbWatchingSports="+escape(cmbWatchingSports)
		query_string +=	"&btn_submit=Y";
		
		//alert(query_string);return false;
		show_processing_image();
		var script_name = "edit_profile_interest.php";
		send_request(script_name, query_string);
	
	}
	function response_EditProfile_Interest(response_text)
	{
		var status_text = response_text.split('~');
		if(status_text[0] == 'Error')
		{
			alert(status_text[1]);
		}
		else
		{
			// submit the form
			window.location.href="edit_profile_lifestyle.php"
		}
	}

	function limitText(limitField, limitCount, limitNum) 
	{
		if (limitField.value.length > limitNum) 
		{
			limitField.value = limitField.value.substring(0, limitNum);
		} 
		else 
		{
			limitCount.value = limitNum - limitField.value.length;
		}
	}


	function validateEmail(email) 
	{
		var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
		
		if(reg.test(email) == false) 
		{
			alert('Invalid Email Address');
		    return false;
		}
	}

	function isLeapYear(yr)
	{
		if(yr%4==0)
			return true;
		else
			return false;
	}

	function IsNumeric(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = "0123456789.-";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
			blnResult = false;
         }
      }
   return blnResult;
   }
   
   function validate_username (username)
   {
	   var error = true;
	   var illegalChars = /\W/;
	  // allow only letters, numbers, and underscores
		if (illegalChars.test(username)) {
		   error = false;
		}
		return error;
   }

   function is_string(elem, helperMsg)
   {

		var alphaExp = /^[a-zA-Z/\s]+$/;
		if(elem.match(alphaExp)){
			return true;
		}else{
			alert(helperMsg);
			return false;
		}

   }

   function is_race(elem, helperMsg)
   {
		var alphaExp = /^[a-zA-Z/\s\/\-]+$/;
		if(elem.match(alphaExp)){
			return true;
		}else{
			alert(helperMsg);
			return false;
		}
   }
   /* search custom save*/
	function search_custom_save(tag)
	{

		var txtSearchName = '';
		var search_key = '';
		if(document.getElementById('txtSearchName'))
		{
			 txtSearchName = document.getElementById('txtSearchName').value;
		}
		if(document.getElementById('user_search'))
		{
			 search_key = document.getElementById('user_search').value;
		}
		var txtLowerAge = document.getElementById('txtLowerAge').value;
		var txtUpperAge = document.getElementById('txtUpperAge').value;
		
		if(tag == 'save')
		{

			if (txtSearchName =="")
			{
				alert("Please enter Serch Name.");
				document.getElementById('txtSearchName').focus();
				return false;
			}
			
			if(txtLowerAge !="")
			{
				if (IsNumeric(txtLowerAge)==false)
				{
					alert("Please enter only Numeric Value.");
					document.getElementById('txtLowerAge').focus();
					return false;
				}
			}
			
			if(txtUpperAge !="")
			{

				if (IsNumeric(txtUpperAge)==false)
				{
					alert("Please enter only Numeric Value.");
					document.getElementById('txtUpperAge').focus();
					return false;
				}
			}
		
		}
		var cmbGender = document.getElementById('cmbGender').value;
				

		var chkWithInMyCountry = document.getElementById('txtCountry').value;
		//if ( ! document.getElementById('chkWithInMyCountry').checked )
			//chkWithInMyCountry = 'n';

		if(document.getElementById('save_search'))
		{
			var search_box = document.getElementById('save_search');
			search_box.style.display = "none";
		}
		

		var chkWithoutPhoto = document.getElementById('chkWithoutPhoto').value;
		if ( ! document.getElementById('chkWithoutPhoto').checked )
			chkWithoutPhoto = 'n';

		var chkWithoutProfile = document.getElementById('chkWithoutProfile').value;
		if ( ! document.getElementById('chkWithoutProfile').checked )
			chkWithoutProfile = 'n';

		var chkLookingFriendship = document.getElementById('chkLookingFriendship').value;
		if ( ! document.getElementById('chkLookingFriendship').checked )
			chkLookingFriendship = 'n';

		var chkCasualRelationship = document.getElementById('chkCasualRelationship').value;
		if ( ! document.getElementById('chkCasualRelationship').checked )
			chkCasualRelationship = 'n';

		var chkSeriousRelationships = document.getElementById('chkSeriousRelationships').value;
		if ( ! document.getElementById('chkSeriousRelationships').checked )
			chkSeriousRelationships = 'n';

		var cmbSmoke = document.getElementById('cmbSmoke').value;
		var cmbDrink = document.getElementById('cmbDrink').value;
		
		var cmbEthnicities = document.getElementById('cmbEthnicities').value;
		var cmbReligion = document.getElementById('cmbReligion').value;
		var cmbEducation = document.getElementById('cmbEducation').value;

		var cmbBodyType = document.getElementById('cmbBodyType').value;

		//var txtSearchName = document.getElementById('txtSearchName').value;
		cmbEmailSearchFor = '';
		if(document.getElementById('cmbEmailSearchFor'))
		{
			var cmbEmailSearchFor = document.getElementById('cmbEmailSearchFor').value;
		}
		
		var chkWithInMyCity = '';
		if(document.getElementById('txtuscity'))
		{
			if(chkWithInMyCountry == 'United States')
			chkWithInMyCity = document.getElementById('txtuscity').value;
		}
		//if ( ! document.getElementById('chkWithInMyCity').checked )
			//chkWithInMyCity = 'n';

		var chkWithInMyState = '';
		if(document.getElementById('txtusstate'))
		{
			if(chkWithInMyCountry == 'United States')
			{
				chkWithInMyState = document.getElementById('txtusstate').value;
				arr_state  = chkWithInMyState.split("_");
				if(arr_state[1])
				{
					chkWithInMyState = arr_state[1];
				}
				else
				{
					chkWithInMyState = '';
				}
			}
		}
		//if ( ! document.getElementById('chkWithInMyState').checked )
			//chkWithInMyState = 'n';

		if(document.getElementById('chkEmailMe'))
		{
			if (document.getElementById('chkEmailMe').checked == false)
			cmbEmailSearchFor = 0;
		}
		//var chkWithInMyMiles = document.getElementById('chkWithInMyMiles').value;
		
		if(tag == 'save')
		{
			var query_string = "action=search_custom_save";
		}
		else if(tag == 'search')
		{
			var query_string = "action=show_form&sub=custom_search";
		}
		
		query_string += "&txtLowerAge=" +escape(txtLowerAge); 
		query_string += "&txtUpperAge=" +escape(txtUpperAge);
		query_string += "&cmbGender=" +escape(cmbGender);
		query_string += "&chkWithInMyCountry=" +escape(chkWithInMyCountry);  
		//query_string += "&chkByRadius=" +escape(chkByRadius);
		//query_string += "&txtLowerMiles=" +escape(txtLowerMiles);
		//query_string += "&txtUpperMiles=" +escape(txtUpperMiles);
		query_string += "&chkWithoutPhoto=" +escape(chkWithoutPhoto);
		query_string += "&chkWithoutProfile=" +escape(chkWithoutProfile);
		query_string += "&chkLookingFriendship=" +escape(chkLookingFriendship); 
		query_string += "&chkCasualRelationship=" +escape(chkCasualRelationship);
		query_string += "&chkSeriousRelationships=" +escape(chkSeriousRelationships);
		query_string += "&cmbSmoke=" +escape(cmbSmoke); 
		query_string += "&cmbDrink=" +escape(cmbDrink); 
		query_string += "&cmbEthnicities=" +escape(cmbEthnicities); 
		query_string += "&cmbReligion=" +escape(cmbReligion); 
		query_string += "&cmbEducation=" +escape(cmbEducation); 
		query_string += "&cmbBodyType=" +escape(cmbBodyType); 
		query_string += "&txtSearchName=" +escape(txtSearchName); 
		query_string += "&cmbEmailSearchFor=" +escape(cmbEmailSearchFor); 
		query_string += "&chkWithInMyCity=" +escape(chkWithInMyCity);  
		query_string += "&chkWithInMyState=" +escape(chkWithInMyState);  
		//query_string += "&chkWithInMyMiles=" +escape(chkWithInMyMiles);  
		
		if(tag == 'save')
		{
			show_processing_image();
			var script_name = "search_custom.php";
			send_request(script_name, query_string);
		}
		else
		{
			window.location.href="search_custom.php?"+query_string+"&search_key="+search_key+"&new_search=y";
		}
	}

	function response_Search_CustomSave(response_text)
	{
		var status_text = response_text.split('~');
		if(status_text[0] == 'Error')
		{
			alert(status_text[1]);
		}
		else
		{
			// submit the form
			var qstring = '';
			if(status_text[1] && status_text[1] != "")
			{
				qstring = status_text[1];
			}
			window.location.href="search_custom.php?"+qstring;
			
		}
	}


	function fnSearchCustomProfile()
	{
		var txtSearchWord = document.getElementById("txtSearchWord").value;

		var query_string = "action=search_custom_profile";

		query_string += "&txtSearchWord=" +escape(txtSearchWord); 
		query_string += "&txtLowerAge=" +escape(txtLowerAge); 
		query_string += "&txtUpperAge=" +escape(txtUpperAge);
		query_string += "&cmbGender=" +escape(cmbGender);
		query_string += "&chkWithInMyCountry=" +escape(chkWithInMyCountry);  
		query_string += "&chkByRadius=" +escape(chkByRadius);
		query_string += "&txtLowerMiles=" +escape(txtLowerMiles);
		query_string += "&txtUpperMiles=" +escape(txtUpperMiles);
		query_string += "&chkWithoutPhoto=" +escape(chkWithoutPhoto);
		query_string += "&chkWithoutProfile=" +escape(chkWithoutProfile);
		query_string += "&chkLookingFriendship=" +escape(chkLookingFriendship); 
		query_string += "&chkCasualRelationship=" +escape(chkCasualRelationship);
		query_string += "&chkSeriousRelationships=" +escape(chkSeriousRelationships);
		query_string += "&cmbSmoke=" +escape(cmbSmoke); 
		query_string += "&cmbDrink=" +escape(cmbDrink); 
		query_string += "&cmbLiving=" +escape(cmbLiving); 
		query_string += "&cmbEthnicities=" +escape(cmbEthnicities); 
		query_string += "&cmbReligion=" +escape(cmbReligion); 
		query_string += "&cmbEducation=" +escape(cmbEducation); 
		query_string += "&cmbBodyType=" +escape(cmbBodyType); 
		query_string += "&txtSearchName=" +escape(txtSearchName); 
		query_string += "&cmbEmailSearchFor=" +escape(cmbEmailSearchFor); 
		
		//alert(query_string);
		show_processing_image();
		var script_name = "search_custom.php";
		
		send_request(script_name, query_string);

	}

	function response_Search_Custom_Profile(response_text)
	{
		var status_text = response_text.split('~');
		if(status_text[0] == 'Error')
		{
			alert(status_text[1]);
		}
		else
		{
			var obj_showProfile = document.getElementById("showprofilelist");
			obj_showProfile.innerHTML = status_text[1];
			//alert(status_text[1]);
		}
	}

	/*search custom save*/


	/*search custom edit*/
	function show_search_custom_edit()
	{
		var user_search = document.getElementById("user_search").value;

		/*if (user_search =="")
		{
			alert("Please select Saved Search.");
			document.getElementById("user_search").focus();
			return false;
		}*/

		var query_string = "action=show_search_custom_edit";

		query_string += "&user_search=" +escape(user_search); 
		
		show_processing_image();
		var script_name = "search_edit_saved.php";
		//alert(script_name + "?"+ query_string);
		send_request(script_name, query_string);
	}

	function response_Show_Search_Custom_Edit(response_text)
	{
		var status_text = response_text.split('~');
		if(status_text[0] == 'Error')
		{
			alert(status_text[1]);
		}
		else
		{
			//alert(status_text[1]);
			var obj_showProfile = document.getElementById("content");
			obj_showProfile.innerHTML = status_text[1];
			
		}
	}

	function search_edit_saved()
	{
		var user_search = document.getElementById('user_search').value;

		if (user_search =="")
		{
			alert("Please select Serch Name.");
			document.getElementById('user_search').focus();
			return false;
		}

		var txtLowerAge = document.getElementById('txtLowerAge').value;
		if (IsNumeric(txtLowerAge)==false)
		{
			alert("Please enter only Numeric Value.");
			document.getElementById('txtLowerAge').focus();
			return false;
		}
		
		var txtUpperAge = document.getElementById('txtUpperAge').value;
		if (IsNumeric(txtUpperAge)==false)
		{
			alert("Please enter only Numeric Value.");
			document.getElementById('txtUpperAge').focus();
			return false;
		}

		var cmbGender = document.getElementById('cmbGender').value;
				

		var chkWithInMyCountry = document.getElementById('txtCountry').value;
		//if ( ! document.getElementById('chkWithInMyCountry').checked )
			//chkWithInMyCountry = 'n';
		
		var chkWithInMyCity = '';
		if(document.getElementById('txtuscity'))
		{
			if(chkWithInMyCountry == 'United States')
			chkWithInMyCity = document.getElementById('txtuscity').value;
		}
		//if ( ! document.getElementById('chkWithInMyCity').checked )
			//chkWithInMyCity = 'n';

		var chkWithInMyState = '';
		if(document.getElementById('txtusstate'))
		{
			if(chkWithInMyCountry == 'United States')
			{
				chkWithInMyState = document.getElementById('txtusstate').value;
				arr_state  = chkWithInMyState.split("_");
				if(arr_state[1])
				{
					chkWithInMyState = arr_state[1];
				}
				else
				{
					chkWithInMyState = '';
				}
			}
		}
		
		//if ( ! document.getElementById('chkWithInMyState').checked )
			//chkWithInMyState = 'n';


		/*
		var chkByRadius = document.getElementById('chkByRadius').value;
		if ( ! document.getElementById('chkByRadius').checked )
			chkByRadius = 'n';

		var txtLowerMiles = document.getElementById('txtLowerMiles').value;
		if (IsNumeric(txtLowerMiles)==false)
		{
			alert("Please enter only Numeric Value.");
			document.getElementById('txtLowerMiles').focus();
			return false;
		}

		var txtUpperMiles = document.getElementById('txtUpperMiles').value;
		if (IsNumeric(txtUpperMiles)==false)
		{
			alert("Please enter only Numeric Value.");
			document.getElementById('txtUpperMiles').focus();
			return false;
		}
		*/
		//var search_box = document.getElementById('save_search');
		//search_box.style.display = "none";

		var chkWithoutPhoto = document.getElementById('chkWithoutPhoto').value;
		if ( ! document.getElementById('chkWithoutPhoto').checked )
			chkWithoutPhoto = 'n';

		var chkWithoutProfile = document.getElementById('chkWithoutProfile').value;
		if ( ! document.getElementById('chkWithoutProfile').checked )
			chkWithoutProfile = 'n';

		var chkLookingFriendship = document.getElementById('chkLookingFriendship').value;
		if ( ! document.getElementById('chkLookingFriendship').checked )
			chkLookingFriendship = 'n';

		var chkCasualRelationship = document.getElementById('chkCasualRelationship').value;
		if ( ! document.getElementById('chkCasualRelationship').checked )
			chkCasualRelationship = 'n';

		var chkSeriousRelationships = document.getElementById('chkSeriousRelationships').value;
		if ( ! document.getElementById('chkSeriousRelationships').checked )
			chkSeriousRelationships = 'n';

		var cmbSmoke = document.getElementById('cmbSmoke').value;
		var cmbDrink = document.getElementById('cmbDrink').value;
		
		var cmbEthnicities = document.getElementById('cmbEthnicities').value;
		var cmbReligion = document.getElementById('cmbReligion').value;
		var cmbEducation = document.getElementById('cmbEducation').value;

		var cmbBodyType = document.getElementById('cmbBodyType').value;

		var query_string = "action=search_edit_saved";
		query_string += "&user_search=" +escape(user_search); 
		query_string += "&txtLowerAge=" +escape(txtLowerAge); 
		query_string += "&txtUpperAge=" +escape(txtUpperAge);
		query_string += "&cmbGender=" +escape(cmbGender);
		query_string += "&chkWithInMyCountry=" +escape(chkWithInMyCountry);  
		//query_string += "&chkByRadius=" +escape(chkByRadius);
		//query_string += "&txtLowerMiles=" +escape(txtLowerMiles);
		//query_string += "&txtUpperMiles=" +escape(txtUpperMiles);
		query_string += "&chkWithoutPhoto=" +escape(chkWithoutPhoto);
		query_string += "&chkWithoutProfile=" +escape(chkWithoutProfile);
		query_string += "&chkLookingFriendship=" +escape(chkLookingFriendship); 
		query_string += "&chkCasualRelationship=" +escape(chkCasualRelationship);
		query_string += "&chkSeriousRelationships=" +escape(chkSeriousRelationships);
		query_string += "&cmbSmoke=" +escape(cmbSmoke); 
		query_string += "&cmbDrink=" +escape(cmbDrink); 
		query_string += "&cmbEthnicities=" +escape(cmbEthnicities); 
		query_string += "&cmbReligion=" +escape(cmbReligion); 
		query_string += "&cmbEducation=" +escape(cmbEducation); 
		query_string += "&cmbBodyType=" +escape(cmbBodyType); 
		query_string += "&chkWithInMyCity=" +escape(chkWithInMyCity);  
		query_string += "&chkWithInMyState=" +escape(chkWithInMyState);  

		

		show_processing_image();
		//alert(query_string);return false;
		var script_name = "search_edit_saved.php";
		send_request(script_name, query_string);
	}

	function response_Search_Edit_Saved(response_text)
	{
		var status_text = response_text.split('~');
		if(status_text[0] == 'Error')
		{
			alert(status_text[1]);
		}
		else
		{
			alert(status_text[1]);
		}
	}

	function search_edit_remove()
	{
		var user_search = document.getElementById('user_search').value;

		var objSearchName = document.getElementById('user_search');
		
		

		if (user_search =="")
		{
			alert("Please select Serch Name.");
			document.getElementById('user_search').focus();
			return false;
		}

		if (!confirm("Are you sure you want delete '" +objSearchName.options[objSearchName.selectedIndex].text + "' search name?"))
		{
			return false;
		}

		
		var query_string = "action=search_edit_remove";
		query_string += "&user_search=" +escape(user_search);

		show_processing_image();
		var script_name = "search_edit_saved.php";
		//alert(script_name + "?" + query_string);return false;
		send_request(script_name, query_string);
	}
	function response_Search_Edit_Remove(response_text)
	{
		var status_text = response_text.split('~');
		if(status_text[0] == 'Error')
		{
			alert(status_text[1]);
		}
		else
		{
			alert(status_text[1]);
			window.location.href='search_edit_saved.php';
		}
	}


/*search custom edit*/

/*tell a friend*/
	function tell_friend()
	{
		var txtFromEmail = document.getElementById("txtFromEmail").value; 
		var txtToEmail = document.getElementById("txtToEmail").value; 
		var txtMessage = document.getElementById("txtMessage").value;
		var txtCaptcha = document.getElementById("txtCaptcha").value;

		if (txtFromEmail=="")
		{
			alert("Please enter your email address.");
			document.getElementById("txtFromEmail").focus();
			return false;
		}

		if (validateEmail(txtFromEmail)==false)
		{
			//alert("Please enter your valid email address.");
			document.getElementById("txtFromEmail").focus();
			return false;
		}
		
		if (txtToEmail=="")
		{
			alert("Please enter your friend email address.");
			document.getElementById("txtToEmail").focus();
			return false;
		}

		if (validateEmail(txtToEmail)==false)
		{
			//alert("Please enter valid email address.");
			document.getElementById("txtToEmail").focus();
			return false;
		}

		if (txtMessage=="")
		{
			alert("Please enter message.");
			document.getElementById("txtMessage").focus();
			return false;
		}




		var query_string = "action=tell_a_friend";

		query_string += "&txtFromEmail=" +escape(txtFromEmail); 
		query_string += "&txtToEmail=" +escape(txtToEmail); 
		query_string += "&txtMessage=" +escape(txtMessage);
		query_string += "&txtCaptcha=" +escape(txtCaptcha);

		show_processing_image();
		var script_name = "tell_a_friend.php";
		send_request(script_name, query_string);
	
	}
	function response_tell_a_friend(response_text)
	{
		var status_text = response_text.split('~');
		if(status_text[0] == 'Error')
		{
			alert(status_text[1]);
		}
		else
		{
			//alert(status_text[1]);
			var obj_showMsg = document.getElementById("content");
			obj_showMsg.innerHTML = status_text[1];
		}
	}
/*tell a friend*/

/*Conatc Us*/
function contact_us()
	{
		var txtYourName = document.getElementById("txtYourName").value; 
		var txtPhone = document.getElementById("txtPhone").value; 
		var txtYourEmail = document.getElementById("txtYourEmail").value; 
		var txtSubject = document.getElementById("txtSubject").value; 
		var txtMessage = document.getElementById("txtMessage").value;
		var txtCaptcha = document.getElementById("txtCaptcha").value;

		if (txtYourName=="")
		{
			alert("Please enter your name.");
			document.getElementById("txtYourName").focus();
			return false;
		}

/*
		if (txtPhone=="")
		{
			alert("Please enter your phone number.");
			document.getElementById("txtPhone").focus();
			return false;
		}
*/

		if (txtYourEmail=="")
		{
			alert("Please enter your email address.");
			document.getElementById("txtYourEmail").focus();
			return false;
		}

		if (validateEmail(txtYourEmail)==false)
		{
			//alert("Please enter your valid email address.");
			document.getElementById("txtYourEmail").focus();
			return false;
		}
		
		if (txtSubject=="")
		{
			alert("Please enter subject.");
			document.getElementById("txtSubject").focus();
			return false;
		}

		if (txtMessage=="")
		{
			alert("Please enter message.");
			document.getElementById("txtMessage").focus();
			return false;
		}

		if (txtCaptcha=="")
		{
			alert("Please enter Verification Code.");
			document.getElementById("txtCaptcha").focus();
			return false;
		}
	


		var query_string = "action=contact_us";

		query_string += "&txtYourName=" +escape(txtYourName); 
		query_string += "&txtPhone=" +escape(txtPhone); 
		query_string += "&txtYourEmail=" +escape(txtYourEmail); 
		query_string += "&txtSubject=" +escape(txtSubject); 

		query_string += "&txtMessage=" +escape(txtMessage);
		query_string += "&txtCaptcha=" +escape(txtCaptcha);

		show_processing_image();
		var script_name = "contact.php";
		send_request(script_name, query_string);
	
	}
	function response_contact_us(response_text)
	{
		var status_text = response_text.split('~');
		if(status_text[0] == 'Error')
		{
			alert(status_text[1]);
		}
		else
		{
			//alert(status_text[1]);
			var obj_showMsg = document.getElementById("content");
			obj_showMsg.innerHTML = status_text[1];
		}
	}

/*Conatc Us*/
/*Help*/
function help()
	{
		var txtYourName = document.getElementById("txtYourName").value; 
		var txtPhone = document.getElementById("txtPhone").value; 
		var txtYourEmail = document.getElementById("txtYourEmail").value; 
		var txtSubject = document.getElementById("txtSubject").value; 
		var txtMessage = document.getElementById("txtMessage").value;
		var txtCaptcha = document.getElementById("txtCaptcha").value;

		if (txtYourName=="" || txtYourName=="Your Name")
		{
			alert("Please enter your name.");
			document.getElementById("txtYourName").focus();
			return false;
		}

/*
		if (txtPhone=="" || txtPhone=="Your Phone")
		{
			alert("Please enter your phone number.");
			document.getElementById("txtPhone").focus();
			return false;
		}
*/

		if (txtYourEmail=="" || txtYourEmail== "Your Email" )
		{
			alert("Please enter your email address.");
			document.getElementById("txtYourEmail").focus();
			return false;
		}

		if (validateEmail(txtYourEmail)==false)
		{
			//alert("Please enter your valid email address.");
			document.getElementById("txtYourEmail").focus();
			return false;
		}
		
		if (txtSubject=="" || txtSubject=="Subject")
		{
			alert("Please enter subject.");
			document.getElementById("txtSubject").focus();
			return false;
		}

		if (txtMessage=="" || txtMessage=="Your Message")
		{
			alert("Please enter message.");
			document.getElementById("txtMessage").focus();
			return false;
		}

		if (txtCaptcha=="")
		{
			alert("Please enter Verification Code.");
			document.getElementById("txtCaptcha").focus();
			return false;
		}
	


		var query_string = "action=help";

		query_string += "&txtYourName=" +escape(txtYourName); 
		query_string += "&txtPhone=" +escape(txtPhone); 
		query_string += "&txtYourEmail=" +escape(txtYourEmail); 
		query_string += "&txtSubject=" +escape(txtSubject); 

		query_string += "&txtMessage=" +escape(txtMessage);
		query_string += "&txtCaptcha=" +escape(txtCaptcha);

		show_processing_image();
		var script_name = "help.php";
		send_request(script_name, query_string);
	
	}
	function response_help(response_text)
	{
		var status_text = response_text.split('~');
		if(status_text[0] == 'Error')
		{
			alert(status_text[1]);
		}
		else
		{
			//alert(status_text[1]);
			var obj_showMsg = document.getElementById("ContactForm");
			obj_showMsg.innerHTML = status_text[1];
		}
	}

/*Help*/

	

	//////////////////END SHREE WORKING AREA//////////////////////

	// Send request to block the selected member
	function block_member(operation)
	{
		var query_string = "action=block_member&operation="+operation;
		var sel_check = selected_checkbox();
		if(!sel_check)
		{
			return false;
		}
		query_string +=sel_check;
		show_processing_image();
		var script_name = "messages.php";
		send_request(script_name, query_string);
	}
	
	function block_mem(operation)
	{
		var query_string = "action=block_member&operation="+operation;
		var sel_check = selected_checkbox();
		if(!sel_check)
		{
			return false;
		}
		query_string +=sel_check;
		show_processing_image();
		var script_name = "accepted_user.php";
		send_request(script_name, query_string);
	}
	// Send request to report the abused message
	function report_message()
	{
		var query_string = "action=report_message";
		var sel_check = selected_checkbox();
		if(!sel_check)
		{
			return false;
		}
		query_string += sel_check;
		var reason_1 = '';
		var reason_2 = '';
		var reason_3 = '';
		var reason_selected = 'N';
		if(document.frm_report_message.reason_1.checked == true)
		{
			reason_1 = 'Y';
			reason_selected = 'Y';
			query_string += "&reason_1=y";
		}
		if(document.frm_report_message.reason_2.checked == true)
		{
			reason_2 = 'Y';
			reason_selected = 'Y';
			query_string += "&reason_2=y";
		}
		if(document.frm_report_message.reason_3.checked == true)
		{
			reason_3 = 'Y';
			reason_selected = 'Y';
			query_string += "&reason_3=y";
		}
		if(reason_selected == 'N')
		{
			alert('Please select at least one reason');
			return false;
		}
		var txt_reason = document.getElementById('txt_report_reason').value;
		query_string += "&txt_reason="+txt_reason;
		show_processing_image();
		var script_name = "messages.php";
		send_request(script_name, query_string);
		
	}
	function response_report_message(response_text)
	{
		var status_text = response_text.split("~");
		if(status_text[0] == 'Error')
		{
			alert(status_text[1]);
		}
		else if(status_text[0] == 'Ok')
		{
			// defined in local js of message_child.html
			alert(status_text[1]);
			hide_report_message();
		}
		
	}
	
	function delete_messages_sent_mail()
	{
		var query_string = "action=delete_message_sent_mail";
		var sel_check = selected_checkbox();
		if(!sel_check)
		{
			return false;
		}
		query_string +=sel_check;

		var conf = confirm('Do you really want to delete ?');
		if(conf)
		{
			show_processing_image();
			var script_name = "sent_mail.php";
			send_request(script_name, query_string);
		}
	}

	function delete_accepted_user()
	{
		var query_string = "action=delete_user";
		var sel_check = selected_checkbox();
		if(!sel_check)
		{
			return false;
		}
		query_string +=sel_check;

		var conf = confirm('Do you really want to delete ?');
		if(conf)
		{
			show_processing_image();
			var script_name = "accepted_user.php";
			send_request(script_name, query_string);
		}
	}

	function response_delete_contact_user(status_text)
	{
		hide_processing_image();
		var response_text = status_text.split('~');
		if(response_text[0] == 'Error')
		{
			alert(response_text[1]);
		}
		else
		{
			var obj_inbox = document.getElementById('inbox_message');
			obj_inbox.innerHTML = response_text[1];
		}
	}

	function delete_blocked_user()
	{
		var query_string = "action=delete_user";
		var sel_check = selected_checkbox();
		if(!sel_check)
		{
			return false;
		}
		query_string +=sel_check;

		var conf = confirm('Do you really want to delete ?');
		if(conf)
		{
			show_processing_image();
			var script_name = "blocked_user.php";
			send_request(script_name, query_string);
		}
	}
	//06/12/2008 - NGP
	function remove_from_favorites(profile_id)
	{
		var conf = confirm("Do you really want to delete?");
		if(!conf)
		{
			return false;
		}
		show_processing_image();
		var query_string = "action=removefavorites&profile_id="+escape(profile_id);
		var server_script = "favorites.php";
		send_request(server_script, query_string);
	}

	function responce_remove_favorites(status_del)
	{
		hide_processing_image();
		var response_text = status_del.split('~');
		if(response_text[0] == 'Error')
		{
			alert(response_text[1]);
		}
		else
		{
			var obj_inbox = document.getElementById('content');
			obj_inbox.innerHTML = response_text[1];
		}
	}
	//06/12/2008 - NGP

	//08/12/2008 - NGP

	function update_main_image()
	{
		show_processing_image();
		var chk_length = document.upload_photos.length;
		var counter = 0;
		var query_string = 'action=updatemainimage';
		for(i=0; i<chk_length; i++)
		{
			var element = document.upload_photos.elements[i];
			if(element.type == 'radio')
			{
				if(element.checked == true)
				{
					var element_name = element.name;
					var element_value = element.value;
					query_string = query_string + 
									"&"+element_name+"="+element_value;
				counter++;
				}
			}
			if(element.id == 'select')
			{
				var element_name = element.name;
				var element_value = element.value;
				query_string = query_string + 
									"&"+element_name+"="+element_value;
				counter++;
			}

		}
		
		if(counter == 0)
		{
			alert('No option is selected');
			hide_processing_image();
			return false;
		}
				
		var server_script = "photos.php";
		send_request(server_script, query_string);
	}

	function responce_update_main_image(status_upd)
	{
		hide_processing_image();
		var response_text = status_upd.split('~');
		if(response_text[0] == 'Error')
		{
			alert(response_text[1]);
		}
		else
		{
			alert(" Data Updated successfully ");
			var obj_inbox = document.getElementById('profile_images');
			obj_inbox.innerHTML = response_text[1];
		}
	}
	
	function delete_image(image_id)
	{
		var conf = confirm("Do you really want to delete?");
		if(!conf)
		{
			return false;
		}
		show_processing_image();
		var query_string = "action=deleteimage&image_id="+escape(image_id);
		var server_script = "photos.php";
		send_request(server_script, query_string);
	}
	
	function responce_delete_image(status_upd)
	{
		hide_processing_image();
		var response_text = status_upd.split('~');
		if(response_text[0] == 'Error')
		{
			alert(response_text[1]);
		}
		else
		{
			var obj_inbox = document.getElementById('profile_images');
			obj_inbox.innerHTML = response_text[1];
		}
	}
	//08/12/2008 - NGP

	//09/12/2008 - NGP
	function date_setting()
	{
		show_processing_image();
		var relationship_friendship   = document.getElementById('relat1');
		if (relationship_friendship.checked == true)
		{
			relationship_friendship = "y";
		}
		else 
		{
			relationship_friendship = "n";
		}
		var relationship_casual  = document.getElementById('relat2');
		if (relationship_casual.checked == true)
		{
			relationship_casual = "y";
		}
		else 
		{
			relationship_casual = "n";
		}

		var relationship_serious = document.getElementById('relat3');
		if (relationship_serious.checked == true)
		{
			relationship_serious = "y";
		}
		else 
		{
			relationship_serious = "n";
		}

		var living_outside_country = document.getElementById('dist1');
		if (living_outside_country.checked == true)
		{
			living_outside_country = "y";
		}
		else 
		{
			living_outside_country = "n";
		}

		var profile_without_photos = document.getElementById('profile1');
		if (profile_without_photos.checked == true)
		{
			profile_without_photos = "n";
		}
		else 
		{
			profile_without_photos = "y";
		}
		var incomplete_profiles = document.getElementById('profile2');
		if (incomplete_profiles.checked == true)
		{
			incomplete_profiles = "n";
		}
		else 
		{
			incomplete_profiles = "y";
		}

		var living_outside_miles = document.getElementById('dist2').value;
		var smoke_preferences = document.getElementById('smoke').value;
		var drink_preferences = document.getElementById('drink').value;
		var younger_age_preferences = document.getElementById('dating').value;
		var lower_age_preferences = document.getElementById('lower').value;
		var upper_age_preferences  = document.getElementById('upper').value;
		if(lower_age_preferences > upper_age_preferences )
		{
			hide_processing_image();
			alert("Please enter proper range of Age");
			return false;
		}
		var religion_preferences = document.getElementById('religion').value;
		var ethnicities_preferences = document.getElementById('ethnicities').value;
		
		var query_string = "action=datesetting&relationship_friendship="+escape(relationship_friendship)+"&relationship_casual="+escape(relationship_casual)+
			"&relationship_serious="+escape(relationship_serious)+
			"&living_outside_country="+escape(living_outside_country)+"&living_outside_miles="+escape(living_outside_miles)+
			"&smoke_preferences="+escape(smoke_preferences)+"&drink_preferences="+
			escape(drink_preferences)+"&younger_age_preferences="+escape(younger_age_preferences)+"&lower_age_preferences="+
			escape(lower_age_preferences)+"&upper_age_preferences="+escape(upper_age_preferences)+
			"&religion_preferences="+escape(religion_preferences)+ "&ethnicities_preferences="+escape(ethnicities_preferences)+"&profile_without_photos="+escape(profile_without_photos)+"&incomplete_profiles="+escape(incomplete_profiles);			
		var server_script = "date_setting.php";
		send_request(server_script, query_string);
		
	}
	
	function responce_date_setting(status_ins)
	{
		hide_processing_image();
		var response_text = status_ins.split('~');
		if(response_text[0] == 'Error')
		{
			alert(response_text[1]);
		}
		else
		{
			alert(response_text[1]);
		}
	}

	function account_setting()
	{
		show_processing_image();
		var newsletter = document.getElementById('news_letter');
		if (newsletter.checked == true)
		{
			newsletter = "y";
		}
		else 
		{
			newsletter = "n";
		}
		var email_notification_on_message = "Instant";
		var email_notification_on_message1 = document.getElementById('email_notif');
			if (email_notification_on_message1.checked == true)
			{
				email_notification_on_message = "Instant";
			}
		var email_notification_on_message2 = document.getElementById('dailt_notif');
			if (email_notification_on_message2.checked == true)
			{
				email_notification_on_message = "Daily";
			}
		var email_notification_on_message3 = document.getElementById('no_email_notif');
		if (email_notification_on_message3.checked == true)
			{
				email_notification_on_message = "None";
			}
		var load_chat_on_signin = document.getElementById('load_chat');
		if (load_chat_on_signin.checked == true)
		{
			load_chat_on_signin = "y";
		}
		else 
		{
			load_chat_on_signin = "n";
		}
		var receive_im_from_favorites = document.getElementById('receive_im');
		if (receive_im_from_favorites.checked == true)
		{
			receive_im_from_favorites = "y";
		}
		else 
		{
			receive_im_from_favorites = "n";
		}
		
		var disbale_im = document.getElementById('disable_im');
		if (disbale_im.checked == true)
		{
			disbale_im = "y";
		}
		else 
		{
			disbale_im = "n";
		}
		var anonymous_views  = document.getElementById('anonymous');
		if (anonymous_views .checked == true)
		{
			anonymous_views  = "y";
		}
		else 
		{
			anonymous_views  = "n";
		}
		
		var query_string = "action=accountsetting&newsletter="+escape(newsletter)+"&email_notification_on_message="+escape(email_notification_on_message)+
			"&load_chat_on_signin="+escape(load_chat_on_signin)+"&receive_im_from_favorites="
		+escape(receive_im_from_favorites)+"&anonymous_views="+escape(anonymous_views)+"&disable_im="+escape(disbale_im);
		var server_script = "account_settings.php";
		send_request(server_script, query_string);

	}

	function responce_account_setting(acc_status)
	{
		hide_processing_image();
		var response_text = acc_status.split('~');
		if(response_text[0] == 'Error')
		{
			alert(response_text[1]);
		}
		else
		{
			alert(response_text[1]);
		}
	}
	//09/12/2008 - NGP

	function password_setting()
	{
		show_processing_image();
		var old_password = document.getElementById('old_password').value;
		var new_password = document.getElementById('new_password').value;
		var confirm_pawd = document.getElementById('confirm_pawd').value;
		if (old_password == '' || new_password == '' || confirm_pawd == '')
		{
			hide_processing_image();
			alert("Please enter the password");
			return false;
		}
		if( confirm_pawd != new_password )
		{
			hide_processing_image();
			alert("Invalid password");
			return false;
		}
		var query_string = "action=accountpasswordsetting&password="+escape(old_password)+
			"&new_password="+escape(new_password);
		var server_script = "account_settings.php";
		send_request(server_script, query_string);
	}

	function responce_password_setting(acc_pawd)
	{
		hide_processing_image();
		var response_text = acc_pawd.split('~');
		if(response_text[0] == 'Error')
		{
			alert(response_text[1]);
		}
		else
		{


			alert(response_text[1]);
		}
	}

	function hide_profile()
	{
		show_processing_image();
		var  hide_profile = document.getElementById('hide_profile');
		if( hide_profile.checked == true)
		{
			hide_profile = '0';
		}
		else
		{
			hide_profile = '1';
		}
		
		var query_string = "action=accounthidesetting&hide_profile="+escape(hide_profile);
		var server_script = "account_settings.php";
		send_request(server_script, query_string);
	}
	
	function responce_hide_profile(acc_hide)
	{
		hide_processing_image();
		var response_text = acc_hide.split('~');
		if(response_text[0] == 'Error')
		{
			alert(response_text[1]);
		}
		else
		{
			alert(response_text[1]);
		}
	}

	function delete_profile()
	{
		var conf = confirm('Do you really want to delete ?');
		if(conf)
		{
			show_processing_image();
			var  in_relatioship = document.getElementById('current_rel');
			if( in_relatioship.checked == true)
			{
				in_relatioship = 'y';
			}
			else
			{
				in_relatioship = 'n';
			}
			var  not_enough_member = document.getElementById('not_enough_member');
			if( not_enough_member.checked == true)
			{
				not_enough_member = 'y';
			}
			else
			{
				not_enough_member = 'n';
			}
			var  other = document.getElementById('why_delete_profile').value;
			var query_string = "action=accountdeletesetting&in_relatioship="+escape(in_relatioship)+"&not_enough_member="+escape(not_enough_member)+"&other="+escape(other);
			var server_script = "account_settings.php";
			send_request(server_script, query_string);
		}
	}

	function responce_delete_profile(status_del)
	{
		hide_processing_image();
		var response_text = status_del.split('~');
		if(response_text[0] == 'Error')
		{
			alert(response_text[1]);
		}
		else
		{
			alert(response_text[1]);
			window.location.href='delete_profile.php?param=1';
		}

	}


	function active_textarea(other)
	{	
		var  why_delete_profile = document.getElementById('why_delete_profile');
		var  other = document.getElementById(other);
		if( other.checked == true)
		{
			why_delete_profile.readOnly = false;
		}
		else
		{
			why_delete_profile.readOnly = true;
		}
	}

	function profile_add_to_favorites(profile_id)
	{
		show_processing_image();
		var query_string = "action=addtofavorites&profile_id="+escape(profile_id);
		var server_script = "../verify.php";
		send_request(server_script, query_string);
	}
	function search_add_to_favorites(profile_id)
	{
		show_processing_image();
		var query_string = "action=addtofavorites&profile_id="+escape(profile_id);
		var server_script = "verify.php";
		send_request(server_script, query_string);
	}

	function responce_add_to_favorites(status)
	{
		hide_processing_image();
		var server_path = document.getElementById('server_path').value;
		var response_text = status.split('~');
		if(response_text[0] == 'Error')
		{
			window.location.href = server_path+'login.php';
		}
		else
		{
			alert(response_text[1]);
		}
	}

	function block_from_contact(member_id)
	{
		show_processing_image();
		var query_string = "action=blockfromcontact&member_id="+escape(member_id);
		var server_script = "../verify.php";
		send_request(server_script, query_string);
	}

	function responce_block_from_contact(status)
	{
		hide_processing_image();
		var server_path = document.getElementById('server_path').value;
		var response_text = status.split('~');
		if(response_text[0] == 'Error')
		{
			window.location.href = server_path+'login.php';
		}
		else
		{
			alert(response_text[1]);
		}
	}

	function block_from_search(profile_id)
	{
		show_processing_image();
		var query_string = "action=blockfromsearch&profile_id="+escape(profile_id);
		var server_script = "../verify.php";
		send_request(server_script, query_string);
	}

	function responce_block_from_search(status)
	{
		hide_processing_image();
		var server_path = document.getElementById('server_path').value;
		var response_text = status.split('~');
		if(response_text[0] == 'Error')
		{
			window.location.href = server_path+'login.php';
		}
		else
		{
			alert(response_text[1]);
		}
	}

	function introduce_your_self()
	{
		show_processing_image();
		var  username = document.getElementById('username').value;
		var  message = document.getElementById('message').value;
		var  recevier_profile_id = document.getElementById('receiver_profile_id').value;
		if (username=="")
		{
			hide_processing_image();
			alert(" User Name field is empty");
			return false;
		}
		if (message=="")
		{
			hide_processing_image();
			alert(" Message field is empty");
			return false;
		}
		var query_string = "action=introduceyourself&username="+escape(username)+"&message="+escape(message)+
			"&recevier_profile_id="+escape(recevier_profile_id);
		
		var server_script = "introduce_yourself.php";
		send_request(server_script, query_string);
	}

	function responce_introduce_your_self(status)
	{
		hide_processing_image();
		var response_text = status.split('~');
		if(response_text[0] == 'Error')
		{
			alert(response_text[1]);
		}
		else
		{
			var obj_introduce = document.getElementById('introduce');
			var res = "<span class='subheadtxt'><b>"+response_text[1]+"</b></span>";
			obj_introduce.innerHTML = res;
			
			//alert(response_text[1]);
		}
	}


	function report_concern()
	{
		show_processing_image();
		var  message = document.getElementById('message').value;
		var  profile_id = document.getElementById('profile_id').value;
		if ( message =="")
		{
			hide_processing_image();
			alert(" Message field is empty");
			return false;
		}
		var query_string = "action=reportconcern&message="+escape(message)+
			"&profile_id="+escape(profile_id);
		var server_script = "report_concern.php";
		send_request(server_script, query_string);
	}

	function responce_report_concern(status)
	{
		hide_processing_image();
		var response_text = status.split('~');
		if(response_text[0] == 'Error')
		{
			alert(response_text[1]);
		}
		else
		{
			alert(response_text[1]);
		}
	}
	
	function constraint_for_im(server_path, contact_username)
	{
		if(document.getElementById('disable_im'))
		{
			if(document.getElementById('disable_im').value == 'y')
			{
			alert("You IM is disabled. Please goto to account \n setting page and enable it.");
			return false;
			}
		}
		
		show_processing_image();
		if(contact_username == '')
		{
			alert('Username is missing');
			return false;
		}
		var is_login = document.getElementById('is_login').value;
		im_member_id = '';
		if(is_login == 'Y')
		{
			var im_member_id = document.getElementById('im_member_id').value;
		}
		if(im_member_id == '')
		{
			alert('Sender Id is missing');
			return false;
		}
		
		var query_string = "action=check_constraint&contact_name="+escape(contact_username)+
			"&member_id="+escape(im_member_id)+"&server_path="+escape(server_path);
		var server_script = "date_setting.php";
		send_request(server_script, query_string);

		//
		var is_login = document.getElementById('is_login').value;
	
		if(is_login == 'Y')
		{
			var im_username = document.getElementById('im_username').value;
			var im_member_id = document.getElementById('im_member_id').value;
			var user_name = im_username;
			var member_id = im_member_id; 
			var chk_status = 'N';
			var script_name = '';
			if(document.getElementById('script_name'))
			{
				script_name = document.getElementById('script_name').value;
			}
			
			var query_string = "user_name="+escape(user_name)+"&member_id="+escape(member_id)+"&chk_remember="+escape(chk_status)+"&autologin=y"+"&script_name="+escape(script_name);
			
			var im_path = server_path+'IM/main.php?'+query_string;
			
			var foo = window.open(im_path, 'IM', 'height=580, width=225, menu=0, scroll=0, location=0, status=0,resizable=0');
		}
		
	}
	
	function response_dating_constraint(response_text)
	{
		hide_processing_image();
		var status_text = response_text.split('~');

		if(trim(status_text[0]) == 'Error')
		{
			alert('This user has their dating preferences set to enable \n only for specific members');
			return false;
		}
		else
		{
			
			var contact_username = '';
			var server_path = '';

			contact_username = status_text[1];
			server_path = status_text[2];

		
			if(contact_username == '')
			{
				alert('Contact username is missing in response');
				return false;
			}
			if(server_path == '')
			{
				alert('Server path is missing in response');
				return false;
			}
			load_im(server_path, contact_username);
		}
	}
	function load_im(server_path, contact_username)
	{
		var my_contact = '';
		if(contact_username == null)
		{
			
		}
		else
		{
			my_contact = contact_username;
		}
		if(document.getElementById('disable_im'))
		{
			if(document.getElementById('disable_im').value == 'y')
			{
			alert("You IM is disabled. Please goto to account \n setting page and enable it.");
			return false;
			}
		}
		var is_login = document.getElementById('is_login').value;
	
		if(is_login == 'Y')
		{
			var im_username = document.getElementById('im_username').value;
			var im_member_id = document.getElementById('im_member_id').value;
			var user_name = im_username;
			var member_id = im_member_id; 
			var chk_status = 'N';
			var script_name = '';
			if(document.getElementById('script_name'))
			{
				script_name = document.getElementById('script_name').value;
			}
			
			var query_string = "user_name="+escape(user_name)+"&member_id="+escape(member_id)+"&chk_remember="+escape(chk_status)+"&autologin=y"+"&script_name="+escape(script_name)+"&my_contact="+escape(my_contact);
			
			var im_path = server_path+'IM/main.php?'+query_string;
			/*
			if(obj_redirect != "")
			{
				window.location.href= obj_redirect;
			}
			else
			{
				window.location.href='member_home.php';
				
			}
			*/
			var foo = window.open(im_path, 'IM', 'height=580, width=225, menu=0, scroll=0, location=0, status=0,resizable=0');
		}
		else
		{
			var foo = window.open(server_path+'IM/main.php', 'IM', 'height=580, width=225, menu=0, scroll=0, location=0, status=0,resizable=0');
		}
	}

	function result_saved_search()
	{
		var search_id = document.frm_saved_search.user_search.value;
		if(search_id == "")
		{
			alert('No item is selected');
			return false;
		}
		var obj_search_key = document.getElementById('search_key');
		obj_search_key.value = search_id;
		document.frm_saved_search.action = 'search_custom.php';
		document.frm_saved_search.submit();
	}
	function show_hide_message_details(control_id, message_id)
	{
		
		var control = document.getElementById(control_id);
		var message = document.getElementById('message_details_'+control_id);

		if(message.style.display == 'none')
		{
			message.style.display = '';
			control.innerHTML = '-More';
		}
		else
		{
			message.style.display = 'none';
			control.innerHTML = '+More';
		}
	}

	function add_attachment(action_type)
	{
		
		if(attachment_counter == 4)
		{
			alert('You can not send more than 4 attachments');
			return false;
		}
		var tbl = document.getElementById('attachment');
		var tbody = document.createElement('tbody');
		var tr    = document.createElement('TR');
		var td1   = document.createElement('TD');
		var td2   = document.createElement('TD');
		var td3   = document.createElement('TD');
		var td4   = document.createElement('TD');
		
		td1.innerHTML = "&nbsp;";
		td2.innerHTML = "&nbsp;";
		td4.innerHTML = "&nbsp;";
		var atag = document.createElement('A');
			atag.setAttribute('href', '#attachment');
			atag.onclick = function(){
				remove_attachment(tr);
		 }
		atag.innerHTML = '&nbsp;&nbsp;&nbsp;<font style="font-size:12pt;color:red;text-decoration:none;"><b>X</b></font>';

		td3.setAttribute('align', 'left');
				
		var inputfile  = document.createElement('INPUT');
		inputfile.setAttribute("type", "file");
		inputfile.setAttribute("name", "msg_attachment[]");
		inputfile.setAttribute("id", "msg_attachment_"+attachment_counter);
		inputfile.setAttribute('style', 'width:300px');
		td3.appendChild(inputfile);
		td3.appendChild(atag);
		// for style
		var isIE = false;
		var styleData = 'padding-left:17px;';
		
		if(navigator.appName == "Microsoft Internet Explorer")
		{
			isIE = true;
		}
		
		  if(!isIE)
		  {
			//use the correct DOM Method
			td3.setAttribute('style', styleData);
			inputfile.setAttribute('style', 'width:220px');
			atag.setAttribute('style', 'text-decoration:none;');
		  }
		  else
		  {
			//use the .cssText hack
			td3.style.setAttribute('cssText', styleData);
			inputfile.style.setAttribute('cssText', 'width:300px');
			atag.style.setAttribute('cssText', 'text-decoration:none;');
		  }

		// link elemetns
		tbl.appendChild(tbody);
		tbody.appendChild(tr);
		tr.appendChild(td1);
		tr.appendChild(td2);
		tr.appendChild(td3);
		tr.appendChild(td4);

		attachment_counter++;
	}

	function remove_attachment(tr)
	{
		tr.parentNode.removeChild(tr);
		attachment_counter--;
	}

	function check_enter_user_profile_exist(username)
	{
		if(username != "")
		{
			show_processing_image();
			var query_string = "action=checkuser_profile_exist&username="+escape(username);
			var script_name = "introduce_yourself.php";
			send_request(script_name, query_string);
		}
	}


	function responc_check_user_exist(responce_text)
	{
		hide_processing_image();
		var response_text = responce_text.split('~');
		var obj_msg = document.getElementById('send_intro');
		if(response_text[0] == 'Error')
		{
			alert(response_text[1]);
			obj_msg.style.display = "none";
		}
		else
		{
			var profile_id = response_text[0];
			var obj_receiver_profile = document.getElementById('receiver_profile_id');
			obj_receiver_profile.value=profile_id;
			obj_msg.style.display = "";
		}
	}


	function block_member_on_username(operation)
	{	
		show_processing_image();
		var username = document.getElementById('username').value;
		var indicator = document.getElementById('indicator').value;
		if(username =='')
		{
			hide_processing_image();
			alert("Please enter username");
			return false;
		}
		var query_string = "action=block_member_on_username&operation="+escape(operation)+"&username="+escape(username)+"&indicator="+escape(indicator);
		var script_name = "blocked_user.php";
		send_request(script_name, query_string);
	}

	function responce_user_name_block(responce_text)
	{
		hide_processing_image();
		var response_text = responce_text.split('~');
		if(response_text[0] == 'Error')
		{
			alert(response_text[1]);
		}
		else
		{
			alert(response_text[1]);
			if(response_text[2]=='1')
			{
				window.location.href='blocked_user.php';
			}	
		}
	}

	function show_user_block_tpl()
	{
		var obj_content = document.getElementById('block_unblock');
		if(obj_content.style.display=="none")
		{
			obj_content.style.display= "inline";
		}
		else if(obj_content.style.display=="inline")
		{
			obj_content.style.display= "none";
		}
	}

	/*Conatc Us*/
	function login_issue()
	{	
		/*show_processing_image();*/
		var txtName = document.getElementById("txtName").value; 
		var txtUsername = document.getElementById("txtUsername").value; 
		var txtAge = document.getElementById("txtAge").value; 
		var txtMothersMaidenName = document.getElementById("txtMothersMaidenName").value; 
		var txtRegisteredEmail = document.getElementById("txtRegisteredEmail").value; 
		var txtAlternativeEmail = document.getElementById("txtAlternativeEmail").value; 
		var txtSubject = document.getElementById("txtSubject").value; 
		var txtProblem = document.getElementById("txtProblem").value;
		var txtCaptcha = document.getElementById("txtCaptcha").value;

		if (txtName=="")
		{
			alert("Please enter your name.");
			document.getElementById("txtName").focus();
			return false;
		}

		if (txtUsername=="")
		{
			alert("Please enter your username.");
			document.getElementById("txtUsername").focus();
			return false;
		}

		if (txtAge=="")
		{
			alert("Please enter your age.");
			document.getElementById("txtAge").focus();
			return false;
		}

		if (txtMothersMaidenName=="")
		{
			alert("Please enter your mother's maiden name.");
			document.getElementById("txtMothersMaidenName").focus();
			return false;
		}

		if (txtRegisteredEmail=="")
		{
			alert("Please enter your registered email id.");
			document.getElementById("txtRegisteredEmail").focus();
			return false;
		}

/*
		if (txtAlternativeEmail=="")
		{
			alert("Please enter your alternative email id.");
			document.getElementById("txtAlternativeEmail").focus();
			return false;
		}
*/

		if (txtSubject=="")
		{
			alert("Please enter subject.");
			document.getElementById("txtSubject").focus();
			return false;
		}

		if (txtProblem=="")
		{
			alert("Please enter your problem.");
			document.getElementById("txtProblem").focus();
			return false;
		}

		if (txtCaptcha=="")
		{
			alert("Please enter Verification Code.");
			document.getElementById("txtCaptcha").focus();
			return false;
		}
	


		var query_string = "action=login_issue";

		query_string += "&txtName=" +escape(txtName); 
		query_string += "&txtUsername=" +escape(txtUsername); 
		query_string += "&txtAge=" +escape(txtAge); 
		query_string += "&txtMothersMaidenName=" +escape(txtMothersMaidenName); 
		query_string += "&txtRegisteredEmail=" +escape(txtRegisteredEmail); 
		query_string += "&txtAlternativeEmail=" +escape(txtAlternativeEmail); 
		query_string += "&txtSubject=" +escape(txtSubject); 

		query_string += "&txtProblem=" +escape(txtProblem);
		query_string += "&txtCaptcha=" +escape(txtCaptcha);
		//document.write(query_string);
		//return false;
		show_processing_image();
		var script_name = "login_issue.php";
		send_request(script_name, query_string);
	
	}
	function response_login_issue(response_text)
	{	hide_processing_image();
		var status_text = response_text.split('~');
		if(status_text[0] == 'Error')
		{
			alert(status_text[1]);
		}
		else
		{
			var obj_showMsg = document.getElementById("login_issue");
			obj_showMsg.innerHTML = "<font face='Arial' size='2' color='red'><b>"+status_text[1]+"</b></font>";
		}
	}
	////////////// AR  START /////////////////
	function result_saved_search_ar()
	{
		var search_id = document.frm_saved_search.user_search.value;
		if(search_id == "")
		{
			alert('No item is selected');
			return false;
		}
		var obj_search_key = document.getElementById('search_key');
		obj_search_key.value = search_id;
		document.frm_saved_search.action = 'search_custom.php';
		document.frm_saved_search.submit();
	}
	
	  /* search custom save*/
	function search_custom_save_ar(tag)
	{

		var txtSearchName = '';
		var search_key='';
		if(document.getElementById('txtSearchName'))
		{
			 txtSearchName = document.getElementById('txtSearchName').value;
		}
		if(document.getElementById('user_search'))
		{
			 search_key = document.getElementById('user_search').value;
		}
		var txtLowerAge = document.getElementById('txtLowerAge').value;
		var txtUpperAge = document.getElementById('txtUpperAge').value;
		
		if(tag == 'save')
		{

			if (txtSearchName =="")
			{
				alert("Please enter Serch Name.");
				document.getElementById('txtSearchName').focus();
				return false;
			}
			
			if(txtLowerAge !="")
			{
				if (IsNumeric(txtLowerAge)==false)
				{
					alert("Please enter only Numeric Value.");
					document.getElementById('txtLowerAge').focus();
					return false;
				}
			}
			
			if(txtUpperAge !="")
			{

				if (IsNumeric(txtUpperAge)==false)
				{
					alert("Please enter only Numeric Value.");
					document.getElementById('txtUpperAge').focus();
					return false;
				}
			}
		
		}
		var cmbGender = document.getElementById('cmbGender').value;
				

		var chkWithInMyCountry = document.getElementById('chkWithInMyCountry').value;
		if ( ! document.getElementById('chkWithInMyCountry').checked )
			chkWithInMyCountry = 'n';

		if(document.getElementById('save_search'))
		{
			var search_box = document.getElementById('save_search');
			search_box.style.display = "none";
		}
		

		var chkWithoutPhoto = document.getElementById('chkWithoutPhoto').value;
		if ( ! document.getElementById('chkWithoutPhoto').checked )
			chkWithoutPhoto = 'n';

		var chkWithoutProfile = document.getElementById('chkWithoutProfile').value;
		if ( ! document.getElementById('chkWithoutProfile').checked )
			chkWithoutProfile = 'n';

		var chkLookingFriendship = document.getElementById('chkLookingFriendship').value;
		if ( ! document.getElementById('chkLookingFriendship').checked )
			chkLookingFriendship = 'n';

		var chkCasualRelationship = document.getElementById('chkCasualRelationship').value;
		if ( ! document.getElementById('chkCasualRelationship').checked )
			chkCasualRelationship = 'n';

		var chkSeriousRelationships = document.getElementById('chkSeriousRelationships').value;
		if ( ! document.getElementById('chkSeriousRelationships').checked )
			chkSeriousRelationships = 'n';

		var cmbSmoke = document.getElementById('cmbSmoke').value;
		var cmbDrink = document.getElementById('cmbDrink').value;
		
		var cmbEthnicities = document.getElementById('cmbEthnicities').value;
		var cmbReligion = document.getElementById('cmbReligion').value;
		var cmbEducation = document.getElementById('cmbEducation').value;

		var cmbBodyType = document.getElementById('cmbBodyType').value;

		//var txtSearchName = document.getElementById('txtSearchName').value;
		cmbEmailSearchFor = '';
		if(document.getElementById('cmbEmailSearchFor'))
		{
			var cmbEmailSearchFor = document.getElementById('cmbEmailSearchFor').value;
		}
		
		var chkWithInMyCity = document.getElementById('chkWithInMyCity').value;
		if ( ! document.getElementById('chkWithInMyCity').checked )
			chkWithInMyCity = 'n';

		var chkWithInMyState = document.getElementById('chkWithInMyState').value;
		if ( ! document.getElementById('chkWithInMyState').checked )
			chkWithInMyState = 'n';

		if(document.getElementById('chkEmailMe'))
		{
			if (document.getElementById('chkEmailMe').checked == false)
			cmbEmailSearchFor = 0;
		}
		//var chkWithInMyMiles = document.getElementById('chkWithInMyMiles').value;
		
		if(tag == 'save')
		{
			var query_string = "action=search_custom_save";
		}
		else if(tag == 'search')
		{
			var query_string = "action=show_form&sub=custom_search";
		}
		
		query_string += "&txtLowerAge=" +escape(txtLowerAge); 
		query_string += "&txtUpperAge=" +escape(txtUpperAge);
		query_string += "&cmbGender=" +escape(cmbGender);
		query_string += "&chkWithInMyCountry=" +escape(chkWithInMyCountry);  
		//query_string += "&chkByRadius=" +escape(chkByRadius);
		//query_string += "&txtLowerMiles=" +escape(txtLowerMiles);
		//query_string += "&txtUpperMiles=" +escape(txtUpperMiles);
		query_string += "&chkWithoutPhoto=" +escape(chkWithoutPhoto);
		query_string += "&chkWithoutProfile=" +escape(chkWithoutProfile);
		query_string += "&chkLookingFriendship=" +escape(chkLookingFriendship); 
		query_string += "&chkCasualRelationship=" +escape(chkCasualRelationship);
		query_string += "&chkSeriousRelationships=" +escape(chkSeriousRelationships);
		query_string += "&cmbSmoke=" +escape(cmbSmoke); 
		query_string += "&cmbDrink=" +escape(cmbDrink); 
		query_string += "&cmbEthnicities=" +escape(cmbEthnicities); 
		query_string += "&cmbReligion=" +escape(cmbReligion); 
		query_string += "&cmbEducation=" +escape(cmbEducation); 
		query_string += "&cmbBodyType=" +escape(cmbBodyType); 
		query_string += "&txtSearchName=" +escape(txtSearchName); 
		query_string += "&cmbEmailSearchFor=" +escape(cmbEmailSearchFor); 
		query_string += "&chkWithInMyCity=" +escape(chkWithInMyCity);  
		query_string += "&chkWithInMyState=" +escape(chkWithInMyState);  
		//query_string += "&chkWithInMyMiles=" +escape(chkWithInMyMiles);  
		
		if(tag == 'save')
		{
			show_processing_image();
			var script_name = "search_custom.php";
			send_request(script_name, query_string);
		}
		else
		{
			window.location.href="search_custom.php?"+query_string+"&search_key="+search_key+"&new_search=y";
		}
	}
	
	
		/*search custom edit*/
	function show_search_custom_edit_ar()
	{
		var user_search = document.getElementById("user_search").value;

		/*if (user_search =="")
		{
			alert("Please select Saved Search.");
			document.getElementById("user_search").focus();
			return false;
		}*/

		var query_string = "action=show_search_custom_edit";

		query_string += "&user_search=" +escape(user_search); 
		
		show_processing_image();
		var script_name = "search_edit_saved.php";
		//alert(script_name + "?"+ query_string);
		send_request(script_name, query_string);
	}
	
	function search_edit_saved_ar()
	{
		var user_search = document.getElementById('user_search').value;

		if (user_search =="")
		{
			alert("Please select Serch Name.");
			document.getElementById('user_search').focus();
			return false;
		}

		var txtLowerAge = document.getElementById('txtLowerAge').value;
		if (IsNumeric(txtLowerAge)==false)
		{
			alert("Please enter only Numeric Value.");
			document.getElementById('txtLowerAge').focus();
			return false;
		}
		
		var txtUpperAge = document.getElementById('txtUpperAge').value;
		if (IsNumeric(txtUpperAge)==false)
		{
			alert("Please enter only Numeric Value.");
			document.getElementById('txtUpperAge').focus();
			return false;
		}

		var cmbGender = document.getElementById('cmbGender').value;
				

		var chkWithInMyCountry = document.getElementById('chkWithInMyCountry').value;
		if ( ! document.getElementById('chkWithInMyCountry').checked )
			chkWithInMyCountry = 'n';

		var chkWithInMyCity = document.getElementById('chkWithInMyCity').value;
		if ( ! document.getElementById('chkWithInMyCity').checked )
			chkWithInMyCity = 'n';

		var chkWithInMyState = document.getElementById('chkWithInMyState').value;
		if ( ! document.getElementById('chkWithInMyState').checked )
			chkWithInMyState = 'n';


		/*
		var chkByRadius = document.getElementById('chkByRadius').value;
		if ( ! document.getElementById('chkByRadius').checked )
			chkByRadius = 'n';

		var txtLowerMiles = document.getElementById('txtLowerMiles').value;
		if (IsNumeric(txtLowerMiles)==false)
		{
			alert("Please enter only Numeric Value.");
			document.getElementById('txtLowerMiles').focus();
			return false;
		}

		var txtUpperMiles = document.getElementById('txtUpperMiles').value;
		if (IsNumeric(txtUpperMiles)==false)
		{
			alert("Please enter only Numeric Value.");
			document.getElementById('txtUpperMiles').focus();
			return false;
		}
		*/
		//var search_box = document.getElementById('save_search');
		//search_box.style.display = "none";

		var chkWithoutPhoto = document.getElementById('chkWithoutPhoto').value;
		if ( ! document.getElementById('chkWithoutPhoto').checked )
			chkWithoutPhoto = 'n';

		var chkWithoutProfile = document.getElementById('chkWithoutProfile').value;
		if ( ! document.getElementById('chkWithoutProfile').checked )
			chkWithoutProfile = 'n';

		var chkLookingFriendship = document.getElementById('chkLookingFriendship').value;
		if ( ! document.getElementById('chkLookingFriendship').checked )
			chkLookingFriendship = 'n';

		var chkCasualRelationship = document.getElementById('chkCasualRelationship').value;
		if ( ! document.getElementById('chkCasualRelationship').checked )
			chkCasualRelationship = 'n';

		var chkSeriousRelationships = document.getElementById('chkSeriousRelationships').value;
		if ( ! document.getElementById('chkSeriousRelationships').checked )
			chkSeriousRelationships = 'n';

		var cmbSmoke = document.getElementById('cmbSmoke').value;
		var cmbDrink = document.getElementById('cmbDrink').value;
		
		var cmbEthnicities = document.getElementById('cmbEthnicities').value;
		var cmbReligion = document.getElementById('cmbReligion').value;
		var cmbEducation = document.getElementById('cmbEducation').value;

		var cmbBodyType = document.getElementById('cmbBodyType').value;

		var query_string = "action=search_edit_saved";
		query_string += "&user_search=" +escape(user_search); 
		query_string += "&txtLowerAge=" +escape(txtLowerAge); 
		query_string += "&txtUpperAge=" +escape(txtUpperAge);
		query_string += "&cmbGender=" +escape(cmbGender);
		query_string += "&chkWithInMyCountry=" +escape(chkWithInMyCountry);  
		//query_string += "&chkByRadius=" +escape(chkByRadius);
		//query_string += "&txtLowerMiles=" +escape(txtLowerMiles);
		//query_string += "&txtUpperMiles=" +escape(txtUpperMiles);
		query_string += "&chkWithoutPhoto=" +escape(chkWithoutPhoto);
		query_string += "&chkWithoutProfile=" +escape(chkWithoutProfile);
		query_string += "&chkLookingFriendship=" +escape(chkLookingFriendship); 
		query_string += "&chkCasualRelationship=" +escape(chkCasualRelationship);
		query_string += "&chkSeriousRelationships=" +escape(chkSeriousRelationships);
		query_string += "&cmbSmoke=" +escape(cmbSmoke); 
		query_string += "&cmbDrink=" +escape(cmbDrink); 
		query_string += "&cmbEthnicities=" +escape(cmbEthnicities); 
		query_string += "&cmbReligion=" +escape(cmbReligion); 
		query_string += "&cmbEducation=" +escape(cmbEducation); 
		query_string += "&cmbBodyType=" +escape(cmbBodyType); 
		query_string += "&chkWithInMyCity=" +escape(chkWithInMyCity);  
		query_string += "&chkWithInMyState=" +escape(chkWithInMyState);  

		

		show_processing_image();
		//alert(query_string);return false;
		var script_name = "search_edit_saved.php";
		send_request(script_name, query_string);
	}
	
	function search_edit_remove_ar()
	{
		var user_search = document.getElementById('user_search').value;

		var objSearchName = document.getElementById('user_search');
		
		

		if (user_search =="")
		{
			alert("Please select Serch Name.");
			document.getElementById('user_search').focus();
			return false;
		}

		if (!confirm("Are you sure you want delete '" +objSearchName.options[objSearchName.selectedIndex].text + "' search name?"))
		{
			return false;
		}

		
		var query_string = "action=search_edit_remove";
		query_string += "&user_search=" +escape(user_search);

		show_processing_image();
		var script_name = "search_edit_saved.php";
		//alert(script_name + "?" + query_string);return false;
		send_request(script_name, query_string);
	}
	
	function response_Search_CustomSave_ar(response_text)
	{
		var status_text = response_text.split('~');
		if(status_text[0] == 'Error')
		{
			alert(status_text[1]);
		}
		else
		{
			// submit the form
			var qstring = '';
			if(status_text[1] && status_text[1] != "")
			{
				qstring = status_text[1];
			}
			window.location.href="search_custom.php?"+qstring;
			
		}
	}

	////////////// AR END/////////////////