// JavaScript Document
<!--
var QStatsHttpObject 	= 		QStatsGetHTTPObject();	
var QStatsIsWorking 	= 		false;
var sq					=		"";
var area				=		"";
var rentsale			=		"";
var region				=		"";
var prop_type			=		"";
var qs_loft				=		"";
var qs_prewar			=		"";
var qs_ChkDoorman		=		"'0'";
var qs_ChkOutDoor		=		"";
var qs_ChkPet			=		"";
var qs_ChkFurnish		=		"";
var FL_Pool				=		"";
var FL_Tennis			=		"";
var FL_Dock				=		"";
var FL_Golf				=		"";
var FL_Horse			=		"";
var LI_ChkboxTennis		=		"";
var LI_ChkboxAC			=		"";
var LI_ChkboxPool		=		"";
var LI_ChkboxFurnished	=		""
var qs_Price			=		"";
var qs_views			=		"";
var beds				=		"";
var baths				=		"";
var sqft				=		"";
var units				=		"";
var floors				=		"";
var qs_waterfrontage	=		"";
var qs_gated			=		"";
var house_styles		=		"";
var rental				=		"";
var qs_waterindex		=		"";
var qs_SHighway			=		"";
var serviceURL			=		"";
var mortgageValues		=		"";

function QuickStats(){
	PropType();
	BuildingAmenities();
	PriceRange();
	Essentials();
	CollectData();
}
function PropType(){
	prop_type="'0'";
	qs_loft="";
	qs_prewar="";
	if(document.getElementById("ChkCoop") && document.getElementById("ChkCoop").checked==true) prop_type+=",'COOP'";
	if(document.getElementById("ChkCondo") && document.getElementById("ChkCondo").checked==true) prop_type+=",'CONDO'";
	if(document.getElementById("ChkCondop") && document.getElementById("ChkCondop").checked==true) prop_type+=",'CONDOP'";
	if(document.getElementById("ChkLoft") && document.getElementById("ChkLoft").checked==true) qs_loft="'Y'";
	if(document.getElementById("ChkPreWar") && document.getElementById("ChkPreWar").checked==true) qs_prewar="'Y'";
}
function BuildingAmenities(){
	qs_ChkDoorman="";
	qs_ChkOutDoor="";
	qs_ChkPet="";
	qs_ChkFurnish="";
	FL_Pool="";
	FL_Tennis="";
	FL_Dock="";
	FL_Golf="";
	FL_Horse="";
	LI_ChkboxTennis="";
	LI_ChkboxAC="";
	LI_ChkboxPool="";
	LI_ChkboxFurnished=""
	
	if(document.getElementById("ChkDoorman") && document.getElementById("ChkDoorman").checked==true) qs_ChkDoorman= " and (doorman='Yes') ";
	if(document.getElementById("ChkOutDoor") && document.getElementById("ChkOutDoor").checked==true) qs_ChkOutDoor=" and (outdoor='Y') ";
	if(document.getElementById("ChkPet") && document.getElementById("ChkPet").checked==true) qs_ChkPet=" and (petsallowed='Y') ";
	if(document.getElementById("ChkFurnish") && document.getElementById("ChkFurnish").checked==true) qs_ChkFurnish=" and (Furnished='Y') ";
	if(document.getElementById("FL_Pool") && document.getElementById("FL_Pool").checked==true) FL_Pool=" and (pool='Y') ";
	if(document.getElementById("FL_Tennis") && document.getElementById("FL_Tennis").checked==true) FL_Tennis=" and (TennisCourt='Y') ";
	if(document.getElementById("FL_Dock") && document.getElementById("FL_Dock").checked==true) FL_Dock=" and (Dock='Y') ";
	if(document.getElementById("FL_Golf") && document.getElementById("FL_Golf").checked==true) FL_Golf=" and (GolfCourse='Y') ";
	if(document.getElementById("FL_Horse") && document.getElementById("FL_Horse").checked==true) FL_Horse=" and (HorseAllowed='Y') ";
	if(document.getElementById("LI_ChkboxPool") && document.getElementById("LI_ChkboxPool").checked==true) LI_ChkboxPool=" and (pool='Y') ";
	if(document.getElementById("LI_ChkboxFurnished") && document.getElementById("LI_ChkboxFurnished").checked==true) LI_ChkboxFurnished=" and (Furnished='Y') ";
	if(document.getElementById("LI_ChkboxAC") && document.getElementById("LI_ChkboxAC").checked==true) LI_ChkboxAC=" and (AirCond is not null ) ";
}
function PriceRange()
{	
	qs_Price="";
	var qs_Mnprice="";
	var qs_MnRprice="";
	var qs_Mxprice="";
	var qs_MxRprice="";
	var FL_Mnprice="";
	var FL_Mxprice="";
	var FL_MnRprice="";
	var FL_MxRprice="";
	var LI_Mnprice="";
	var LI_Mxprice=""
	var LI_MnRprice="";
	var LI_MxRprice="";
	var LI_LandMnprice="";
	var LI_LandMxprice="";
	
	qs_Mnprice=document.getElementById("Mnprice");
	qs_MnRprice=document.getElementById("MnRprice");
	qs_Mxprice=document.getElementById("Mxprice");
	qs_MxRprice=document.getElementById("MxRprice");
	FL_Mnprice=document.getElementById("FL_Mnprice");
	FL_Mxprice=document.getElementById("FL_Mxprice");
	FL_MnRprice=document.getElementById("FL_MnRprice");
	FL_MxRprice=document.getElementById("FL_MxRprice");
	LI_Mnprice=document.getElementById("LI_Mnprice");
	LI_Mxprice=document.getElementById("LI_Mxprice");
	LI_MnRprice=document.getElementById("LI_MnRprice");
	LI_MxRprice=document.getElementById("LI_MxRprice");
	LI_LandMnprice=document.getElementById("LI_LandMnprice");
	LI_LandMxprice=document.getElementById("LI_LandMxprice");
	
	if(qs_Mnprice) qs_Price= " and ( price >="+qs_Mnprice.options[qs_Mnprice.selectedIndex].value+" and price<="+qs_Mxprice.options[qs_Mxprice.selectedIndex].value+") ";
	if(qs_MnRprice) qs_Price= " and ( price >="+qs_MnRprice.options[qs_MnRprice.selectedIndex].value+" and price<="+qs_MxRprice.options[qs_MxRprice.selectedIndex].value+") ";
	
	if(FL_Mnprice) qs_Price= " and ( price >="+FL_Mnprice.options[FL_Mnprice.selectedIndex].value+" and price<="+FL_Mxprice.options[FL_Mxprice.selectedIndex].value+") ";
	if(FL_MnRprice && FL_MnRprice.value!="" && FL_MxRprice.value!="") qs_Price= " and ( price >="+FL_MnRprice.value+" and price<="+FL_MxRprice.value+") ";
	else if(FL_MnRprice && FL_MnRprice.value!="" && FL_MxRprice.value=="") qs_Price= " and ( price >="+FL_MnRprice.value+" and price<=900000000 ) ";
	else if(FL_MnRprice && FL_MnRprice.value=="" && FL_MxRprice.value!="") qs_Price= " and ( price >=0 and price<="+FL_MxRprice.value+" ) ";
	
	if(LI_Mnprice) qs_Price= " and ( price >="+LI_Mnprice.options[LI_Mnprice.selectedIndex].value+" and price<="+LI_Mxprice.options[LI_Mxprice.selectedIndex].value+") ";
	if(LI_MnRprice && LI_MnRprice.value!="" && LI_MxRprice.value!="") qs_Price= " and ( price >="+LI_MnRprice.value+" and price<="+LI_MxRprice.value+") ";
	else if(LI_MnRprice && LI_MnRprice.value!="" && LI_MxRprice.value=="") qs_Price= " and ( price >="+LI_MnRprice.value+" and price<=900000000 ) ";
	else if(LI_MnRprice && LI_MnRprice.value=="" && LI_MxRprice.value!="") qs_Price= " and ( price >=0 and price<="+LI_MxRprice.value+" ) ";
	if(LI_LandMnprice) qs_Price= " and ( price >="+LI_LandMnprice.options[LI_LandMnprice.selectedIndex].value+" and price<="+LI_LandMxprice.options[LI_LandMxprice.selectedIndex].value+") ";
}
function Essentials(){
	var qs_Beds="";
	var qs_Baths="";
	var qs_SqFt="";
	var qs_SqFt2="";
	var qs_Units="";
	var qs_Floors="";
	var FL_Beds="";
	var FL_Baths="";
	var FL_View="";
	var FL_WaterFrontage="";
	var FL_GatedCommunities="";
	var LI_Waterview="";
	var LI_SHighway="";
	var LI_Beds="";
	var LI_Baths="";
	var bg_Beds="";
	var bg_Baths="";
	beds="";
	baths="";
	sqft="";
	units="";
	floors="";
	qs_views="";
	qs_waterfrontage="";
	qs_gated="";
	qs_waterindex="";
	qs_SHighway="";
	
	FL_Beds=document.getElementById("FL_beds");
	FL_Baths=document.getElementById("FL_Baths");
	FL_View=document.getElementById("FL_View");
	FL_WaterFrontage=document.getElementById("FL_WaterFrontage");
	FL_GatedCommunities=document.getElementById("FL_GatedCommunities");
	LI_Waterview=document.getElementById("LI_Waterview");
	LI_SHighway=document.getElementById("LI_SHighway");
	LI_Beds=document.getElementById("LI_Beds");
	LI_Baths=document.getElementById("LI_Baths");
	qs_Beds=document.getElementById("Beds");
	qs_Baths=document.getElementById("Baths");
	qs_SqFt=document.getElementById("SqFt");
	qs_SqFt2=document.getElementById("SqFt2");
	qs_Floors=document.getElementById("Floors");
	qs_Units=document.getElementById("Units");
	bg_Beds=document.getElementById("bg_Beds");
	bg_Baths=document.getElementById("bg_Baths");
	
	if(qs_Beds && qs_Beds.selectedIndex!=0 && qs_Beds.selectedIndex!=1) beds= " and ( beds "+qs_Beds.options[qs_Beds.selectedIndex].value+") ";
	if(qs_Beds && qs_Beds.selectedIndex==1) beds= " and ( beds >=0) ";
	//florida beds
	if(FL_Beds && FL_Beds.selectedIndex!=0 && FL_Beds.selectedIndex!=1) beds= " and ( beds "+FL_Beds.options[FL_Beds.selectedIndex].value+") ";
	if(FL_Beds && FL_Beds.selectedIndex==1) beds= " and ( beds >=0) ";
	if(FL_Baths && FL_Baths.selectedIndex!=0 ) baths= " and ( baths "+FL_Baths.options[FL_Baths.selectedIndex].value+") ";
	//views
	if(FL_View && FL_View.selectedIndex==2) qs_views= " and ( OceanView='Y' ) ";
	else if(FL_View && FL_View.selectedIndex==3) qs_views= " and ( CoastalView ='Y' ) ";
	else if(FL_View && FL_View.selectedIndex==4) qs_views= " and ( WaterView='Y' ) ";
	else if(FL_View && FL_View.selectedIndex==5) qs_views= " and ( GolfCourseView='Y' ) ";
	//water frontage & gated
	if(FL_WaterFrontage && (FL_WaterFrontage.selectedIndex!=0 && FL_WaterFrontage.selectedIndex!=1)) qs_waterfrontage= " and ( WaterFrontage ='"+FL_WaterFrontage.options[FL_WaterFrontage.selectedIndex].value+"') ";
	if(FL_GatedCommunities && (FL_GatedCommunities.selectedIndex!=0 && FL_GatedCommunities.selectedIndex!=1)) qs_gated= " and ( Gated ='"+FL_GatedCommunities.options[FL_GatedCommunities.selectedIndex].value+"') ";
	if(LI_Waterview && (LI_Waterview.selectedIndex!=0 && LI_Waterview.selectedIndex!=6)) qs_waterindex= " and ( waterindex ="+LI_Waterview.selectedIndex+") ";
	if(LI_Waterview && (LI_Waterview.selectedIndex==6)) qs_waterindex= " and ( waterindex in (1,2,3,4,5)) ";
	if(LI_SHighway && (LI_SHighway.selectedIndex!=0 )) qs_SHighway= " and ( SouthOfTheHwy ='"+LI_SHighway.options[LI_SHighway.selectedIndex].value+"') ";

	if(qs_Baths && qs_Baths.selectedIndex!=0 ) baths= " and ( baths "+qs_Baths.options[qs_Baths.selectedIndex].value+") ";
	if(qs_SqFt && qs_SqFt.selectedIndex!=0) sqft= " and ( SqFtInterior >="+qs_SqFt.options[qs_SqFt.selectedIndex].value+") ";
	//if(qs_SqFt2 && qs_SqFt2.selectedIndex!=0) sqft= " and ( SqFtInterior >="+qs_SqFt2.options[qs_SqFt2.selectedIndex].value+") ";
	if(qs_Floors && qs_Floors.selectedIndex!=0) floors= " and ( floors "+qs_Floors.options[qs_Floors.selectedIndex].value+") ";
	if(qs_Units && qs_Units.selectedIndex!=0) units= " and ( units "+qs_Units.options[qs_Units.selectedIndex].value+") ";
	//LI beds baths
	if(LI_Beds && LI_Beds.selectedIndex!=0 && LI_Beds.selectedIndex!=1) beds= " and ( beds "+LI_Beds.options[LI_Beds.selectedIndex].value+") ";
	if(LI_Beds && LI_Beds.selectedIndex==1) beds= " and ( beds >=0) ";
	if(LI_Baths && LI_Baths.selectedIndex!=0 ) baths= " and ( baths "+LI_Baths.options[LI_Baths.selectedIndex].value+") ";
	//budget search
	if(bg_Beds && bg_Beds.selectedIndex!=0 && bg_Beds.selectedIndex!=1) beds= " and ( beds "+bg_Beds.options[bg_Beds.selectedIndex].value+") ";
	if(bg_Beds && bg_Beds.selectedIndex==1) beds= " and ( beds >=0) ";
	if(bg_Baths && bg_Baths.selectedIndex!=0 ) baths= " and ( baths "+bg_Baths.options[bg_Baths.selectedIndex].value+") ";
}
function CollectData(){
	var t=document.getElementsByTagName("input");
	var k=document.getElementsByTagName("label");
	area="'',";
	for (var i=0;i<t.length;i++){
		if(t[i].getAttribute("type")=="checkbox" && (t[i].getAttribute("id").indexOf("ManChkbox")!=-1 || t[i].getAttribute("id").indexOf("BknChkbox")!=-1 || t[i].getAttribute("id").indexOf("QnsChkbox")!=-1 || t[i].getAttribute("id").indexOf("FLChkbox")!=-1 || t[i].getAttribute("id").indexOf("NFChkbox")!=-1 || t[i].getAttribute("id").indexOf("SFChkbox")!=-1 || t[i].getAttribute("id").indexOf("NFChkLandbox")!=-1 || t[i].getAttribute("id").indexOf("SFChkLandbox")!=-1 || t[i].getAttribute("id").indexOf("Chkbox1")!=-1 || t[i].getAttribute("id").indexOf("Chkbox2")!=-1) && t[i].checked==true){
			area+="'"+t[i].parentNode.childNodes[1].childNodes[0].nodeValue +"',";
		}
	}
	if(document.getElementById("SIChkbox") && document.getElementById("SIChkbox").checked==true) {area+="'Shelter Island',";}
	if(document.getElementById("SIChkLandbox") && document.getElementById("SIChkLandbox").checked==true) {area+="'Shelter Island',";}
	if(document.URL.match("SU"))	rentsale="'SU'";
	if(document.URL.match("RU"))	rentsale="'RU'";
	if(document.URL.match("SB"))	rentsale="'SB'";
	if(document.URL.match("RB"))	rentsale="'RB'";
	if(document.URL.match("SH"))	rentsale="'SH'";
	if(document.URL.match("RH"))	rentsale="'RH'";
	if(document.URL.match("SL"))	rentsale="'SL'";
	
	//for budget search only
	if(document.URL.match("NYC"))	region=" and  Region= 'NYC' and rentsale in ('SU','SB') ";
	if(document.URL.match("FL"))	region=" and  Region='FL' and rentsale in ('SU','SH') ";
	if(document.URL.match("LI"))	region=" and  Region LIKE 'LI%' and rentsale in ('SH','SL') ";
	
	var hs_ok=true;
	if(document.getElementById("LI_HseStyleChkbox")) hs_ok=GetHouseStyles();
	GetRentalPeriod();		
	if(hs_ok)
		final_q();
}
function GetHouseStyles(){
	var t=document.getElementsByTagName("input");
	var k=document.getElementsByTagName("label");
	house_styles="'',";
	for (var i=0;i<t.length;i++){
		if(t[i].getAttribute("type")=="checkbox" && (t[i].getAttribute("id").indexOf("LI_HseStyleChkbox")!=-1) && t[i].checked==true){
			house_styles+="'"+t[i].parentNode.childNodes[1].childNodes[0].nodeValue +"',";
		}
	}
	if(house_styles!="'',")		
	{
		house_styles="and housestyle in ("+house_styles.substring(0,house_styles.length-1)+")";
		house_styles=house_styles.replace("&","mmm");house_styles=house_styles.replace("&","mmm");
	}else		house_styles="";
	return true;
}

