function getWindowHeight() {
	var  windowHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		windowHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6
		windowHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 7
		windowHeight = document.body.clientHeight;
	}
  
	return windowHeight;
}


function switchIndex() {
	 $("index_fluidbook").style.minHeight = (getWindowHeight()-49)+"px";
	if ($("fbContainer").style.visibility == "visible") {
			$("sommaire").style.display = "none";
			$("fbContainer").style.visibility = "hidden";
			$("fbContainer").style.marginTop = "-1500px";
			$("index_fluidbook").style.display = "block";
			$("fbswitchIndex").src = "img/btnIndex-ferme.gif";
	} else {
			$("fbContainer").style.visibility = "visible";
			$("index_fluidbook").style.display = "none";
			$("fbContainer").style.marginTop = "0px";
			$("fbswitchIndex").src = "img/btnIndex-ouvert.gif";
	}
}
function afficheIndex() {
	var shuffle = Math.random();
	var url='index_fluidbook.php?shuffle='+shuffle;
	new Ajax.Request(url,{
		method: 'get',
		asynchronous: true,
		onloading: function(){

			},
		onSuccess: function(transport){
			$('index_fluidbook').innerHTML = transport.responseText;
			
			},
		onFailure:function(){
			alert('Problem');
			return true;
			}
	});
}
function indexGoto(pageNumber) {
		switchIndex();
		flippingBook.getFlippingBookReference().flipGotoPage( pageNumber );	
}
function switchSommaire() {
	if ($("sommaire").style.display == "none") {
		if ($("fbContainer").style.marginTop == "-1500px") {
			$("fbContainer").style.visibility = "visible";
			$("fbContainer").style.marginTop = "0px";
		}
	if ($("send_to_friend").style.display == "block"){
		$("send_to_friend").style.display = "none";
		$("send_to_friend_bkg").style.display = "none";	
		}
		$("sommaire").style.display = "none";
		$("sommaire").style.height = "";
		Effect.SlideDown('sommaire');
		$("index_fluidbook").style.display = "none";
		$("fbswitchIndex").src = "img/btnIndex-ouvert.gif";
	} else {
		Effect.SlideUp('sommaire');
		setTimeout("hideSommaire()", 3000);
	}
}
function hideSommaire() {
		$("sommaire").style.display == "none";	
}
function sommaireGoto(pageNumber) {
	$('sommaire').style.display = "none";
	flippingBook.getFlippingBookReference().flipGotoPage( pageNumber );	
}