 jQuery.noConflict();

jQuery(document).ready(function(){
 hideContent = function(contentString){
  jQuery("div.dynamicContent").fadeOut( 100 ,function() {
     showContent(contentString);playSound(0);
     });
 };
 showContent = function (contentString) {
  jQuery.ajax({
      type: "GET",
      url: contentString,
      dataType:"html",
      success: function(data){
       jQuery("div.dynamicContent").html(data);
      jQuery("div.dynamicContent").slideDown(100);
    },
      error: function () {
        alert("Page "+contentString+" not found");
       }
   }); 
 };

  if(jQuery(document).getUrlParam("page")!=null) {    
    hideContent(jQuery(document).getUrlParam("page")); 
  } else {
    showContent("pages_du_site/_home.htm"); 
/*-----------lance la page _home au demarrage du site  ?----------*/
 } 
});

function sendToASUnselectButton(button_id) {
  thisMovie(button_id).sendToASUnselectButton("");
     }
     
function thisMovie(movieName) {
     if (navigator.appName.indexOf("Microsoft") != -1) {
         return window[movieName];
     } else {
         return document[movieName];
     }
 }

var requiredMajorVersion = 9;
var requiredMinorVersion = 9; 
var requiredRevision = 0;
var selected_button ="";
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;

function myButton (buttonText,buttonLink) { 
 AC_FL_RunContent('codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0','width','220','height','22','src','flash/button','quality','high','pluginspage','http://www.macromedia.com/go/getflashplayer','movie','flash/button','flashvars','custom_xml_url=button.xml&item_text='+buttonText+'&item_url='+buttonLink+'&button_id='+(anim_ids+1)+'&isIE='+isIE,'scale','noScale');
}

function myFlashHeader (_src,_width,_height,_bgcolor,_divID,_xml) { 
 if (window.document.getElementById(_divID)) {
 window.document.getElementById(_divID).innerHTML=AC_FL_RunContentDiv( 
'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0','width',_width,'height',_height,'src',_src,'quality','high','pluginspage','http://www.macromedia.com/go/getflashplayer','movie',_src,'flashvars','custom_xml_url='+_xml, 
'bgcolor',_bgcolor,'allowScriptAccess','sameDomain','scale','noScale'); //end AC code        
 } else  {
  alert("Div '"+_divID+"' not found ");
 }
}

function myFlashGallery (_src,_width,_height,_bgcolor,_divID) { 
 if (window.document.getElementById(_divID)) {
 window.document.getElementById(_divID).innerHTML=AC_FL_RunContentDiv( 
'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0','width',_width,'height',_height,'src',_src,'quality','high','pluginspage','http://www.macromedia.com/go/getflashplayer','movie',_src,'bgcolor',_bgcolor,'allowScriptAccess','sameDomain','allowFullScreen','true'); 
//end AC code        
 AC_FL_RunContentDiv( 
'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0','width','540','height','418','src','flash/gallery/gallery','quality','high','pluginspage','http://www.macromedia.com/go/getflashplayer','movie','flash/gallery/gallery','bgcolor','#FFFFFF','allowFullScreen','true'); 
//end AC code       
 } else  {
  alert("Div '"+_divID+"' not found ");
 }
}




function showPage(pageURL,button_id) {
ScrollUpToPage();   /* ---insertion fonction pour forcer retour en haut de page----------*/ 
masque_haut_right_col('haut_right_col'); masque_haut_right_col('haut_right_col_retro');/* ---insertion fonction pour cacher le bandeau des liens artistes suivants .....---*/
 hideContent(pageURL);
 if (selected_button!="" && button_id!=selected_button) {
   sendToASUnselectButton('anim_'+selected_button);  
 }
 selected_button = button_id; 
}





/* Copyright (c) 2006-2007 Mathias Bank (http://www.mathias-bank.de)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 * 
 * Version 2.1
 * 
 * Thanks to 
 * Hinnerk Ruemenapf - http://hinnerk.ruemenapf.de/ for bug reporting and fixing.
 * Tom Leonard for some improvements
 * 
 */
