var nmbTextLayers = 30;
var i,old_txt_id='pic0';
var old_id_pub='mainpub';
var xml_on_off = 1; /* 0: XML page not in viwing area, 1: xml page in viewing area */


/**************************************************************************************************
*** Function: test_iframe(iframe_id,for_source)							***
*** Ant:  iframe 'id' exists.			  						***
***  	  											***
*** Cons: The SRC of the iframe is set to for_source (texte_list.xml here) if xml_on_off        ***
***       value is 0.										***
***	  							                                ***
*** Uses: set_iframe_src(iframe_id,new_source) 							***
*** Var:  iframe_ id: Id of iframe to have it's 'src' property set to texte_list.xml		***
***    	  xml_on_off: sentinel for whether the viewing area conains the interpreted XML or not	***
***												***
**************************************************************************************************/

function test_iframe(iframe_id, for_source){
		if (xml_on_off==0){ 
			set_iframe_src(iframe_id,for_source);
			
		}
}

/**************************************************************************************************
*** Function: set_iframe_src(iframe_id,new_source)						***
*** Ant:  iframe 'id' exists.  									***
*** 	  new_source must be a valid source file or URL						***
***  	  											***
*** Cons: The xml_on_off sentinel is set to 1 if new_source is the texte_list.xml file 		***
***	  The SRC of the iframe is now the value of new_source  				***
*** 	  The content in the display area is the new SRC of the iframe				***
*** Uses: 											***
*** Var: 											***
***	iframe_ id: Id of iframe to have it's 'src' property set to the value of new_source	***
***	new_source: Valid path to a file or URL to be displayed in the iframe			***
***											        ***
**************************************************************************************************/
function set_iframe_src(iframe_id,new_source){
	new_source =="texte_list.xml"?xml_on_off=1:xml_on_off=0;
	document.getElementById(iframe_id).src= new_source;
	return true;
}

/**************************************************************************************************
*** Function: show_txt(id)									***
*** Ant:  Element 'id' exists.  								***
*** 	  The 'visibility property value of the element 'id' is 'visible'			***
***  	  The content of the element may be visible in a display area.				***
*** Cons: The 'visibility' property of the previously display element is set to 'hidden'        ***
***	  The 'visibility' property of the element 'id' is set to 'visible'       		***
*** 	  The content in the display area is hidden and replaced by the contents of element 'id'***
***	  The id of the new element is memorized for futur use.                                 ***
*** Uses: hide(id)										***
*** Var: 											***
***	id: Id of element required to have it's 'visibility' property set to visible		***
***	old_txt_id: Initialy set to "texte0" when page page loads.					***
***		Set to the id of the new element displayed                                    	***
***											        ***
**************************************************************************************************/
function show_txt(id) {/*
if (document.layers) { return; }
	hide(old_txt_id);
	window.document.getElementById(id).style.visibility = 'visible';
	old_txt_id=id
*/
window.document.getElementById("frame").innerHTML='<center><img src="images/' +id+ '.jpg" border=0></center>';

}



/**************************************************************************************************
*** Function: show_pub(id)										***
*** Ant:  Element 'id' exists.  								***
*** 	  The 'visibility property value of the element 'id' is 'visible'			***
***  	  The content of the element may be visible in a display area.				***
*** Cons: The 'visibility' property of the previously display element is set to 'hidden'        ***
***	  The 'visibility' property of the element 'id' is set to 'visible'       		***
*** 	  The content in the display area is hidden and replaced by the contents of element 'id'***
***	  The id of the new element is memorized for futur use.                                 ***
*** Uses: hide(id)										***
*** Var: 											***
***	id: Id of element required to have it's 'visibility' property set to visible		***
***	old_id_pub: Initialy set to "mainpub" when page page loads.					***
***		Set to the id of the new element displayed                                    	***
***											        ***
**************************************************************************************************/
function show_pub(id) {
if (document.layers) { return; }
	hide(old_id_pub);
	document.getElementById(id).style.visibility = 'visible';
	old_id_pub=id;
}

