/*

GLOBE Web Portal Scripts
Created by Jason Soffe (Webmaster)
jason.soffe@fondation-merieux.org


*/

/* =gallery 
------------------------------------------------------------ */
function swapPhoto(photoSRC,theCaption) 
	{ 
	var displayedCaption = document.getElementById("caption");
	displayedCaption.firstChild.nodeValue = theCaption;
	document.images.imgPhoto.src = photoSRC; 
	} 
	
function toggleGlobeNews(id_news){
	jQuery("div#article_" + id_news).toggle("500");
}

jQuery(document).ready(function(){
if ($('#main-nav').attr('class') == '-hide') {
	$('ul#nav').hide();
	$('li.fr').hide();
	$('li.en').hide();
	$('ul#nav-hidden').show().addClass('show');
}
$("li.menu a").click(function() {
		if ($('ul#nav-hidden').attr('class') == 'show') {
		 	$('ul#nav-hidden').fadeOut('slow', function() {
		 		$('li.fr').slideDown('fast');
				$('li.en').slideDown('fast');
		    $('ul#nav').slideDown('fast');
		    $('ul#nav-hidden').removeClass('show');
		  });
		} else {
		  $('li.fr').slideUp('fast');
			$('li.en').slideUp('fast');
		 	$('ul#nav').slideUp('fast', function() {
		    $('ul#nav-hidden').fadeIn('slow').addClass('show');
		  });
		}
	});
	
	$("li.menu_footer a").click(function() {
		if ($("div#footer").attr("id") != undefined) {
			$("div#footer").attr("id", "footer-hide");
		}
		else {                  
			$("div#footer-hide").attr("id", "footer");
		}
	});
	
	jQuery("div[id^='tool']").each(function(i){
		var id_select = jQuery(this).attr("id");
		jQuery("div#" + id_select).addClass("tool-select");
		jQuery("div#" + id_select + " h3 a").click(function(e){
			if ((jQuery("div#" + id_select).attr("class")) == "tool") {
				jQuery("div#" + id_select + " table").fadeIn(500);
				jQuery("div#" + id_select).removeClass("tool").addClass("tool-select");
			} else {
				jQuery("div#" + id_select + " table").fadeOut(500);
				jQuery("div#" + id_select).removeClass("tool-select").addClass("tool");
			}
		});
	});
	
		
	jQuery("#publicationForm").hide();
	jQuery("a#searchToggle").click(function(){
	if ((jQuery(this).attr("class")) == "on") {
			jQuery("#publicationForm").fadeOut(500);
			jQuery(this).removeClass("on");
		} else {
			jQuery("#publicationForm").fadeIn(500);
			jQuery(this).addClass("on");			
		}
		return false;
	});

});

function calcIframeHeight() {
  var iframeHeight=document.getElementById('gabrielIframe').contentWindow.document.body.scrollHeight;
  document.getElementById('gabrielIframe').height=iframeHeight;
}