function ph() {
	if (window.innerHeight) {
		return window.innerHeight;
	}
	if (document.body.clientHeight) {
		return document.body.clientHeight;
	}
	return (null);
}
function pw() {
	if (window.innerWidth) {
		return window.innerWidth;
	}
	if (document.body.clientWidth) {
		return document.body.clientWidth;
	}
	return (null);
}

var curpos = new Array(4);
var gt = "&gt;&nbsp;";
var GT = "&gt;&gt;&nbsp;";
 
function openIframe(ifrm, left, top, width, height, src) {
	curpos[0] = left;
	curpos[1] = top;
	curpos[2] = width;
	curpos[3] = height;
	var p_width = pw();
	var p_height = ph();
	var ifr = window.parent.document.getElementById(ifrm);
	if (ifr == null) {
		alert("frame " + ifrm + " non disponible");
		return;
	}
	ifr.src = src;
	ifr.style.visibility="visible";
	if (width <= 0) width = p_width + (width * 2);
	if (height < 0) height = p_height + (height * 2);
	if ((height == 0) && (top > 0)) height = p_height - (top + 16);
	ifr.style.position = "absolute";
	ifr.style.width = width + "px";
	ifr.style.height = height + "px";
	ifr.style.left = (left < 0) ? (((p_width - width) / 2) + "px") : (left + "px");
	ifr.style.top = (top < 0) ? (((p_height - height) / 2) + "px") : (top + "px");
	ifr.setAttribute("statut", "0");
}

function moveIframes() {
	var left = curpos[0];
	var top = curpos[1];
	var width = curpos[2];
	var height = curpos[3];			
	var p_width = pw();
	var p_height = ph();
	if (width <= 0) width = p_width + (width * 2);
	if (height < 0) height = p_height + (height * 2);
	if ((height == 0) && (top > 0)) height = p_height - (top + 16);
	for (ctr=1;ctr<=6;ctr++) {
		var idiv = document.getElementById("iframeIpop" + ctr);
		if (idiv) {
			if (idiv.style.visibility == "visible") {
				idiv.style.width = width + 'px';
				idiv.style.height = height + 'px';
				idiv.style.left = (left < 0) ? (((p_width - width) / 2) + 'px') : (left + 'px');
				idiv.style.top = (top < 0) ? (((p_height - height) / 2) + 'px') : (top + 'px');
			 }
		}
	}
}

function swifr(curi,newi,url) {
    popHideByID();
	var obj1 = window.parent.document.getElementById("iframeIpop" + curi);
	if (obj1 == null) {
		alert("iframeIpop" + curi + " inexistant !");
		return;
	}
	var obj2 = window.parent.document.getElementById("iframeIpop" + newi);
	if (obj2 == null) {
		alert("iframeIpop" + newi + " inexistant !");
		return;
	}
	obj2.style.position="absolute";
	obj2.style.left = obj1.style.left;
	obj2.style.top = obj1.style.top;
	obj2.style.width = obj1.style.width;
	obj2.style.height = obj1.style.height;
	obj1.style.visibility = 'hidden';	
	/*
	if (obj1) {
		obj1.blur();
	}
	*/
	if (url) {
		obj2.src = url;
	}
	var obj3 = window.parent.document.getElementById("explorerMenuOpt" + newi);
	if (obj3) {
		obj3.innerHTML = GT + "<b>" + v_plabel + "</b>";
		obj3.setAttribute("label", v_plabel);
	}
	else {
		alert("obj3 [" + newi + "] not found !");
	}
	var obj4 = window.parent.document.getElementById("explorerMenuOpt" + curi);
	if (obj4) {
		obj4.innerHTML = gt + obj4.getAttribute("label");
	}

	for (ctr=newi+1;ctr<=6;ctr++) {
		obj3 = window.parent.document.getElementById("explorerMenuOpt" + ctr);
		if (obj3) {
			obj3.innerHTML = "";
		}
	}
	window.parent.document.thf.ifm.value = newi;
	obj1.style.zIndex=1;
	obj2.style.zIndex=2;
	obj2.style.visibility = "visible";
	obj2.contentWindow.focus();
}

