function show_graph(i)
{

  var row=document.getElementById('show_'+i);
  
  if(row.style.display=='none')
   {
       row.style.display='';
   }
  else 
  {
  row.style.display='none';
  }
  
  var count=document.getElementById('i').value;




	if ( document.getElementById('show_'+i).style.display == "none")
	{
		$("#img_"+i).attr('src','/templates/default/images/plus.jpg');
	}
	else if ( document.getElementById('show_'+i).style.display == "table-row")
	{
		$("#img_"+i).attr('src','/templates/default/images/minus.jpg');
	}
	else
	{
		$("#img_"+i).attr('src','/templates/default/images/minus.jpg');
	}
	

	for(var x=1;x<=count;x++)
	 {
	   if( i != x)
    	{
			
	     $('#show_'+x).hide();
		 $("#img_"+x).attr('src','/templates/default/images/plus.jpg');
		
	    }
	}
   
}


function get_neighbour(m)
{

     var locality_name=document.getElementById('loc_'+m).value;

	
	 
	 document.getElementById('common').value=m;
       //alert(locality_name);
        process		=	'loadEvent';
		output		=	'text';
		url			=	getURL() + "/property/locality/?act=NL&locality="+locality_name;


	responseHandler	=	"processEventResponsesample";

	ajaxPostRequest(url, "");		
	return false;	
}

function processEventResponsesample(responseText)
{
	
	var new_common=document.getElementById('common').value;
	document.getElementById('neighbour_locations_'+new_common).innerHTML = responseText;	
}


function get_property(m)
{
     var locality_name=document.getElementById('loc_'+m).value;
	  
	    
	  
	 document.getElementById('common').value=m;

        process		=	'loadEvent';
		output		=	'text';
		url			=	getURL() + "/property/locality/?act=NL&locality="+locality_name;


	ajaxPostRequest(url, "");		
	return false;	

}



/*function neighbour_property(neighbour_name,locality)
{
		
     document.getElementById('localityname').value=locality;
        process		=	'loadEvent';
		output		=	'text';
		url			=	getURL() + "/property/locality/?act=NLP&Nlocality="+neighbour_name;


	responseHandler	=	"processEventResponsesample_N";

	ajaxPostRequest(url, "");		
	return false;
	
	
}


function processEventResponsesample_N(responseText)
 {

	var locs=document.getElementById('localityname').value;
	document.getElementById('properties_'+locs).innerHTML = responseText;	
}
*/



function neighbour(n)
{
	url			=	getURL() + "/property/search/?act=F&budgetType=1&searchtype=buy&searchmode=property&searchmethod=advanced&property_posted_by=All&city=Chennai&resType=&comType=&bed_rooms=All&locality="+n+"&budget=&budgetRent=";
   window.location=url;	

}

function neighbours(n,property_type)
{
	
  if(property_type=='sale')
   {
		
			url			=	getURL() + "/property/search/?act=F&budgetType=2&searchtype=buy&searchmode=property&ownership_type=Sell|&searchmethod=advanced&property_posted_by=All&city=Chennai&resType=&comType=&bed_rooms=All&locality="+n+"&budget=&budgetRent=";
           window.location=url;	

	}
	
	else
	{
		url			=	getURL() + "/property/search/?act=F&budgetType=1&searchtype=buy&searchmode=property&ownership_type=Rent|&searchmethod=advanced&property_posted_by=All&city=Chennai&resType=&comType=&bed_rooms=All&locality="+n+"&budget=&budgetRent=";
   window.location=url;	
      
	}
 }

function neighbouring(n)
{
	
	url			=	getURL() + "/property/search/?act=F&budgetType=2&searchtype=buy&searchmode=property&ownership_type=Sell|&searchmethod=advanced&property_posted_by=All&city=Chennai&resType=&comType=&bed_rooms=All&locality="+n+"&budget=&budgetRent=";
           window.location=url;	
}

function property_type(value,location)
 {

	  
	document.getElementById('localityname').value=location;

   if(value=='sale')
    {

	   process		=	'loadEvent';
		output		=	'text';
		url			=	getURL() + "/property/locality/?act=NLSale&locality="+location+"&type="+value;

	   responseHandler	=	"processEventResponsesampleSell";
    }	
   else
   {

        process		=	'loadEvent';
		output		=	'text';
		url			=	getURL() + "/property/locality/?act=NLRent&locality="+location+"&type="+value;

		responseHandler	=	"processEventResponsesampleRent";
   }

	ajaxPostRequest(url, "");		
	return false;		
 }

function processEventResponsesampleRent(responseText)
 {
	
    var locs=document.getElementById('localityname').value;
	document.getElementById('properties_'+locs).innerHTML = responseText;	
 }

 function processEventResponsesampleSell(responseText)
 {

	var locs=document.getElementById('localityname').value;
	document.getElementById('properties_'+locs).innerHTML = responseText;	
 }
 

