var counter_value=6; 
function display_counter(){ 
  counter_value=counter_value-1;   
  $("#counter_show").html(counter_value);
  setTimeout("display_counter()",1000)
  if(counter_value<0){
	 $("#counter_show").html(0);
  }
} 

$().ready(function() {
			   
	$('#frmLogin_front :input').each(function() {
			//alert($("#"+this.id).attr('name'));						
		//if($("#"+this.id)!=null){			
			$("#"+this.id).keyup(function(e){
			var code = (e.keyCode ? e.keyCode : e.which);
			if (code == 13){
				
				ajaxLogin();	
				return false;
			}
			})
		//}
						  
		})				   

	$('#signUp').click(function() {	
								
/*$("#confirm_div").fadeIn(200);
$("#loader_registration").slideDown(200);
$('html, body').animate({
scrollTop: $("#loader_registration").offset().top
}, 2000);*/
//$("#loader_registration").css({"background":"url(images/process_built.jpg) repeat-x  top"});
	validationControl();							 
	 });
	 
	 
	 
	$('#signupForm :input').each(function() {
			//alert($("#"+this.id).attr('name'));						//	 alert($("#"+this.id));
		//if($("#"+this.id)!=null){
			
			$("#"+this.id).keyup(function(e){
			var code = (e.keyCode ? e.keyCode : e.which);
			if (code == 13){
				
				validationControl();	
				return false;
			}else{
				validationControl2(this.id);
			}
			})
		//}
						  
		})
	

 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	
	$('#signUpOption').click(function() {
		if(document.getElementById('signUpDiv').style.display=='' || document.getElementById('signUpDiv').style.display=='block'){
			$('#signUpDiv').slideUp('slow');
			$('#signUpDiv2').slideDown('slow');
			//$('#signUpDiv').fadeOut('slow');
		}
		if(document.getElementById('signUpDiv').style.display=='none'){
			$('#signUpDiv2').slideUp('slow');
			$('#signUpDiv').slideDown('slow');
		}
	 });
$('#signupForm :input').keyup(function() {
	//validationControl2(this.id);  
});
$('#signupForm :select').change(function() {
	validationControl2(this.id);  
});



$('#signUpRegister').click(function() {	
	validationRegisterControl();							 
	 });

$('#signupFormRegister :input').keyup(function() {
	validationRegisterControl12(this.id);  
});

$('#signUpCatagoryRegister').click(function() {	
	validationCatagoryRegisterControl();							 
	 });

$('#signupFormCatagoryRegister :input').keyup(function() {
	validationCatagoryRegisterControl12(this.id);  
});

});
	
function checkEnter(e){
	//alert(e);
var k;
if(event.which)
k = event.which.keyCode;
else
k = event.keyCode;
if(k == 13){

		validationControl();
		//return false;
	}
}


function validationControl2(id){
	//var $inputs = $('#signupForm :input');

   // var values = {};
    //$inputs.each(function() {
						 //alert(this.id);
						//  alert($("#"+this.id).attr('rel'));
	//if($("#"+this.id).attr('rel')!=null){
		if($("#"+id).attr('value')==''){
			for(i=0;i<=21;i++){
				if(i!=id){
				$("#error"+i).fadeOut('slow');
				}
			}
			var err=$("#error"+$("#"+id).attr('rel')).attr('value');
			$("#error"+$("#"+id).attr('rel')).html(err).fadeIn('slow')
			
			
		}else{
				if(id=='user_name'){
			var err_user=0;	
				//user available
				if($("#"+id).attr('value').length>=2){	
				//alert($("#user_name").val());
				var user_name=$("#user_name").val();
				var dataStringAva="user_name="+ user_name;
					var iv=1;							
							 var input_id='';
							 $('#signupForm :input').each(function() {
							  input_id=this.id;
								if(input_id=='ownership_type1'){
								  if(document.getElementById('ownership_type1').checked==true){
									  dataStringAva+="&ownership_type="+$('#'+input_id).val();
								  }
							  }else if(input_id=='ownership_type2'){
								  if(document.getElementById('ownership_type2').checked==true){
									  dataStringAva+="&ownership_type="+$('#'+input_id).val();
								  }
							  }else if(input_id=='ownership_type3'){
								  if(document.getElementById('ownership_type3').checked==true){
									  dataStringAva+="&ownership_type="+$('#'+input_id).val();
								  }
							  }
						});
							 var url_site=str_SITE_URL+"ajax/check_ajax.php";
							//alert(dataStringAva);
									//	$("#error"+$("#"+this.id).attr('rel')).fadeIn('slow');
										
										 $.ajax({
											   type: "POST",
											   url: url_site,
											   data: dataStringAva,
											   cache: false,
											   error: function(){
													alert('Error loading XML document');
												},
									
											   success: function(msg){  
											   //alert($("#"+this.id).attr('rel'));
											   //alert(msg);
														if(msg == 'OK')
														{ 
															$("#error19").html('<img src="'+str_SITE_URL+'images/yes.png" align="absmiddle"> <font color="Green"> Available </font>  ').fadeIn('slow');
														}  
														else  
														{  
														//	$(err_user).val(1);
															$("#error19").html('<img src="'+str_SITE_URL+'images/notavailable.gif" align="absmiddle"> '+msg).fadeIn('slow');
															
															return false;
														}  
												  }
										 });
								//err();
								 //alert('hi');								
								if(err_user==1){									
									return false;
								}
										
				}else{
										//	$("#"+this.id).focus();
							$("#error"+$("#"+id).attr('rel')).html('User name must be more than 2 character').fadeIn('slow');
							return false;
				}
			
			//user available
			}else{
			$("#error"+$("#"+id).attr('rel')).fadeOut('slow');
			}
		}
	//}
	// });
}


