/*--FUNCTIONS.JS--*/

function pngFix(){
	$$(".pngFix").each(function(el){
		$(el).firstChild.style.visibility = "hidden";
		$(el).style.display = "block";
		$(el).style.width = $(el).firstChild.width+"px";
		$(el).style.height = $(el).firstChild.height+"px";
		$(el).style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+$(el).firstChild.src+"', sizingMethod='crop');";
	});
}

var timer = null;

function menuInit() {
		
		/*-- btn MENU HAUT ----------------------------*/		
		var tabElt = document.getElementsByTagName('li');
		
		for( i=0; i<tabElt.length; i++)
		{
		  if( tabElt[i].parentNode.id == 'menu' && tabElt[i].id != 'menu-produit' )
			{
  			var btn = tabElt[i];
  			btn.url = btn.firstChild.attributes.href.value;
  			
  		    btn.onclick = function(){ document.location.href = this.url };					
  			
  			if( btn.className != 'selected')
  			{
  				btn.onmouseover = function()
  				{
  					this.className = 'over';
  				};
  	
  				btn.onmouseout = function()
  				{
  					this.className = 'out';
  				};
  			}
  			else
  			{
  				this.className = 'selected';
  			}
  		}
		}		
		
		/*-- btn OU NOUS TROUVER --*/		
		$('product-search').setStyle({ display: 'none' })
		
		var btnSearch = document.getElementById('menu-produit');
	
	  btnSearch.onmouseover = function(){			
			if(timer != null){ clearTimeout(timer); }			
			$('product-search').appear();			
		}
		
		btnSearch.onmouseout = function(){
			timer = setTimeout("hideSearch()",1000);
		}
		
		$('product-search').onmouseover = function(){
			if(timer != null){ clearTimeout(timer); }			
		}
		
		$('product-search').onmouseout = function(){
			timer = setTimeout("hideSearch()",1000)			
		}		
		
		$('product-search-input').onmouseover = function(){
			if(timer != null){ clearTimeout(timer); }				
		}
		
		$('product-search-button').onmouseover = function(){
			if(timer != null){ clearTimeout(timer); }				
		}
		
		$('product-search-input').onclick = function(){
      this.value = '';    
    } 		
		
		/*
		var lienSearch = btnSearch.firstChild;
		lienSearch.onclick = function(){ return false; } 
    */
}

function hideSearch(){
	$('product-search').fade({ duration: 1.0, from: 1, to: 0 });
	timer = null;
}

function onBodyLoad(){
	menuInit();
}

new Event.observe(window, 'load', onBodyLoad);







