function setBorde(){
	event.toElement.className="borde";
}
function setNormal(){
	event.fromElement.className="sinborde";
}

function setVisible(){
	document.forms[0].editor.className="visible";
	document.forms[0].txtHTML.className="invisible";
	document.forms[0].editor.DocumentHTML = document.forms[0].txtHTML.value;
}
function setInvisible(){
	document.forms[0].editor.className="invisible";
	document.forms[0].txtHTML.className="visible";
	document.forms[0].txtHTML.value = document.forms[0].editor.DocumentHTML;
}

function cut(){
	document.forms[0].editor.ExecCommand(5003);
}
function copy(){
	document.forms[0].editor.ExecCommand(5002);
}
function paste(){
	document.forms[0].editor.ExecCommand(5032);
}
function undo(){
	document.forms[0].editor.ExecCommand(5049);
}
function redo(){
	document.forms[0].editor.ExecCommand(5033);
}
function left(){
	document.forms[0].editor.ExecCommand(5025);
}
function center(){
	document.forms[0].editor.ExecCommand(5024);
}
function right(){
	document.forms[0].editor.ExecCommand(5026);
}
function justify(){
	//document.forms[0].editor.ExecCommand(5026);
	var rango = document.forms[0].editor.DOM.selection;
	alert(rango.type);
	//alert(rango.getParentElement.tagName);
	
	 range = rango.createRange();
	 alert( range.innerHTML );
	 
     //alert( range.htmlText );
	 //alert( range.getParentElement.tagName );
	 
	 //range.collapse;
     //alert( range.parentElement.outerHTML);
	
	/*
	var rango = document.forms[0].editor.DOM.selection.createRange();
	rango.pasteHTML("<table width=\"100%\" border=\"1\"><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr></table>");
	rango.collapse = false;
	rango.select;
	*/
	
	/*
	' This reduces the selection to just the insertion
         ' point. The parentElement method will then return the 
         ' element directly under the mouse pointer.
         Set rg = DHTMLEdit1.DOM.selection.createRange
         rg.collapse
         MsgBox rg.parentElement.outerHTML
	*/
	
	
	
	//alert(rango.parentElement.tagName);
	
	//alert(rango.parentElement.tagName);
	
	//if(rango.type == "Control"){
		//var control = document.forms[0].editor.DOM.selection.createControlRange();
        //alert(control.commonParentElement.outerHTML);
		//alert(control.parentElement.tagName);
	//}
}
function bullist(){
	document.forms[0].editor.ExecCommand(5051);
}
function numlist(){
	document.forms[0].editor.ExecCommand(5030);
}
function indent(){
	document.forms[0].editor.ExecCommand(5018);
}
function outdent(){
	document.forms[0].editor.ExecCommand(5031);
}
function link(){
	document.forms[0].editor.ExecCommand(5016);
}



function bold(){
	document.forms[0].editor.ExecCommand(5000);
}
function italic(){
	document.forms[0].editor.ExecCommand(5023);
}
function underline(){
	document.forms[0].editor.ExecCommand(5048);
}
function table(){
	var rango = document.forms[0].editor.DOM.selection.createRange();
	rango.pasteHTML("<table width=\"100%\" border=\"1\"><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr></table>");
	rango.collapse = false;
	rango.select;
}

function iniciar(){
	document.forms[0].editor.ShowBorders=-1;
}

function setHTML(html){
	document.forms[0].editor.DocumentHTML = html;	
}
function getHTML(){
	return document.forms[0].editor.DocumentHTML;	
}
function getHTMLBody(){
	var html = document.forms[0].editor.DocumentHTML;
	//html = html.toLowerCase();
	var body ="";
	p1 = html.indexOf("<BODY");
	if(p1>0){
		p1 = html.indexOf(">", p1+1);
		p2 = html.indexOf("</BODY");
		body = html.substring(p1+1,p2);
	}
	return body;
}

function fuente(){
	document.forms[0].editor.ExecCommand(5009);
}
function color(){
	alert(document.forms[0].editor.ExecCommand(5010));
}
function propiedades(){
	document.forms[0].editor.ExecCommand(5052);
}