function validationControl(){
	
    // get all the inputs into an array.
    var $inputs = $('#signupForm :input');

    // not sure if you wanted this, but I thought I'd add it.
    // get an associative array of just the values.
    var values = {};
    $inputs.each(function() {
						//  alert(this.id);
						//  alert($("#"+this.id).attr('rel'));
	if($("#"+this.id).attr('rel')!=null){
		for(i=0;i<=23;i++){
				$("#error"+i).fadeOut('slow');	
			}
		if($("#"+this.id).attr('value')!=''){
			
			//alert($("#"+this.id).attr('rel'));
			//alert($("#"+this.id).attr('value'));
			$("#error"+$("#"+this.id).attr('rel')).fadeOut('slow');
			
			
			if(document.getElementById('signUpDiv').style.display=='' || document.getElementById('signUpDiv').style.display=='block'){
			if(this.id=='user_name'){
			var err_user=0;	
				//user available
				if($("#"+this.id).attr('value').length>=2){	
				//alert($("#user_name").val());
				var user_name=$("#user_name").val();
									//	$("#error"+$("#"+this.id).attr('rel')).fadeIn('slow');
										var dataStringAva="user_name="+ user_name;
							var iv=1;							
							 var input_id='';
							 $('#signupForm :input').each(function() {
							  input_id=this.id;
								if(input_id=='ownership_type1'){
								  if(document.getElementById('ownership_type1').checked==true){
									  dataStringAva+="&ownership_type="+$('#'+input_id).val();
								  }
							  }else if(input_id=='ownership_type2'){
								  if(document.getElementById('ownership_type2').checked==true){
									  dataStringAva+="&ownership_type="+$('#'+input_id).val();
								  }
							  }else if(input_id=='ownership_type3'){
								  if(document.getElementById('ownership_type3').checked==true){
									  dataStringAva+="&ownership_type="+$('#'+input_id).val();
								  }
							  }
						});
							  var url_site=str_SITE_URL+"ajax/check_ajax.php";
							 //alert(dataStringAva);
										 $.ajax({
											   type: "POST",
											   url: url_site,
											   data: dataStringAva,
											   cache: false,
											   error: function(){
													alert('Error loading XML document');
												},
									
											   success: function(msg){  
											   //alert($("#"+this.id).attr('rel'));
											   //alert(msg);
														if(msg == 'OK')
														{ 
															$("#error19").html('<img src="'+str_SITE_URL+'images/yes.png" align="absmiddle"> <font color="Green"> Available </font>  ').fadeIn('slow');
														}  
														else  
														{  
														//	$(err_user).val(1);
															$("#error19").html('<img src="'+str_SITE_URL+'images/notavailable.gif" align="absmiddle"> '+msg).fadeIn('slow');
															
															return false;
														}  
												  }
										 });
								//err();
								 //alert('hi');								
								if(err_user==1){									
									return false;
								}
										
				}else{
										//	$("#"+this.id).focus();
							$("#error"+$("#"+this.id).attr('rel')).html('User name must be more than 2 character').fadeIn('slow');
							return false;
				}
			
			//user available
			}
			
			
		
			
			if(this.id=='email'){
				if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test($("#"+this.id).val())){
					$("#error"+$("#"+this.id).attr('rel')).html('Invalid email id').fadeIn('slow');
					$('html, body').animate({scrollTop: $("#"+this.id).offset().top}, 2000);
					var element_id=$("#"+this.id);
					setTimeout(function(){
							element_id.focus();   
						},2000);
					return false;
				}
			}
			
			if(this.id=='mobile_user'){
				if(isNaN($("#"+this.id).val())){
					$("#error"+$("#"+this.id).attr('rel')).html('Please enter proper mobile number').fadeIn('slow');
					$('html, body').animate({scrollTop: $("#"+this.id).offset().top}, 2000);
					var element_id=$("#"+this.id);
					setTimeout(function(){
							element_id.focus();   
						},2000);
					return false;
				}else if($("#"+this.id).val().length<10){
					$("#error"+$("#"+this.id).attr('rel')).html('Please enter proper mobile number').fadeIn('slow');
					$('html, body').animate({scrollTop: $("#"+this.id).offset().top}, 2000);
					var element_id=$("#"+this.id);
					setTimeout(function(){
							element_id.focus();   
						},2000);
					return false;
				}
			}
			
			if(this.id=='password'){
				if($("#"+this.id).val().length<5){
					$("#error"+$("#"+this.id).attr('rel')).html('Password must be more than 5 character').fadeIn('slow');
					$('html, body').animate({scrollTop: $("#"+this.id).offset().top}, 2000);
					var element_id=$("#"+this.id);
					setTimeout(function(){
							element_id.focus();   
						},2000);
					return false;
				}
			}
			if(this.id=='confirm_password'){
				if($("#"+this.id).val()!=$("#password").val()){
					$("#error"+$("#"+this.id).attr('rel')).html('Confirm password does not match').fadeIn('slow');
					$('html, body').animate({scrollTop: $("#"+this.id).offset().top}, 2000);
					var element_id=$("#"+this.id);
					setTimeout(function(){
							element_id.focus();   
						},2000);
					return false;
				}
			}
			}
				if(this.id=='built_up_area'){
				if(isNaN($("#"+this.id).val())){
					$("#error"+$("#"+this.id).attr('rel')).html('Please enter proper built up area').fadeIn('slow');
					$('html, body').animate({scrollTop: $("#"+this.id).offset().top}, 2000);
					var element_id=$("#"+this.id);
					setTimeout(function(){
							element_id.focus();   
						},2000);
					return false;
				}
			}
			if(this.id=='carpet_area'){
				if(isNaN($("#"+this.id).val())){
					$("#error"+$("#"+this.id).attr('rel')).html('Please enter proper carpet area').fadeIn('slow');
					$('html, body').animate({scrollTop: $("#"+this.id).offset().top}, 2000);
					var element_id=$("#"+this.id);
					setTimeout(function(){
							element_id.focus();   
						},2000);
					return false;
				}
			}
		
			if(this.id=='price_all'){
				if($("#"+this.id).val()==0){
				$('html, body').animate({scrollTop: $("#crores").offset().top}, 2000)
				$("#error"+$("#"+this.id).attr('rel')).html('Please choose propery price').fadeIn('slow');
				var element_id=$("#crores");
					setTimeout(function(){
							element_id.focus();   
						},2000);
						return false;
				}
				
			}
			if(this.id=='post'){
				//alert($("#post").val());
						
//$("#confirm_div").fadeIn(200);
/*$("#loader_registration").slideDown(200);
$('html, body').animate({
scrollTop: $("#loader_registration").offset().top
}, 2000);*/
						var iv=1;
							///uploading data
							//alert(data_string1);
							 var input_id='';
							 var data_string='type=registration';
							 //data_string+=data_string1;
						$('#signupForm :input').each(function() {
							  input_id=this.id;
							  if(input_id=='property_class'){
								 
								  if(document.getElementById('property_class').checked==true){
									  data_string+="&property_class="+$('#'+input_id).val();
								  }
								  
							  }else if(input_id=='property_class2'){
								  if(document.getElementById('property_class2').checked==true){
									  data_string+="&property_class="+$('#'+input_id).val();
								  }
								  
							  }else if(input_id=='ownership_type1'){
								  if(document.getElementById('ownership_type1').checked==true){
									  data_string+="&ownership_type="+$('#'+input_id).val();
								  }
							  }else if(input_id=='ownership_type2'){
								  if(document.getElementById('ownership_type2').checked==true){
									  data_string+="&ownership_type="+$('#'+input_id).val();
								  }
							  }else if(input_id=='ownership_type3'){
								  if(document.getElementById('ownership_type3').checked==true){
									  data_string+="&ownership_type="+$('#'+input_id).val();
								  }
							  }else if(input_id=='property_for1'){
								  if(document.getElementById('property_for1').checked==true){
									  data_string+="&property_for="+$('#'+input_id).val();
								  }
							  }else if(input_id=='property_for2'){
								  if(document.getElementById('property_for2').checked==true){
									  data_string+="&property_for="+$('#'+input_id).val();
								  }
							  }else if(input_id=='property_for3'){
								  if(document.getElementById('property_for3').checked==true){
									  data_string+="&property_for="+$('#'+input_id).val();
								  }
							  }else{
							data_string+="&"+input_id+"="+$('#'+input_id).val(); 
							  }
				
							//alert(signupForm.(this.name.value);
						});
						
						if(document.getElementById('signUpDiv').style.display=='' || document.getElementById('signUpDiv').style.display=='block'){
							data_string+="&signupCheck=0"; 
							
						}else{
							data_string+="&signupCheck=1"; 
						}
						
						///registration process
						if(document.getElementById('edit').value==1){
							data_string+="&property_id="+document.getElementById('property_id').value; 
						var url_link=str_SITE_URL+"ajax/information_edit_ajax.php"
						}else if(document.getElementById('edit').value==2){
						var url_link=str_SITE_URL+"ajax/requirement_ajax.php"	
						}else if(document.getElementById('edit').value==3){
							data_string+="&requirement_id="+document.getElementById('requirement_id').value; 
						var url_link=str_SITE_URL+"ajax/requirement_edit_ajax.php"	
						}else{
						var url_link=str_SITE_URL+"ajax/registration_ajax.php"
						}
						//alert(data_string);
						//alert(url_link);
						$('#page_loading').fadeIn(500);
						$('html, body').animate({scrollTop: $("#page_loading").offset().top}, 2000);
						
						 $.ajax({
											   type: "POST",
											   url: url_link,
											   data: data_string,
											   cache: false,
											   error: function(){
													alert('Error loading XML document');
												},
									
											   success: function(msg){  
											   //alert($("#"+this.id).attr('rel'));
											 // alert(msg);
											
														if(msg == 'OK')
														{ 
														if(document.getElementById('edit').value==1){
															//alert('edit');
															$('#page_loading').html('<h2><strong>Updated Successfully</strong></h2><div style="margin:auto; text-align:center;">This page will be redirected in <span style="font:bold 14px/14px Arial, Helvetica, sans-serif; color:#090;" id="counter_show">6</span> seconds</div>');
															display_counter();
															setTimeout("window.location=str_SITE_URL+'spanacre.manageproperties/page/'+document.getElementById('redirect_location').value",5000);
															
														}else if(document.getElementById('edit').value==2){
															//alert('edit');
															$('#page_loading').html('<h2><strong>Updated Successfully</strong></h2><div style="margin:auto; text-align:center;">This page will be redirected in <span style="font:bold 14px/14px Arial, Helvetica, sans-serif; color:#090;" id="counter_show">6</span> seconds</div>');
															display_counter();
															setTimeout("window.location=str_SITE_URL+'spanacre.managerequirement'",5000);
															
															//window.location=str_SITE_URL+"spanacre.managerequirement";
														}else if(document.getElementById('edit').value==3){
															//alert('edit');
															
															$('#page_loading').html('<h2><strong>Updated Successfully</strong></h2><div style="margin:auto; text-align:center;">This page will be redirected in <span style="font:bold 14px/14px Arial, Helvetica, sans-serif; color:#090;" id="counter_show">6</span> seconds</div>');
															display_counter();
															setTimeout("window.location=str_SITE_URL+'spanacre.managerequirement/page/'+document.getElementById('redirect_location').value",5000);
															
															//window.location=str_SITE_URL+"spanacre.managerequirement/page/"+document.getElementById('redirect_location').value;
														}else{
															
															
															$('#page_loading').html('<h2><strong>Registration Successfull</strong></h2><div style="margin:auto; text-align:center;">This page will be redirected in <span style="font:bold 14px/14px Arial, Helvetica, sans-serif; color:#090;" id="counter_show">6</span> seconds</div>');
															display_counter();
															setTimeout("window.location=str_SITE_URL+'spanacre.manageproperties'",5000);
															
															
															//$("#loader_registration").html(' <font color="Green"> Registration Successfull </font>  ').fadeIn('slow');
															//window.location=str_SITE_URL+"spanacre.manageproperties";
															$("#signUp").attr("disabled", true);
														}  
														}
														else if(msg == 'dup')
														{ 
															$('html, body').animate({scrollTop: $("#user_name").offset().top}, 2000);
															
															$("#error19").html('<img src="'+str_SITE_URL+'images/notavailable.gif" align="absmiddle"> User name already exist').fadeIn('slow');
															return false;
														}else if(msg == 'notfound'){
															$('html, body').animate({scrollTop: $("#user_name_in").offset().top}, 2000)
																$("#error22").html('Invalid user name or password').fadeIn('slow');															
															return false;			
														}  
														else  
														{  
														$('#page_loading').html('<h2><strong>Registration Failed</strong></h2><div style="margin:auto; text-align:center;">This page will be redirected in <span style="font:bold 14px/14px Arial, Helvetica, sans-serif; color:#090;" id="counter_show">6</span> seconds</div>');
															display_counter();
															setTimeout("window.location=str_SITE_URL+'spanacre.manageproperties'",5000);
														
															//$("#loader_registration").html('Registration Failed').fadeIn('slow');
															err_user=1;
															return false;
														}  
												  }
										 });
						
						///registration process
						
						
			}
			//return false;
		}else{
	if(document.getElementById('signUpDiv').style.display=='' || document.getElementById('signUpDiv').style.display=='block'){	
	
	if(this.id=='user_name_in' || this.id=='password_in'){	
					
		}else{
		//alert(this.id);
			if(this.id=='price_all'){
				$('html, body').animate({scrollTop: $("#crores").offset().top}, 2000);
					var element_id=$("#crores");
		setTimeout(function(){
        element_id.focus();   
    },2000);
			}else{
			//alert($("#"+this.id).attr('rel'));
//$("#"+this.id).focus();
$('html, body').animate({scrollTop: $("#"+this.id).offset().top}, 2000);
var element_id=$("#"+this.id);
setTimeout(function(){
        element_id.focus();   
    },2000);
			}
//$("#"+this.id).focus();
//alert(this.id);
			var err=$("#error"+$("#"+this.id).attr('rel')).attr('value');
			$("#error"+$("#"+this.id).attr('rel')).html(err).fadeIn('slow');
			//$("#error"+$("#"+this.id).attr('rel')).fadeIn('slow');
			return false;
		}
	
	}else{
		if(this.id=='name' || this.id=='email' || this.id=='address_user' || this.id=='city_user' || this.id=='zip_user' || this.id=='mobile_user' || this.id=='user_name' || this.id=='password' || this.id=='confirm_password'){	
		}else{
		
			if(this.id=='price_all'){
				$('html, body').animate({scrollTop: $("#crores").offset().top}, 2000)
					var element_id=$("#crores");
					setTimeout(function(){
							element_id.focus();   
						},2000);
			}else{
			//alert($("#"+this.id).attr('rel'));
//$("#"+this.id).focus();
$('html, body').animate({scrollTop: $("#"+this.id).offset().top}, 2000);
var element_id=$("#"+this.id);
setTimeout(function(){
        element_id.focus();   
    },2000);
			}
//$("#"+this.id).focus();
//alert(this.id);
			var err=$("#error"+$("#"+this.id).attr('rel')).attr('value');
			$("#error"+$("#"+this.id).attr('rel')).html(err).fadeIn('slow')
			//$("#error"+$("#"+this.id).attr('rel')).fadeIn('slow');
			return false;
		}
	}
		}
	}
    });
	