function swifrWP(curi,newi,url) {
	swifr(curi,newi,url + v_pid);
}

function swifrWP1(plabel,curi,newi,url) {
	setPopLabel(plabel);
	swifr(curi,newi,url + v_pid);
	popHideByID();
}

function swifrWP2(plabel,curi,newi,url) {
	setPopLabel(plabel);
	swifr(curi,newi,url + "&pid=" + v_pid + "&hqp=" + (v_npage + 1));
	popHideByID();
}

function swifrlbl(plabel,curi,newi,url) {
	setPopLabel(plabel);
	swifr(curi,newi,url);
	popHideByID();
}

function setcurifr(curi,plabel) {
	setPopLabel(plabel);
	var obj = window.parent.document.getElementById("explorerMenuOpt" + curi);
	if (obj) {
		obj.innerHTML = GT + "<b>" + v_plabel + "</b>";
		obj.setAttribute("label", v_plabel);
	}
	window.parent.document.thf.ifm.value = curi;
}

function swifrPNL(curi,newi,cmd) {
	swifr(curi,newi,"/access8/bbadm?hqr=" + cmd + "&acc=" + v_acc + "&pnl=" + v_pnl + "&pnlsel=" + v_pnlsel + "&pnlseljob=" + v_pnlseljob);
}

function scifr(newi) {
    var curi =window.parent.document.thf.ifm.value;
	if ((curi != 0) && (newi != curi)) {
		var obj1 = window.parent.document.getElementById("iframeIpop" + curi);
		var obj2 =  window.parent.document.getElementById("iframeIpop" + newi);
		obj2.style.position="absolute";
		obj2.style.left = obj1.style.left;
		obj2.style.top = obj1.style.top;
		obj2.style.width = obj1.style.width;
		obj2.style.height = obj1.style.height;
		obj1.style.visibility = 'hidden';	
		obj2.style.visibility = "visible";
		window.parent.document.thf.ifm.value = newi;
		obj1.style.zIndex=1;
		obj2.style.zIndex=2;
		obj2.contentWindow.focus();
		var obj3 = window.parent.document.getElementById("explorerMenuOpt" + newi);
		if (obj3) {
			obj3.innerHTML = GT + "<b>" + obj3.getAttribute("label") + "</b>";
		}
		var obj4 = window.parent.document.getElementById("explorerMenuOpt" + curi);
		if (obj4) {
			obj4.innerHTML = gt + obj4.getAttribute("label");;
		}
	}
}

 function getIFrameDocument(ifr,aID){ 
 	var rv = null; 
 	// if contentDocument exists, W3C compliant (Mozilla) 
 	if (ifr.contentDocument){ 
   		rv = ifr.contentDocument; 
 	} else { 
   		// IE 
   		rv = window.parent.document.frames[aID].document; 
 	} 
 	return rv; 
  } 
 
function rlifr(newi,frm,cmd) {
    var curi =window.parent.document.thf.ifm.value;
	if (curi != 0) {
		var obj1 = window.parent.document.getElementById("iframeIpop" + curi);
		var obj2 =  window.parent.document.getElementById("iframeIpop" + newi);
		obj2.style.position="absolute";
		obj2.style.left = obj1.style.left;
		obj2.style.top = obj1.style.top;
		obj2.style.width = obj1.style.width;
		obj2.style.height = obj1.style.height;
		/* obj1.blur(); */
		obj1.style.visibility = 'hidden';	
		obj2.style.visibility = "visible";
		obj1.style.zIndex=1;
		obj2.style.zIndex=2;
		obj2.contentWindow.focus();
		/* obj2.focus();*/	
		window.parent.document.thf.ifm.value = newi;
		var obj3 = window.parent.document.getElementById("explorerMenuOpt" + curi);
		if (obj3) {
			obj3.innerHTML = gt + obj3.getAttribute("label");
		}
		var obj4 = window.parent.document.getElementById("explorerMenuOpt" + newi);
		if (obj4) {
			obj4.innerHTML = gt + obj4.getAttribute("label") + "</b>";
		}
		var doc = getIFrameDocument(obj2,"iframeIpop" + newi)
 		with (doc.forms[frm]) {
 			hqr.value=cmd;
 			tms.value=saveToggleStates(doc);
 			submit();
 		}
	}
}

