				var page = {id:'',title:'',module:'catalogue',langue:''};
				var module = '';
/*	* **** DEBUT DU JS **** */
var repServeur = '';
var editeurTexte = 'ckeditor';
if ( editeurTexte == 'ckeditor' ){
document.write('<script type="text/javascript" src="/'+repServeur+'js/ck_init.js"></script>'+"\n");
}
else if ( editeurTexte == 'tinymce' ){
document.write('<script type="text/javascript" src="/'+repServeur+'js/tyni_init.js"></script>'+"\n");
}
/** ===== COMMON JS ===== */
function doNothing(){}

document.write('<script type="text/javascript" src="/'+repServeur+'js/valideForm.js"></script>');

/*******************************************************************
	*												OBJETS JQUERY-UI
	*******************************************************************/

/*===================== OBJET calendrier ==========================*/

var calendrier = function(id){
 var joursFr = null;
 var moisFr = null;

 $('#'+id).datepicker({
  dateFormat: 'dd/mm/yy',
  dayNames: calendrier.getJoursFr(),
  dayNamesMin: ['Di', 'Lu', 'Ma', 'Me', 'Je', 'Ve', 'Sa'],
  dayNamesShort: ['Dim', 'Lun', 'Mar', 'Mer', 'Jeu', 'Ven', 'Sam'],
  monthNames: calendrier.getMoisFr(),
  firstDay: 1
 });

}
calendrier.getJoursFr = function(){
 if ( !this.joursFr )
  joursFr = new Array('Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi');
 return joursFr;
}

calendrier.getMoisFr = function(){
 if ( !this.moisFr )
  this.moisFr = new Array('Janvier','f&eacute;vrier','Mars','Avril','Mai','Juin','Juillet','Ao&ucirc;t','Septembre','Octobre','Novembre','D&eacute;cembre');
 return this.moisFr;
}

calendrier.dateMin = function(dateMin){
 this.elt.datepicker({
  beforeShowDay: function(date) {
   if ( date > dateMin)
    alert('coucou');
  }
 });
}
/*===================== /OBJET calendrier ==========================*/


function isMod(from){
 $("#submit").show();
 $("#statut").html('modifié');
 if ( from )
  from.getBody().innerHTML;
}
/*===================== OBJET modaleDiv ==========================*/
var modaleDiv = function (data,resize){
 this.creer(data,resize);
};

modaleDiv.prototype.creer = function(data,resize){
 if ( !data )
  data = '';
 var resizable = ( resize == '1' )? true:false;
 if ( !$("#modale").size() )
  $("body").append('<div id="modale"></div>');
 this.modale = $("#modale");
 this.modale.append(data);
 this.modale.dialog({
  position: 'center',
  modal: true,
  resizable: resizable,
  close: function() {
   $(this).dialog("destroy");
   $(this).remove();
  }
 });
};

modaleDiv.prototype.alert = function (texte){
 this.creer(texte);
 this.modale.dialog('option','buttons', {
  'Ok':function(){
   $(this).dialog("close");
  }
 });
}

modaleDiv.prototype.confirme = function(texte,action,item,id,child,childId){
 var retour = true;
 $("#modale").html(texte);
 this.modale.dialog('option','buttons', {
  'Annuler':function(){
   $(this).dialog("close");
  },
  "Oui": function() {
   switch( action ){
    case 'enfants':
     del(item,id,child,childId);
     break;
    case 'del':
     del(item,id,child,childId);
     break;
    case 'duplic':
     dupliquer(item,id);
     break;
    default:
     return true;
     break;
   }
   $(this).dialog("close");
  }
 });
 return retour;
}


modaleDiv.prototype.confirmeSuppression = function (intitule,item,id,child,childId){
 this.confirme('<span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>Vous allez supprimer '+intitule+'<br/>Êtes-vous sur?','del',item,id,child,childId );
 this.setTitle('Confirmation de suppression');
}
modaleDiv.prototype.confirmeDuplication = function (intitule,item,id){
 this.confirme('<span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>Vous allez dupliquer '+intitule+'<br/>Êtes-vous sur?','duplic',item,id);
 this.setTitle('Confirmation de suppression');
}
modaleDiv.prototype.setTitle = function(title){
 this.modale.dialog('option','title',title);
}

modaleDiv.prototype.setResizable = function(bool){
 this.modale.dialog('option','resizable',bool);
}

modaleDiv.prototype.setClasse = function(classe){
 this.modale.dialog( "option", "dialogClass", classe );
}
/*=====================  / OBJET modaleDiv ==========================*/