return false;

}


	
function available(){
	var user_name=document.getElementById('user_name').value;
	if(user_name.length>0){
	if(user_name.length>=2){	
	$("#error19").fadeIn('slow');
	var dataStringAva="user_name="+ user_name;
	var iv=1;							
							 var input_id='';
							 $('#signupForm :input').each(function() {
							  input_id=this.id;
								if(input_id=='ownership_type1'){
								  if(document.getElementById('ownership_type1').checked==true){
									  dataStringAva+="&ownership_type="+$('#'+input_id).val();
								  }
							  }else if(input_id=='ownership_type2'){
								  if(document.getElementById('ownership_type2').checked==true){
									  dataStringAva+="&ownership_type="+$('#'+input_id).val();
								  }
							  }else if(input_id=='ownership_type3'){
								  if(document.getElementById('ownership_type3').checked==true){
									  dataStringAva+="&ownership_type="+$('#'+input_id).val();
								  }
							  }
						});
							//alert(dataStringAva);
							 var url_site=str_SITE_URL+"ajax/check_ajax.php";
	 $.ajax({
		   type: "POST",
		   url: url_site,
		   data: dataStringAva,
		   cache: false,
		   error: function(){
				alert('Error loading XML document');
			},

   		   success: function(msg){     			
					if(msg == 'OK')
					{ 
						$("#error19").html('<img src="'+str_SITE_URL+'images/yes.png" align="absmiddle"> <font color="Green"> Available </font>  ').fadeIn('slow');
					}  
					else  
					{  
						$("#error19").html('<img src="'+str_SITE_URL+'images/notavailable.gif" align="absmiddle"> '+msg).fadeIn('slow');
						err_u=1;
						return err_u;
						//return false;
						
						
					}  
			  }
 	 });

}else{
		for(i=0;i<=21;i++){
				$("#error"+i).fadeOut('slow');	
			}
		$("#error19").html('User name must be more than 2 character').fadeIn('slow');
		return false;
	}
	
	}else{
		for(i=0;i<=21;i++){
				$("#error"+i).fadeOut('slow');	
			}
		$("#error19").html($("#error19").attr('value')).fadeIn('slow');
	}
}



