/*
			Fichier créé par Olivier LIGNY, alias @ntares, le 26/12/2002.
			Le fichier drag.js provient d'autre part.
			Modifié par H.A le 01/05/08

			Bibliothèque de fonctions permettant la gestion de fenêtres flottantes,
			c'est à dire de zones DIV contenant un élément IFRAME affichant une page.

*/




function CreateWin(name, title, src, width, height)
{
//var left=(screen.width-width-20);
var left=(document.body.clientWidth-width-20);
var top=(getWindowHeight()-height)/2;
//var left=(screen.width-width)/2;
//var top=(screen.height-height)/2;
var txt2write = "";
title = " "+title;
width = width + 5;
height = height +8;

txt2write += '<DIV heightinit='+height+' id=\"'+name+'\" \r\n'; 
txt2write += 'style=\"cursor: move; visibility: hidden; LEFT: '+left+'px; WIDTH: '+(width+10)+'px; POSITION: absolute; TOP: '+top+'px; HEIGHT: '+(height+20)+'px\">\r\n'; 
txt2write += '<TABLE id=\''+name+'_tab\' height=\"100%\" cellSpacing=0 cellPadding=0 width=\"100%\" align=center \r\n'; 
txt2write += 'background=\"\" border=0>\r\n'; 
txt2write += '  <TBODY>\r\n'; 
txt2write += '  <TR>\r\n'; 
txt2write += '    <TD background=Images/coin_hg.gif></TD>\r\n'; 
txt2write += '    <TD background=Images/top.gif height=6></TD>\r\n'; 
txt2write += '    <TD background=Images/coin_hd.gif></TD></TR>\r\n'; 
txt2write += '  <TR>\r\n'; 
txt2write += '    <TD width=6 background=Images/left.gif></TD>\r\n'; 
txt2write += '    <TD vAlign=top align=middle>\r\n'; 
txt2write += '\r\n'; 
txt2write += '          <TABLE cellSpacing=0 cellPadding=0 width=0 border=0 height=\"100%\">\r\n'; 
txt2write += '             <TBODY>\r\n'; 
txt2write += '             <TR>\r\n'; 
txt2write += '             <TD bgColor=#FFCC33 valign=top align=center height=20><FONT face=Verdana color=#0 size=6 >\r\n'; 
txt2write += '\r\n'; 
txt2write += '    		     <TABLE cellSpacing=0 cellPadding=0 width=\"100%\" border=0 height=20>\r\n'; 
txt2write += '      		        <TBODY>\r\n'; 
txt2write += '    	            <TR>\r\n'; 
txt2write += '   	 	            <TD align=left height=4><FONT color=#0 size=4 >&nbsp;<strong>'+title+'</strong> \r\n'; 
txt2write += '    	            </FONT></TD>\r\n'; 
txt2write += '    	            <TD vAlign=center align=right> \r\n';   		        
txt2write += '    	            <a href="#"> \r\n'; 
txt2write += '    	            <IMG \r\n'; 
txt2write += '    		        src=\"Images/fermeture.gif\" alt=\"Fermer la fenêtre\" hspace=0 border=0 onclick=\"cache(\''+name+'\')\" ></TD></TR>\r\n'; 
txt2write += '		         </TBODY></TABLE>\r\n'; 
txt2write += '\r\n'; 
txt2write += '			</FONT></TD></TR>\r\n'; 
txt2write += '        	<TR>\r\n'; 
txt2write += '       	    <TD background=Images/sep.gif height=3></TD></TR>\r\n'; 
txt2write += '       		 <TR>\r\n'; 
txt2write += '            <TD vAlign=top align=middle><IFRAME \r\n'; 
txt2write += '            style=\"HEIGHT:'+height+'px;WIDTH:'+width+'px; BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px\" align=left\r\n'; 
txt2write += '            name=ifrm_'+name+' src=\"'+src+'\" width=\"100%\" heightinit='+(height-18)+' ></IFRAME>\r\n'; 
txt2write += '            </TD></TR>\r\n'; 
txt2write += '        </TBODY></TABLE>\r\n'; 
txt2write += '\r\n'; 
txt2write += '    </TD>\r\n'; 
txt2write += '    <TD width=6 background=Images/right.gif></TD></TR>\r\n'; 
txt2write += '    <TR>\r\n'; 
txt2write += '    <TD background=Images/coin_bg.gif></TD>\r\n'; 
txt2write += '    <TD background=Images/bottom.gif height=6></TD>\r\n'; 
txt2write += '    <TD background=Images/coin_bd.gif></TD></TR>\r\n'; 
txt2write += '\r\n'; 
txt2write += '</TBODY></TABLE>\r\n'; 
txt2write += '\r\n'; 
txt2write += '</DIV>\r\n'; 

document.write(txt2write);
//new dragElement(name);

return false;

}
function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
/*    if (navigator.appName=="Microsoft Internet Explorer") { 
    object.filter = "alpha(opacity=" + opacity + ")";
	}*/
}

function DestroyWin(name)
{
	if ( document.getElementById && document.getElementById(name) != null )
	{
		document.getElementById(name).style.visibility = "hidden";
		document.getElementById(name).innerHTML = "";
		document.getElementById(name).id = "deleted_"+parseInt(Math.random()*10000); 
	}
  	return false;
}

function cache(name)
{
	if ( document.getElementById && document.getElementById(name) != null )
	{
		document.getElementById(name).style.visibility = "hidden";
		changeOpac(100, 'container')	}
}

function visible(name)
{
	if ( document.getElementById && document.getElementById(name) != null )
	{
		if (fen != "") {cache(fen);	}
		changeOpac(70, 'container')
		document.getElementById(name).style.visibility = "visible";
		fen=name;
	}
}

