/*
#############################################################
             
Purpose:  	Popup WYSIWYG Editor to edit HTML content
Inputs:		DOM element
Outputs:	HTML
Errors:		None
Assumptions:DOm element is supports either innerHTML or elem.value.
Notes:		This Editor onlys works in IE 5+ browsers, Netscape is not supported

Updates:	Date		Author			    Description
			01/18/2001	Michael Bartha		created
			01/25/2001	Michael Bartha		added editor path parameter

#############################################################
*/
var win = null;
var targetElem = null;
var editorSetup = new editor;
var strEditorContent = "";

function copyFromEditor(str) {
	//editor calls this function to copy HTML back to this window
	//alert(targetElem.name);
	//added by Ramazan
	str = str.replace(/\"/g,"'");
	if(str == "<P>&nbsp;</P>")
		str = "";
	targetElem.value = "" + str;//.replace(/\"/g,"'");
	
	
}

function editor(path,parameters) {
	this.path = path || 'popupEditor.html';
	this.parameters = parameters || 'top=0,left=360,width=610,height=460,resizable=yes,toolbar=no,location=no';
}



function openEditor(elem) {
	targetElem = elem;
	
	strEditorContent = targetElem.value;
	
	if(!win) {
		win = window.open(editorSetup.path,"",editorSetup.parameters);
	}
	else {
		win.copyToEditor(strEditorContent);
		win.focus();
	}
	
}