// JavaScript Document by Yvan Daneault
//pefel will not read this file unless it is called in html by script tag with src to this file
//http://pefel.com/index/theme/chameleon/scripts.js or dhceu.org
//hides the button if user did not click it 
top.document.getElementById('haut').style.display = 'none'; //hides the button
//sets the mask height when a page is loaded in the iframe m
function resizeMask(hauteur) {
	parent.document.getElementById('mask').style.height=hauteur;
}
//deprecated
function popup(url) {
	window.open(url, "win","width=736,height=520,menubar=0,scrollbars=0,location=0,resizable=0,status=0,toolbar=0,directories=0","true");
}
// Firefox 3 no longer allows authors to remove resizable grippy and toolbars!!!
// They prefer to let the user decide
function popup2(url, width, height) {
	var opt = "width=" + width + ",height=" + height + ",menubar=0,scrollbars=0,location=0,resizable=0,status=0,toolbar=0,directories=0,locationbar=0,personalbar=0,statusbar=0";
	window.open(url,"win",opt,"true");
}

//scripting for expandable/collapsable content in documentation
var lastid; //stores last id that was expanded
var lastid2; //stores last h1 id that has its bg image pointing down
function perm(id,id2) { //called by the h1 being clicked
	if(document.getElementById(id).style.display=='block') {
	document.getElementById(id).style.display = 'none';
	document.getElementById(id2).style.backgroundImage='url(../collap.png)';
	self.scrollTo(0,0); //scrolls to top of page in iframe m
	} else {
		if(lastid) { //si le lastid existe dans le html
		document.getElementById(lastid).style.display = 'none';
		}
		if(lastid2) { //idem
			document.getElementById(lastid2).style.backgroundImage='url(../collap.png)';
		}
		document.getElementById(id).style.display = 'block';
		self.location='#' + id2; //brings selected title to top of iframe m
		parent.document.getElementById('haut').style.display = 'block'; //displays button
		document.getElementById(id2).style.backgroundImage='url(../expand.png)';
		lastid=id; //stores the expanded content id to lastid for next call
		lastid2=id2; //idem
		parent.document.getElementById('q1').value=lastid; //store lastid in topframe hidden field
		parent.document.getElementById('q2').value=lastid2;//idem
		}
} //closes perm()
//invoked by a click of haut de page button that resides in the TOP FRAME
function hautpage() {
	lastid=document.getElementById('q1').value;//gets back lastid from hidden field
	//alert(lastid); //does work
	lastid2=document.getElementById('q2').value; //idem
	m.scrollTo(0,0); //scroll to top of page in iframe
	window.scrollTo(0,0); //scroll to top of main window
	document.getElementById('haut').style.display = 'none'; //hides the button
	//the following must specify to find lastid in m window or it will not work
	m.document.getElementById(lastid).style.display = 'none';//cache le div etendu
	m.document.getElementById(lastid2).style.backgroundImage='url(../collap.png)';
}
