//MAXLENGTH sur un textarea
function textCounter( field, countfield, maxlimit ) {
 if ( field.value.length > maxlimit ) {
  field.value = field.value.substring( 0, maxlimit );
  field.blur();
  field.focus();
  return false;
 } else {
  countfield.value = maxlimit - field.value.length;
 }
}

showLayer = function(id){
	hideAllLayer();
	var layer = getElemRefs(id);
	if (layer && layer.css) layer.css.display = "block";
	//alert(layer);
}

hideLayer = function(id){
	var layer = getElemRefs(id);
	if (layer && layer.css) layer.css.display = "none";
}

swapLayer = function(id_toshow,id_tohide){
	hideAllLayer();
	showLayer(id_toshow);
	hideLayer(id_tohide);
}

hideAllLayer = function(){
	hideLayer('info_default');
	hideLayer('info_select_travaux');
	hideLayer('info_portfolio');
	hideLayer('info_goodies');
	hideLayer('info_illustration');
	hideLayer('info_reportage');
	hideLayer('info_pano');
	hideLayer('info_art');
	hideLayer('info_tarif');
  hideLayer('info_contact');
	hideLayer('info_contact_form');
	hideLayer('info_contact_guestbook');
	//hideLayer('info_contact_mailing');
	hideLayer('info_contact_infoleg');
	hideLayer('info_partenaires');
	hideLayer('info_prestations');
	hideLayer('fond_ecran');
	hideLayer('divers');
  hideAllPresta();
  hideAllContact();
}

hideAllPresta = function(){
  hideLayer('presta_default');
  hideLayer('presta_pub');
  hideLayer('presta_reportage');
  hideLayer('presta_portrait');
  hideLayer('presta_pano');
  //hideLayer('presta_deco');
  hideLayer('presta_tarifs');
  hideLayer('presta_art');
  //hideLayer('presta_multi_imp');
}
showPresta = function(id){
	hideAllPresta();
	var layer = getElemRefs(id);
	if (layer && layer.css) layer.css.display = "block";
}
hideAllContact = function(){
  hideLayer('contact_form');
  hideLayer('contact_guestbook');
  //hideLayer('contact_mailing');
}
showContact = function(id){
	hideAllContact();
	var layer = getElemRefs(id);
	if (layer && layer.css) layer.css.display = "block";
}
showHighLight = function(id){
  closeAllHighLight();
  var liId = getElemRefs(id);
  liId.className="highlight";
}
closeHighLight = function(id){
  var liId = getElemRefs(id);
  liId.className="";
}
closeAllHighLight = function(){
  closeHighLight('li_accueil');
  closeHighLight('li_presta');
  closeHighLight('li_galerie');
  closeHighLight('li_tirage');
  closeHighLight('li_partenaire');
  closeHighLight('li_contact');
}

showBulletSelected = function(id){
  deSelectAllBullet();
  var bulletId = document.getElementById(id);
  bulletId.className="bulletSelected";
  
}

deSelectBullet = function(id){
  var bulletId = document.getElementById(id);
  bulletId.className="bulletDeSelected";
}

deSelectAllBullet = function(id){
  deSelectBullet('a_presta_pub');
  deSelectBullet('a_presta_reportage');
  deSelectBullet('a_presta_portrait');
  deSelectBullet('a_presta_pano');
  //deSelectBullet('a_presta_deco');
  deSelectBullet('a_presta_tarif');
  deSelectBullet('a_contact_form');
  deSelectBullet('a_contact_guestbook');
  //deSelectBullet('a_contact_mailing');
  //deSelectBullet('a_presta_multi_imp');
}




getElemRefs = function(id){
	var elmt = (document.getElementById)? document.getElementById(id): (document.all)? document.all[id]: (document.layers)? document.layers[id]: null;
  if (elmt) elmt.css = (elmt.style)? elmt.style: elmt;
  return elmt;
}

MenuFocusOn = function(id){
	id.color="#C00";
	id.background="#484848";
}
MenuFocusOff = function(id){
	id.color="#C00";
	id.background="#fff";
}



bDebugEffectPano = false;
panoEffect = function(){
	if (bDebugEffectPano == false){
		new Effect.Grow('info-pano-pic',{duration: 1.0});
		bDebugEffectPano=true;
	}
}

bDebugEffectIllustration = false;
illustrationEffect = function(){
  new Effect.SlideDown('info_illustration_effect',{duration: 1.0});
}
