

function InitAjax ( )
{
	if ( window.ActiveXObject )
	{

		xmlHttp = new ActiveXObject ( "Microsoft.XMLHTTP" ) ; // IE create way

	}
	else if ( window.XMLHttpRequest ) // FF create way
	{

		xmlHttp = new XMLHttpRequest ( ) ;

	}

	return xmlHttp ;

}
	
jQuery.noConflict();
 //20100831 tao add/modify
function setHash(a){
	jQuery.browser.msie?jQuery.locationHash(a):location.hash=a;
}

jQuery(window).hashchange(function(){
	doHash();
});
function ajaxFn(n){
	var action = document.searchform.action.value;
	var status = document.searchform.status.value;
	var rooms = document.searchform.rooms.value;
	var type = document.searchform.type.value;
	var priceform = document.searchform.priceform.value;
	var priceto = document.searchform.priceto.value;
	var sizeform = document.searchform.sizeform.value;
	var sizeto = document.searchform.sizeto.value;
	var district = document.searchform.district.value;
	var price_type = document.searchform.price_type.value;
	var page = n;
	
	var url  = "cpcom.php?action="+action+"&status="+status+"&rooms="+rooms+"&priceform="+priceform+"&priceto="+priceto+"&sizeform="+sizeform+"&sizeto="+sizeto+"&district="+district+"&page="+page+"&type="+type+"&price_type="+price_type;
	
	getFlats(url);
	setHash("#page_"+page);
	
}
function ajaxBFn(n){
	var action = document.searchform.action.value;
	var status = document.searchform.status.value;
	var rooms = document.searchform.rooms.value;
	var type = document.searchform.type.value;
	var priceform = document.searchform.priceform.value;
	var priceto = document.searchform.priceto.value;
	var sizeform = document.searchform.sizeform.value;
	var sizeto = document.searchform.sizeto.value;
	var district = document.searchform.district.value;
	var price_type = document.searchform.price_type.value;
	var page = n;

	var url  = "cpcom.php?action="+action+"&status="+status+"&rooms="+rooms+"&priceform="+priceform+"&priceto="+priceto+"&sizeform="+sizeform+"&sizeto="+sizeto+"&type="+type+"&price_type="+price_type+"&district="+district+"&page="+page;
	
	getBFlats(url);
	setHash("#page_"+page);
	
}
function ajaxPageFn(action, status, type, rooms, priceform, priceto, sizeform, sizeto, district, page, price_type){
	var action = action;
	var status = status;
	var rooms = rooms;
	var priceform = priceform;
	var priceto = priceto;
	var sizeform = sizeform;
	var sizeto = sizeto;
	var district = district;
	var page = page;
	var price_type = price_type;

	var url  = "cpcom.php?action="+action+"&status="+status+"&type="+type+"&rooms="+rooms+"&priceform="+priceform+"&priceto="+priceto+"&sizeform="+sizeform+"&sizeto="+sizeto+"&district="+district+"&page="+page+"&price_type="+price_type;
	
	Flats_pages(url);
	setHash("#page_"+page);
	
}
//tao add/modify end

function getFlats (url){

	var show = document.getElementById( "show_Layer" ) ;
	show.innerHTML = "<div class='innerRSCLoading'><img src='images/loading.gif' border=0></div>";


	var ajax = InitAjax ( ) ;

	ajax.open( "GET", url, true ) ;

	ajax.onreadystatechange = function ( )
	{

		if ( ajax.readyState == 4 && ajax.status == 200 )
		{
			
			show.innerHTML = ajax.responseText ;
		}

	}

	ajax.send ( null ) ;

}

function getDetailFlats ()
{
	var action = document.searchform.action.value;
	var rooms = document.searchform.rooms.value;
	var priceform = document.searchform.priceform.value;
	var priceto = document.searchform.priceto.value;
	var sizeform = document.searchform.sizeform.value;
	var sizeto = document.searchform.sizeto.value;
	var district = document.searchform.district.value;
	var price_type = document.searchform.price_type.value;

	var url  = "cpcom_details.php?action="+action+"&rooms="+rooms+"&priceform="+priceform+"&priceto="+priceto+"&sizeform="+sizeform+"&sizeto="+sizeto+"&district="+district+"&price_type="+price_type;
	

	var show = document.getElementById( "show_Layer" ) ;
	show.innerHTML = "<div style='position:absolute;right:320px;top:260px;'><img src='images/loading.gif' border=0></div>";
	var ajax = InitAjax ( ) ;

	ajax.open( "GET", url, true ) ;

	ajax.onreadystatechange = function ( )
	{

		if ( ajax.readyState == 4 && ajax.status == 200 )
		{
			
			show.innerHTML = ajax.responseText ;
		}

	}

	ajax.send ( null ) ;

}


