// JavaScript Document

function add_to_selection(id){
	minishoppingcart(id);
}

function minishoppingcart(id){
	topPos = eval((screen.height/2)+(document.body.scrollTop-150)); 
	document.getElementById('mini_add_selection').style.top = topPos;
	document.getElementById('mini_add_selection').style.left = eval( (document.body.scrollWidth / 2) - 300);
	document.getElementById('mini_add_selection').style.display = 'block';
	
	var xhr_object = null;   
	if(window.XMLHttpRequest) // Firefox, Safari
		xhr_object = new XMLHttpRequest();   
	 else if(window.ActiveXObject) // Internet Explorer   
		xhr_object = new ActiveXObject("Microsoft.XMLHTTP");   
	 else { // XMLHttpRequest non supporté par le navigateur   
		alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");   
	   return;   
	}
	xhr_object.open("GET", 'mini_add_selection.php?products_id='+id, true); 
	xhr_object.send(null);   
	xhr_object.onreadystatechange = function(){
		if(xhr_object.readyState == 4) {
			document.getElementById('mini_add_selection').innerHTML = xhr_object.responseText;
			retraitHeight = document.getElementById('mini_add_selection').scrollHeight/2;
			topPos = eval((screen.height/2)+(document.body.scrollTop-retraitHeight)); 
			document.getElementById('mini_add_selection').style.top = topPos;
		}
	}
}