jQuery.fn.extend({
/**
* Returns get parameters.
*
* If the desired param does not exist, null will be returned
*
* To get the document params:
* @example value = $(document).getUrlParam("paramName");
* 
* To get the params of a html-attribut (uses src attribute)
* @example value = $('#imgLink').getUrlParam("paramName");
*/ 
 getUrlParam: function(strParamName){
   strParamName = escape(unescape(strParamName));
   
   var returnVal = new Array();
   var qString = null;
   
   if (jQuery(this).attr("nodeName")=="#document") {
    //document-handler
  
  if (window.location.search.search(strParamName) > -1 ){
   
   qString = window.location.search.substr(1,window.location.search.length).split("&");
  }
   
   } else if (jQuery(this).attr("src")!="undefined") {
    
    var strHref = jQuery(this).attr("src")
    if ( strHref.indexOf("?") > -1 ){
      var strQueryString = strHref.substr(strHref.indexOf("?")+1);
     qString = strQueryString.split("&");
    }
   } else if (jQuery(this).attr("href")!="undefined") {
    
    var strHref = jQuery(this).attr("href")
    if ( strHref.indexOf("?") > -1 ){
      var strQueryString = strHref.substr(strHref.indexOf("?")+1);
     qString = strQueryString.split("&");
    }
   } else {
    return null;
   }
    
   
   if (qString==null) return null;
   
   
   for (var i=0;i<qString.length; i++){
   if (escape(unescape(qString[i].split("=")[0])) == strParamName){
    returnVal.push(qString[i].split("=")[1]);
   }
   
   }
   
   
   if (returnVal.length==0) return null;
   else if (returnVal.length==1) return returnVal[0];
   else return returnVal;
 }
});

/*-----------script pour forcer retour en haut de page ----------*/
var delai=0; var pix=0; var pixmax=0; var inc=0;

function MomNavigateur() {
  if (navigator.appName=="Microsoft Internet Explorer") {
	pixscroll = document.documentElement.scrollTop;
  }
  else {
	pixscroll = window.pageYOffset;
  }	
}

function ScrollUpToPage() {
	delai=1;
	inc=-20;
	MomNavigateur()
	pix = pixscroll;
	if (-inc > pixscroll) {
		if (pixscroll > 15) {inc = -pixmax+15;};
	}
	if (pixscroll > 15) {self.scrollTo(0,15);pixscroll=15;pix=15;inc=-5;}
	setTimeout("scroll()",delai);
}

function scroll() {
	pix=pix+inc;
	self.scrollBy(0,inc);
	if (pix >= 0) {
		setTimeout("scroll()",delai);
		MomNavigateur();
		if (pixscroll <= 5) {inc=-1;}
		if (pixscroll > 5) {if (pixscroll <= 10) {inc=-3;};}
		if (pix < pixscroll) {pix=0;};
	}
}

/*----------- script pour defilement des fiches des artistes  ----------*/
var index_artiste=0; var nom_artiste=""; var prenom_artiste=""; 

function cherche_fiche_artiste(nom){
for (var i=0; i< liste_artistes.length ; i++)
{
if (liste_artistes[i]["nom"]==nom) {index_artiste=i; prenom_artiste=liste_artistes[i]["prenom"]; nom_artiste=liste_artistes[i]["nom"]; }                                
}
 if (nom_artiste != "") {showPage('fiches_artistes/'+ nom_artiste + '/_fiche.htm',3); affichage_haut_right_col('haut_right_col');}
}

function defilement_fiches() {
}
function fiche_suivante() {
var fiche_OK = 0; var prochain = 0;
for (var i=0; i< liste_artistes.length ; i++) 
{if (liste_artistes[i]["nom"]==nom_artiste)  prochain=1; 
else { if (prochain ==1 && liste_artistes[i]["fiche"]=="oui")  {index_artiste=i; prenom_artiste=liste_artistes[i]["prenom"];nom_artiste=liste_artistes[i]["nom"]; fiche_OK = 1; prochain=0; }}
}
if (fiche_OK == 1) {showPage('fiches_artistes/'+ nom_artiste + '/_fiche.htm',3); affichage_haut_right_col('haut_right_col');}
}