function changeProfile(){
	
    // get all the inputs into an array.
    var $inputs = $('#signupForm :input');

    // not sure if you wanted this, but I thought I'd add it.
    // get an associative array of just the values.
    var values = {};
	var data='';
	data='type=editProfile';
    $inputs.each(function() {
						  //alert(this.id);
						//  alert($("#"+this.id).attr('rel'));
			
				if($("#"+this.id).attr('rel')!=null){
					for(i=0;i<=6;i++){
							$("#error"+i).fadeOut('slow');	
						}
					//alert(this.id);
					if($("#"+this.id).attr('value')==''){
						$("#error"+$("#"+this.id).attr('rel')).fadeIn('slow');
						//alert(this.id);
					
						return false;
					}else{
									if(this.id=='email'){
										if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test($("#"+this.id).val())){
											$("#error"+$("#"+this.id).attr('rel')).html('Invalid email id').fadeIn('slow');											
											return false;
										}
									}else{
											data+='&'+this.id+'='+$("#"+this.id).val();	
									} 
									if(this.id=='mobile_user'){
										if(isNaN($("#"+this.id).val())){
											$("#error"+$("#"+this.id).attr('rel')).html('Please enter proper mobile number').fadeIn('slow');											
											return false;
										}else if($("#"+this.id).val().length<10){
											$("#error"+$("#"+this.id).attr('rel')).html('Please enter proper mobile number').fadeIn('slow');											
											return false;
										}else{
											data+='&'+this.id+'='+$("#"+this.id).val();	
										}
									}else{
						data+='&'+this.id+'='+$("#"+this.id).val();						
									}
									
								
								
					}
					
				}else{
					data+='&'+this.id+'='+$("#"+this.id).val();
					
				}
				
				
				if(this.id=='editBtn'){	
				 //alert(data);
				 var url_site=str_SITE_URL+"ajax/ajax_edit_profile.php";
				 //$("#loader_edit").html('<img src="'+str_SITE_URL+'images/ajax-loader.gif" width="31" height="31" />').fadeIn('slow');
				 $('#page_loading').fadeIn(500);
						$('html, body').animate({scrollTop: $("#page_loading").offset().top}, 2000);
						
				  $.ajax({
											   type: "POST",
											   url: url_site,
											   data: data,
											   cache: false,
											   error: function(){
													alert('Error loading XML document');
												},
									
											   success: function(msg){  
											   //alert($("#"+this.id).attr('rel'));
											   //alert(msg);
														if(msg == 'OK')
														{ 
														//$("#loader_edit").fadeOut('slow');
														
														$('#page_loading').html('<h2><strong>Your profile Updated</strong></h2><div style="margin:auto; text-align:center;">This page will be redirected in <span style="font:bold 14px/14px Arial, Helvetica, sans-serif; color:#090;" id="counter_show">6</span> seconds</div>');
															display_counter();
															setTimeout("window.location=window.location.href",5000);
														
														// $("#loader_edit").html('<p style="background:#fff;">Profile updated successfuly</p>').fadeIn('slow');
														//setTimeout("window.location=window.location.href",2000);
														
														}else  
														{  
															$("#loader_edit").html(msg).fadeIn('slow');															
															return false;
														}  
												  }
										 });
				}
	  });
	
}

function changePassword(){
	
    // get all the inputs into an array.
    var $inputs = $('#signupForm :input');

    // not sure if you wanted this, but I thought I'd add it.
    // get an associative array of just the values.
    var values = {};
	var data='';
	data='type=editPassword';
    $inputs.each(function() {
						  //alert(this.id);
						//  alert($("#"+this.id).attr('rel'));
			
				if($("#"+this.id).attr('rel')!=null){
					for(i=0;i<=2;i++){
							$("#error"+i).fadeOut('slow');	
						}
					//alert(this.id);
					if($("#"+this.id).attr('value')==''){
						$("#error"+$("#"+this.id).attr('rel')).fadeIn('slow');
						//alert(this.id);
					
						return false;
					}else{
						if(this.id=='password'){
							if($("#"+this.id).val().length<5){
								$("#error"+$("#"+this.id).attr('rel')).html('Password must be more than 5 character').fadeIn('slow');
							
								return false;
							}
						}else{
						data+='&'+this.id+'='+$("#"+this.id).val();						
						}
						if(this.id=='confirm_password'){
							if($("#"+this.id).val()!=$("#password").val()){
								$("#error"+$("#"+this.id).attr('rel')).html('Confirm password does not match').fadeIn('slow');
								
								return false;
							}
						}else{
						data+='&'+this.id+'='+$("#"+this.id).val();						
						}					
						
									
								
								
					}
					
				}else{
					data+='&'+this.id+'='+$("#"+this.id).val();
					
				}
				
				
				if(this.id=='editBtn'){	
				// alert(data);
				var url_site=str_SITE_URL+"ajax/ajax_edit_password.php";
				// $("#loader_edit").html('<img src="'+str_SITE_URL+'images/ajax-loader.gif" width="31" height="31" />').fadeIn('slow');
				$('#page_loading').fadeIn(500);
						$('html, body').animate({scrollTop: $("#page_loading").offset().top}, 2000);
						
				  $.ajax({
											   type: "POST",
											   url: url_site,
											   data: data,
											   cache: false,
											   error: function(){
													alert('Error loading XML document');
												},
									
											   success: function(msg){  
											   //alert($("#"+this.id).attr('rel'));
											   //alert(msg);
														if(msg == 'OK')
														{ 
														//$("#loader_edit").fadeOut('slow');
														
														$('#page_loading').html('<h2><strong>Your Password Updated</strong></h2><div style="margin:auto; text-align:center;">This page will be redirected in <span style="font:bold 14px/14px Arial, Helvetica, sans-serif; color:#090;" id="counter_show">6</span> seconds</div>');
															display_counter();
															setTimeout("window.location=window.location.href",5000);
														
														
														// $("#loader_edit").html('<p style="background:#fff;">Password updated successfuly</p>').fadeIn('slow');
														//setTimeout("window.location=window.location.href",2000);
														
														}else  
														{  
															$("#loader_edit").html(msg).fadeIn('slow');															
															return false;
														}  
												  }
										 });
				}
	  });
	
}


