/*Admin View*/
var enabled;
enabled=false;
document.onkeydown = adminView
function adminView(e) {
	var keycode;
	var allH6 = document.getElementsByTagName("h6");
	if (window.event)keycode = window.event.keyCode; /*windows*/
	else if (e) keycode = e.which; /*firefox*/
	if (keycode==123 && enabled == false ) 
	{
		for (var i = 0; i < allH6.length; i++)
			allH6[i].className = "adminViewTrue";
		enabled = true;
	}
	else if (keycode==123 && enabled == true) 
	{
		for (var i = 0; i < allH6.length; i++)
			allH6[i].className = "adminViewFalse";
		enabled = false;
	}
}

/*Montrer ou cacher un objet*/
function showHideObject(myId) {
	var myObject = document.getElementById(myId);
	myObject.className = myObject.className == "hideMe" ? "showMe" : "hideMe";
}

/*Montrer ou cacher deux objets*/
function showHideObjects(myId, myId1) {
	var myObject = document.getElementById(myId);
	var myObject1 = document.getElementById(myId1);
	myObject.className = myObject.className == "hideMe" ? "showMe" : "hideMe";
	myObject1.className = myObject1.className == "hideMe" ? "showMe" : "hideMe";
}


/*Ticker*/
function startTicker()
{
	theCurrentStory     = -1;
	theCurrentLength    = 0;
	
	if (document.getElementById) {	
		theAnchorObject     = document.getElementById("previsions");
		runTheTicker();   	
	}
	else {
		document.write("<style>#prevision{display:none;}</style>");
		return true;
	}
}

function runTheTicker()
{
	var myTimeout;  
	
	if(theCurrentLength == 0)
	{
		if(theSummaries.length == (theCurrentStory + 1) ){
			theCurrentStory=0;
		}else{
			theCurrentStory++;
		}
		theCurrentStory      = theCurrentStory % theItemCount;
		theStorySummary      = theSummaries[theCurrentStory].replace(/&quot;/g,'"');
	}
	
	theAnchorObject.innerHTML = theStorySummary.substring(0,theCurrentLength) + whatWidget();
	
	if(theCurrentLength != theStorySummary.length)
	{
		theCurrentLength++;
		myTimeout = theCharacterTimeout;
	}
	else
	{
		theCurrentLength = 0;
		myTimeout = theStoryTimeout;
	}
	
	setTimeout("runTheTicker()", myTimeout);
	}
	
	function whatWidget()
	{
	if(theCurrentLength == theStorySummary.length)
	{
		return theWidgetNone;
	}
	
	if((theCurrentLength % 2) == 1)
	{
		return theWidgetOne;
	}
	else
	{
		return theWidgetTwo;
	}
}
var theCharacterTimeout = 25;
var theStoryTimeout     = 4000;
var theWidgetOne        = "_";
var theWidgetTwo        = "-";
var theWidgetNone       = "";
var theSummaries = new Array();

// Popup
var intCount = 0;

            //-Fonction d'ajout d'entrées principales-------------------------
            function DynamicMenu_addParent(strName) {
                var strID = 'P_' + strName; 
                var strTemp = '<DIV ID="' + strID + '" CLASS="parent"';
                strTemp += ' onClick="expandCollapse(this);">';
                strTemp += '<IMG SRC="left.gif" Height="12">';
                strTemp += '&nbsp;' + strName;
                strTemp += '<DIV STYLE="display: none" CLASS="child"></DIV>';
                strTemp += '</DIV>';

                this.div.innerHTML += strTemp;
                this.currentChild = document.getElementById(strID);
            }

            //-Fonction d'ajout des sous entrées principales-------------------------
            function DynamicMenu_addSousParent(strName) {
                var strID = 'S_' + strName; 
                var strTemp = '<DIV ID="' + strID + '" CLASS="parent"';
                strTemp += ' onClick="expandCollapse(this);">';
                strTemp += '<IMG SRC="left.gif" Height="12">';
                strTemp += '&nbsp;' + strName;
                strTemp += '<DIV STYLE="display: none" CLASS="child"></DIV>';
                strTemp += '</DIV>';

                if (document.all) {
                    this.currentChild.children[1].innerHTML += strTemp;
                } else {
                    this.currentChild.childNodes[2].innerHTML += strTemp;
                }

                this.currentChild = document.getElementById(strID);
            }

            //-Fonction d'ajout de liens dans le menu-------------------------
            function DynamicMenu_addChild(strName,strURL) {
                var strTemp = '<A HREF="' + strURL + '"'
                            + ' onClick="cancelBubble(arguments[0]);">' 
                            + strName + '</A><BR>';

                if (document.all) {
                    this.currentChild.children[1].innerHTML += strTemp;
                } else {
                    this.currentChild.childNodes[2].innerHTML += strTemp;
                }
            }

            //-inhibe la cascade d'évènements au DIV conteneur----------------
            function cancelBubble(netEvent) {
                if (document.all) {
                    window.event.cancelBubble = true;
                } else {
                    netEvent.cancelBubble = true;
                }
            }

            //-Contracte ou expanse le menu-----------------------------------
            function expandCollapse(objElement) {

				var strId = objElement.id;
				if (intCount == 0) {
	                if (document.all) {
	                    var imgIcon = objElement.children[0];
	                    objElement = objElement.children[1];
	                } else {
	                    var imgIcon = objElement.childNodes[0];
	                    objElement = objElement.childNodes[2];
	                }    
	
	                if (objElement.style.display == "none") {  
	                    objElement.style.display = "block" ;
	                    imgIcon.src = "bottom.gif" ;
	                } else {
	                    objElement.style.display = "none" ;
	                    imgIcon.src = "left.gif" ;
	                }
				}

				if (strId.substring(0,1) == 'S') {
					intCount = 1;
				}

				if (strId.substring(0,1) == 'P' && intCount == 1) {
					intCount = 0;
				}
            }

            //-Fonction de création de menu dynamique------------------------- 
            function DynamicMenu(strName) {
                //var id = "Menu" + intCount++;
                var id = strName;
                document.write('<DIV Id="' + id + '"></DIV>');

                this.div = document.getElementById(id);
                this.currentChild = null;

                this.addParent = DynamicMenu_addParent;
                this.addSousParent = DynamicMenu_addSousParent;
                this.addChild = DynamicMenu_addChild;
}

/*Popup Image*/
function affichage_popup(nom_de_la_page, nom_interne_de_la_fenetre)
{
window.open (nom_de_la_page, nom_interne_de_la_fenetre, config='height=280, width=380, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, directories=no, status=no')
}
