// Bibliothèque de scripts - SIPROTEC 


//****************************************************************
// Affichage des sous-menus 
//****************************************************************

sfHover = function() {
	if (document.getElementById('left-col'))
		{
		var sfEls = document.getElementById('left-col').getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" sfhover";
			}
			sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
			}
		}
		}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);


//****************************************************************
// Affichage des libellés de la boîte à outils 
//****************************************************************

sfHover = function() {
        if (document.getElementById('tools'))
                {
                var sfEls = document.getElementById('tools').getElementsByTagName("LI");
                for (var i=0; i<sfEls.length; i++) {
                        sfEls[i].onmouseover=function() {
                                this.className+=" sfhover";
                        }
                        sfEls[i].onmouseout=function() {
                        this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
                        }
                }
                }
}
if (window.attachEvent) window.attachEvent("onload", sfHover);


//****************************************************************
// Fonction d'import des animations Flash 
//****************************************************************

function RunFlash(swf, hauteur, largeur, nom) {
	document.write("<object width=\""+largeur+"\" height=\""+hauteur+"\" id=\""+nom+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\">\n");
	document.write("<param name=\"quality\" value=\"high\">\n");
	document.write("<param name=\"wmode\" value=\"transparent\">\n");
	document.write("<param name=\"movie\" value=\""+swf+"\">\n");
	document.write("<embed src=\""+swf+"\" quality=\"high\" wmode=\"transparent\" width=\""+largeur+"\" height=\""+hauteur+"\" name=\""+nom+"\" align=\"middle\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\">\n");
	document.write("</object>\n");
}


//****************************************************************
// Fonction gérant les styles des liens non HTML 
//****************************************************************
function fileLinks() {
    var fileLink;
    if (document.getElementsByTagName('a')) {
        for (var i = 0; (fileLink = document.getElementsByTagName('a')[i]); i++) {
            if (fileLink.href.indexOf('.pdf') != -1) {
                fileLink.setAttribute('target', '_blank');
                fileLink.className = 'pdf';
            }
        }
    }
}
window.onload = function() {
    fileLinks();
}


//****************************************************************
// Affichage des POPUP 
//****************************************************************

function funcPopup(varUrl, varWidth, varHeight, varResize)
	{
	var ScreenW = screen.availWidth;
	var ScreenH = screen.availHeight;
	var WinPopUp = window.open(varUrl, 'popup', "toolbar=no, menubar=no, scrollbars=yes, resizable=" + varResize + ", location=no, directories=no, status=no, width=" + varWidth + ", height=" + varHeight);
	WinPopUp.moveTo(Math.round((ScreenW-varWidth)/2), Math.round((ScreenH-varHeight)/2));	
	}