function validationRegisterControl(){
			  var $inputs = $('#signupFormRegister :input');
		      var values = {};
    		  $inputs.each(function() {
									//alert(this.id);
					if($("#"+this.id).attr('rel')!=null){
						//alert(this.id);
		for(i=0;i<=10;i++){
				$("#error"+i).fadeOut('slow');	
			}
		if($("#"+this.id).attr('value')!=''){
			
			//alert($("#"+this.id).attr('rel'));
			//alert($("#"+this.id).attr('value'));
			$("#error"+$("#"+this.id).attr('rel')).fadeOut('slow');
			
			
			if(document.getElementById('signUpDiv').style.display=='' || document.getElementById('signUpDiv').style.display=='block'){
			if(this.id=='user_name'){
			var err_user=0;	
				//user available
				if($("#"+this.id).attr('value').length>=2){	
				//alert($("#user_name").val());
				var user_name=$("#user_name").val();
									//	$("#error"+$("#"+this.id).attr('rel')).fadeIn('slow');
										var dataStringAva="user_name="+ user_name;
							var iv=1;							
							 var input_id='';
							 $('#signupFormRegister :input').each(function() {
							  input_id=this.id;
								if(input_id=='ownership_type1'){
								  if(document.getElementById('ownership_type1').checked==true){
									  dataStringAva+="&ownership_type="+$('#'+input_id).val();
								  }
							  }else if(input_id=='ownership_type2'){
								  if(document.getElementById('ownership_type2').checked==true){
									  dataStringAva+="&ownership_type="+$('#'+input_id).val();
								  }
							  }else if(input_id=='ownership_type3'){
								  if(document.getElementById('ownership_type3').checked==true){
									  dataStringAva+="&ownership_type="+$('#'+input_id).val();
								  }
							  }
						});
							 var url_site=str_SITE_URL+"ajax/check_ajax.php";
							//alert(dataStringAva);
										 $.ajax({
											   type: "POST",
											   url: url_site,
											   data: dataStringAva,
											   cache: false,
											   error: function(){
													alert('Error loading XML document');
												},
									
											   success: function(msg){  
											   //alert($("#"+this.id).attr('rel'));
											   //alert(msg);
														if(msg == 'OK')
														{ 
															$("#error8").html('<img src="'+str_SITE_URL+'images/yes.png" align="absmiddle"> <font color="Green"> Available </font>  ').fadeIn('slow');
														}  
														else  
														{  
														//	$(err_user).val(1);
															$("#error8").html('<img src="'+str_SITE_URL+'images/notavailable.gif" align="absmiddle"> '+msg).fadeIn('slow');
															
															return false;
														}  
												  }
										 });
								//err();
								 //alert('hi');								
								if(err_user==1){									
									return false;
								}
										
				}else{
										//	$("#"+this.id).focus();
							$("#error"+$("#"+this.id).attr('rel')).html('User name must be more than 2 character').fadeIn('slow');
							return false;
				}
			
			//user available
			}
			
			
			
			
			if(this.id=='email'){
				if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test($("#"+this.id).val())){
					$("#error"+$("#"+this.id).attr('rel')).html('Invalid email id').fadeIn('slow');
					$('html, body').animate({scrollTop: $("#"+this.id).offset().top}, 2000);
					return false;
				}
			}
			
			if(this.id=='mobile_user'){
				if(isNaN($("#"+this.id).val())){
					$("#error"+$("#"+this.id).attr('rel')).html('Please enter proper mobile number').fadeIn('slow');
					$('html, body').animate({scrollTop: $("#"+this.id).offset().top}, 2000);
					return false;
				}else if($("#"+this.id).val().length<10){
					$("#error"+$("#"+this.id).attr('rel')).html('Please enter proper mobile number').fadeIn('slow');
					$('html, body').animate({scrollTop: $("#"+this.id).offset().top}, 2000);
					return false;
				}
			}
			
			if(this.id=='password'){
				if($("#"+this.id).val().length<5){
					$("#error"+$("#"+this.id).attr('rel')).html('Password must be more than 5 character').fadeIn('slow');
					$('html, body').animate({scrollTop: $("#"+this.id).offset().top}, 2000);
					return false;
				}
			}
			if(this.id=='confirm_password'){
				if($("#"+this.id).val()!=$("#password").val()){
					$("#error"+$("#"+this.id).attr('rel')).html('Confirm password does not match').fadeIn('slow');
					$('html, body').animate({scrollTop: $("#"+this.id).offset().top}, 2000);
					return false;
				}
			}
			}
			
			if(this.id=='phone_user'){
				
			}
			
			if(this.id=='post'){
				//alert($("#post").val());
						
//$("#confirm_div").fadeIn(200);
/*$("#loader_registration").slideDown(200);
$('html, body').animate({
scrollTop: $("#loader_registration").offset().top
}, 2000);*/
						var iv=1;
							///uploading data
							//alert(data_string1);
							 var input_id='';
							 var data_string='type=registration';
							 //data_string+=data_string1;
						$('#signupFormRegister :input').each(function() {
							  input_id=this.id;
							  //alert(input_id);
							  if(input_id=='ownership_type1'){
								  if(document.getElementById('ownership_type1').checked==true){
									  data_string+="&ownership_type="+$('#'+input_id).val();
								  }
							  }else if(input_id=='ownership_type2'){
								  if(document.getElementById('ownership_type2').checked==true){
									  data_string+="&ownership_type="+$('#'+input_id).val();
								  }
							  }else if(input_id=='ownership_type3'){
								  if(document.getElementById('ownership_type3').checked==true){
									  data_string+="&ownership_type="+$('#'+input_id).val();
								  }
							  }else{
							data_string+="&"+input_id+"="+$('#'+input_id).val(); 
							  }
				
							//alert(signupForm.(this.name.value);
						});
						
						
							data_string+="&signupCheck=0"; 
							
						
						
						///registration process
						
						var url_link="ajax/user_registration_ajax.php"
						
						//alert(data_string);
						//alert(url_link);
						$('#page_loading').fadeIn(500);
						$('html, body').animate({scrollTop: $("#page_loading").offset().top}, 2000);
						
						 $.ajax({
											   type: "POST",
											   url: url_link,
											   data: data_string,
											   cache: false,
											   error: function(){
													alert('Error loading XML document');
												},
									
											   success: function(msg){  
											   //alert($("#"+this.id).attr('rel'));
											  // alert(msg);
														if(msg == 'OK')
														{ 
														
														
														$('#page_loading').html('<h2><strong>Registration Successfull</strong></h2><div style="margin:auto; text-align:center;">This page will be redirected in <span style="font:bold 14px/14px Arial, Helvetica, sans-serif; color:#090;" id="counter_show">6</span> seconds</div>');
															display_counter();
															setTimeout("window.location=str_SITE_URL+'spanacre.myaccount'",5000);
														
															//$("#loader_registration").html(' <font color="Green"> Registration Successfull </font>  ').fadeIn('slow');
															//window.location=str_SITE_URL+"spanacre.myaccount";
															$("#signUp").attr("disabled", true);
														  
														}
														else if(msg == 'dup')
														{ 
															$('html, body').animate({scrollTop: $("#user_name").offset().top}, 2000);
															
															$("#error19").html('<img src="'+str_SITE_URL+'images/notavailable.gif" align="absmiddle"> User name already exist').fadeIn('slow');
															return false;
														}else if(msg == 'notfound'){
															$('html, body').animate({scrollTop: $("#user_name_in").offset().top}, 2000)
																$("#error22").html('Invalid user name or password').fadeIn('slow');															
															return false;			
														}  
														else  
														{  
															$("#loader_registration").html('Registration Failed').fadeIn('slow');
															err_user=1;
															return false;
														}  
												  }
										 });
						
						///registration process
						
						
			}
			//return false;
		}else{

			if(this.id=='phone_user'){
				
			}else{
			$('html, body').animate({scrollTop: $("#"+this.id).offset().top}, 2000);

			$("#error"+$("#"+this.id).attr('rel')).fadeIn('slow');
			return false;
			}
		
	}
		}
	//}
    });
