/* 

DOCSOURCING 2008 | © DELTA WEB http://www.delta-web.com



*/
/* --------------------------------------------------------------
   
   Actions
   
   --------------------------------------------------------------
*/
function initHide(id)
{
	document.getElementById(id).style.display = "none";
}

/*
hideId = "";

function hideShow(id)
{
	document.getElementById(id).style.display = "block";
	if(hideId)
	{
		document.getElementById(hideId).style.display = "none";
	}
	if(hideId != id)
	{
		hideId = id;
	} 
	else {
		hideId = "";
	}
}
*/

function ow (url)
{
	window.open(url);
}

function hide(id)
{
	document.getElementById(id).style.display = "none";
}

function show(id)
{
	document.getElementById(id).style.display = "block";
}

hideId = "";
oldId = "";
function hideShow(id)
{
	if(id!=oldId)
	{
		document.getElementById(id).style.display = "block";
		//document.getElementById(id).style.height = 0+"px";
		if(hideId)
		{
			document.getElementById(hideId).style.display = "none";
		}
		if(hideId != id)
		{
			hideId = id;
		} else {
			hideId = "";
		}
		oldId = id;
	}
}

function setHeightActionInit()
{
	H = 0;
	//H_DEST = document.getElementById(targetActionHeight).offsetHeight;
}
function setHeightAction()
{
	var paddingEle = 0;
	if(Math.round(H)<(H_DEST-(paddingEle+2)))
	{
		H += Math.round(((H_DEST-paddingEle)-H)/5);
		document.getElementById(targetActionHeight).style.height = H+"px";
		actionHeightBoucle = setTimeout(setHeightAction,1);
	} else {
		document.getElementById(targetActionHeight).style.height = H_DEST-paddingEle+"px";
	}
}
function heightAction(id)
{
	targetActionHeight = id;
	setTimeout(setHeightActionInit,100);
	setTimeout(setHeightAction,200);
}

function rollMenu (ele,subMenu,id)
{
	ele.onmouseover = function()
	{
		//hideShow(subMenu);
		nb_bt = tab_lib[id][1].length
		H_DEST = nb_bt*22; //document.getElementById(subMenu).offsetHeight;
		//heightAction(subMenu);
	}
}

function mymailto (nom,dom,lib)
{
	document.write("<a href='mailto:"+nom+"@"+dom+"'>"+lib+"</a>");
}

/* --------------------------------------------------------------
   
   Display
   
   --------------------------------------------------------------
*/

function writeNav (selectItem)
{
	var nb_bt = tab_nav.length;
	var listNav = "";
	for(i=0;i<nb_bt;i++)
	{
		if(i!=6)
		{
			if(i!=selectItem)
			{
				listNav = listNav+"<li><a href="+traceur+tab_nav[i]+">"+tab_lib[i]+"</a></li>";
			} else {
				listNav = listNav+"<li class='selected'><a href="+traceur+tab_nav[i]+">"+tab_lib[i]+"</a></li>";
			}
		}
		
		if(i==6)
		{
			listNav = listNav+"<li><a href='"+tab_nav[i]+"' onclick='ow(\""+tab_nav[i]+"\");return false;'>"+tab_lib[i]+"</a></li>";
		}
	}
	document.write("<ul id='menu1'>"+listNav+"</ul>");
}

function writeNavSec (selectItem)
{
	var nb_bt = tab_lib_sec.length;
	var listNav = "";
	for(i=0;i<nb_bt;i++)
	{
		if(i!=selectItem)
		{
			listNav = listNav+"<li id='bt"+i+"'><a href="+traceur+tab_nav_sec[i]+"><span class='noDisplay'>"+tab_lib_sec[i]+"</span></a></li>";
		} else {
			listNav = listNav+"<li id='bt"+i+"' class='selected'><a href="+traceur+tab_nav_sec[i]+"><span class='noDisplay'>"+tab_lib_sec[i]+"</span></a></li>";
		}
	}
	document.write("<ul id='menu2'>"+listNav+"</ul>");
}
function writeNavSub (selectItem)
{
	var nb_bt = tab_lib_sub.length;
	var listNav = "";
	for(i=0;i<nb_bt;i++)
{
		if(i!=selectItem)
		{
			listNav = listNav+"<li><a href="+traceur+tab_nav_sub[i]+">"+tab_lib_sub[i]+"</a></li>";
		} else {
			listNav = listNav+"<li class='selected'><a href="+traceur+tab_nav_sub[i]+">"+tab_lib_sub[i]+"</a></li>";
		}
	}
	document.write("<ul id='menu3'>"+listNav+"</ul>");
}

