$(document).ready(function(){
	
	//png transparency
	var arVersion = navigator.appVersion.split("MSIE");
	var version = parseFloat(arVersion[1]);
	
	if ((version >= 5.5) && (version < 7)  && (document.body.filters)) 
	{
	   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;
	      }
	   }
	}
		
	if (!$.browser.msie) {
		$('.form_select select').selectbox();
		//$('.prod_trousse select').selectbox();
	}
	//$('.men_nav select').selectbox();
	$.fn.extend({
		init_rubrique : function () {
			$(this).each (function () {
				result_html= $(".description .cont",this).html();
				$('.restit_ongles',this).html(result_html);
				$(".description h5",this)
				.click	( function () { $(this).click_rubrique();})
				.each (function (i) {
					if (i==0){
						$(this).addClass ("on");
					}				 
				});
			});
		},
		click_rubrique : function () {
			var result_html = $(this).next(".cont").html();
			$(this).parents(".systeme_ongles").each (function (){	
				$('h5.on',this).removeClass('on');
				$('.restit_ongles',this).html(result_html);
			});
			
			$(this).addClass('on');
		}
	})

	//$(".systeme_ongles").init_rubrique();
	
	$('div.section_box').each(function (){	
		var minHeight = 0;
		$('div.small1',this).each(function (){	
				minHeight = Math.max(minHeight, $(this).height());
		});

		$('div.small1',this).each(function (){	
				$(this).height(minHeight);
		});		
	});

	/* Menu_d�roulant */
	$("#menudrop").hover(function(){
	  $(this).addClass("hover");
	},function(){
	  $(this).removeClass("hover");
	});
})


//-------lightbox gallery
function hide_all_frms(){
	for(var i=1; i<=max_frm; i++) {
		document.getElementById('frm_'+i).style.display = 'none';	
	}
}	
function show_frm() {
		document.getElementById('frm_'+cur_frm).style.display = 'block';		
}

function prev_image() {
	cur_frm--;
	if(cur_frm < 1) {
		cur_frm = 1;
		return;
	}	
	hide_all_frms();
	show_frm();
}

function next_image() {
	cur_frm++;
	if(cur_frm > max_frm) {
		cur_frm = max_frm;
		return;
	}	
	hide_all_frms();
	show_frm();
}
//-------lightbox gallery

function tab_click(id) {
	//var tabs = new Array('tab_a', 'tab_b', 'tab_c');
	if(id=='all') {
		for ( var i =0; i < tabs.length; i++ ) {	  
					var head = tabs[i];
					var tab = tabs[i];
					head = head.replace(/tab/ig, 'head'); 
					$(head).removeClass('on');
		    	$(tab).show();
		}	
		//$('current_tab').value = 'tab_all'; 
	} else {		
		for ( var i =0; i < tabs.length; i++ ) {	 				
				var head = ''+tabs[i];
				var tab = ''+tabs[i];
				head = head.replace(/tab/ig, 'head'); 
		    if(id==tab) {		    	
		    	$('#'+head).addClass('on');
		    	$('#'+tab).show();
		    } else {
		    	$('#'+head).removeClass('on');
		    	$('#'+tab).hide();
		    }
		} 
		//$('head_all').removeClassName('tabberactive');
		//$('current_tab').value = id; 
	}	
}		