// JavaScript Document
/*
 * popup
 * tpl_publication : ouvre le pageflip en popup
 *
 */
function popup(page) {
	// ouvre une fenetre sans barre d'etat, ni d'ascenceur
	w = 820;
	h	= 620;
	var top=(screen.height-h)/2;
	var left=(screen.width-w)/2;
	myPopup = window.open(page,'popup','top='+top+', left='+left+', width='+w+', height='+h+', scrollbars=yes');	
	myPopup.focus();
}
/*
 * popup
 * tpl_publication : ouvre le pageflip en popup
 *
 */
function montre(id) {
	var a = document.getElementById('smenu'+id);
	//alert(document.getElementById('smenu_edition').style.width);
	for (var i = 1; i<=3; i++) {
		document.getElementById('smenu'+i).style.display = (i == id) ? 'block' : 'none';
	}
}
function page(id) {
	var a = document.getElementById('page'+id);
	var b = document.getElementById('b'+id);
	var c = document.getElementById('nav');
	
	for (var i = 1; i<=3; i++) {
		document.getElementById('page'+i).style.display = (i == id) ? 'block' : 'none';
		if(document.images['b'+i]){
			document.images['b'+i].src = (i == id) ? 'image/b'+i+'-on.gif' : 'image/b'+i+'-off.gif';
		}
	}
	if(c){
		c.style.display = (id != 2) ? 'block' : 'none';
	}
	if(id <= 2){
		//alert(id);
		var d1 = document.getElementById('butt1');
		var d2 = document.getElementById('butt2');
		d1.style.display = (id == 2) ? 'block' : 'none';
		d2.style.display = (id == 1) ? 'block' : 'none';
	}
}

function swapdesc(id, titre, desc) {
	var a = document.getElementById(titre+id);
	var b = document.getElementById(desc+id);
	for (var i = 1; i<=4; i++) {
		if (document.getElementById(desc+i) && i!=id) {document.getElementById(desc+i).style.display='none';}
		if (document.getElementById(titre+i) && i!=id) {document.getElementById(titre+i).className='';}
	}
	if (b) {
		a.className = 'active';
		b.style.display = 'block';
	}
}
function swapimg(id, bool) {
	if(bool == 'off'){
		var p = document.getElementById('page'+id);
		if(!p || p.style.display == 'none'){
			document.images['b'+id].src = 'image/b'+id+'-off.gif';
		}
	}
	else{
		document.images['b'+id].src = 'image/b'+id+'-on.gif';
	}
}
/*
function getDivWidth(mydiv, myitem, n, scrollerdiv){
	var w = 0;
	for(var i=1 ; i<=n ; i++){
		w += document.getElementById(myitem+i).offsetWidth;
	}
	document.getElementById(mydiv).style.width = w + "px";
	
	if(w > 560){
		document.getElementById(scrollerdiv).style.display = 'block';
	}
}
function cache(){
	for(var i = 1 ; i<= 3 ; i++){
		a = document.getElementById('smenu'+i);
		a.style.display = 'none';
	}
}

function init(){
	cache();
	//scroll collection niveau 2 
	//scroll collection niveau 3
}
function rollRetour(str){
	alert(str);
	document.images['bk'].src='image/retour-'+str+'.gif';
}
function siwtchDisplay(div1, div2) {
	var a = document.getElementById(div1);
	var b = document.getElementById(div2);
	var c = document.images['buttvid'];
	if (a) {
		a.style.display = (a.style.display == 'block') ? 'none' : 'block';
	}
	if (b) {
		b.style.display = (b.style.display == 'none') ? 'block' : 'none';
	}
		document.images['buttvid'].src = (a.style.display == 'none') ?'image/bt_videoback.png' : 'image/bt_video.png';
}
*/

