// MENU DEROULANT
function sfHover() {
	$('#groupe li').hover(
    function () { $(this).addClass('sfhover'); },
    function () { $(this).removeClass('sfhover'); }
  );
}

// Correctly handle PNG transparency in Win IE 5.5 &
function correctPNG()
{
  var ie55 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 5.5") != -1);
	var ie6 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 6.0") != -1);

	if (ie55 || ie6) {
		$(document).find("img[@src$=.png]").each(function() {

			$(this).attr('width',$(this).width());
		  $(this).attr('height',$(this).height());

			var prevStyle = '';
			var strNewHTML = '';
			var imgId = ($(this).attr('id')) ? 'id="' + $(this).attr('id') + '" ' : '';
			var imgClass = ($(this).attr('class')) ? 'class="' + $(this).attr('class') + '" ' : '';
			var imgTitle = ($(this).attr('title')) ? 'title="' + $(this).attr('title') + '" ' : '';
			var imgAlt = ($(this).attr('alt')) ? 'alt="' + $(this).attr('alt') + '" ' : '';
			var imgAlign = ($(this).attr('align')) ? 'float:' + $(this).attr('align') + ';' : '';
			var imgHand = ($(this).parent().attr('href')) ? 'cursor:hand;' : '';
			if (this.style.border) {
				prevStyle += 'border:'+this.style.border+';';
				this.style.border = '';
			}
			if (this.style.padding) {
				prevStyle += 'padding:'+this.style.padding+';';
				this.style.padding = '';
			}
			if (this.style.margin) {
				prevStyle += 'margin:'+this.style.margin+';';
				this.style.margin = '';
			}
			var imgStyle = (this.style.cssText);

			strNewHTML += '<span '+imgId+imgClass+imgTitle+imgAlt;
			strNewHTML += 'style="position:relative;white-space:pre-line;display:inline-block;background:transparent;'+imgAlign+imgHand;
			strNewHTML += 'width:' + $(this).width() + 'px;' + 'height:' + $(this).height() + 'px;';
			strNewHTML += 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader' + '(src=\'' + $(this).attr('src') + '\', sizingMethod=\'scale\');';
			strNewHTML += imgStyle+'"></span>';
			if (prevStyle != ''){
				strNewHTML = '<span style="position:relative;display:inline-block;'+prevStyle+imgHand+'width:' + $(this).width() + 'px;' + 'height:' + $(this).height() + 'px;'+'">' + strNewHTML + '</span>';
			}

			$(this).hide();
			$(this).after(strNewHTML);

		});
	}
}


// FONCTION SET FONT SIZE
fs = 100;
function setFontsize(v){
	if(v>0)
		fs += 20;
	else
		fs -=20;

  $('h1').css('font-size', ''+fs+'%');
  $('h2').css('font-size', ''+fs+'%');
  $('h3').css('font-size', ''+fs+'%');
  $('p').css('font-size', ''+fs+'%');
  $('td').css('font-size', ''+fs+'%');
  $('li').children().css('font-size', ''+fs+'%');
}



// Appel aux fonctions
$(document).ready(function() {
  // Menu déroulant
  sfHover();
});

// Png transparent
correctPNG();


/* *********************
 *	Auto Complete Exemple : start
 */

$(document).ready(function() {

  $("#actifs").autocomplete("/fileadmin/templates/search.php", { autoFill:1,
                                            minChars:3,
                                            matchSubset:1,
                                            matchContains:1,
                                            cacheLength:10,
                                            selectFirst:1,
                                            maxItemsToShow:20,
                                            inputClass: 'ac_inputs',
                                            resultsClass: 'ac_results',
                                            loadingClass: 'ac_loading'
                                          });

});



/*
 *	Auto Complete : End
 ********************* */