Galleria.loadTheme('/galleria/themes/classic/galleria.classic.min.js');

function puzzle(url) {
     window.open('/picasa/puzzle.html','mywindow','width=780,height=780,resizable=yes,scrollbars=yes,toolbar=yes,menubar=yes,location=yes')
}
function site(url) {
     window.open(url)
}


function site2(url) {
     window.open(url,'_newtab','width=1300,height=780,resizable=yes,scrollbars=yes,toolbar=yes,menubar=yes,location=yes')
}

function preg_replace (array_pattern, array_pattern_replace, my_string)  {
 var new_string = String (my_string);
 for (i=0; i<array_pattern.length; i++) {
			var reg_exp= RegExp(array_pattern[i], "gi");
			var val_to_replace = array_pattern_replace[i];
			new_string = new_string.replace (reg_exp, val_to_replace);
 }
return new_string;
}


function mysearch(album) {
    var new_string;
   	
    var pattern_accent =          new Array("ä", "Ä","û","é", "è", "ê", "ë", "ç", "à", "â", "î", "ï", "ù", "ô", "ó", "ö" ,"ß");
    var pattern_replace_accent = new Array( "a","A","u","e", "e", "e", "e", "c", "a", "a", "i", "i", "u", "o", "o", "o" , "ss");
    if (album && album!= "") {
	 new_string = preg_replace (pattern_accent, pattern_replace_accent, album);
    }

    var  pica= new Galleria.Picasa();
    pica.setOptions({
       description:'true',
       max:100, 
       transition:'fade'
     });
   
    pica.search( new_string,function(data){ 
         var gallery = Galleria.get(0);         
         gallery.load(data);
	 gallery.unbind('image');
	 gallery.bind('image',function(e) {
	 $(e.imageTarget).click(this.proxy(function() {
               this.openLightbox();
             }));
         });   
    });
   
   $('#columnRight').find('p').remove();
   $('#columnRight').append('<p>Résultats de la recherche concernant:<b> ' + album + '</b></p>&nbsp;<p>&nbsp;</p>');
}

