/* UTILISATION DE LA FONTION StartTag
 * Déclarer un tableau de coordonnées (x,y,L,H) où x=coordonnées x, y=coordonnées y, L=largeur, H=hauteur
 * ex: var layer_coords=new Array(34,108,34,137);
 * Si besoin, déclarer un tableau de clipping de la région (a,b,c,d) où a=point zéro de la zone, b=largeur de la zone, c=hauteur de la zone, et d=retour au point zéro
 * ex: var layer_clip=new Array(0,120,350,0);
 *
 * Les arguments à passer à la fonction sont, dans l'ordre:
 * 		1- Le nom du layer
 * 		2- le tableau de coordonnées
 * 		3- la "visibility" [optionnel: 'visible' ou 'hidden']
 * 		4- le clipping [optionnel]
 * 		5- l'overflow du clipping (IE) [optionnel: 'visible' ou 'hidden'] 
 * 
 * Le résultat sort une <DIV> pour IE ou NS6 et un <LAYER> pour NS4 avec les attributs optimisés pour chaque navigateur. Le z-indexing est incrémenté automatiquement à chaque appel de la fonction.
*/

var z_indexing=0;

function StartTag(nom,coords,visibility,clip,overflow) {
	var tabcoord= new Array("left","top","width","height");
	var tag="";
	
	if(document.layers) {
		tag += "<layer name=\""+nom+"\" ";
		//tag += "bgcolor=\"#00FF00\" "; 
		if(coords) {
			for(var i=0; i<coords.length; i++) {
				if(coords[i] != null && coords[i] != "")tag += tabcoord[i]+"=\""+coords[i]+"\" ";
				}
			}
		if(clip) {
			tag += "clip=\"" + clip[1]+ "," +clip[2] + "\"";
				}
			
		if(visibility) {
			if(visibility=="visible")tag += " visibility=\"show\"";
			else tag += " visibility=\"hide\"";
			}
		tag += " z-index="+ ++z_indexing+">";
		}
	else {
		tag += "<div id=\""+nom+"\" ";
		tag +="style=\"position:absolute; "
		if(coords) {
			for(var i=0; i<coords.length; i++) {
				if(coords[i] != null && coords[i] != "")tag += tabcoord[i]+":"+coords[i]+"; ";
				}
			}
		if(clip) {
			tag += "clip:rect(";
			for (var i=0; i< clip.length; i++) {
				tag += clip[i];
				if(i < clip.length-1) tag +=",";
				}
			tag += ");";
			}
		if(visibility) tag += " visibility:"+visibility+";";
		if(overflow) tag += " overflow:"+overflow+";"
		tag += "; z-index:"+ ++z_indexing;
		tag += "\">";
		}
	document.write(tag);
	}				
			


/* 12/11/02 FF
> Fonction qui génère un bouton avec libellé et rollover :
 strNom 		: nom du libellé
 intTaille		: taille du bouton en pixel
 Boosens		: sens d'orientation du bouton ( 1 : fleche à droite, 0 : fleche à gauche )
 codeM			: code marché ( optionel )
 codeL			: code langue ( optionel )
 flagTest 		: l'initaliser à false pour n'utiliser que le codeMArche dans la declaration du bouton
*/
function bouton( strNom, intTaille, Boosens, codeM, codeL )
{
	cu_Mar = cu_Marche!=null?cu_Marche:'FR';
	var coef1 = 6.2; var coef2 = 2.5; var coef3 = 10.7; var coef4 = 3.5;
	var nbblanc = 0; var liSize = 0; var autreSize = 0; var Sesp = 13;
	var mSize = 0; var espSize = 0;
	var deb = strNom.indexOf( '>' );
	var fin = strNom.indexOf( '</' );
	var TrueName = (deb!=-1)?strNom.substring( deb+1, fin ):strNom;
	var mac=(navigator.userAgent.indexOf('Mac')!=-1)?true:false;
	var ns=(document.layers)?true:false;
	if(ns) {coef1 = 5.1; coef3 = 8.6; coef2 = 2.6; coef4 = 4; Sesp = 14; };
	if(mac && ns) {coef1 = 6.3; coef2 = 2.6; coef3 = 9; coef4 = 4; Sesp = 14; };
	var stesp = TrueName.match( eval( '/ /g' ) ); 
	var stli = TrueName.match( eval( '/[i,l]/g' ) ); 
	var stm = TrueName.match( eval( '/m/g' ) ); 
	var stautre = TrueName.match( eval( '/[^i,l,m, ]/g' ) ); 
	if( stautre!=null ) autreSize = stautre.length*coef1;	
	if( stli!=null ) liSize = stli.length*coef2;
	if( stm!=null ) mSize = stm.length*coef3;
	if( stesp!=null ) espSize = stesp.length*coef4;
	var blocNV = 10+liSize+autreSize+mSize+espSize;
	Ecart = Math.ceil( intTaille - blocNV - Sesp );
	if( intTaille < 100 ) Ecart += 5;
	//strCode=( bouton.arguments.length>3 )?( bouton.arguments.length>4 )?"/"+codeM+"/"+codeL:"/"+codeM:"../../../..";
	strCode=( bouton.arguments.length>3 )?( bouton.arguments.length>4 )?"/"+codeM+"/"+codeL:"/"+codeM:"/"+cu_Mar;
	if( flagTest ) strCode = '../../../..';
	strPixTrans = '<img src="'+strCode+'/common/common/img/pixel/pixtrans.gif" width="'+Ecart+'" height="10" border="0" />';
	var strtot = ( Boosens )?'&nbsp;'+TrueName+'&nbsp;'+strPixTrans:strPixTrans+'&nbsp;'+TrueName+'&nbsp;';
	document.write( strtot );
}







