//0.2

var ajaxWaitingEvent;
var ajaxWaitingObject;

var isIE = false;

var ajaxMode = "0";

var ajaxPriceListType; 
var ajaxPriceListCurrentPage;
var ajaxPriceListTotalPerPage;
var ajaxPriceListEvent;

function ajaxRequestPOST(url, senddata) {
	var httpRequest = false;

	if (window.XMLHttpRequest) { // Mozilla, Safari,...
		httpRequest = new XMLHttpRequest();
		if (httpRequest.overrideMimeType) {
			httpRequest.overrideMimeType('text/xml');
		}
	}
	else if (window.ActiveXObject) { // IE
	
		isIE = true;
	
		try {
			httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e) {
			try {
				httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e) {}
		}
	}

	if (!httpRequest) {
		alert('Abandon :( Votre fureteur ne supporte pas AJAX!!!!');
		return false;
	}
	
	
	
	httpRequest.onreadystatechange = function() { ajaxIncoming(httpRequest); };
	httpRequest.open('POST', url, true);
	httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	httpRequest.send(senddata);
}

// AJAX INCOMING EVENT -->

function ajaxIncoming(httpRequest) {

	if (httpRequest.readyState == 4) {
		if (httpRequest.status == 200) {
		
			switch (ajaxWaitingEvent) {
			
				case "dRaise": //Link raise download number.
			
					ajaxWaitingEvent = "";
			
				break;
				
				case "peditITEM": //Show price list
				
					mainPriceList.innerHTML = httpRequest.responseText;
					ajaxWaitingEvent = "";
					DisplayAjaxLoading(300, 500, false);
					
				break;
				
				case "LinkPAGE": //ShowLinkPage
				
					cbMainCategories.innerHTML = httpRequest.responseText;
					LinkList();
				
				break;
			
				case "linkLIST": //Show Link Page.
				
					ajaxWaitingEvent = "";
					tableLinks.innerHTML = httpRequest.responseText;
					
				break;
				
				default: 
					
					ajaxWaitingEvent = "";
			
			}
			
			
		} else {
			alert('Un problème est survenu avec la requête ajax.');
		}
	}

}

