	function lastmenu (container) {
		var size = $$("#"+container+" ul li").length;
		$$("#"+container+" ul li").each(function (elt, i) {
			if (i == size - 1) {
//				$(elt).setProperty('style','border: 0');
				$(elt).style.borderWidth = "0px";
//				alert($(elt).style);
			}
		});
	}
		
	function styleSubMenu (container) {
		$$("#"+container+" ul li").each(function (elt, i) {
			
			var index = elt.getProperty('class').replace(/sub(\d)+/,'$1');
			if (index > 0) {
//				elt.setProperty('style','text-indent:'+(index*25)+'px');
				$(elt).style.textIndent = (index*20)+"px";
			}
		});
	}

	function updateBanner () {
		var lstBanner = Array();
		lstBanner["http://www.craem-auvergne.com/fr/actualites_3.php"] = "http://www.craem-auvergne.com/templates/01/images/banner_content_actualites.jpg";
		
		$$("#menu a").each(function (elt, i) {
			if (elt.getProperty('class') == "on") {
				$('bc').src = lstBanner[elt.src];
			}
		});
	}
	
	function httpRequest (srcElt, dstElt) {
	srcElt.addEvent('click', function(event) { 
		event.stop();
        var req = new Request({  
					method: 'get',  
             		url: srcElt.get('href'), 
	             	onComplete: function(response) { dstElt.set('html',response) ; }  
		         	}).send();  
    	});  
	}
		
	function httpRequestPost (srcElt, dstElt) {
		var data = "";
		$$("#search_form input").each(function (item, index) {
			data += item.getProperty("name") + "=" +item.getProperty("value")+"&";
		});

	        var req = new Request({  
						method: 'post',  
						data: data,
        		     	url: srcElt.getProperty('action'), 
            		 	onComplete: function(response) { dstElt.set('html',response) ; }  
		         	  }).send();  
				
	}


function createRequestObject () {
		var request_o;
		var browser = navigator.appName;

		if(browser == "Microsoft Internet Explorer"){
			request_o = new ActiveXObject("Microsoft.XMLHTTP");
		}else{
			request_o = new XMLHttpRequest();
		}

		return request_o;
	}


	function paramEU (a, b, c, d, e) {
		this.method = a;
		this.idDst = b;
		this.idSrc = c;
		this.url = d;
		this.fct = e;
		this.arg = "";
	}
	
	function execUrl (param) {
		param.arg = (param.method == "POST")?execUrlPostArg(param.idSrc):"";

		var http = createRequestObject(); 
		http.open(param.method, param.url);

		http.onreadystatechange = function(){
			if(http.readyState == 4){
				var response = http.responseText;
				if (parseInt(param.fct) == 1)
					document.getElementById(param.idDst).value = parseInt(response);
				else document.getElementById(param.idDst).innerHTML = response;

				if (param.fct != undefined)
					eval(param.fct);
			}
		};

		if (param.method == "POST")
			http.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
		http.send((param.method == "GET")?null:param.arg);
	}


	function execUrlPostArg (id) {
		var postArg = "";
		var mp = document.getElementById(id);
		var mi = mp.getElementsByTagName("input");
		for (var i=0; i<mi.length; i++) {	
			if (mi[i].type == "checkbox" && mi[i].checked == true)
				postArg += "&" + mi[i].name + "=" + mi[i].value;

			if (mi[i].type == "radio" && mi[i].checked == true)
				postArg += "&" + mi[i].name + "=" + mi[i].value;

			if (mi[i].type == "text")
				postArg += "&" + mi[i].name + "=" + mi[i].value;

			if (mi[i].type == "hidden")
				postArg += "&" + mi[i].name + "=" + mi[i].value;
		}

		var mi = mp.getElementsByTagName("select");
		for (var i=0; i<mi.length; i++)
			postArg += "&" + mi[i].name + "=" + mi[i].value;

		var mi = mp.getElementsByTagName("textarea");
		for (var i=0; i<mi.length; i++)
			postArg += "&" + mi[i].name + "=" + mi[i].value;

		return postArg.substr(0,postArg.length);
	}