function bckifr(newi) {
    var curi =window.parent.document.thf.ifm.value;
	if (curi != 0) {
		var obj1 = window.parent.document.getElementById("iframeIpop" + curi);
		var obj2 =  window.parent.document.getElementById("iframeIpop" + newi);
		window.parent.document.thf.ifm.value=newi;
		obj2.style.position="absolute";
		obj2.style.left = obj1.style.left;
		obj2.style.top = obj1.style.top;
		obj2.style.width = obj1.style.width;
		obj2.style.height = obj1.style.height;
		obj1.style.visibility = 'hidden';	
		obj2.style.visibility = "visible";
		obj1.src = "";
		obj1.style.zIndex=1;
		obj2.style.zIndex=2;
		obj2.contentWindow.focus();
		clrifr(newi);
	}
}

function clrifr(newi) {
	for (ctr=newi+1;ctr<=6;ctr++) {
		var obj = window.parent.document.getElementById("explorerMenuOpt" + ctr);
		if (obj) {
			obj.innerHTML = "";
			obj.setAttribute("label", "");
		}
	}
}

function saveToggleStates(obj) {
    /* 
    alert("in saveToggleStates()");
    */
	var ul = obj.getElementsByTagName("ul");
	/*
	alert("ul=" + ul);
	*/
	if (ul) {
		var s = "+";
		for (var i=0;i<ul.length;i++) {
  			if (ul[i].style.display == "block") {
  				s = s + ul[i].id + "+";
  			}
  		}
  		return s;
  	}
  	return "";
 }
  
 function ewl(msg,def,cmd,frm,trg) {
 	var lbl = prompt(msg,def);
 	if (lbl.length > 3) {
 		with (document.forms[frm]){
 			hqr.value=cmd;
 			tms.value=saveToggleStates(window.document);
 			acc.value=v_acc;
 			target=trg;
 			arg.value=lbl;
 			submit();
 		}
 	}
 	else {
 		alert("'" + lbl + "' n'est pas un nom de dossier acceptable !");
 	}
 }
 
 function cwl(msg,cmd,frm,trg) {
 	var res = confirm(msg);
  	if (res == "1") {
 		with (document.forms[frm]){
 			hqr.value=cmd;
 			tms.value=saveToggleStates(window.document);
 			acc.value=v_acc;
 			target=trg;
 			submit();
 		}
 	}
 }
 

 function saveOrderStates(frm) {
 	var npg = 1;
 	var seq  = 0;
 	var nq = 0;
 	for (var i = 0; i < div_array.length; i ++) {
 		var tvObj = document.getElementById(div_array[i]);
 		if (tvObj != null) {
 			for(var j=0; j < tvObj.childNodes.length; j++){
				if(tvObj.childNodes[j].nodeName=='#text') continue;
				var fld =  tvObj.childNodes[j].getAttribute("id");
				if (fld != null) {
					var elm = document.forms[frm].elements["pg_" + fld];
					if (elm != null) {
						elm.value = (npg - 1);
						document.forms[frm].elements["sq_" + fld].value = ++seq;
						nq ++;
					}
				}
			}
			if (nq > 0) {
				npg ++;
				nq = 0;
			}
		}
	}
	document.forms[frm].hqr.value = "7011";
	document.forms[frm].submit();
}

 function addPageContainer(cur_container,n_page,frm) {
    var opt = confirm("Ajouter une page avant la page " + n_page + " ? ");
    if (opt == "1") {
 		var cur_ifr = document.getElementById(cur_container);
  		var new_ifr = cur_ifr.cloneNode(false);
 		var parent = cur_ifr.parentNode;
 		var num = 1 + div_array.length;
 		new_ifr.id = "PageContainer" + num;
 		new_ifr.setAttribute("class", "DragContainer");
 		new_ifr.setAttribute("overClass", "OverDragContainer");
 		parent.insertBefore(new_ifr, cur_ifr);
 		var br = document.createElement("BR");
 		new_ifr.appendChild(br);
  		addDragContainers([new_ifr.id],0);
 		for(var i=0; i< div_array.length; i++) {
			if (div_array[i] == cur_ifr.id) {
				div_array.splice(i, 0, new_ifr.id);
				break;
			}
		} 
		// alert("maj=" + div_array.join("/"));
	}
}