function GetRentalPeriod(){
	var t=document.getElementsByTagName("input");
	var k=document.getElementsByTagName("label");
	rental="";
	if(document.getElementById("LI_ChkboxRental") && document.getElementById("LI_ChkboxRental").checked==true) 
		rental+=(rental!="")?"or ( rent_meaningA is not null ) ":"( rent_meaningA is not null ) ";
	if(document.getElementById("LI_ChkboxRental2") && document.getElementById("LI_ChkboxRental2").checked==true) 
		rental+=(rental!="")?"or ( rent_meaningB is not null ) ":"( rent_meaningB is not null ) ";
	if(document.getElementById("LI_ChkboxRental3") && document.getElementById("LI_ChkboxRental3").checked==true) 
		rental+=(rental!="")?"or ( rent_meaningC is not null ) ":"( rent_meaningC is not null ) ";
	if(document.getElementById("LI_ChkboxRental4") && document.getElementById("LI_ChkboxRental4").checked==true) 
		rental+=(rental!="")?"or ( rent_meaningD is not null ) ":"( rent_meaningD is not null ) ";
	if(document.getElementById("LI_ChkboxRental5") && document.getElementById("LI_ChkboxRental5").checked==true) 
		rental+=(rental!="")?"or ( rent_meaningE is not null ) ":"( rent_meaningE is not null ) ";
	if(document.getElementById("LI_ChkboxRental6") && document.getElementById("LI_ChkboxRental6").checked==true) 
		rental+=(rental!="")?"or ( rent_meaningF is not null ) ":"( rent_meaningF is not null ) ";
	if(document.getElementById("LI_ChkboxRental7") && document.getElementById("LI_ChkboxRental7").checked==true) 
		rental+=(rental!="")?"or ( rent_meaningG is not null ) ":"( rent_meaningG is not null ) ";
	if(document.getElementById("LI_ChkboxRental8") && document.getElementById("LI_ChkboxRental8").checked==true) 
		rental+=(rental!="")?"or ( rent_meaningI is not null ) ":"( rent_meaningI is not null ) ";
	if(document.getElementById("LI_ChkboxRental9") && document.getElementById("LI_ChkboxRental9").checked==true) 
		rental+=(rental!="")?"or ( rent_meaningH is not null ) ":"( rent_meaningH is not null ) ";
	
}
function final_q(){
	var s="";
	var cntrct="";
	var cntrct2="";
	var l_status="";
	var qs_incontract=document.getElementById("ChkInContract");//ChkInContract
	if(qs_incontract && qs_incontract.checked==true) l_status=" and listingstatus in ('AVAIL','CONTRACT') ";
	else l_status=" and listingstatus in ('AVAIL') ";
	//townhouse
	var qs_incontract2=document.getElementById("ChkInContract2");//ChkInContract
	if(qs_incontract2 && qs_incontract2.checked==true) l_status=" and listingstatus in ('AVAIL','CONTRACT') ";
	else l_status=" and listingstatus in ('AVAIL') ";
	//LI
	if(document.getElementById("TblLI") || document.getElementById("TblLILand")) l_status=" and listingstatus in ('AVAIL','CONTRACT') ";
	if(document.getElementById("TblLILand")) l_status="";
	//area prop type, prewar
	s=(rentsale!="" && !document.URL.match("budgetsearch"))?" rentsale="+rentsale+" and area in ("+area.substring(0,area.length-1)+")":" area in ("+area.substring(0,area.length-1)+") ";
	if(prop_type!="'0'" && qs_loft=="Y")			s+=" and (propertytype in("+prop_type+") and (loft='Y')) ";
	else if(prop_type!="'0'" && qs_loft=="")		s+=" and (propertytype in("+prop_type+")) ";	
	if(qs_prewar!="")							s+=" and (prewar='Y') ";
	s+=l_status+qs_ChkDoorman+qs_ChkOutDoor+qs_ChkPet+qs_ChkFurnish+qs_Price+beds+baths+sqft+units+floors+FL_Pool+FL_Tennis;
	s+=FL_Dock+FL_Golf+FL_Horse+qs_views+qs_waterfrontage+qs_gated+house_styles+qs_waterindex+qs_SHighway+LI_ChkboxAC;
	s+=LI_ChkboxPool+LI_ChkboxFurnished;
	if(document.URL.match("budgetsearch"))
	{
		s+=region;
		mortgageValues="&down="+document.getElementById("DpDwnPmt").options[document.getElementById("DpDwnPmt").selectedIndex].value+"&min="+document.getElementById("DpMinPmt").options[document.getElementById("DpMinPmt").selectedIndex].value+"&max="+document.getElementById("DpMaxPmt").options[document.getElementById("DpMaxPmt").selectedIndex].value+"&rate="+document.getElementById("txtRate").value+"&time="+document.getElementById("SelPeriod").options[document.getElementById("SelPeriod").selectedIndex].value;
	    
	    if (document.getElementById("ChkMaint").checked==true)
	        mortgageValues+="&MaintIncluded=Y";
	    else
	        mortgageValues+="&MaintIncluded=N";
	    
	
	}
	if(rental!="") s+=" and ("+rental+" ) ";
	//alert(s);
	//document.write(s)
	if(document.URL.match("budgetsearch")) 			serviceURL="Quickstats/Default.aspx?p=budget"+mortgageValues+"&s_details=";
	else  											serviceURL="Quickstats/Default.aspx?s_details=";
	QStatsSendHttpRequest(s);

}

