// Verification des composants necessaires a Ajax
if (!window.XMLHttpRequest && window.ActiveXObject) {
	window.XMLHttpRequest = function() {
		var a = [ 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP', 'Msxml2.XMLHTTP.3.0', 'Msxml2.XMLHTTP.4.0', 'Msxml2.XMLHTTP.5.0' ],
		i = a.length; while(i--) {
			try {
				return new ActiveXObject(a[i]);
			} catch (e) { }
		}
		return null;
	};
}

var xmlhttp;
	if (window.XMLHttpRequest) {
	xmlhttp = new XMLHttpRequest();
}
if (!xmlhttp) {
	//alert( 'Sorry, creating the XMLHttpRequest object failed.' );
}

// Ajax
// Gestionnaires d evenements
function initAjax() {
	var browser = navigator.appName;
	if (browser == "Microsoft Internet Explorer")
		http = new ActiveXObject("Microsoft.XMLHTTP");
	else
		http = new XMLHttpRequest();
}


function handleHttpResponseAssociatedProduct() {
	if (http.readyState == 4) {
		if (http.status == 200) {
			var xmldoc = http.responseXML;
			var root_node = xmldoc.getElementsByTagName('associatedProduct').item(0);
			document.getElementById('associatedProduct').innerHTML = root_node.firstChild.data;
		}
	}
}
// fin Ajax

// recupere les produits associes à un produit
function getAssociatedProduct(sit,sub,article,productType) {
	http.open("POST", 'http://www.salomonsports.com/scripts/getAssociatedProductAjax.aspx', true);
	http.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	http.onreadystatechange = handleHttpResponseAssociatedProduct;
	http.send("sit=" + sit + "&sub=" + sub + "&article=" + article + "&productType=" + productType);
}