var div_array = new Array();

function initOrganizer() {
	var args = arguments;
	div_array.length = 0;
	for(var i=0; i<args.length; i++) {
		div_array[i] = args[i];
	}
	loadOrganizer(args);
}


function maskbars() {
	var ua = navigator.userAgent;
	var ual = ua.toLowerCase();
	var is_major = parseInt(navigator.appVersion);
	var is_minor = parseFloat(navigator.appVersion);
	var is_win = ( (ual.indexOf("win")!=-1) || (ual.indexOf("16bit")!=-1) );
	var is_ie = ((ual.indexOf("msie") != -1) && (ual.indexOf("opera") == -1) && (ual.indexOf("konqueror") == -1));
	var is_ie4 = (is_ie && (is_major == 4) && (ual.indexOf("msie 4")!=-1) );
	var is_ie5 = (is_ie && (is_major == 4) && (ual.indexOf("msie 5.0")!=-1) );
	var is_ie5_5 = (is_ie && (is_major == 4) && (ual.indexOf("msie 5.5") !=-1));
	var is_ie6 = (is_ie && (is_major == 4) && (ual.indexOf("msie 6.")!=-1) );

	if (!is_ie) {
		window.toolbar.visible=false; 
		window.locationbar.visible=false; 
		window.menubar.visible=false; 
		window.statusbar.visible=false; 
		window.scrollbars.visible=true; 
		window.titlebar.visible=false; 
		window.personalbar.visible=false;
	}
	else {
		window.toolbar=0; 
		window.locationbar=0; 
		window.menubar=0; 
		window.statusbar=0; 
		window.scrollbars=1; 
		window.titlebar=0; 
		window.personalbar=0;
	}
}

function setWinPos(mode) { 
	var x = 0; 
	var y = 0; 
	var hh = screen.availHeight;
	var ww = screen.availWidth; 
	var w = ww; var h = hh; 
	if (window.self.name.length == 0) { 
		switch(mode) { 
			case 2 : 
				x = (ww - 800) / 2; 
				y = (hh - 600) / 2; 
				w = 800;
				h = 600; 
				break;  
			case 3 : 
				x = (ww - 640) / 2; 
				y = (hh - 480) / 2; 
				w = 640; 
				h = 480; 
				break; 
			case 4 : 
				w = ww * 2 / 3; 
				h = hh * 2 / 3; 
				x = (ww - w) / 2;
				y = (hh - h) / 2; 
				break; 
			case 5 : 
				w = ww / 2; 
				h = hh / 2;
				x = (ww - w) / 2;
				y = (hh - h) / 2;
				break; 
			default : 
				break;
		}	
		if (x < 0) x = 0; 
		if (y < 0) y = 0; 
		if (w > ww) w = ww; 
		if (h > hh) h = hh; 
		maskbars();
		moveTo(x, y); 
		resizeTo(w, h); 
	} 
}

function setWinStrictPos(x, y, width, height) { 
	var hh = screen.availHeight;
	var ww = screen.availWidth; 
	if (window.self.name.length == 0) { 
		if (x < 0) x = 0; 
		if (y < 0) y = 0; 
		if (width > ww) width = ww; 
		if (height > hh) height = hh; 
		maskbars();
		moveTo(x, y); 
		resizeTo(width, height); 
	} 
}