function initInput(size) {
	var ie4=false;
	var bigSize = size>10 ? true : false;
	if( navigator.userAgent.indexOf('Win')==-1 ) mac=true; else mac=false;
	if (document.layers) ns=true; else ns=false;
	if (document.all) { ie=true; if( navigator.appVersion.indexOf( "MSIE 4" ) !=-1 )ie4=true;}
	else { ie=false; }
	if(!ie&&document.getElementById){ns=false;n6=true;}
	if(!mac && ns) { var taille = bigSize?Math.abs(size*0.60):Math.abs(size*0.70); }	
	else if(!mac && ie) { if( ie4 ) { var taille = bigSize?Math.abs(size*1):Math.abs(size*1.90); }
						else { var taille = bigSize?Math.abs(size*1):Math.abs(size*1.40); } }
	else if(mac && ns) { var taille = bigSize?Math.abs(size*0.90):Math.abs(size*1.90); }
	else if(mac && ie) { var taille = bigSize?Math.abs(size*1):Math.abs(size*2.50); }
	else {taille = size;}
	return taille;
}

function WriteInputRet( nom, size, maxlength, value, typeCSS, BooPassOk ) {
if( isNaN( maxlength*1 ) ) { BooPassOk=value; typeCSS=maxlength; maxlength=35; value='' };
ttaille = Math.round(initInput(size));
var Ty = ((BooPassOk==1) || (BooPassOk=="1"))?'password':'text';
strHTML = '<INPUT TYPE=\"'+Ty+'\" SIZE=\"'+ttaille+'\" MAXLENGTH=\"'+maxlength+'\" NAME=\"'+nom+'\" class=\"'+typeCSS+'\" VALUE=\"'+value+'\"';
if( WriteInputRet.arguments.length>6 ) strHTML += ' />';
return strHTML;
}

function WriteInput( nom, size, maxlength, value, typeCSS, BooPassOk ) {
document.write( WriteInputRet( nom, size, maxlength, value, typeCSS, BooPassOk ) + ' />' );
}




function initInput(size) {
	var ie4=false;
	var bigSize = size>10 ? true : false;
	if( navigator.userAgent.indexOf('Win')==-1 ) mac=true; else mac=false;
	if (document.layers) ns=true; else ns=false;
	if (document.all) { ie=true; if( navigator.appVersion.indexOf( "MSIE 4" ) !=-1 )ie4=true;}
	else { ie=false; }
	if(!ie&&document.getElementById){ns=false;n6=true;}
	if(!mac && ns) { var taille = bigSize?Math.abs(size*0.60):Math.abs(size*0.70); }	
	else if(!mac && ie) { if( ie4 ) { var taille = bigSize?Math.abs(size*1):Math.abs(size*1.90); }
						else { var taille = bigSize?Math.abs(size*1):Math.abs(size*1.40); } }
	else if(mac && ns) { var taille = bigSize?Math.abs(size*0.90):Math.abs(size*1.90); }
	else if(mac && ie) { var taille = bigSize?Math.abs(size*1):Math.abs(size*2.50); }
	else {taille = size;}
	return taille;
}

function WriteInputRet( nom, size, maxlength, value, typeCSS, BooPassOk ) {
if( isNaN( maxlength*1 ) ) { BooPassOk=value; typeCSS=maxlength; maxlength=35; value='' };
ttaille = Math.round(initInput(size));
var Ty = ((BooPassOk==1) || (BooPassOk=="1"))?'password':'text';
strHTML = '<INPUT TYPE=\"'+Ty+'\" SIZE=\"'+ttaille+'\" MAXLENGTH=\"'+maxlength+'\" NAME=\"'+nom+'\" class=\"'+typeCSS+'\" VALUE=\"'+value+'\"';
if( WriteInputRet.arguments.length>6 ) strHTML += ' />';
return strHTML;
}

function WriteInput( nom, size, maxlength, value, typeCSS, BooPassOk ) {
document.write( WriteInputRet( nom, size, maxlength, value, typeCSS, BooPassOk ) + ' />' );
}



function initArea(size) {
	var ie4=false;
	var bigSize = size>30 ? true : false;
	if( navigator.userAgent.indexOf('Win')==-1 ) mac=true; else mac=false;
	if (document.layers) ns=true; else ns=false;
	if (document.all) { ie=true; if( navigator.appVersion.indexOf( "MSIE 4" ) !=-1 )ie4=true;}
	else { ie=false; }
	if(!ie&&document.getElementById){ns=false;n6=true;}
	if(!mac && ns) { var taille = bigSize?Math.abs(size*0.60):Math.abs(size*0.80); }	
	else if(!mac && ie) { var taille = Math.abs(size*1); }
	else if(mac && ns) { var taille = bigSize?Math.abs(size*0.70):Math.abs(size*1); }
	else if(mac && ie) { var taille = bigSize?Math.abs(size*1):Math.abs(size*0.9); }
	else {taille = size;}
	return taille;
}

function WriteAreaRet( nom, size, typeCSS, ligne, valeur ) {
if( !isNaN( nom*1 ) ) { ligne=typeCSS; typeCSS=size; size=nom }
ttaille = Math.round(initArea(size));
if( ligne == "" ) var ligne="10";
strHTML = '<textarea name=\"'+nom+'\" class=\"'+typeCSS+'\" cols=\"'+ttaille+'\" rows=\"'+ligne+'\">';
if (valeur != null) { strHTML +=valeur; } 
strHTML += '</textarea>';
return strHTML;
}



function WriteArea( nom, size, typeCSS, ligne, valeur ) {
document.write( WriteAreaRet( nom, size, typeCSS, ligne, valeur ) );
}













