var global_obj;
var global_obj1;
var tmrId = 0;
var customarray = new Array();

window.addEvent('domready', function(){
    if (document.getElementById('txtCity'))
        global_obj = actb(document.getElementById('txtCity'),customarray);
   
    if (document.getElementById('txtCity1'))
        global_obj = actb(document.getElementById('txtCity1'),customarray);

    if (document.getElementById('txtLocation'))
        global_obj1 = actb(document.getElementById('txtLocation'),customarray);
    
    if (document.getElementById('txtDestination'))
        global_obj1 = actb(document.getElementById('txtDestination'),customarray);
    
    if (document.getElementById('txtDestinationAva'))
        global_obj1 = actb(document.getElementById('txtDestinationAva'),customarray);
});


function startTimer()
{
	clearTimeout (tmrId);
	tmrId = setTimeout ("searchCount()", 600);
}

function searchCount()
{
var temp;
	temp = ajaxUrl + "s=y";
	var txt = document.getElementById('txtCity');
	if (txt != null)
	{
		//if (txt.value.length == 0)
		//	return;
	    
	    temp = temp + "&l=" + txt.value;	
	}
	else
		return;

	txt = document.getElementById('cboService')
	if (txt !=null)
		temp = temp + "&service=" + txt.value;

	txt = document.getElementById('txtPriceMin');
	if (txt != null)
	    temp = temp + "&min=" + txt.value;

	txt = document.getElementById('txtPriceMax');
	if (txt != null)
	    temp = temp + "&max=" + txt.value;
	
	AJAXrequest (temp, ajaxRetSearch);
}

function ajaxRetSearch()
{
    if (xmlHttpObj.readyState == READYSTATE_COMPLETE && xmlHttpObj.status == '200')
    {
		
		var count = xmlHttpObj.responseText;
		showCounter (count)

/*
		if (count=="0")
			$('divCount').innerHTML = "No results";
		else if (count=="1")
			$('divCount').innerHTML = "1 result";
		else
			$('divCount').innerHTML = count + " results";
		*/
	}
}

function showCounter(val)
{
	
	var holder = document.getElementById('holder');
	if (!holder)
		return;
		
	var divFlash = document.getElementById('flashcontent');
	if (!divFlash)
	{
		holder.innerHTML = '<div id=flashcontent></div>';
	}

	var flashvars = {
		config_file: "config.xml",
		displayValue: val
	};

	var params = {
		align: "default",
		bgcolor: "faf1f2",
		menu: "false",
		scale: "default",
		displayValue: "123"
	};

	var attributes = {
		id: "swf_content",
		name: "swf_content"
	};

	swfobject.embedSWF("counter2.swf", "flashcontent", "68", "22", "8.0.0", false, flashvars, params, attributes);
}

/*

function ajaxRetLoc()
{
    if (xmlHttpObj.readyState == READYSTATE_COMPLETE && xmlHttpObj.status == '200')
    {
		var cityId = xmlHttpObj.responseText;
		if (cityId > 0)
			window.location.href = '<%=sPath%>Display_Area.asp?Service='+document.Areas1.cboService.options[document.Areas1.cboService.selectedIndex].value+'&City=' + cityId +'&Menu=1&Price='+document.Areas1.fPrice.value+'&aTitle='+document.Areas1.fTitle.value;
	}
}
*/