function findFrm(rw, tgt) { 
	for (var ctr = 0; ctr < rw.frames.length; ctr ++) { 
		if (rw.frames[ctr].name == tgt) 
			return(rw.frames[ctr].window);  
		var sw = rw.frames[ctr].window; 	
		if (sw.frames.length > 0) { 
			var res = findFrm(sw, tgt); 
			if (res != 0) return(res); 
		}	
	}
	return(0); 
}

function clearFrms(target) {
	var tgs = target.split(",");
	if (tgs != null) {
		for (var ctr = 0; ctr < tgs.length; ctr ++) {
			var tw = findFrm(window.top, tgs[ctr]);
			if (tw != 0) {
				tw.document.open();
				tw.document.writeln("<html><head></head><body bgcolor='" + document.bgColor + "'></body></html>"); 
				tw.document.close();
			}
		}
	}
}

function updtFrms(target) { 
	var tgs = target.split(','); 
	if (tgs != null) { 
		for (var ctr = 0; ctr < tgs.length; ctr ++) { 
			var tw = findFrm(window.top, tgs[ctr]);
			if (tw != 0) tw.document.location.reload(); 
		}
	}
}

function submitRequest(code) { 
	document.myform.hqr.value = code; 
	document.myform.submit();
	if (code == "-999") closeIframePopup();
}

function closeIframePopup() {
	try {
		var ifr = window.parent.document.getElementById("divIframePopup");
		if (ifr != null) {	
			ifr.setAttribute("statut", "1");
			/*
			window.blur();
			*/
			window.parent.focus();
		}
	}
	catch(error) {
	}
}

function pageRequest(code)  { 
	document.myform.hqr.value = '2'; 
	document.myform.hqp.value = code; 
	document.myform.submit(); 
}

var pub_regnum = new RegExp("[^0-9\+\-\.,]","g");
var pub_regcomma = new RegExp("[,]","g");
var pub_regpoint = new RegExp("[\.]","g");

function checkNum(ctrl, min_val, max_val, def_val, flag) {
	var str_v = ctrl.value;
	var str_f = str_v;
	var flag_err = false;
	// alert("test sur [" + str_v + "]");
	if (str_f.length > 0) {
		str_f = str_v.replace(pub_regnum, "");
		// alert("str_f=" + str_f);
		str_f = str_f.replace(pub_regcomma, ".");
		num_v = parseFloat(str_f);
		if (isNaN(num_v) == true) {
			flag = -1;
		}
		var msg = "La valeur doit ?tre ";
		switch(flag) {
			case -1 : 
					msg = msg + "num?rique";
					flag_err = true;
					break;
			case 1 :
				if (num_v < min_val) { 
			 		msg = msg + "sup?rieure ou ?gale ? " + min_val;
					flag_err = true;
				}
				break;
			case 2 :
				if (num_v > max_val) { 
			 		msg = msg + "inf?rieure ou ?gale ? " + max_val;
					flag_err = true;
				}
				break;
			case 3 : 
				if ((num_v < min_val) || (num_v > max_val)) { 
			 		msg = msg + "comprise entre " + min_val + " et " + max_val;
					flag_err = true;
				}
				break;
		}
		switch (flag_err) {
			case true : 
				alert(msg + ".\nVous avez saisi \"" + str_v + "\", cette valeur ne peut pas ?tre enregistr?e.\nMerci de corriger.\n");
				ctrl.value = def_val;
				break;
			default : 
				ctrl.value = num_v.toString().replace(pub_regpoint, ",");
				break;
		}
		return;
	}
	ctrl.value = def_val;
	return;
}

var objPopup = null;
var objPopupByID = null;

