function enregistrerInfosSqueezebox(inputButton) {
	var uiBox = this.jQuery.ui;
	var postUrl = this.frameElement.attributes[0].nodeValue+"&smdb_ajaxRequest=1";
	var nameFormulaire = inputButton.form.name;
	if(inputButton.form.id=="") { inputButton.form.id = nameFormulaire;}
	if(validateForm(inputButton.form,false,false,false,true,16)) {
		var myHTMLRequest = new Request.HTML({	url:postUrl,
			onSuccess: function(){
				var reponseAjax = myHTMLRequest.response.text;
				if(reponseAjax.search("Erreur")==-1) {
					newValue = myHTMLRequest.response.text;
					uiBox.close();
				}
				else {
					alert(reponseAjax);
				}
			}
		}).post($(inputButton.form.id));
	}
	else {
		return validateForm(inputButton.form,false,false,false,true,16);
	}
	//alert(inputButton.form.attributes[0].value);
	
}

function smdbAjaxRequest(buttonFrom,onSuccessFunction,onErrorFunction){
	var uiBox = this.jQuery.ui;
	var postUrl = this.frameElement.attributes[0].nodeValue+"&smdb_ajaxRequest=1";
	var nameFormulaire = buttonFrom.form.name;
	var formId=buttonFrom.form.id;
	if(formId=="") { buttonFrom.form.id = nameFormulaire;}
	var jsfValidateAction=buttonFrom.form.jsfValidateAction.value;
	if(jsfValidateAction!=""){
		jsfValidateAction=jsfValidateAction.replace("this","buttonFrom.form");
		var jsfValidateResponse=eval(jsfValidateAction);
	}else{
		jsfValidateResponse=true;
	}
	if(jsfValidateResponse){
		setLoadingElement(formId,"set");
		$.ajax({
			url: postUrl,
			success: function(data) {
				var mySuccessFonction=onSuccessFunction + "(" + data + ")";
				setLoadingElement(formId,"remove");
				eval(mySuccessFonction);
			},
			error: function() {
				uiBox.dialog('option','title','La requête a échoué !');
				uiBox[0].innerHTML = 'Merci de réessayer.';
				uiBox.dialog('option','buttons', { 'Ok': function() { $(this).dialog('close'); } } );
			}
		});
		/*$.ajax({
			  type: 'POST',
			  url: postUrl,
			  data: data,
			  success: function(data){
						var mySuccessFonction=onSuccessFunction + "(" + data + ")";
						setLoadingElement(formId,"remove");
						eval(mySuccessFonction);
						}
			});*/
		/*var myHTMLRequest = new Request.HTML({	url:postUrl,
			onSuccess: function(){
				var mySuccessFonction=onSuccessFunction + "(" + myHTMLRequest.response.text + ")";
				setLoadingElement(formId,"remove");
				eval(mySuccessFonction);
			}
		}).post($(formId));*/
	}
}

function setLoadingElement(myElement,setOrRemove){
	if(setOrRemove=="set"){
		var formHeight=$(myElement).clientHeight;
		var formWidth=$(myElement).clientWidth;
		var formTop=$(myElement).offsetTop;
		var formLeft=$(myElement).offsetLeft;
		var formLoadingElement = $('div');
		formLoadingElement.addClass('ajaxLoading');
		formLoadingElement.id = 'ajaxLoading';
		formLoadingElement.css('position','absolute');
		formLoadingElement.css('top',formTop);
		formLoadingElement.css('left',formLeft);
		formLoadingElement.height(formHeight);
		formLoadingElement.width(formWidth);
		/*var formLoadingElement = new Element('div',{
			'class'	: 'ajaxLoading',
			'id'		: 'ajaxLoading',
			styles	: {
				'position'	: 'absolute',
				'top'				: formTop + 'px',
				'left'			: formLeft + 'px',
				'height'		: formHeight + 'px',
				'width'			: formWidth + 'px'
			}
		});*/
		$(myElement).append(formLoadingElement);
	}else{
		$('#ajaxLoading').remove();
	}
	
}