return false;
}


function validationRegisterControl12(id){
	
		if($("#"+id).attr('value')==''){
			for(i=0;i<=10;i++){
				if(i!=id){
				$("#error"+i).fadeOut('slow');
				}
			}
			var err=$("#error"+$("#"+id).attr('rel')).attr('value');
			$("#error"+$("#"+id).attr('rel')).html(err).fadeIn('slow')
			
			
		}else{
				if(id=='user_name'){
			var err_user=0;	
				//user available
				if($("#"+id).attr('value').length>=2){	
				//alert($("#user_name").val());
				var user_name=$("#user_name").val();
				var dataStringAva="user_name="+ user_name;
					var iv=1;							
							 var input_id='';
							 $('#signupFormRegister :input').each(function() {
							  input_id=this.id;
								if(input_id=='ownership_type1'){
								  if(document.getElementById('ownership_type1').checked==true){
									  dataStringAva+="&ownership_type="+$('#'+input_id).val();
								  }
							  }else if(input_id=='ownership_type2'){
								  if(document.getElementById('ownership_type2').checked==true){
									  dataStringAva+="&ownership_type="+$('#'+input_id).val();
								  }
							  }else if(input_id=='ownership_type3'){
								  if(document.getElementById('ownership_type3').checked==true){
									  dataStringAva+="&ownership_type="+$('#'+input_id).val();
								  }
							  }
						});
							//alert(dataStringAva);
									//	$("#error"+$("#"+this.id).attr('rel')).fadeIn('slow');
										 var url_site=str_SITE_URL+"ajax/check_ajax.php";
										 $.ajax({
											   type: "POST",
											   url: url_site,
											   data: dataStringAva,
											   cache: false,
											   error: function(){
													alert('Error loading XML document');
												},
									
											   success: function(msg){  
											   //alert($("#"+this.id).attr('rel'));
											   //alert(msg);
														if(msg == 'OK')
														{ 
															$("#error8").html('<img src="'+str_SITE_URL+'images/yes.png" align="absmiddle"> <font color="Green"> Available </font>  ').fadeIn('slow');
														}  
														else  
														{  
														//	$(err_user).val(1);
															$("#error8").html('<img src="'+str_SITE_URL+'images/notavailable.gif" align="absmiddle"> '+msg).fadeIn('slow');
															
															return false;
														}  
												  }
										 });
								//err();
								 //alert('hi');								
								if(err_user==1){									
									return false;
								}
										
				}else{
										//	$("#"+this.id).focus();
							$("#error"+$("#"+id).attr('rel')).html('User name must be more than 2 character').fadeIn('slow');
							return false;
				}
			
			if(id=='email'){
				if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test($("#"+id).val())){
					$("#error"+$("#"+id).attr('rel')).html('Invalid email id').fadeIn('slow');
					$('html, body').animate({scrollTop: $("#"+id).offset().top}, 2000);
					return false;
				}
			}
			
			if(id=='mobile_user'){
				if(isNaN($("#"+id).val())){
					$("#error"+$("#"+id).attr('rel')).html('Please enter proper mobile number').fadeIn('slow');
					$('html, body').animate({scrollTop: $("#"+id).offset().top}, 2000);
					return false;
				}else if($("#"+id).val().length<10){
					$("#error"+$("#"+id).attr('rel')).html('Please enter proper mobile number').fadeIn('slow');
					$('html, body').animate({scrollTop: $("#"+id).offset().top}, 2000);
					return false;
				}
			}
			
			if(id=='password'){
				if($("#"+this.id).val().length<5){
					$("#error"+$("#"+this.id).attr('rel')).html('Password must be more than 5 character').fadeIn('slow');
					$('html, body').animate({scrollTop: $("#"+this.id).offset().top}, 2000);
					return false;
				}
			}
			if(id=='confirm_password'){
				if($("#"+this.id).val()!=$("#password").val()){
					$("#error"+$("#"+this.id).attr('rel')).html('Confirm password does not match').fadeIn('slow');
					$('html, body').animate({scrollTop: $("#"+this.id).offset().top}, 2000);
					return false;
				}
			}	
			if(id=='phone_user'){
				
			}
			//user available
			}else{
			
			$("#error"+$("#"+id).attr('rel')).fadeOut('slow');
			
			}
		}
}