function popUp(event,objectID) {
	objPopTrig = document.getElementById(event);
	objPopup = document.getElementById(objectID);
	xPos = objPopTrig.offsetLeft;
	yPos = objPopTrig.offsetTop + objPopTrig.offsetHeight;
	if (xPos + objPopup.offsetWidth > document.body.clientWidth) xPos = xPos - objPopup.offsetWidth;
	if (yPos + objPopup.offsetHeight > document.body.clientHeight) yPos = yPos - objPopup.offsetHeight - objPopTrig.offsetHeight;
	objPopup.style.left = xPos + 'px';
	objPopup.style.top = yPos + 'px';
	objPopup.style.visibility = 'visible';
}

function popHide() {
	if (objPopup) {
		objPopup.style.visibility = 'hidden';
		objPopup = null;
	}
}

function getOffsetPosition(obj_id, type_TopLeft)
{
 	var pos = 0;
 	var objID = document.getElementById(obj_id);
 	var sType = 'objID.offset' + type_TopLeft;
 	while (objID && objID.tagName != 'BODY') {
  		pos += eval(sType);
  		objID = objID.offsetParent;
 	}
	return pos;
}

function popUpByID(id,objectID) {
	if (objPopupByID) {
		var trig = document.getElementById(id);
		var byID = document.getElementById(objectID);
		var flag = ((trig == objPopTrig) && (byID == objPopupByID)) ? true : false;
		popHideByID();
		objPopTrig = null;
		objPopupByID = null;
		if (flag) return;
	}	
	objPopTrig = document.getElementById(id);
	objPopupByID = document.getElementById(objectID);
	xPos = getOffsetPosition(id, "Left");
	yPos = getOffsetPosition(id, "Top") + objPopTrig.offsetHeight;
	if (xPos + objPopupByID.offsetWidth > document.body.clientWidth) xPos = xPos - objPopupByID.offsetWidth;
	if (yPos + objPopupByID.offsetHeight > document.body.clientHeight) yPos = yPos - objPopupByID.offsetHeight - objPopTrig.offsetHeight;
	if (yPos < 1) yPos = 1;
	objPopupByID.style.left = xPos + 'px';
	objPopupByID.style.top = yPos + 'px';
	objPopupByID.style.visibility = 'visible';
}

function popHideByID() {
	if (objPopupByID) {
		objPopupByID.style.visibility = 'hidden';
		objPopupByID = null;
	}
}

var v_acc=0;
var v_pid=0;
var v_gmid=0;
var v_plabel="";
var v_npage=0;
var v_pnl=0;
var v_plsel=0;
var v_pnlseljob=0;

function setPopLabel(p_label) {
	v_plabel=p_label;
}

function spl(p_label) {
	v_plabel=p_label;
}

function popUpExt(id,objectID,acc_id,p_id,p_label) {
	v_acc=acc_id;
	v_pid=p_id;
	setPopLabel(p_label); 
	popUpByID(id,objectID);
}		

function getAccId() {
	return v_acc;
}

function getGmId() {
	return v_gmid;
}

function popUpExt1(id,objectID,acc_id,gm_id,p_label) {
	v_acc=acc_id;
	v_gmid=gm_id;
	setPopLabel(p_label);
	popUpByID(id,objectID);
}		

function popUpExt2(id,objectID,acc_id,p_id,p_label,npage) {
	v_acc=acc_id;
	v_pid=p_id;
	setPopLabel(p_label); 
	v_npage=npage;
	popUpByID(id,objectID);
}		

function popUpExt3(id,objectID,acc_id,pnl,pnlsel,pnlseljob,p_label) {
	v_acc=acc_id;
	v_pnl=pnl;
	v_pnlsel=pnlsel;
	v_pnlseljob=pnlseljob;
	v_plabel=p_label;
	popUpByID(id,objectID);
}		

function popupSubmit(frm,cmd,trg) {
	popHideByID();
	with (document.forms[frm]) {
		hqr.value = cmd;
		acc_id.value = v_acc_id;
		pid.value = v_pid;
		did.value = -1;
		target.value = trg;
		submit();	
	}
}

