var _reg = new RegExp("[_]", "g");

function messageGlobal(style,msg,dest) {
  var id = dest || 'ajaxMessageGlobal';
  if (style!="") {
    $(id).className = 'message-'+style;
    new $(id).update(msg);
  } else {
    new $(id).update('');
    $(id).className = '';
  }
}

function showProjects(e){
  var elt = Event.element(e);
  if (elt.id != '') {
//    messageGlobal('valid',$('cacheProjets').getStyle('width'));
    var infos = elt.id.split(_reg);
    if ((elt.id=='lien-projets' || infos[0]=='cat' || elt.id=='projectsMenu')) {
      if ($('cacheProjets').getStyle('width') == '715px')
        $('cacheProjets').morph('width:0px;',{duration:1.5});
    }
    else if ($('cacheProjets').getStyle('width') == '0px') {
      $('cacheProjets').morph('width:715px;',{duration:1});
    }
  }
}

function showFooter(e) {
  var elt = e.element();
  var parent = elt.ancestors().reverse();
  if (parent[3]) {
    if (parent[3].id=='menubottom') {
      if ($('cacheFooter').getStyle('width') == '450px')
        $('cacheFooter').morph('width:0px;',{duration:1.5});
     } else if ($('cacheFooter').getStyle('width') == '0px') {
        $('cacheFooter').morph('width:450px;',{duration:1});
    }
  }
}


function hideExcept( e ) {
  var id = typeof(e)=='object' ? Event.element(e).id : e;
  var infos = id.split(_reg);
  var idToShow = infos[1];
	$$('#contacts div').each( function (elt) {
		if ( elt.id == idToShow )
			Element.show( elt );
		else
      Element.hide( elt );
	});
}


function initSite() {
}