var inputText = "";
function createBalloonEditor2(parentName, x, y, width, height,inputText) {
	if (window.opener.document.getElementById('notecontent').value == ""){
		if (inputText == null) inputText = "";
		inputText = inputText.replace(/<BR>/g, "\n");
		inputText = inputText.replace(/<br>/g, "\n");
		inputText = inputText.replace(/\s*\(.*\)\s*$/, "");
	}else
		inputText = window.opener.document.getElementById('notecontent').value;
	var innerHtml = "<center style='font-family: Tahoma ,arial, sans-serif;'>Scratch Paper<textarea id='notecontent' style='height:200px;width:290px;font-family:Arial;font-size;12;color:#333333;background-color:#fff0bb;' onkeydown='window.opener.document.getElementById(\"texts\").value = this.value; window.opener.document.getElementById(\"notecontent\").value = this.value' onkeyup='window.opener.document.getElementById(\"texts\").value = this.value; window.opener.document.getElementById(\"notecontent\").value = this.value'>"+inputText+"</textarea></center>"; 
	createEditor(parentName, x, y, width, height, innerHtml,2);
}
function newWindow() { 
	$('notecontent').disabled = true;
	$('notes_anchor').onclick_bk = $('notes_anchor').onclick;
	$('notes_anchor').onclick = '';
	window1 = window.open("", "Order", "width=300,height=250");
	window1.document.writeln("<html><head>"); 
	window1.document.writeln("<title>Scratch Paper</title>");
	window1.document.writeln("<script src='/javascripts/notes2.js' type='text/javascript'></script>");
	window1.document.writeln("</head>");
	window1.document.writeln("<Body bgcolor='ffffff' id='body'>");
	window1.document.writeln("<font style='font-family:Arial;font-size;12;color:333333;'>");
	window1.document.writeln("<script>");
	window1.document.writeln("createBalloonEditor2('body', 0, 0, 280, 228); ");
	window1.document.writeln("window.onbeforeunload  = function() {");
	window1.document.writeln("opener.document.getElementById('notecontent').disabled = false;");
	window1.document.writeln("opener.document.getElementById('notes_anchor').onclick = opener.document.getElementById('notes_anchor').onclick_bk;");	
	//window1.document.writeln("window.dispose();");	
	window1.document.writeln("}");
	window1.document.writeln("</script></font>");
	window1.document.writeln("</BODY></HTML>");
}
function createEditor(parentName, x, y, width, height, innerHtml, type) {
	var floating = document.createElement('div');
	floating.id = 'floatdiv';
	floating.style.position = 'absolute';
	var parent = document.getElementById(parentName);
	var divId = 'noteseditor';
	var oldDiv = document.getElementById(divId);
	if (oldDiv != null){
		new Effect.BlindUp(divId);
		oldDiv.parentNode.removeChild(oldDiv);
	}
	else{
		var div = document.createElement('div');
		div.id = divId;
		div.style.position = 'absolute';
		if (type != 2){
			div.style.left = '778px';
			div.style.top = '60px';
		}else{
			div.style.left = '0px';
			div.style.top = '0px';
		}
		div.style.height = height+'px';
		div.style.width = width+'px';
		div.style.border = "none";
		div.style.overflow = 'hidden';
		div.style.padding = "0";
		div.style.margin.top = '0px';
		if (type == 2) 
			div.style.display = 'block';
		else
			div.style.display = 'none';
			
		div.style.padding = '2px';
		div.style.background = 'none';
		div.style.zIndex = 2;
		div.innerHTML = innerHtml;		
		floating.appendChild(div);
		parent.appendChild(floating);
		if (type == 1){
			new Effect.BlindDown('noteseditor');
			float_menu();
		}
	}
}