// JavaScript Document


function search_ajax(method, url, div) {
	search_update("<img src='/images/search/search-ajax.gif'>", div);
	
    var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open(method, url, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
            search_update(self.xmlHttpReq.responseText, div);
        }
    }
    self.xmlHttpReq.send(url);
}


function search_update(str, div){	
    var _div = document.getElementById(div);
	if (_div) _div.innerHTML = str;
}

function search_categorie_ajax(catId, div){
	
	var url = "/p,search-ajax?action=search_categorie&catId=" + catId ;
	search_ajax('POST', url, div) ;
}
function search_souscategorie_ajax(catId, div){
	
	var url = "/p,search-ajax?action=search_souscategorie&catId=" + catId ;
	search_ajax('POST', url, div) ;
}
function search_denomination_ajax(catId, div){
	
	var url = "/p,search-ajax?action=search_denomination&catId=" + catId ;
	search_ajax('POST', url, div) ;
}
