/******************************************************************************************/
/*                                                                                        */
/*    JMF framework 2009                                                                  */
/*                                                                                        */
/******************************************************************************************/
//PNGFIX : Permet d'afficher correctement les couche alpha des .png pour IE6 
$(document).ready(function(){
	var arV = navigator.appVersion.split("MSIE");
	var v = parseFloat(arV[1]);
	if ((v >= 5.5 && v < 7) && (document.body.filters)) 
	{
		//Pour toutes les images PNG dans le document
		for(var i=0; i<document.images.length; i++)
		{
			var img = document.images[i];
			var imgName = img.src.toUpperCase()
			if (imgName.substring(imgName.length-3, imgName.length) == "PNG"){
				var imgID = (img.id) ? "id='" + img.id + "' " : ""
				var imgClass = (img.className) ? "class='" + img.className + "' " : ""
				var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
				var imgStyle = "display:inline-block;" + img.style.cssText 
				if (img.align == "left") imgStyle = "float:left;" + imgStyle
				if (img.align == "right") imgStyle = "float:right;" + imgStyle
				if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
				var strNewHTML = "<span " + imgID + imgClass + imgTitle
				+ " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
				+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
				+ "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
				img.outerHTML = strNewHTML
				i = i-1
			}
		}
	}									
});




//Gestion des erreurs validation, alert , info , validation
function setOut(e,c,t){
	$(e).fadeTo(0,0)  ;
	$(e).html(c)  ;
	$(e).fadeTo('normal',1)  ;
	if(t!=undefined){setTimeout(function(){$($(e).children()).fadeOut('slow')},t);}
}
function valid(e,c,t){setOut(e,'<span class="valid">'+c+'</span>',t);}
function info(e,c,t){setOut(e,'<span class="info">'+c+'</span>',t);}
function al(e,c,t){setOut(e,'<span class="alert">'+c+'</span>',t);}
function err(e,c,t){setOut(e,'<span class="error">'+c+'</span>',t);}
function clrOut(e,t){
	if(t==undefined) t=0;
	$($(e).children()).fadeTo(t,0)  ;
}

var J = new J();
function J(){
	this.JPath=''  ;
	this.eval = function(url,p1,p2){$(window).jmfEval(url,p1,p2)}
}


//J.eval();
(function($){
	 $.fn.jmfEval = function(url,p1,p2){
		  if(typeof p1=='object'){
			  $.post(url,p1,function(d){
					eval(d)
					if(p2!=undefined) p2(); 									
			  });
			  
		  }else if(typeof p1=='function'){
			  $.post(url,function(d){
				 eval(d);
				 p1();
			  });
		  }else{
			  $.post(url,function(d){
				 eval(d);
			  });  
		  }
	 };
})(jQuery)