function fiche_precedente() {
var fiche_OK = 0; var prochain = 0; var nbre = liste_artistes.length-1;
for (var i=nbre; i>=0 ; i=i-1) 
{if (liste_artistes[i]["nom"]==nom_artiste)  prochain=1; 
else { if (prochain ==1 && liste_artistes[i]["fiche"]=="oui")  {index_artiste=i; prenom_artiste=liste_artistes[i]["prenom"];nom_artiste=liste_artistes[i]["nom"]; fiche_OK = 1; prochain=0; }}
}
if (fiche_OK == 1) {showPage('fiches_artistes/'+ nom_artiste + '/_fiche.htm',3); affichage_haut_right_col('haut_right_col');}
}


/*----------- projet script pour gestion de div haut_right_col ----------*/
function masque_haut_right_col(couche)
{
 action = "haut_right_col_off"; 
if (document.layers)
    document.layers[couche].className = action ; 
if (document.all)
    document.all(couche).className = action; 
if (document.getElementById)
    document.getElementById(couche).className = action; 
  
}

function affichage_haut_right_col(couche)
{
 action = "haut_right_col_on"; 
if (document.layers)
    document.layers[couche].className = action ; 
if (document.all)
    document.all(couche).className = action; 
if (document.getElementById)
    document.getElementById(couche).className = action; 
	
} 
 
/*----------- script pour defilement des retrospectives  ----------*/
var index_retro=0; var nom_retro="";

function cherche_fiche_retro(nom){
for (var i=0; i< liste_retro.length ; i++)
{
if (liste_retro[i]["nom"]==nom) {index_retro=i; nom_retro=nom;}                                
}
 if (nom_retro != "") {showPage('retrospective/'+ nom_retro + '/_photo.htm',3); affichage_haut_right_col('haut_right_col_retro');}
}

function fiche_suivante_retro() {
var fiche_OK = 0; var prochain = 0;
for (var i=0; i< liste_retro.length ; i++) 
{if (liste_retro[i]["nom"]==nom_retro)  prochain=1; 
else { if (prochain ==1 )  {index_retro=i; nom_retro=liste_retro[i]["nom"]; fiche_OK = 1; prochain=0; }}
}
if (fiche_OK == 1) {showPage('retrospective/'+ nom_retro + '/_photo.htm',3); affichage_haut_right_col('haut_right_col_retro');}
}

function fiche_precedente_retro() {
var fiche_OK = 0; var prochain = 0; var nbre = liste_retro.length-1;
for (var i=nbre; i>=0 ; i=i-1) 
{if (liste_retro[i]["nom"]==nom_retro)  prochain=1; 
else { if (prochain ==1 )  {index_retro=i; nom_retro=liste_retro[i]["nom"]; fiche_OK = 1; prochain=0; }}
}
if (fiche_OK == 1) {showPage('retrospective/'+ nom_retro + '/_photo.htm',3); affichage_haut_right_col('haut_right_col_retro');}
}




/*----------- script pour banniere  ----------*/
var position1=0, ban1, delai1, message1; 
function banniere1(delai) { 
delai1 = delai; 
if (position1 >= message1.length) 
position1 = 0; 
else if (position1 == 0) { 
message1 = ' ' + message1; 
while (message1.length < 128) 
message1 += ' ' + message1; 
} 
document.bandeau1.Fbanniere1.value = message1.substring(position1,position1+message1.length); 
position1++; 
ban1 = setTimeout("banniere1(delai1)",delai); 
} 

/*----------- PORTA  ---------*/

            function show_album() {
			 var fo = new SWFObject("ext/viewer.swf", "viewer", "100%", "100%", "7", "#e48901");
                fo.addVariable("preloaderColor", "0xffffff");
                fo.addVariable("xmlDataPath", "gallery_porta.xml");
                fo.addVariable("fontColor", "0xffffff");
                fo.addVariable("footer", "© 2011");
                fo.write("flashcontent");
                document.getElementById('mainlayer').style.visibility = 'visible';
                document.getElementById('introlayer').style.visibility = 'hidden';
            }

            function show_intro() {

                document.getElementById('mainlayer').style.visibility = 'hidden';
                document.getElementById('introlayer').style.visibility = 'visible';
            }

            var skip_intro = window.location.href.indexOf("?skip_intro")!=-1;
            if (!skip_intro && 0) {

                show_intro();
            }
			
               
             
 