$(document).ready(function() {
 $("#select-prog").change(function(event){
  event.preventDefault();
 window.location = $('option:selected',this).val();
 })
 /*if ( $("#headSlider").size() ){
  var sliderHead = new funnySlider('headSlider');
  sliderHead.boutonsInside();
  sliderHead.autoPlay();
  sliderHead.horizontal();
 }*/
 if ( $('#show-twitter').size() ){
  var sliderTwitter = new funnySlider('show-twitter',{
   inifi:true,
   idZone:'pp-twitter'
  });
  sliderTwitter.autoPlay();
 }
 //Focus sur le premier input text
 if ( $("#main input[type=text]").size() )
  $("#main input[type=text]")[0].focus();

 //Rend redimenssionnable les elements de classe retailleLaMoi
 if ( $(".retailleLaMoi").size())
  $(".retailleLaMoi").resizable();

 //Active l'affichage du menu'
 if ( $("#menu-haut ul li.niv1").size()){
  $("#menu-haut ul li.niv1").hover(function(){
   $(".niv2").fadeIn();
  },
  function(){
   $(".niv2").fadeOut();
  });
 }
 //Valeur par defaut pour le champ de recherche
 if ( $('#GNRsearch').size()){
  $('#GNRsearch').find('input').blur(function(){
   valeurParDefaut($(this),'Rechercher');
  });
  $('#GNRsearch').find('input').click(function(){
   valeurParDefaut($(this),'Rechercher');
  });
 }
//#valeur par defaut
});
//document.ready

/** Change le texte d'un element
*@param elt selector Element concerne
*@param texte1 string Texte de base
*@param texte2 string Texte de remplacement
*/
function toggleTexte(elt,texte1,texte2){
 if ( $(elt).html() == texte1 ){
  $(elt).html(texte2)
 }else
  $(elt).html(texte1)
}
/**
 *Affiche un champ en fade
 **/
function affChampFade(id,ids){
 var premier = $("#"+id);
 if (premier.css('display') == 'none')
  premier.fadeIn();
 else
  premier.fadeOut();
 if ( ids ){
  var second =$("#"+ids);

  if (second.css('display') == 'none')
   second.fadeIn();
  else
   second.fadeOut();
 }
}

/** Affiche ou cache un element suivant sont etat actuel
*@param id string ID de l'element
*@param ids string ID du second element a lier ( optionnel )
*/
function affChamp(id,ids){
 var premier = $("#"+id);
 if (premier.css('display') == 'none')
  premier.show();
 else
  premier.hide();
 if ( ids ){
  var second =$("#"+ids);

  if (second.css('display') == 'none')
   second.show();
  else
   second.hide();
 }
}

function toggleSubmit(id){
 toggleTexte($("#"+id).find('button'),'Enregistrer','Enregistré');
 setTimeout($("#"+id).submit(),5000);
 return false;
}

// Animation pour le bouton admin vue éditer
function editionOn(){
 $('#editiOnOff img').stop().animate({
  marginLeft: "-75px",
  duration:300
 },
 function(){
  document.formAdmin.submit()
 });
}
function editionOff(){
 $('#editiOnOff2 img').stop().animate(
 {
  marginLeft: "0px",
  duration:300
 },
 function(){
  document.formAdmin.submit()
 }
 );
}
// #Animation editer


function waitLoading(){
 if ( !$('#ajaxloading').size()  ){
  $("body").append('<img src="/'+repServeur+'/cssimg/8.gif alt="chargement en cours" id="ajaxloading" style="width:150px;height:45px;margin:auto;"/>');
 }
 else
  $('#ajaxloading').remove();
}

/** Copie la valeur du champ from dans le champ to
*@param from string ID du champ d'origine
*@param to string ID du champ de destination
*/
function copierColler(from,to){
 $('#'+to).val($("#"+from).val());
}

/** Premet de garder une valeur par defaut dans un champ
* @param $elt jQueryElt Element jquery correspondant au champ
* @param valeur string Valeur par defaut
*/
function valeurParDefaut($elt,valeur){
 if( $elt.val() == valeur)
  $elt.val('');
 else if ( $elt.val() == '' )
  $elt.val(valeur);
}


function isLienExterne(){
 if ( $("#select-module").val() == 'lienExterne'){
  $("#title").parent().find('label').html('Adresse du lien');
  $("#title").val('http://');
 }
 else{
  $("#title").parent().find('label').html('Titre de la page');
  $("#title").val('');

 }
}


function ChangeImage(id,url){
 var dest = document.getElementById(id);
 if( dest){
  dest.setAttribute('src','/imagesUp/'+url);
 }
}