function validationCatagoryRegisterControl(){
			  var $inputs = $('#signupFormCatagoryRegister :input');
		      var values = {};
    		  $inputs.each(function() {
									//alert(this.id);
					if($("#"+this.id).attr('rel')!=null){
						//alert(this.id);
		for(i=0;i<=10;i++){
				$("#error"+i).fadeOut('slow');	
			}
		if($("#"+this.id).attr('value')!=''){
			
			//alert($("#"+this.id).attr('rel'));
			//alert($("#"+this.id).attr('value'));
			$("#error"+$("#"+this.id).attr('rel')).fadeOut('slow');
			
			
			if(document.getElementById('signUpDiv').style.display=='' || document.getElementById('signUpDiv').style.display=='block'){
			if(this.id=='user_name'){
			var err_user=0;	
				//user available
				if($("#"+this.id).attr('value').length>=2){	
				//alert($("#user_name").val());
				var user_name=$("#user_name").val();
									//	$("#error"+$("#"+this.id).attr('rel')).fadeIn('slow');
										var dataStringAva="user_name="+ user_name;
							var iv=1;							
							 var input_id='';
							 $('#signupFormCatagoryRegister :input').each(function() {
							  input_id=this.id;
								 if(input_id=='catagory_type'){
									  dataStringAva+="&catagory_type="+$('#'+input_id).val();
								  }
							 
						});
							
										 var url_site=str_SITE_URL+"ajax/catagory_check_ajax.php";
							//alert(dataStringAva);
										 $.ajax({
											   type: "POST",
											   url: url_site,
											   data: dataStringAva,
											   cache: false,
											   error: function(){
													//alert('Error loading XML document');
												},
									
											   success: function(msg){  
											   //alert($("#"+this.id).attr('rel'));
											   //alert(msg);
														if(msg == 'OK')
														{ 
															$("#error8").html('<img src="'+str_SITE_URL+'images/yes.png" align="absmiddle"> <font color="Green"> Available </font>  ').fadeIn('slow');
														}  
														else  
														{  
														//	$(err_user).val(1);
															$("#error8").html('<img src="'+str_SITE_URL+'images/notavailable.gif" align="absmiddle"> '+msg).fadeIn('slow');
															
															return false;
														}  
												  }
										 });
								//err();
								 //alert('hi');								
								if(err_user==1){									
									return false;
								}
										
				}else{
										//	$("#"+this.id).focus();
							$("#error"+$("#"+this.id).attr('rel')).html('User name must be more than 2 character').fadeIn('slow');
							return false;
				}
			
			//user available
			}
			
			
			
			
			if(this.id=='email'){
				if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test($("#"+this.id).val())){
					$("#error"+$("#"+this.id).attr('rel')).html('Invalid email id').fadeIn('slow');
					$('html, body').animate({scrollTop: $("#"+this.id).offset().top}, 2000);
					return false;
				}
			}
			
			if(this.id=='mobile_user'){
				if(isNaN($("#"+this.id).val())){
					$("#error"+$("#"+this.id).attr('rel')).html('Please enter proper mobile number').fadeIn('slow');
					$('html, body').animate({scrollTop: $("#"+this.id).offset().top}, 2000);
					return false;
				}else if($("#"+this.id).val().length<10){
					$("#error"+$("#"+this.id).attr('rel')).html('Please enter proper mobile number').fadeIn('slow');
					$('html, body').animate({scrollTop: $("#"+this.id).offset().top}, 2000);
					return false;
				}
			}
			
			if(this.id=='password'){
				if($("#"+this.id).val().length<5){
					$("#error"+$("#"+this.id).attr('rel')).html('Password must be more than 5 character').fadeIn('slow');
					$('html, body').animate({scrollTop: $("#"+this.id).offset().top}, 2000);
					return false;
				}
			}
			if(this.id=='confirm_password'){
				if($("#"+this.id).val()!=$("#password").val()){
					$("#error"+$("#"+this.id).attr('rel')).html('Confirm password does not match').fadeIn('slow');
					$('html, body').animate({scrollTop: $("#"+this.id).offset().top}, 2000);
					return false;
				}
			}
			}
			if(this.id=='post'){
				//alert($("#post").val());
						
//$("#confirm_div").fadeIn(200);
/*$("#loader_registration").slideDown(200);
$('html, body').animate({
scrollTop: $("#loader_registration").offset().top
}, 2000);*/
						var iv=1;
							///uploading data
							//alert(data_string1);
							 var input_id='';
							 var data_string='type=registration';
							 //data_string+=data_string1;
						$('#signupFormCatagoryRegister :input').each(function() {
							  input_id=this.id;
							  //alert(input_id);
							 
							data_string+="&"+input_id+"="+$('#'+input_id).val(); 
							  
				
							//alert(signupForm.(this.name.value);
						});
						
						
							data_string+="&signupCheck=0"; 
							
						
						
						///registration process
						
						 var url_site=str_SITE_URL+"ajax/catagory_user_registration_ajax.php";
						//alert(data_string);
						//alert(url_link);
						
						$('#page_loading').fadeIn(500);
						$('html, body').animate({scrollTop: $("#page_loading").offset().top}, 2000);
						
						 $.ajax({
											   type: "POST",
											   url: url_site,
											   data: data_string,
											   cache: false,
											   error: function(){
													//alert('Error loading XML document');
												},
									
											   success: function(msg){  
											   //alert($("#"+this.id).attr('rel'));
											  // alert(msg);
														if(msg == 'OK')
														{ 
														
														$('#page_loading').html('<h2><strong>Registration Successfull</strong></h2><div style="margin:auto; text-align:center;">This page will be redirected in <span style="font:bold 14px/14px Arial, Helvetica, sans-serif; color:#090;" id="counter_show">6</span> seconds</div>');
															display_counter();
															setTimeout("window.location=str_SITE_URL+'spanacre.myaccountCat'",5000);
														
															//$("#loader_registration").html(' <font color="Green"> Registration Successfull </font>  ').fadeIn('slow');
															//window.location=str_SITE_URL+"myaccountCat.php";
															$("#signUp").attr("disabled", true);
														  
														}
														else if(msg == 'dup')
														{ 
															$('html, body').animate({scrollTop: $("#user_name").offset().top}, 2000);
															
															$("#error19").html('<img src="'+str_SITE_URL+'images/notavailable.gif" align="absmiddle"> User name already exist').fadeIn('slow');
															return false;
														}else if(msg == 'notfound'){
															$('html, body').animate({scrollTop: $("#user_name_in").offset().top}, 2000)
																$("#error22").html('Invalid user name or password').fadeIn('slow');															
															return false;			
														}  
														else  
														{  
															$("#loader_registration").html('Registration Failed').fadeIn('slow');
															err_user=1;
															return false;
														}  
												  }
										 });
						
						///registration process
						
						
			}
			//return false;
		}else{

		/*if(this.id=='name' || this.id=='email' || this.id=='address_user' || this.id=='city_user' || this.id=='zip_user' || this.id=='mobile_user' || this.id=='user_name' || this.id=='password' || this.id=='confirm_password'){	
		}else{
		
			if(this.id=='price_all'){
				$('html, body').animate({scrollTop: $("#crores").offset().top}, 2000)
			}else{*/
			//alert($("#"+this.id).attr('rel'));
//$("#"+this.id).focus();
$('html, body').animate({scrollTop: $("#"+this.id).offset().top}, 2000);
			//}
//$("#"+this.id).focus();
//alert(this.id);
			/*var err=$("#error"+$("#"+this.id).attr('rel')).attr('value');
			$("#error"+$("#"+this.id).attr('rel')).html(err).fadeIn('slow')*/
			$("#error"+$("#"+this.id).attr('rel')).fadeIn('slow');
			return false;
		
	}
		}
	//}
    });
return false;
}


