// JavaScript Document

 $(function(){
	 
	 
	 
	  $("#submitSell").click(function(){
		  
		 		  
		  if ($("#categorySell").val()=="") 
					
						{
						jAlert('Please Select Catagory')
						return (false); 	
						}
							
							
							else if($("#citySell").val()==""){
								
								jAlert('Please Select City')
								return (false); 
								
															
								}
							else if($("#location").val()=="Location"){
								
								jAlert('Please Select Location')
								return (false); 
								
								}
							else if($("#propertyTypeSell").val()==""){
								
								jAlert('Please Select Property Type')
								return (false); 
																							
								}	
								
						else if(($("#subBHKProperty").val()=="")|| ($("#subBHKProperty").val()=="Size")){
								
								jAlert('Please Select Size')
								return (false); 
																							
								}
								
													
						else if(($("#subBHKSlabs").val()=="")|| ($("#subBHKSlabs").val()=="In Square-Feet(Only Numeric)") ||  ($("#subBHKSlabs").val()<=0)  ){
								
								jAlert('Please Enter Size in Square Feet(Only Numeric Value)')
								return (false); 
																							
								}
							
							else if(($("#subBHKSizes").val()=="")|| ($("#subBHKSizes").val()=="In Square-Feet(Only Numeric)") || ($("#subBHKSizes").val()<=0) ){
								alert($("#subBHKSizes").val());
								jAlert('Please Enter Size in Square Feet(Only Numeric Value)..')
								return (false); 
																							
								}			
		 					else if(($("#subBHKLandSell").val()=="")|| ($("#subBHKLandSell").val()=="In Acre/Acres(Only Numeric)") || ($("#subBHKLandSell").val()<=0)){
								
								jAlert('Please Enter Size in Acre/Acres(Only Numeric Value)')
								return (false); 
																							
								}			
		 					else if(($("#budgetRangeSell").val()=="") || ($("#budgetRangeSell").val()=="Price in Rs.")){
													
								jAlert('Please Enter Price in Rs.')
																
								return (false); 
																							
								}
							else if ((isNaN($("#budgetRangeSell").val())) || ($("#budgetRangeSell").val()<= 0.0)) {
									jAlert('Price should be in numeric');
									return (false); 
								}
													
		 
	 	 	//alert('moumita here'); //exit;
		$.post("outputSellData.php",{
					categorySell:$("#categorySell").val(),
					citySell:$("#citySell").val(),
					locationSell:$("#locationSell").val(),
					propertyTypeSell:$("#propertyTypeSell").val(),
					subBHKProperty:$("#subBHKProperty").val(),
					subBHKSlabs:$("#subBHKSlabs").val(),
					subBHKSizes:$("#subBHKSizes").val(),
					subBHKLandSell:$("#subBHKLandSell").val(),
					
					/*subBHKSlabs:$("#subBHKsale").val(),
					subBHKProperty:$("#subBHKProperty").val(),
					subBHKSizes:$("#subBHKSizes").val(),*/
					budgetRangeSell:$("#budgetRangeSell").val(),
					/*subBHKLand:$("#subBHKLandSell").val(),
					sellname:$("#sellname").val(),
					sellEmail:$("#sellEmail").val(),
					sellMobile:$("#sellMobile").val(),
					sellPropertyName:$("#sellPropertyName").val(),*/
				},function(data){
					//alert(data); //exit;
								
					if(data == 1)
					{
						//jAlert('Thank you for submitting the details.Our representative will contact you with in 48 hours.')	
						window.location = 'sellDetailsForm.php';
							
					}
					else if(data == 0)
					{
						
					jAlert('Data was not submitted suceesfully. Please tyry again.')	
					}
										
					tb_remove();
					});
		 });
	 
	  
	 function changeLocation(val)
 {
	 
  
  $.ajax({ 
		   cache:false,
		   async:true,
		   type: "POST",
		   url: "locationSell.php",
		   data: "name="+val,
		   success: function(msg){
			 if(msg == 0){
				  window.location = 'index.php';	// change the URL according to ur path
			  }
			  $("#locationSells").html(msg);
		   }
		});
  
  
 
 }

	changeLocation($("#citySell").val());
		
		$("#citySell").change(function(){
				changeLocation($(this).val());
			});
			
	
	 });
	 

 $(function(){
	 
	 function changeProperty(val)
 {
	 
  
  $.ajax({ 
		   cache:false,
		   async:true,
		   type: "POST",
		   url: "propertySell.php",
		   data: "name="+val,
		   success: function(msg){
			 if(msg == 0){
				  window.location = 'index.php';	// change the URL according to ur path
			  }
			  $("#propertySell").html(msg);
			  changeSubProperty($("#propertyTypeSell").val());
		   }
		});
  
   
 
 }

	changeProperty($("#categorySell").val());
		
		$("#categorySell").change(function(){
				changeProperty($(this).val());
			});
			
	
	
	 function changeSubProperty(val)
 {
	 
  if(val==11 || val==5 || val==14 || val==6 )
  {
  $.ajax({ 
		   cache:false,
		   async:true,
		   type: "POST",
		   url: "subproperty.php",
		   data: "name="+val,
		   success: function(msg){
			 if(msg == 0){
				  window.location = 'index.php';	// change the URL according to ur path
			  }
			  $("#subBHKSSell").html(msg);
		   }
		});
  
  
 
  }
  else if(val==7 || val==8 || val==12 || val==13)
  {
	  
	  $.ajax({ 
		   cache:false,
		   async:true,
		   type: "POST",
		   url: "subSizes.php",
		   data: "name="+val,
		   success: function(msg){
			 if(msg == 0){
				  window.location = 'index.php';	// change the URL according to ur path
			  }
			  $("#subBHKSSell").html(msg);
		   }
		});
  
	  
	  
  }
  
   else if(val==2)
  {
	  
	  $.ajax({ 
		   cache:false,
		   async:true,
		   type: "POST",
		   url: "sizeSlabs.php",
		   data: "name="+val,
		   success: function(msg){
			 if(msg == 0){
				  window.location = 'index.php';	// change the URL according to ur path
			  }
			  $("#subBHKSSell").html(msg);
		   }
		});
  
	  
	  
  }
  
   else if(val==15 || val==16 || val ==4 || val ==3)  
  {
	  
	  $.ajax({ 
		   cache:false,
		   async:true,
		   type: "POST",
		   url: "subLandSizesBuy.php",
		   data: "name="+val,
		   success: function(msg){
			 if(msg == 0){
				  window.location = 'index.php';	// change the URL according to ur path
			  }
			  $("#subBHKSSell").html(msg);
		   }
		});
  
	  
	  
  }
		
 }
 changeSubProperty($("#propertyTypeSell").val());
 
	$("#propertyTypeSell").live("change",function(){
		changeSubProperty($(this).val());
	 	});
});
	 

