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 getDelRates(postcode, product_id, price) {
	document.getElementById('shippingDetails').className = 'hide';
	var service = "../_services/delivery.php?action=del_rates&product_id="+product_id+"&product_price="+price+"&postcode="+postcode;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null) {
		alert ("Browser does not support HTTP Request");
		return;
	} 
	xmlHttp.onreadystatechange=delRates;
	xmlHttp.open("GET",service,true);
	xmlHttp.send(null);
	return false;
}

function delRates() {
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { 
		
		var tmp = xmlHttp.responseText;
		if(tmp != '') {
			document.getElementById('shippingDetails').innerHTML = tmp;
			document.getElementById('shippingDetails').className = 'clear leftFloat';
		}
	}	
}

function compareProducts(site_addr, comp_alert) {
	
	var service = site_addr+"../_services/compare.php?alert="+comp_alert;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null) {
		alert ("Browser does not support HTTP Request");
		return;
	} 
	xmlHttp.onreadystatechange=showCompare;
	xmlHttp.open("GET",service,true);
	xmlHttp.send(null);
	return false;
}

function showCompare() {
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { 
		var tmp = xmlHttp.responseText;
		if(tmp != '') {
			document.getElementById('compareProducts').innerHTML = tmp;
		}
	}
}

/*function swapImg(imgID) {
	var service = "../_services/product.php?action=swap_image&image_id="+imgID;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null) {
		alert ("Browser does not support HTTP Request");
		return;
	} 
	xmlHttp.onreadystatechange=swapImg2;
	xmlHttp.open("GET",service,true);
	xmlHttp.send(null);
	return false;
}

function swapImg2() {
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { 
		
		var tmp = xmlHttp.responseText;
		if(tmp != '') {
			document.getElementById('mainImg').innerHTML = tmp;
		}
	}
}*/
