var xmlHttp

function GetXmlHttpObject(){
	var xmlHttp=null;
	try{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}catch (e){
		// Internet Explorer
		try{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}catch (e){
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}

function updateResults(str2, str3, str4, str5, str6, str7){ 
//alert(str1);
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
		alert ("Your browser does not support AJAX!");
		return;
	}

	var q1 = 0;
	if(document.filtertable.filterradio1){
		for (var i=0; i < document.filtertable.filterradio1.length; i++){
			if(document.filtertable.filterradio1[i].checked){
				q1 = document.filtertable.filterradio1[i].value;
			}
		}
	}

	var q2 = 0;
	if(document.filtertable.filterradio2){
		for (var i=0; i < document.filtertable.filterradio2.length; i++){
			if(document.filtertable.filterradio2[i].checked){
				q2 =document.filtertable.filterradio2[i].value;
			}
		}
	}

	var q3 = 0;
	if(document.filtertable.filterradio3){
		for (var i=0; i < document.filtertable.filterradio3.length; i++){
			if(document.filtertable.filterradio3[i].checked){
				q3 =document.filtertable.filterradio3[i].value;
			}
		}
	}
/*
	if(document.sortbar.sortby.value){
		str4 = document.sortbar.sortby.value;
	}else if(document.sortbar2.sortby.value){
		str4 = document.sortbar2.sortby.value;
	}//end if
*/
	if(str5 == 1 && document.sortbar.results.value){
		str5 = document.sortbar.results.value;
	}//end if

//	if(q1==0 && q2==0 && q3==0){
	//          var url = document.location.href + "?pg=1&sb=" + document.sortbar.sortby.value + "&rpp=" + document.sortbar.results.value;
//		var url = document.location.href;
//		window.location.reload(url);
//	}else{
		var url="filterresults.html";
		url=url+"?q1="+q1;
		url=url+"&q2="+q2;
		url=url+"&q3="+q3;
		url=url+"&t="+str2;
		url=url+"&i="+str3;
		url=url+"&sb="+str4;
		url=url+"&rpp="+str5;
		url=url+"&pgn="+str6;
		url=url+"&pg="+str7;
		url=url+"&sid="+Math.random();
		xmlHttp.onreadystatechange=stateChanged;
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
//	}
}

function stateChanged(){
	if (xmlHttp.readyState==4){
		document.getElementById('page-wrap').style.opacity = '1';
		document.getElementById('page-wrap').style.filter = "alpha(opacity=100)";
//		alert(xmlHttp.responseText);
		document.getElementById("product-content").innerHTML=xmlHttp.responseText;
	}else{
		document.getElementById('page-wrap').style.opacity = '.4';
		document.getElementById('page-wrap').style.filter = "alpha(opacity=40)";
	}
}

function disablejs(){
		document.getElementById('left-menu').style.opacity = '1';
		document.getElementById('left-menu').style.filter = "alpha(opacity=100)";

}
