<!--


var dx0 = 0, dy0 = 0, cxs, i, ip, ipo, j, urlp = '', vt = '', vf = '';
var chps = new Array();
var wo = new Array();
var it = new Array();
var cl = new Array();
var rub = new Array();
var tpl_p = new Array();


urlp = document.location + '';
it = urlp.split('?');
urlp = it[0];
if(it[1]) vt = ('&' + it[1].replace(/#$/, '')).replace(/&ip{1,2}=[a-z0-9_]*/g, '').substr(1);
it = vt.split(/&/g);
for(i=0;i< it.length;i++) vf += '<input type="hidden" name="' + it[i].replace(/=/, '" value="') + '">';


function WO_Elts(){
	
	// Intégration cl => chps
	var nbre = chps.length;
	if(!chps[nbre - 1].match(/^cl[0-9]+$/)){
		for(i=0;i< cl.length;i++){
			chps[i + nbre] = 'cl' + i;
			cl[i][0].replace(/!/g, ' ');
		}
	}
	
	for(i=0;i< chps.length;i++){
		try {
			eval('this.' + chps[i] + ' = \'' + WO_Elts.arguments[i].replace(/\'/g, '\\\'') + '\'');
		}
		catch(e){
			eval('this.' + chps[i] + ' = \'\'');
		}
	}
	
	if(WO_Elts.arguments[1] == 'cl'){
		for(i=0;i< cl.length;i++) eval('this.cl' + i + ' = \'' + cl[i][0].replace(/\'/g, '\\\'') + '\'');
	}
}

function WO_LienDoc(elt){
	
	var fichier = elt.fichier;
	
	try {
		fichier = WO_ImgEdit(fichier);
	}
	catch(e){
	}
	
	return fichier.replace(/^http_/i, cxs);	
}

function WO_AffiImg(type_affi, num_i, elt, l_max, h_max){
	
	var cont, echelle = elt.echelle.replace(/%$/, ''), img = elt.fichier, h, l, r;
	
	try {
		img = WO_ImgEdit(img);
	}
	catch(e){	
	}
	
	if(!echelle) echelle = 100;
	l = elt.width * echelle / 100;
	h = elt.height * echelle / 100;
	r = 1;
	if(l_max && h_max && (l > l_max || h > h_max)) r = Math.min(l_max/l, h_max/h);
	l = Math.round(l * r);
	h = Math.round(h * r);
	
	img = '<img name="img' + num_i + '" src="' + img.replace(/^http_/i, cxs) + '"';
	if(type_affi.match(/^edit\/form/)){
		if(poids_max && elt.poids > poids_max) img += ' border="1"';
	}
	if(l) img += ' width="' + l + '"';
	if(h) img += ' height="' + h + '"';
	img += '>';
	
	cont = '<table border="0" width="' + l + '" cellspacing="0" cellpadding="0"';
	if(elt.align) cont += ' align="' + elt.align + '">';
	cont += '<tr>';
	if(elt.align == 'right') cont += '<td width="10">&nbsp;</td>';
	cont += '<td>' + img + '</td>';
	if(elt.align == 'left') cont += '<td width="10">&nbsp;</td>';
	cont += '</tr>';
	if(elt.legende){
		cont += '<tr>';
		if(elt.align == 'right') cont += '<td></td>';
		cont += '<td class="cont_legende">' + elt.legende + '</td>';
		if(elt.align == 'right') cont += '<td></td>';
		cont += '</tr>';
	}
	cont += '</table>';
	
	if(type_affi == 'edit/form/interf') return img;
	else return cont;
}

function WO_TryEval(chaine){
	
	try {
		return eval(chaine);
	}
	catch(e){
		return '';
	}
}

function WO_AffiCont(div, num_c, num_e, type_m, type_e, x_pos, y_pos, opt){
	
	var bgcolor, cont = '', i, interf_lien, interf_img, j, lien, txt_def = '', type_affi = 'publi', x_def = 800, x_min, x_max, y_def = 600;
	var elt = new WO_Elts();
	
	if(urlp.match(/_edition_form\.php$/)) type_affi = 'edit/form';
	else if(urlp.match(/_edition\.php$/)) type_affi = 'edit';
	
	if(!type_affi.match(/edit/)){
		x_min = screen.width;
		x_max = 0;
		for(i=1;i< wo.length;i++){
			x_min = Math.min(x_min, wo[i][0].left * 1);
			x_max = Math.max(x_max, wo[i][0].left * 1 + wo[i][0].width * 1);
		}
		//dx0 = Math.max(0, (screen.width - x_max + x_min)/2) - 25;
		dx0 += Math.max(0, Math.round((document.body.clientWidth + x_min - x_max - dx0)/2));
	}
	
	if(type_affi == 'edit/form'){
		WO_AffiMC();
		if(wo.length <= 1){
			wo[1] = new Array();
			wo[1][0] = col_init;
		}
		txt_def = '(à complèter) ';
		interf_img = '<img src="' + cxs + '/' + chemin + '/custom/' + def + '/ressource/w!_interf.gif" border="0" width="16" height="16" align="absmiddle">';
	}
	
	for(i=1;i< wo.length;i++){
		
		cont += '<div id="cal' + i + '" style="position:absolute; left: ' + (dx0 + wo[i][0].left * 1) + 'px; top: ' + (dy0 + wo[i][0].top * 1) + 'px; width:' + wo[i][0].width + 'px;';
		if(wo[i][0].height) cont += ' height:' + wo[i][0].height + 'px';
		cont += ' z-index:1; border: 1px none #000000; overflow : hidden">\n';
		cont += '<table width="100%" border="0" cellpadding="0" cellspacing="0"' + WO_TryEval('tpl_col_bg') + '>';
		
		if(type_affi == 'edit/form' && wo[i].length <= 1) cont += '<tr><td class="cont_texte">' + txt_def + '<a href="#" onclick="WO_AffiCont(\'' + div + '\', ' + i + ', 1, \'ajout\', \'\', \'\', \'\', \'\')">' + interf_img + '</a></td></tr>\n';
		
		for(j=1;j< wo[i].length;j++){
			
			elt = wo[i][j];
			
			lien = '';
			if(elt.info_dev == 'oui'){
				if(type_affi == 'edit/form'){
					lien = '#"';
				}
				else if(elt.ip_dev || type_affi == 'edit'){
					lien = '?' + vt + '&ipp=' + ip + '_c' + i + 'e' + j;
					if(elt.ip_dev) lien = urlp + lien + '&ip=' + elt.ip_dev;
					else lien = urlp.replace(/_edition\.php/, '_edition_form.php') + lien;
				}
			}
			else if(elt.lien.match(/^http/i)){
				lien += elt.lien + ' target="_blank"';
			}
			
			interf_lien = ''; bt_page = '', bgcolor = '';
			if(type_affi == 'edit/form' && (wo[i][0].tpl || wo[i][j].tpl)){
				interf_lien = ' <a href="#" onclick="WO_AffiCont(\'' + div + '\', ' + i + ', ' + j + ', \'gal\', \'\', \'\', \'\', \'\')">' + interf_img + '</a>\n';
				if(i == num_c && j == num_e && type_m != 'ajout') bgcolor = ' bgcolor="#aaaaaa"';
			}
			else if(type_affi == 'edit' && elt.info_dev == 'oui'){
				if(elt.ip_dev) bt_page = 'bouton_page.gif';
				else bt_page = 'bouton_nopage.gif';
				bt_page =  ' <a href="' + lien + '"><img src="' + cxs + '/' + chemin + '/custom/' + def + '/ressource/' + bt_page + '" border="0" width="13" height="16"></a>\n';
			}
			
			if(elt.type == 'rub'){
				cont += '<tr' + bgcolor + '><td class="cont_rub">' + elt.titre + interf_lien  + bt_page + '</td></tr>';
			}
			else if(elt.type == 'par'){
				if(elt.titre){
					if(lien) cont += '<tr' + bgcolor + '><td class="cont_titre"><a href="' + lien + '" class="cont_titre">' + elt.titre + '</a>' + interf_lien  + bt_page + '</td></tr>';
				 	else cont += '<tr' + bgcolor + '><td class="cont_titre">' + elt.titre + interf_lien + '</td></tr>';
				 	cont += '<tr' + bgcolor + '><td height="10"></td></tr>';
				}
				if(!elt.titre || elt.texte || elt.fichier){
					cont += '<tr' + bgcolor + '><td class="cont_texte">';
					if(elt.fichier) cont += WO_AffiImg(type_affi, i, elt, '', '') ;
					if(elt.texte) cont += elt.texte;
					if(!elt.texte && !elt.fichier) cont += txt_def;
					if(!elt.titre){
						if(lien) cont += '<br><br><div align="center"><a href="' + lien + '" class="cont_fct">Pour en savoir plus</a>' + bt_page + '</div>\n';	
						cont += interf_lien;
					}
					cont += '</td></tr>';
				}
			}
			else if(elt.type == 'img' && (elt.fichier || type_m == '')){
				cont += '<tr' + bgcolor + '><td align="' + elt.align + '">' + WO_AffiImg(type_affi, i, elt, '', '') + '<br>' + interf_lien + '</td></tr>\n';
			}
			else if(elt.type == 'doc'){
				if(!elt.titre) elt.titre = elt.fichier;
				if(!elt.titre) elt.titre = txt_def;
				if(elt.fichier) cont += '<tr' + bgcolor + '><td class="cont_lien"><a href="' + WO_LienDoc(elt) + '" target="_blank">' + elt.titre + '</a>';
				else cont += elt.titre;
				cont += interf_lien + '</td></tr>';
			}
			else if(elt.type == 'lien'){
				if(!elt.titre) elt.titre = elt.fichier;
				if(!elt.titre) elt.titre = txt_def;
				if(elt.lien) cont += '<tr' + bgcolor + '><td class="cont_lien"><a href="' + elt.lien + '" target="_blank">' + elt.titre + '</a>';
				else cont += elt.titre;
				cont += interf_lien + '</td></tr>';
			}
			else if(elt.type == 'mailto'){
				if(!elt.titre && !elt.lien) elt.titre = txt_def;
				cont += '<tr' + bgcolor + '><td class="cont_mailto">' + elt.titre + '<a href="mailto:' + elt.lien + '">' + elt.lien + '</a>' + interf_lien + '</td></tr>';
			}
			
			if(j != wo[i].length - 1) cont += '<tr><td height="10"></td></tr>\n';
		}
		
		cont += '</table>';
		if(tpl_p[i] && !type_affi.match(/edit/)) cont += tpl_p[i];
		cont += '</div>\n';
	}
	
	if(type_m && type_affi.match(/edit/)){
		
	    	// Interface
	    	
	    	if(!x_pos && !y_pos){
			
			x_pos = 400;
			y_pos = 100;
			
	    		it = def.split(/x/i);
			if(it.length == 2){
				x_def = it[0];
				y_def = it[1];
			}
			if(Curseur('x')) x_pos = Curseur('x');
			if(x_pos >= x_def - 300) x_pos -= 250;
			if(type_m.match(/sortie/)){
				y_pos = Curseur('y') + 5;
			}
			else {
				if(Curseur('y')) y_pos = Curseur('y');
				if(y_pos >= y_def - 200) y_pos -= 150;
			}
		}
		
		cont += WO_AffiInterf(num_c, num_e, type_m, type_e, x_pos, y_pos, opt);
	}
	
	
	// Affichage
	//document.test.contest.value = cont;
	if(!div) div = 'cont';
	if(document.getElementById && type_affi != 'publi') document.getElementById(div).innerHTML = cont;
	else document.write(cont);
}


//-->