function Flats_pages (url){

	var show = document.getElementById( "show_Layer" ) ;
	
	show.innerHTML = "<div class='innerHTMLLoading'><img src='images/loading.gif' border=0></div>";
	
	
	var ajax = InitAjax ( ) ;
	ajax.open( "GET", url, true ) ;
	ajax.onreadystatechange = function ( )
	{
		if ( ajax.readyState == 4 && ajax.status == 200 )
		{
			show.innerHTML = ajax.responseText ;
		}
	}
	ajax.send ( null ) ;

}

function Flats_pages_details (action,type, rooms, priceform, priceto, sizeform, sizeto, district, page, price_type){
	var action = action;
	var rooms = rooms;
	var priceform = priceform;
	var priceto = priceto;
	var sizeform = sizeform;
	var sizeto = sizeto;
	var district = district;
	var page = page;
	var price_type = price_type;

	var url  = "cpcom_details.php?action="+action+"&type="+type+"&rooms="+rooms+"&priceform="+priceform+"&priceto="+priceto+"&sizeform="+sizeform+"&sizeto="+sizeto+"&district="+district+"&page="+page+"&price_type="+price_type;
	//cpcom.php?action="+action+"&rooms="+rooms+"&priceform="+priceform+"&priceto="+priceto+"&sizeform="+sizeform+"&sizeto="+sizeto+"&type="+type+"&price_type="+price_type+"&district="+district;
	

	var show = document.getElementById( "show_Layer" ) ;
	
	show.innerHTML = "<div style='position:absolute;right:320px;top:250px;'><img src='images/loading.gif' border=0></div>";
	
	
	var ajax = InitAjax ( ) ;
	ajax.open( "GET", url, true ) ;
	ajax.onreadystatechange = function ( )
	{
		if ( ajax.readyState == 4 && ajax.status == 200 )
		{
			show.innerHTML = ajax.responseText ;
		}
	}
	ajax.send ( null ) ;

}


function Daily_pages (page)
{


	var url  = "dailytails.php?page="+page;
	
	

	var show = document.getElementById( "show_Layer" ) ;
	
	show.innerHTML = "<div style='position:absolute;right:450px;top:400px;'><img src='images/loading.gif' border=0></div>";
	
	
	var ajax = InitAjax ( ) ;
	ajax.open( "GET", url, true ) ;
	ajax.onreadystatechange = function ( )
	{
		if ( ajax.readyState == 4 && ajax.status == 200 )
		{
			show.innerHTML = ajax.responseText ;
		}
	}
	ajax.send ( null ) ;

}

function getBFlats (url)
{
	
	
	//alert(url);


	var show = document.getElementById( "show_Layer" ) ;
	show.innerHTML = "<div class='innerHTMLLoading'><img src='images/loading.gif' border=0></div>";

//show.innerHTML = url;
//exit;


	var ajax = InitAjax ( ) ;

	ajax.open( "GET", url, true ) ;

	ajax.onreadystatechange = function ( )
	{

		if ( ajax.readyState == 4 && ajax.status == 200 )
		{
			//alert(ajax.responseText);
			show.innerHTML = ajax.responseText ;
		}
	}	
	ajax.send ( null ) ;
}

function getDailyFlats ()
{

	var url  = "dailytails.php";

	var show = document.getElementById( "show_Layer" ) ;
	show.innerHTML = "<div style='position:absolute;right:450px;top:400px;'><img src='images/loading.gif' border=0></div>";
	var ajax = InitAjax ( ) ;

	ajax.open( "GET", url, true ) ;

	ajax.onreadystatechange = function ( )
	{

		if ( ajax.readyState == 4 && ajax.status == 200 )
		{
			//alert(ajax.responseText);
			show.innerHTML = ajax.responseText ;
		}
	}	
	ajax.send ( null ) ;
}