function QStatsHandleHttpResponse() {
	if (QStatsHttpObject.readyState == 4) {
   		if (QStatsHttpObject.responseText.indexOf('invalid') == -1) {
			results = QStatsHttpObject.responseText;
			QStatsIsWorking = false;
			QStatsProcessData(results);
		}
	}
}
function QStatsSendHttpRequest(s){
	if (!QStatsIsWorking && QStatsHttpObject) {
	  QStatsHttpObject.open("POST", serviceURL+s, true);	
	  QStatsHttpObject.onreadystatechange = QStatsHandleHttpResponse;	
	  QStatsHttpObject.send('');
	}
}
function QStatsProcessData(r){
	var s=new Array(); 
	s=r.split("%47%");
	if(document.getElementById("TblQstats")){
		if(s[0]!=0){
			document.getElementById("TblQstats").style.display="block";
			document.getElementById("QSMax").style.display="block";
			document.getElementById("QSMin").style.display="block";
			document.getElementById("QSAvg").style.display="block";
			
			//done this way for MAC's sake. Otherwise not neccessary in Windows
			document.getElementById("QSMax2").innerHTML="<strong>Max. Price: </strong>";
			document.getElementById("QSMin2").innerHTML="<strong>Min. Price: </strong>";
			document.getElementById("QSAvg2").innerHTML="<strong>Average Price: </strong>";
			
			document.getElementById("QSTotal").innerHTML=s[0];
			document.getElementById("QSMax").innerHTML=QStatsFormatPrice(s[2]);
			document.getElementById("QSMin").innerHTML=QStatsFormatPrice(s[1]);
			document.getElementById("QSAvg").innerHTML=QStatsFormatPrice(s[3]);
		}else{
			//document.getElementById("TblQstats").style.display="none";
			document.getElementById("QSTotal").innerHTML="0";
			document.getElementById("QSMax").style.display="none";
			document.getElementById("QSMin").style.display="none";
			document.getElementById("QSAvg").style.display="none";
			
			//done this way for MAC's sake. Otherwise not neccessary in Windows
			document.getElementById("QSMax2").innerHTML="";
			document.getElementById("QSMin2").innerHTML="";
			document.getElementById("QSAvg2").innerHTML="";
		}
	}
}
//format price
function QStatsFormatPrice(num){
	if(num)
	num= num.toString().replace(/\$|\,/g,'');
	if(isNaN(num))
	num = "0";
	sign = (num == (num = Math.abs(num)));
	num = Math.floor(num*100+0.50000000001);
	num = Math.floor(num/100).toString();
	for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
	num = num.substring(0,num.length-(4*i+3))+','+
	num.substring(num.length-(4*i+3));
	return (((sign)?'':'-') + '$' + num);
}

function QStatsGetHTTPObject() {

  var xmlhttp;

  
  /*@cc_on

  @if (@_jscript_version >= 5)

    try {

      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");

    } catch (e) {

      try {

        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");

      } catch (E) {

        xmlhttp = false;

      }

    }

  @else

  xmlhttp = false;

  @end @*/
	 if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {

    try {

      xmlhttp = new XMLHttpRequest();
	  //xmlhttp.overrideMimeType('text/xml');

    } catch (e) {

      xmlhttp = false;

    }

  }
  



  return xmlhttp;

}
-->
