var callbackVisualEditor = "";
function startVisualEditor(width, height, resolution, type, mentionsImprimeur, mentionsVoiePublique, idProdSess, idClient, callback){
	//On créé le div qui affichera  l'iframe contenant l'éditeur
	var divNoir = document.createElement("div");
	var leDiv = document.createElement("div");
	
	
	
	divNoir.id = "divNoir_visualEditor";
	divNoir.style.position = "absolute";
	divNoir.style.zIndex = "1000";
	divNoir.style.backgroundColor = "#FFFFFF";
	divNoir.style.left = "0px";
	divNoir.style.top = "0px";
	divNoir.style.width = "100%";
	divNoir.style.height = "100%";
	divNoir.style.opacity = "0.75";
	divNoir.style.filter = "alpha(opacity:75)";
	
	leDiv.id = "divPrinc_visualEditor";
	leDiv.style.position = "absolute";
	leDiv.style.zIndex = "1001";
	leDiv.style.border = "1px solid black";
	leDiv.style.backgroundColor = "#FFFFFF";
	leDiv.style.left = "2.5%";
	leDiv.style.top = "4%";
	leDiv.style.width = "95%";
	leDiv.style.height = "92%";
	leDiv.innerHTML = "<iframe src=\"js/visualEditor/editor.php?width=" + width + "&height=" + height + "&resolution=" + resolution + "&type=" + type + "&idProdSess=" + idProdSess + "&mentionsImprimeur=" + mentionsImprimeur + "&mentionsVoiePublique=" + mentionsVoiePublique + "&idClient=" + idClient + "\" width=\"100%\" height=\"100%\" border=\"0\" scrolling=\"no\" style=\"border:0px;overflow:hidden;\" id=\"visualEditorFrameID\"></iframe>";
	
	callbackVisualEditor = callback;
	
	window.document.body.appendChild(divNoir);
	window.document.body.appendChild(leDiv);
	
	var bodyElt = document.getElementsByTagName("body")[0];
	if(bodyElt){
		bodyElt.style.overflow = "hidden";
	}
	
	scroll(0,0);
}

function closeVisualEditor(edited){
	var divNoir = document.getElementById("divNoir_visualEditor");
	var leDiv = document.getElementById("divPrinc_visualEditor");
	
	window.document.body.removeChild(divNoir);
	window.document.body.removeChild(leDiv);
	
	var bodyElt = document.getElementsByTagName("body")[0];
	if(bodyElt){
		bodyElt.style.overflow = "auto";
	}
	
	if(callbackVisualEditor != "" && callbackVisualEditor != null && callbackVisualEditor != "NULL"){
		eval(callbackVisualEditor + "(" + edited + ");");
	}
}
