/*---------------------------------------------------------------------------------------------------
$ // Raccourci pour avoir document.getElementById
---------------------------------------------------------------------------------------------------*/
function $(id){
	return document.getElementById(id);
}


/*---------------------------------------------------------------------------------------------------
addLoadEvent // Ajoute une fonction à la liste de fonction à executé lors de l'événement onload
---------------------------------------------------------------------------------------------------*/
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}



function validSearch() {
	var inputSearch = document.getElementById("s");
	
	if ((!inputSearch.value=='') || (inputSearch.length>2)){
		return true;
	}
	inputSearch.focus();
	return false;
		
	//}	
}

/*---------------------------------------------------------------------------------------------------
equalHeight // 
---------------------------------------------------------------------------------------------------*/
function equalHeight(){
	//alert('titt');
	containerElement = $('container');
	if (!containerElement) return false;
	var els = containerElement.getElementsByTagName("*");
	var tempArray = new Array();
	for(var i=0; i< els.length; i++){	
		var el = els[i];
		if(el.className.indexOf("equalHeight_@") != -1){
			var startSubString = el.className.indexOf("equalHeight_@");
			var string = el.className.substring(startSubString);
			var param1 = string.split('@')[1];
			var param1 = param1.split(' ')[0];
			tempArray.push(param1);
			if(!tempArray[param1])tempArray[param1] = new Array();
			tempArray[param1].push(el);
		}
	}
	
	for(var x in tempArray){
		if(typeof(tempArray[x]) == 'object'){
			var maxHeight = 0;
			for(var y in tempArray[x]){
				var el = tempArray[x][y];
				if(el.offsetHeight > maxHeight) maxHeight = el.offsetHeight;
			}			
			for(var y in tempArray[x]){
				var el = tempArray[x][y];
				el.style.minHeight = maxHeight + "px";
				if(navigator.userAgent.indexOf('MSIE 6.0') != -1){
					el.style.height = maxHeight + "px";
				}
			}
		}
	}
}
addLoadEvent(equalHeight);

