var xmlHttp;
var thisCat;
var thisGroup;
var goOffset;

function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}

function commerceChanged() { 
//document.getElementById('commerceHere').innerHTML = "<table width=500 cellpadding=50><tr><td align=center><p><p><p><img src='/forum/resource/graphics/loader.gif'><p><p><p></td></tr></table>"
if (xmlHttp.readyState==4)
{ 
if (xmlHttp.status == 200) {
document.getElementById("commerceHere").innerHTML=xmlHttp.responseText;
         } else {
            alert('There was a problem with the request.');
         }
		 }
}

function openGroup(obj,obj2,obj3){

if(obj3=="undefined"){
goOffset=0;
}else{
goOffset=obj3;
}
topMe();
var thisLot="categ=" + encodeURIComponent(obj);
thisLot=thisLot + "&group=" + encodeURIComponent(obj2);
thisLot=thisLot+"&offset=" + encodeURIComponent(obj3);


var url="/commerce/resource/furniture/commerceDisplay.asp";
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
//document.location.href=url+"?"+thisLot;
xmlHttp.onreadystatechange = commerceChanged;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}

function openProduct(obj,obj2){
if(obj2=="undefined"){
goOffset=0;
}else{
goOffset=obj2;
}
topMe();
var thisLot="id=" + encodeURIComponent(obj);
thisLot=thisLot+"&offset=" + encodeURIComponent(obj2);


var url="/commerce/resource/furniture/commerceProduct.asp";
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
//document.location.href=url+"?"+thisLot;
xmlHttp.onreadystatechange = commerceChanged;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}

function topMe(){
	document.location.href="#";
}


function checkurl(obj){
	if(obj){
		openProduct(obj,0)
	}
}

function findPostcode(){
var thisLot="origin=" + document.pcfinder.postcodeme.value;
var url="/commerce/resource/working/commerceFindDo.asp";

//alert(thisLot)

xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }

xmlHttp.onreadystatechange = pcChange;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}

function pcChange() { 
document.getElementById('pcresulthere').innerHTML = "<center><img src='/forum/resource/graphics/loader.gif'></center>"
if (xmlHttp.readyState==4)
{ 
if (xmlHttp.status == 200) {
document.getElementById("pcresulthere").innerHTML=xmlHttp.responseText;
document.location.href="#list"
         } else {
            document.write(xmlHttp.responseText);//alert('There was a problem with the request.');
         }
		 }
}
