$(document).ready(function()
{ 
	uid = $("#huserid").val();
	agentid_value = $("#hagentid").val();
	$('.paginate').each(function()
 	{
		a = this.id;
		b = "#"+a+"_listings";
		if(uid == "")
	 	{
	 		newlink = this_domain + '/body/agents_property/ajax_agents_property_listings.php?purpose='+a+'&agentid='+agentid_value;
	 	}
	 	else
	 	{
	 		newlink = this_domain + '/body/agents_property/ajax_agents_property_listings.php?purpose='+a+'&userid='+ uid+'&agentid='+agentid_value;
	 	}
		var load_image = "<center><img src='" + this_domain + "/images/common/loading.gif' /></center>";
		$(b).html(load_image);
		c=$.ajax({url: newlink ,async: false }).responseText;
		$(b).html(c);
	});
});

$('.paginate span a').livequery('click', function(event)
 {
  		uid = $("#huserid").val();
		agentid_value = $("#hagentid").val();
		a = $(this).parents('.paginate').attr("id") ;
		b = "#"+a+"_listings";
		c = "#"+a+"_select select";
		sub_value = $(c).val();
		var load_image = "<center><img src='" + this_domain + "/images/common/loading.gif' /></center>";
		$(b).html(load_image);
		if(typeof uid === "undefined")
		{
			uid = 0;
		}
		$.get(this_domain + '/body/agents_property/ajax_agents_property_listings.php',{purpose:a,userid:uid,page:this.id,number_records:sub_value, agentid:agentid_value}
		,function(str) {$(b).html(str);});		
		return false;
});

$(".show_select").livequery('change',function(event)
{
	
	uid = $("#huserid").val();
	agentid_value = $("#hagentid").val();
	div_id = $(this).parent().attr("id");
	a = div_id.replace("_select","");
	b = "#"+a+"_listings";
	sub_value = this.value;
	var load_image = "<center><img src='" + this_domain + "/images/common/loading.gif' alt='' /></center>";
		$(b).html(load_image);
	$.get(this_domain + '/body/agents_property/ajax_agents_property_listings.php', {purpose: a, userid: uid, number_records: sub_value, agentid: agentid_value}
		,function(str) {$(b).html(str);});		
		return false;
});

