/* / */
// Recherche par index
/*function openflash(chemin,larg,haut) {
	fen = window.open(chemin, 'flash', 'scrollbars=no,status=no,toolbar=no,width='+larg+',height='+haut+', top=300, left=0');
	fen.focus();
}
function openfen(adresse, w, h, scroll_ou_bien) {
	fen = window.open(adresse, 'fenetre', 'scrollbars='+scroll_ou_bien+',status=no,toolbar=no,width='+w+',height='+h+', top=150, left=340');
	fen.focus();
}*/
function openzoom(oeuvre_id,larg,haut,zoom) {
	if (larg<screen.width){
		largfen=larg;
		leftfen=Math.ceil(((screen.width-largfen)/2));
	}
	else{
		largfen=screen.width;
		leftfen=0;	
	}
	hautecran=screen.height-58;
	if (haut<hautecran){
		hautfen=haut;
		topfen=Math.ceil(((hautecran-haut)/2));	
	}
	else{
		hautfen=haut;
		topfen=0;			
	}
	fenz = window.open('../oeuvre/zoom.php?oeuvre_id='+oeuvre_id, zoom, 'resizable=yes,scrollbars=no,status=no,toolbar=no,width='+largfen+',height='+hautfen+',top='+topfen+',left='+leftfen);
	fenz.focus();
}
function openfull(oeuvre_id,larg,haut,fen) {
	if (larg<screen.width){
		largfen=larg;
		leftfen=Math.ceil(((screen.width-largfen)/2));
	}
	else{
		largfen=screen.width;
		leftfen=0;	
	}
	hautecran=screen.height-58;
	if (haut<hautecran){
		hautfen=haut;
		topfen=Math.ceil(((hautecran-haut)/2));	
	}
	else{
		hautfen=haut;
		topfen=0;			
	}	
	fenplein = window.open('../oeuvre/full.php?oeuvre_id='+oeuvre_id, fen, 'resizable=yes,scrollbars=no,status=yes,toolbar=no,width='+largfen+',height='+hautfen+',top='+topfen+',left='+leftfen);
	fenplein.focus();
}
var current;
var next;
$(document).ready(function() {
	$("#cadre_vignettes a").click(function() {
		next = $("div"+this.getAttribute("href",2));
		current.fadeOut(100, function() {
			current = next;
			current.fadeIn(100);
		});
		
		return false;
	});
});
$(document).ready(function() {
	$("div.not_nav a").click(function() {
		next = $("div"+this.getAttribute("href",2));
		current.fadeOut(100, function() {
			current = next;
			current.fadeIn(100);
		});
		return false;
	});
});

var current2;
var next2;
$(document).ready(function() {
	$("#l_etude a").click(function() {
		next2 = $("div"+this.getAttribute("href",2));
		switch (this.getAttribute("href",2)){
			case "#contexte": 
				document.getElementById("lk_contexte").className="actif";
				document.getElementById("lk_analyse").className="aclic";
				document.getElementById("lk_interpretation").className="aclic";
				break;
			case "#analyse":
				document.getElementById("lk_contexte").className="aclic";
				document.getElementById("lk_analyse").className="actif";
				document.getElementById("lk_interpretation").className="aclic";
				break;
			case "#interpretation":
				document.getElementById("lk_contexte").className="aclic";
				document.getElementById("lk_analyse").className="aclic";
				document.getElementById("lk_interpretation").className="actif";
				break;
				
		}
		current2.fadeOut(300, function() {
			current2 = next2;
			current2.fadeIn(300);
		});
		/*current2.hide(1, function() {
			current2 = next2;
			current2.show(1);
		});*/
		return false;
	});
});
$(document).ready(function() {
	$("#sommaire .l_som a").click(function() {
		//if ((this.getAttribute("href",2)=="#contexte")||(this.getAttribute("href",2)=="#analyse")||(this.getAttribute("href",2)=="#interpretation")){
			next2 = $("div"+this.getAttribute("href",2));
			switch (this.getAttribute("href",2)){
				case "#contexte": 
					document.getElementById("lk_contexte").className="actif";
					document.getElementById("lk_analyse").className="aclic";
					document.getElementById("lk_interpretation").className="aclic";
					break;
				case "#analyse":
					document.getElementById("lk_contexte").className="aclic";
					document.getElementById("lk_analyse").className="actif";
					document.getElementById("lk_interpretation").className="aclic";
					break;
				case "#interpretation":
					document.getElementById("lk_contexte").className="aclic";
					document.getElementById("lk_analyse").className="aclic";
					document.getElementById("lk_interpretation").className="actif";
					break;
					
			}
			current2.fadeOut(300, function() {
				current2 = next2;
				current2.fadeIn(300);
			});
			/*current2.hide(1, function() {
				current2 = next2;
				current2.show(1);
			});*/
		//}
		return false;
	});
	
});

function showall(){
	$("div.bl_notice").show();
	$("div.bl_txt").show();
}
function hideall(){
	$("div.bl_notice").hide(0);
	current.show();
	$("div.bl_txt").hide(0);
	current2.show();	
}

function imprimer(){
	if (navigator.appName=='Microsoft Internet Explorer'){
		var paragra=GetElementsWithClassName("p","etude_p");
		lg = paragra.length;
		for (i = 0; i < lg; i++)
			/*paragra[i].style.width=paragra[i].style.width=parseInt((document.getElementById("cadre_etude").offsetWidth-470)) + "px";	*/
			paragra[i].style.width=paragra[i].style.width="auto";
		//document.getElementById("blocs_texte").style.margin="0 0 0 20px";
		document.getElementById("contexte").style.clear="both";
	}
	showall();
	window.print();
	setTimeout("hideall()", 2000);
	if (navigator.appName=='Microsoft Internet Explorer'){
		lg = paragra.length;
		for (i = 0; i < lg; i++)
			paragra[i].style.width=parseInt((document.getElementById("cadre_etude").offsetWidth-320)) + "px";
		//document.getElementById("blocs_texte").style.margin="0";
		document.getElementById("contexte").style.clear="none";
	}
}