function collection(album, name,country,wiki) {
    $('#footer').find('p').remove();
    $('#footer').append('<p><a href=https://picasaweb.google.com/103567523840246919262/' + album + '>Picasa</a> - Copyright ©1994-2012</p>');
           
    var  pica= new Galleria.Picasa();
    pica.setOptions({
       description:'true',
       transition:'fade',
       max:450
     });
    pica.useralbum('fondationjeb' , album,function(data){ 
         var gallery = Galleria.get(0);
         gallery.load(data);
         gallery.unbind('image');
         gallery.bind('image',function(e) {
            $(e.imageTarget).click(this.proxy(function() {
               this.openLightbox();
            }));
         });    
    });

 

   if ( typeof(country) != "undefined" ) {
       if ( country == 'jp2' ||  country == 'eg2' ||  country == 'cn2' ||  country == 'in2' ||  country == 'je2'  ||  country == 'ludwig' ) {
              $('#columnRight').find('p').remove();
              $('#columnRight').append('<p>' + name + '</p>&nbsp;<p>&nbsp;</p><p>&nbsp;</p></p>');
        }
	if (  country == 'ludwig' ) {	              
            $('#columnLeft').find('h4').remove();  
            $('#columnRight').find('p').remove();  
       } 
   }
   
   if ( typeof(wiki) != "undefined" ) {
        $('#columnLeft').find('h4').remove();     

        var newwiki = wiki.replace(/'/g, "\\'");
       
        $('#columnLeft').append('<h4>' + name + '<hr><a href="javascript:site(\'http://' + newwiki + '\');">Wikipedia</a></h4>');
   
   }
    
}

function artists(album,name,babel) {

    $('#footer').find('p').remove();
    $('#footer').append('<p><a href=https://picasaweb.google.com/103567523840246919262/' + album + '>Picasa</a> - Copyright ©1994-2012</p>');
      
   
    var  pica= new Galleria.Picasa();
    pica.setOptions({
       description:'true',
       transition:'fade',
       max:450
     });
    pica.useralbum('fondationjeb' , album,function(data){ 
         var gallery = Galleria.get(0);
         gallery.load(data);
         gallery.unbind('image');
         gallery.bind('image',function(e) {
            $(e.imageTarget).click(this.proxy(function() {
               this.openLightbox();
            }));
         });    
    });
   $('#columnLeft').find('b').remove();
   $('#columnLeft').find('p').remove();
   $('#columnLeft').find('h3').remove();
   $('#columnLeft').find('h4').remove();     
   $('#columnLeft').find('hr').remove();  
   $('#columnLeft').find('ul').remove();  
   $('#columnLeft').find('li').remove();
   if ( typeof(babel) != "undefined" ) {
     $('#columnLeft').append('<p style="margin:200px 0 0 0;"><b>Artist Section</b></p>');
   }else {
     $('#columnLeft').append('<p style="margin:200px 0 0 0;"><b>Rubrique artistes</b></p>');
   }
   $('#columnRight').find('p').remove(); 
   $('#columnRight').append('<p>' + name + '</p>&nbsp;<p></p>');
  
}

function periods(album,name,babel) {
    $('#footer').find('p').remove();
    $('#footer').append('<p><a href=https://picasaweb.google.com/103567523840246919262/' + album + '>Picasa</a> - Copyright ©1994-2012</p>');  
   
    var  pica= new Galleria.Picasa();
    pica.setOptions({
       description:'true',
       transition:'fade',
       max:450
     });
    pica.useralbum('fondationjeb' , album,function(data){ 
         var gallery = Galleria.get(0);
         gallery.load(data);
         gallery.unbind('image');
         gallery.bind('image',function(e) {
            $(e.imageTarget).click(this.proxy(function() {
               this.openLightbox();
            }));
         });    
    });
   $('#columnLeft').find('b').remove();
   $('#columnLeft').find('p').remove();
   $('#columnLeft').find('h3').remove(); 
   $('#columnLeft').find('h4').remove();     
   $('#columnLeft').find('hr').remove();  
   $('#columnLeft').find('ul').remove();
   $('#columnLeft').find('li').remove();
   if ( typeof(babel) != "undefined" ) {
     $('#columnLeft').append('<p style="margin:200px 0 0 0;"><b>Period Section</b></p>');
   }else {
     $('#columnLeft').append('<p style="margin:200px 0 0 0;"><b>Rubrique périodes</b></p>');
   }
   
   $('#columnRight').find('p').remove();   
   $('#columnRight').append('<p>' + name + '</p>&nbsp;<p></p>');
}


function pourart(album, fr) {
 if ( typeof(fr) == "undefined" ) {
$('#columnRight').find('p').remove();
$('#columnRight').append('<p><b>On Behalf of Art</b> (Lausanne 1979-1993 - Geneva 1990-1993), lecture-course cycles: <b><i>The splendors of the Baroque and Rococo Styles</i></b>,<b><i>The Forgotten Pathways</i></b> (Architecture and the Sacred), <b><i>Art and Civilization during the European Renaissance</i></b>, <b><i>The Keys to Looking</i></b> (Major Schools of Painting),  <b><i>Enigmas in Painting</i></b> (Fifteen Works Seeking our Gaze), and  except cycle <b><i>Roman Portraits from Egypt</i></b>. Each cycle mentioned consisted of fifteen lectures.</p>');
}
var conf = [ 
"wv6km4k7oyM", 
"-w1AtoFrStY",

"ipdbSHBm_uw",  
"Azqr6Ot8BGg",   
"NjEdFvhMssQ",  
"qzY20MdI7pk",  
"djLh6B-0fCs",   
"o6K2QOW6XcY",  
"DwsQIIO2sgg",  
"sa9BP3HbyhM",  
"NC-QXuNLYR8",  
"Y02X7VMuPfQ",  
"WaMiOGJaOvQ",


"tmw33mMmhpM", 
"DErlKWZ13X8",
"hDkMI4rhQww",
"W1d3lTZxm0w",
"gJnRK0ybu-M",
"R71sQQQkKwo",
"I7xg-n1NNPE",
"YzFl-b7bUno",
"iVmSuhNs2EA",
"T8-A6lJ7Pac",
"cj1v5hxbzKI",
"finSM5QB6ZE",
"fWElt0-ut9A",
"hZc4ZxE8_oo",
"x1LzuWmjTP4",

"WPAlupyiWSA",
"GnWDpXOBMEs",
"ct-2toz3UOQ", 
"f5040qN787g", 
"n7mQOV5tYsA", 
"RNf0pMQ-IzE", 
"qh5aFFq2UT0", 
"NfB3gKpJTZQ", 
"omGcJOQgl3g",
"JKuuV6_sFQ4", 
"qKwhPO0MQGE", 
"rwNu94SS4KA", 
"Jk_VfWniBDM", 
"Q6LOll3rIPY", 
"JIzR7bjcq0I",		 	  	  

"BYQIBLrza5E",  
"cHnGFB5-E7I",	 	  

"GM1u5PYSmDo",  
"ySwZTY5ggzI"	 

];

$('#gallery').galleria({   
    picasa: 'useralbum:fondationjeb/' + album,
    picasaOptions: {
	description:'true', 
        max:100,      
    },
     width: 700,
     height: 450,
    show:1,
extend: function() {
       var gallery = this;
       this.bind('image',function(e) {
         $(e.imageTarget).click(this.proxy(function() {                     
                site('http://www.youtube.com/watch?v=' + conf[gallery.getIndex()]);
             
         }));
       });      
   }
});
}


function pourart2(album) {
$('#columnRight').find('p').remove();
$('#columnRight').append('<p><b>On Behalf of Art</b> (Lausanne 1979-1993 - Geneva 1990-1993), lecture-course cycles: <b><i>The splendors of the Baroque and Rococo Styles</i></b>,<b><i>The Forgotten Pathways</i></b> (Architecture and the Sacred), <b><i>Art and Civilization during the European Renaissance</i></b>, <b><i>The Keys to Looking</i></b> (Major Schools of Painting),  <b><i>Enigmas in Painting</i></b> (Fifteen Works Seeking our Gaze), and  except cycle <b><i>Roman Portraits from Egypt</i></b>. Each cycle mentioned consisted of fifteen lectures.</p>');

var conf = [ 
"-w1AtoFrStY",
"wv6km4k7oyM", 

"ipdbSHBm_uw",  
"Azqr6Ot8BGg",   
"NjEdFvhMssQ",  
"qzY20MdI7pk",  
"djLh6B-0fCs",   
"o6K2QOW6XcY",  
"DwsQIIO2sgg",  
"sa9BP3HbyhM",  
"NC-QXuNLYR8",  
"Y02X7VMuPfQ",  
"WaMiOGJaOvQ",


"tmw33mMmhpM", 
"DErlKWZ13X8",
"hDkMI4rhQww",
"W1d3lTZxm0w",
"gJnRK0ybu-M",
"R71sQQQkKwo",
"I7xg-n1NNPE",
"YzFl-b7bUno",
"iVmSuhNs2EA",
"T8-A6lJ7Pac",
"cj1v5hxbzKI",
"finSM5QB6ZE",
"fWElt0-ut9A",
"hZc4ZxE8_oo",
"x1LzuWmjTP4",

"WPAlupyiWSA",
"GnWDpXOBMEs",
"ct-2toz3UOQ", 
"f5040qN787g", 
"n7mQOV5tYsA", 
"RNf0pMQ-IzE", 
"qh5aFFq2UT0", 
"NfB3gKpJTZQ", 
"omGcJOQgl3g",
"JKuuV6_sFQ4", 
"qKwhPO0MQGE", 
"rwNu94SS4KA", 
"Jk_VfWniBDM", 
"Q6LOll3rIPY", 
"JIzR7bjcq0I",		 	  	  

"BYQIBLrza5E",  
"cHnGFB5-E7I",	 	  

"GM1u5PYSmDo",  
"ySwZTY5ggzI"	 

];

$('#gallery').galleria({   
    picasa: 'useralbum:fondationjeb/' + album,
    picasaOptions: {
	description:'true', 
        max:100,      
    },
     width: 700,
     height: 450,
    
extend: function() {
       var gallery = Galleria.get(0);     
       this.bind('image',function(e) {
         $(e.imageTarget).click(this.proxy(function() {                     
                site('http://www.youtube.com/watch?v=' + conf[gallery.getIndex()]);
             
         }));
       });      
   }
});
}


function galleria(album) {

$('#footer').find('p').remove();
$('#footer').append('<p><a href=https://picasaweb.google.com/103567523840246919262/' + album + '>Picasa</a> - Copyright ©1994-2012</p>');
   
$('#gallery').galleria({   
    picasa: 'useralbum:fondationjeb/' + album,
    picasaOptions: {
	description:'true', 
        max:100 ,
       transition:'fade'   
    },
     width: 700,
     height: 450,
      
    extend: function() {
       this.bind('image',function(e) {
         $(e.imageTarget).click(this.proxy(function() {
             this.openLightbox();
         }));

       });      
   } 
});
}


function home(album) {
 $('#columnRight').find('p').remove();
 $('#columnRight').append('<p>Private Collection: Egypt - Middle Empire');
   
$('#gallery').galleria({   
    picasa: 'useralbum:fondationjeb/' + album,
    picasaOptions: {
	description:'true', 
        max:100 ,
       transition:'fade'   
    },
     width: 700,
     height: 450,
     show:10, 
    extend: function() {
       this.bind('image',function(e) {
         $(e.imageTarget).click(this.proxy(function() {
             this.openLightbox();
         }));

       });      
   } 
});
}

