/**
 * Bibliothéque Javascript de element
 *
 * @version (voir sicrij.element.php)
 * @package sicrij
 * @access public
 * @author CRIJ Poitou-Charentes
 * @licence GNU Public Licence
 */

// Champ de saisie ////////////////////////////////////////////////////////////////////
function element_champ_focus(elm, autoclean) { if(elm.value==autoclean) elm.value=''; }
function element_champ_blur(elm, autoclean)  { if(!elm.value && autoclean) elm.value=autoclean; }

// Changement de taille du contenu ////////////////////////////////////////////////////
/*
MyRichText=new Object();
for(var tag in RichText) MyRichText[tag]=RichText[tag].concat();

function AccessFontAugmente()
{
   for (var tag in MyRichText)
      if(MyRichText[tag][0]<RichText[tag][0]+18) MyRichText[tag][0]+=6;
	  
   AccessFontUpdate();
}

function AccessFontDiminue()
{
   for (var tag in MyRichText)
      if(MyRichText[tag][0]>RichText[tag][0]) MyRichText[tag][0]-=6;
	  
   AccessFontUpdate();
}

function AccessFontUpdate()
{
   var BaliseValide="P H1 H2 H3 H4 H5 H6 LI A STRONG EM U B I TD OPTION INS BLOCKQUOTE ADDRESS ABBR ACRONYM CITE CODE DFN Q SAMP PRE";	
   var elm=document.getElementById('contenu').getElementsByTagName('*');
   
   for(nb=0; nb<elm.length; nb++)
	  if(BaliseValide.search(elm[nb].tagName)>-1)
		  elm[nb].style.fontSize=(MyRichText[elm[nb].tagName])?MyRichText[elm[nb].tagName][0]+'px':elm[nb].style.fontSize=MyRichText['P'][0]+'px';
}
*/

// Affiche le calque d'assombrissement d'écran /////////////////////
function Assombrissement(etat)
{
   var objBG, bodyheight, winheight, frame;

   var cumulFrame=new Array();

   for(i=0; i<parent.frames.length; i++) { cumulFrame.push(parent.frames[i].document); }

   for(key in cumulFrame)
   { 
      if(!cumulFrame.hasOwnProperty(key)) continue;
	  frame=cumulFrame[key];  
      objBG=frame.getElementById('element_assombrissement'); 

      if(!objBG)
      {
	     objBG=frame.createElement('DIV');
	     objBG.id='element_assombrissement';
	     frame.body.appendChild(objBG);
      }
	  
	  if(etat=='visible')
	  {
	     bodyheight=(frame.innerHeight || frame.body.clientHeight)+(bw.ie?30:0);
	     winheight=frame.documentElement.clientHeight;
		 
         objBG.style.height=((bodyheight>winheight)?bodyheight:winheight)+'px';
         	
	  } else objBG.style.height='0px';

	  objBG.style.visibility=etat;
   }
}

// Gestion des fenêtres calques ////////////////////////
function CloseWindow(id)
{
   if(typeof(id)=='undefined') { id='window'; }
   var winelm=$(id).style;

   Assombrissement('hidden');
   winelm.visibility='hidden';
   winelm.position='absolute';
}

function OpenWindow(title, id)
{
   if(typeof(id)=='undefined') { id='window'; }
   var winelm=$(id).style;

   if(title) $(id+'_title').innerHTML=title;

   Assombrissement('visible');
   
   winelm.visibility='visible';
   if(!(bw.ie && bw.ver<7)) { winelm.position='fixed'; }
}