function popupLoad(div_name,ifr_name,url,cmd) {
	popHideByID();
	var obj = document.getElementById(div_name);
	obj.style.visibility = "visible";
	obj = document.getElementById(ifr_name);
	obj.src = url + v_pid;
}

function switchPopup(cur_div,cur_ifr,new_div,new_ifr,url) {
	var obj1 = window.parent.document.getElementById(cur_div);
	var obj2 =  window.parent.document.getElementById(new_div);
	obj2.style.position="absolute";
	obj2.style.left = obj1.style.left;
	obj2.style.top = obj1.style.top;
	obj2.style.width = obj1.style.width;
	obj2.style.height = obj1.style.height;
	alert("left:" + obj2.style.left + ", top:" + obj2.style.top + ", width:" + obj2.style.width + ", height:" + obj2.style.height);
	obj1.style.visibility = 'hidden';	
	obj2.style.visibility = "visible";
	var obj3 = window.parent.document.getElementById(new_ifr);
	obj3.src = url + v_pid;
}

function toggleCollapsibleMenu(objectID) {
	popHideByID();
	var object = document.getElementById(objectID);
	if (object.style.display == 'block') object.style.display = 'none';
	else object.style.display = 'block';
	return;
}

function pageHeight() {
	if (window.innerHeight) {
		return window.innerHeight;
	}
	if (document.body.clientHeight) {
		return document.body.clientHeight;
	}
	return (null);
}

function pageWidth() {
	if (window.innerWidth) {
		return window.innerWidth;
	}
	if (document.body.clientWidth) {
		return document.body.clientWidth;
	}
	return (null);
}

var current_container = null;
var current_ifrm = null;
var current_pos = new Array(4);

function openIframePopup(container, ifrm, left, top, width, height, src) {
	current_pos[0] = left;
	current_pos[1] = top;
	current_pos[2] = width;
	current_pos[3] = height;
	
	var p_width = pageWidth();
	var p_height = pageHeight();
	var ifr = document.getElementById(ifrm);
	ifr.src = src;
	ifr.style.visibility="visible";

	var idiv = document.getElementById(container);
	idiv.style.visibility="visible";

	if (width <= 0) width = p_width + (width * 2);
	if (height < 0) height = p_height + (height * 2);
	if ((height == 0) && (top > 0)) height = p_height - (top + 16);
	idiv.style.width = width + 'px';
	idiv.style.height = height + 'px';
	idiv.style.left = (left < 0) ? (((p_width - width) / 2) + 'px') : (left + 'px');
	idiv.style.top = (top < 0) ? (((p_height - height) / 2) + 'px') : (top + 'px');

	ifr.setAttribute("statut", "0");
	current_container = container;
	current_ifrm = ifrm;
}

function moveCurrentIframePopup() {
	if (current_container != null) {
		var left = current_pos[0];
		var top = current_pos[1];
		var width = current_pos[2];
		var height = current_pos[3];	
		var idiv = document.getElementById(current_container);
		var p_width = pageWidth();
		var p_height = pageHeight();
		if (width <= 0) width = p_width + (width * 2);
		if (height < 0) height = p_height + (height * 2);
		if ((height == 0) && (top > 0)) height = p_height - (top + 16);
		idiv.style.width = width + 'px';
		idiv.style.height = height + 'px';
		idiv.style.left = (left < 0) ? (((p_width - width) / 2) + 'px') : (left + 'px');
		idiv.style.top = (top < 0) ? (((p_height - height) / 2) + 'px') : (top + 'px');
	}
}

function closeIframePopup(container, ifrm) {
	var ifr = document.getElementById(ifrm);
	var state = ifr.getAttribute("statut");
	if (state == "1") {
		document.getElementById(container).style.visibility="hidden";
		ifr.style.visibility="hidden";
		ifr.src = "";
		ifr.setAttribute("statut", "0");
		current_container= null;
		current_ifrm = null;
	}
}

function closeCurrentIframePopup() {
	if (current_container) closeIframePopup(current_container, current_ifrm);
}