/****************************************************************************************************
*** Function: hideAllFrom(textNo1, to_textNo2)							  ***
*** Ant:  Elements 'textNo1'..'to_textNo2' exist.						  ***
***	  The 'visibility property value of elements 'textNo1'..'to_textNo2' may be 'visible'	  ***
***	  The contents of elements 'textNo1'..'to_textNo2' may be vsisble in some display area	  ***
*** Cons: The 'visibility' property of each element, 'textNo1'..'to_textNo2', is set to 'hidden'  ***
***	  The contents of the elements, 'textNo1'..'to_textNo2', are hidden			  ***	  
*** Uses: hide(id)										  ***
*** Var: 											  ***
***	textNo1: Id of first element in list of elements to set 'visibility' property to hidden   ***
***	to_textNo2: Id of last element in list of elements to set 'visibility' property to hidden ***
***											          ***
*** Ex: hideAllFrom(1,14); will hide all from texte1 to texte14					  ***
*****************************************************************************************************/
function hideAllFrom(picNo1, picNo2) {
	i = picNo1;
	while (i <= picNo2  && i < nmbTextLayers)
	{
	
		id = 'pic'+i;
		i++;
		hide(id);
	}

} 

/**************************************************************************************************
*** Function: hide(id)										***
*** Ant:  Element 'id' exists.									***
***	  The 'visibility property value of the element 'id' is 'visible'				***
***  	  The content of the element may be visible in a display area.				***
*** Cons: The 'visibility' property of the element 'id' is set to 'hidden'   		        ***
*** 	  The content in the display area is hidden						***
*** Uses:											***
*** Var: 											***
***	id: Id of element required to have it's 'visibility' property set to hidden		***
***											        ***
**************************************************************************************************/
function hide(id) {
if (document.layers) { return; }
	document.getElementById(id).style.visibility = 'hidden';
}

/**************************************************************************************************
*** Function: hide_txt_pub()									***
*** Ant:  Variables 'old_txt_id' and 'old_id_pub' contain exsiting element ids.			***
***	  The 'visibility property value of each element is 'visible'				***
***  	  The content of the elements may be visible in a display area.				***
*** Cons: The 'visibility' properties of the elements are set to 'hidden'  		        ***
*** 	  The contents in the display areas are hidden						***
*** Uses:											***
*** Var: 											***
***	old_txt_id, old_id_pub: Element ids required to have their 'visibility' set to hidden	***
***											        ***
**************************************************************************************************/
function hide_active_pub() {
if (document.layers) { return; }
	document.getElementById(old_id_pub).style.visibility = 'hidden';
}


/**************************************************************************************************
*** Function: changeCls(elmntId,class_name)							***
*** Ant:  The element 'elmntId' exists.								***
***  	  The class 'class_name' exists.							***
*** Cons: 'className' property value of element 'elmntId' is set to the value of 'class_name'   ***
*** Uses: hide(id)										***
*** Var: 											***
***	elmntId: Id of element required to have it's 'className' property changed		***
***	class_name: Value of 'className' property to set for element 'elmlntId'                 ***
***											        ***
**************************************************************************************************/
function changeCls(elmntId,class_name) {
//if (document.all)

document.getElementById(elmntId).className = class_name;
}

/**************************************************************************************************
*** Function: changeBg(elmntId,urlImage)							***
*** Ant:  The element 'elmntId' exists.								***
***  	  The images 'urlImage' exists where specified.						***
*** Cons: 'backgroundImage' property value of element 'elmntId' style is set to the value       ***
***        of 'urlImage'   									***
*** Uses: hide(id)										***
*** Var: 											***
***	elmntId: Id of element required to have it's 'className' property changed		***
***	urlImage: Value of 'backgroundImage property to set for element 'elmlntId' style        ***
***		  It must be of the form: 'url(imageName)'				        ***
***											        ***
**************************************************************************************************/
function changeBg(elmntId,urlImage) {
//if (document.all)
document.getElementById(elmntId).style.backgroundImage = urlImage;
}