function validationCatagoryRegisterControl12(id){
	
		if($("#"+id).attr('value')==''){
			for(i=0;i<=10;i++){
				if(i!=id){
				$("#error"+i).fadeOut('slow');
				}
			}
			var err=$("#error"+$("#"+id).attr('rel')).attr('value');
			$("#error"+$("#"+id).attr('rel')).html(err).fadeIn('slow')
			
			
		}else{
				if(id=='user_name'){
			var err_user=0;	
				//user available
				if($("#"+id).attr('value').length>=2){	
				//alert($("#user_name").val());
				var user_name=$("#user_name").val();
				var dataStringAva="user_name="+ user_name;
					var iv=1;							
							 var input_id='';
							 $('#signupFormCatagoryRegister :input').each(function() {
							  input_id=this.id;
								  if(input_id=='catagory_type'){
									  dataStringAva+="&catagory_type="+$('#'+input_id).val();
								  }
							 
						});
							//alert(dataStringAva);
									//	$("#error"+$("#"+this.id).attr('rel')).fadeIn('slow');
										 var url_site=str_SITE_URL+"ajax/catagory_check_ajax.php";
										//alert(url_site);
										$.ajax({
											   type: "POST",
											   url: url_site,
											   data: dataStringAva,
											   cache: false,
											   error: function(){
													alert('Error loading XML document');
												},
									
											   success: function(msg){  
											   //alert($("#"+this.id).attr('rel'));
											   //alert(msg);
														if(msg == 'OK')
														{ 
															$("#error8").html('<img src="'+str_SITE_URL+'images/yes.png" align="absmiddle"> <font color="Green"> Available </font>  ').fadeIn('slow');
														}  
														else  
														{  
														//	$(err_user).val(1);
															$("#error8").html('<img src="'+str_SITE_URL+'images/notavailable.gif" align="absmiddle"> '+msg).fadeIn('slow');
															
															return false;
														}  
												  }
										 });
								//err();
								 //alert('hi');								
								if(err_user==1){									
									return false;
								}
										
				}else{
										//	$("#"+this.id).focus();
							$("#error"+$("#"+id).attr('rel')).html('User name must be more than 2 character').fadeIn('slow');
							return false;
				}
			
			if(id=='email'){
				if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test($("#"+id).val())){
					$("#error"+$("#"+id).attr('rel')).html('Invalid email id').fadeIn('slow');
					$('html, body').animate({scrollTop: $("#"+id).offset().top}, 2000);
					return false;
				}
			}
			
			if(id=='mobile_user'){
				if(isNaN($("#"+id).val())){
					$("#error"+$("#"+id).attr('rel')).html('Please enter proper mobile number').fadeIn('slow');
					$('html, body').animate({scrollTop: $("#"+id).offset().top}, 2000);
					return false;
				}else if($("#"+id).val().length<10){
					$("#error"+$("#"+id).attr('rel')).html('Please enter proper mobile number').fadeIn('slow');
					$('html, body').animate({scrollTop: $("#"+id).offset().top}, 2000);
					return false;
				}
			}
			
			if(id=='password'){
				if($("#"+this.id).val().length<5){
					$("#error"+$("#"+this.id).attr('rel')).html('Password must be more than 5 character').fadeIn('slow');
					$('html, body').animate({scrollTop: $("#"+this.id).offset().top}, 2000);
					return false;
				}
			}
			if(id=='confirm_password'){
				if($("#"+this.id).val()!=$("#password").val()){
					$("#error"+$("#"+this.id).attr('rel')).html('Confirm password does not match').fadeIn('slow');
					$('html, body').animate({scrollTop: $("#"+this.id).offset().top}, 2000);
					return false;
				}
			}
			//user available
			}else{
			$("#error"+$("#"+id).attr('rel')).fadeOut('slow');
			}
		}
}







function contactUs(){
	
    // get all the inputs into an array.
    var $inputs = $('#ContactForm :input');

    // not sure if you wanted this, but I thought I'd add it.
    // get an associative array of just the values.
    var values = {};
	var data='';
	data='type=editProfile';
    $inputs.each(function() {
						  //alert(this.id);
						//  alert($("#"+this.id).attr('rel'));
			
				if($("#"+this.id).attr('rel')!=null){
					for(i=0;i<=3;i++){
							$("#error"+i).fadeOut('slow');	
						}
					//alert(this.id);
					if($("#"+this.id).attr('value')==''){
						$("#error"+$("#"+this.id).attr('rel')).fadeIn('slow');
						//alert(this.id);
						$('html, body').animate({scrollTop: $("#"+this.id).offset().top}, 2000);
						return false;
					}else{
									if(this.id=='name'){
										
										if($("#"+this.id).val()==''){
											$("#error"+$("#"+this.id).attr('rel')).html('Please enter your name').fadeIn('slow');
											$('html, body').animate({scrollTop: $("#"+this.id).offset().top}, 2000);
											return false;
										}else{
									data+='&'+this.id+'='+$("#"+this.id).val();						
									}
									}
									
									if(this.id=='email'){
										if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test($("#"+this.id).val())){
											$("#error"+$("#"+this.id).attr('rel')).html('Invalid email id').fadeIn('slow');		
											$('html, body').animate({scrollTop: $("#"+this.id).offset().top}, 2000);
											return false;
										}else{
									data+='&'+this.id+'='+$("#"+this.id).val();						
									}
									}
								
									if(this.id=='message'){
										if($("#"+this.id).val()==''){
											$("#error"+$("#"+this.id).attr('rel')).html('Please enter message').fadeIn('slow');	
											$('html, body').animate({scrollTop: $("#"+this.id).offset().top}, 2000);
											return false;
										}else{
									data+='&'+this.id+'='+$("#"+this.id).val();						
									}
									}
								
								
					}
					
				}else{
					data+='&'+this.id+'='+$("#"+this.id).val();
					
				}
				
				
				if(this.id=='editBtn'){	
				 //alert(data);
				 var url_site=str_SITE_URL+"ajax/ajax_contact_us.php";
				 //$("#loader_edit").html('<img src="'+str_SITE_URL+'images/ajax-loader.gif" width="31" height="31" />').fadeIn('slow');
				// alert(data);
				 $('#page_loading').fadeIn(500);
						$('html, body').animate({scrollTop: $("#page_loading").offset().top}, 2000);
						
				  $.ajax({
											   type: "POST",
											   url: url_site,
											   data: data,
											   cache: false,
											   error: function(){
													alert('Error loading XML document');
												},
									
											   success: function(msg){  
											   //alert($("#"+this.id).attr('rel'));
											   //alert(msg);
														if(msg == 'OK')
														{ 
														//$("#loader_edit").fadeOut('slow');
														
														$('#page_loading').html('<h2><strong>Thank you for showing interest in spanacre.com</strong></h2><div style="margin:auto; text-align:center;">This message will be close in <span style="font:bold 14px/14px Arial, Helvetica, sans-serif; color:#090;" id="counter_show">6</span> seconds</div>');
															display_counter();
															setTimeout("$('#page_loading').fadeOut(1000);",5000);
														
														// $("#loader_edit").html('<p style="background:#fff;">Profile updated successfuly</p>').fadeIn('slow');
														//setTimeout("window.location=window.location.href",2000);
														
														}else  
														{  
															$("#loader_edit").html(msg).fadeIn('slow');	
															setTimeout("$('#page_loading').fadeOut(1000);",5000);
															return false;
														}  
												  }
										 });
				}
	  });
	
}