function writeFooter ()
{
	document.write("<div class='colfooter'><p><a href='#' class='hautdepage'>Retour haut de page</a></p></div>"
				   +"<div class='colfooter'><p>Docsourcing"
				   +"<br />17A, rue de la Presse"
				   +"<br />BP 90090"
				   +"<br />42003 Saint-Etienne Cedex 1"
				   +"<br />T. +33 (0)4 77 81 50 05"
				   +"<br />F. +33 (0)4 77 81 50 04"
				   +"<br /><a href='mailto:info@docsourcing.com'>info@docsourcing.com</a></p></div>"
				   +"<div class='colfooter'><p>Plateformes sur"
				   +"<br />Paris, Lyon, Saint-Etienne, Mulhouse</p></div> ");
}

function writeFL (id,src,W,H,WM,pathxml,path,idr)
{
	document.write("<object id='"+id+"' classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,19,0' width='"+W+"' height='"+H+"' align='middle'>");
	document.write("<param name='allowScriptAccess' value='always'>");
	document.write("<param name='wmode' value='"+WM+"'>");
	document.write("<param name='movie' value="+src+">");
	document.write("<param name='flashvars' value='idR="+idr+"&path="+path+"&pathXML="+pathxml+"'>");
	document.write("<param name='quality' value='high'>");
	document.write("<embed name='"+id+"' src="+src+" flashvars='idR="+idr+"&path="+path+"&pathXML="+pathxml+"' allowScriptAccess='always' width='"+W+"' height='"+H+"' wmode='"+WM+"' align='middle' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash'></embed>");
	document.write("</object>");
}

// script qui limite le nombre de caractere dans le textarea
function LimiterTextArea(moncontroletexte, nbcar, moncontroledecompte) 
{ 
moncontroletexte.onclick = function(){TextAreaEstRempli(moncontroletexte, nbcar, moncontroledecompte)}; 
moncontroletexte.onblur = function(){TextAreaEstRempli(moncontroletexte, nbcar, moncontroledecompte)}; 
moncontroletexte.onkeyup = function(){TextAreaEstRempli(moncontroletexte, nbcar, moncontroledecompte)}; 
moncontroletexte.onkeypress = function(){TextAreaEstRempli(moncontroletexte, nbcar, moncontroledecompte)}; 

// Affichage du nombre de caractères restant 
moncontroledecompte.innerHTML = NbCarRestant(moncontroletexte, nbcar); 
} 

// TextAreaEstRempli 
// args : textarea moncontroletexte, int nbcar, element_HTML moncontroledecompte 
// return : bool 
// Renvoie vrai si le nombre de caractères maximum du textarea n'est pas atteint 
function TextAreaEstRempli(moncontroletexte, nbcar, moncontroledecompte) 
{ 
if (moncontroletexte) 
{ 
 if (moncontroletexte.value.length <= nbcar) 
 { 
     // Affichage du nombre de caractères restant 
     moncontroledecompte.innerHTML = NbCarRestant(moncontroletexte, nbcar); 
     return true; 
 } 
 else 
 {     
     // Affichage du nombre de caractères restant 
     moncontroletexte.value = moncontroletexte.value.substr(0, nbcar); 
     moncontroledecompte.innerHTML = NbCarRestant(moncontroletexte, nbcar); 
     return false; 
 } 
} 
} 

// NbCarRestant 
// args : textarea moncontroletexte, int nbcar 
// return : int 
// Renvoie le nombre de caractère à saisir 

function NbCarRestant(moncontroletexte, nbcar) 
{ 
return new Number(nbcar - moncontroletexte.value.length); 
} 
