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

			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.

			Utilisez MinimizeWin(nom) pour réduire une fenêtre,
			et DestroyWin(nom) pour fermer une fenêtre.
*/


function CreateWin(name, title, src, width, height, left, top)
{
left=Math.max(Math.round((document.body.offsetWidth-width)/2),0);
top=Math.max(Math.round((document.body.offsetHeight-height)/2),0);
var txt2write = "";

txt2write += '<DIV heightinit='+height+' id=\"ae_'+name+'\" '; 
txt2write += 'style=\"LEFT: '+left+'px; WIDTH: '+width+'px; POSITION: absolute; TOP: '+top+'px; ZHEIGHT: '+(height+20)+'px\">'; 
txt2write += '<TABLE id=\''+name+'_tab\' height=\"100%\" cellSpacing=0 cellPadding=0 width=\"100%\" align=center '; 
txt2write += 'background=\"\" border=0>'; 
txt2write += '<TBODY>'; 
txt2write += '  <TR>'; 
txt2write += '    <TD background=\"/commun/img/coin_hg.gif\"></TD>'; 
txt2write += '    <TD background=\"/commun/img/top.gif\" height=6></TD>'; 
txt2write += '    <TD background=\"/commun/img/coin_hd.gif\"></TD></TR>'; 
txt2write += '  <TR>'; 
txt2write += '    <TD width=6 background=\"/commun/img/left.gif\"></TD>'; 
txt2write += '    <TD vAlign=top align=middle>'; 
txt2write += ''; 
txt2write += '          <TABLE cellSpacing=0 cellPadding=0 width=0 border=0 Zheight=\"100%\">'; 
txt2write += '             <TBODY>'; 
txt2write += '             <TR>'; 
txt2write += '             <TD bgColor=#003366 valign=top align=center height=20><FONT face=Verdana color=#ffffff size=2>'; 
txt2write += ''; 
txt2write += '    		     <TABLE cellSpacing=0 cellPadding=0 width=\"100%\" border=0 height=20>'; 
txt2write += '      		        <TBODY>'; 
txt2write += '    	            <TR>'; 
txt2write += '   	 	            <TD align=left height=4><FONT color=#ffffff size=2>&nbsp;'+title+' '; 
txt2write += '    	            </FONT></TD>'; 
txt2write += '    	            <TD vAlign=center align=right><!--<IMG '; 
txt2write += '    		        src=\"/commun/img/minim.gif\" alt=\"Minimiser/Restaurer la fenêtre\" width=13 height=13 border=0 onclick=\"MinimizeWin(\''+name+'\')\" style=\"cursor: hand;\">-->'; 
txt2write += '    	            <IMG '; 
txt2write += '    		        src=\"/commun/img/fermeture.gif\" alt=\"Fermer la fenêtre\"  border=0 onclick=\"DestroyWin(\''+name+'\');\" style=\"cursor: pointer;\"></TD></TR>'; 
txt2write += '		         </TBODY></TABLE>'; 
txt2write += ''; 
txt2write += '			</FONT></TD></TR>'; 
txt2write += '        	<TR>'; 
txt2write += '       	    <TD background=\"/commun/img/sep.gif\" height=3></TD></TR>'; 
txt2write += '       		 <TR>'; 
txt2write += '            <TD vAlign=top align=middle><IFRAME '; 
txt2write += '            style=\"HEIGHT:'+height+'px; WIDTH:'+(width-10)+'px; BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px\" '; 
txt2write += '            name=ifrm_'+name+' src=\"'+src+'\" width=\"100%\" heightinit='+(height-18)+' ></IFRAME>'; 
txt2write += '            </TD></TR>'; 
txt2write += '        </TBODY></TABLE>'; 
txt2write += ''; 
txt2write += '    </TD>'; 
txt2write += '    <TD width=6 background=\"/commun/img/right.gif"></TD></TR>'; 
txt2write += '    <TR>'; 
txt2write += '    <TD background=\"/commun/img/coin_bg.gif\"></TD>'; 
txt2write += '    <TD background=\"/commun/img/bottom.gif\" height=6></TD>'; 
txt2write += '    <TD background=\"/commun/img/coin_bd.gif\"></TD></TR>'; 
txt2write += ''; 
txt2write += '</TBODY></TABLE>'; 
txt2write += ''; 
txt2write += '</DIV>'; 


ajouterDHTML(txt2write);

}


function ajouterDHTML(dhtml){
obj=document.createElement('DIV');
obj.id='WIN';
obj.innerHTML=dhtml;
document.body.appendChild(obj);
//document.body.innerHTML += dhtml;
}


function DestroyWin()
{ 
  document.body.removeChild(document.getElementById("WIN"),true);	
  // document.getElementById("ae_"+name).style.visibility = "hidden";
  // document.getElementById("ae_"+name).innerHTML = "";
  // document.getElementById("ae_"+name).id = "deleted_"+parseInt(Math.random()*10000);
  // return false;
}

function DestroyWiniframe(name)
{ 
  parent.document.getElementById("ae_"+name).style.visibility = "hidden";
  parent.document.getElementById("ae_"+name).innerHTML = "";
  parent.document.getElementById("ae_"+name).id = "deleted_"+parseInt(Math.random()*10000);
  return false;
}
