var lock = false;
var not_allow = false;
//var not_allow = true;

function short_edit_off(){
        not_allow = true;
	document.all.fly.style.display='none'
	setTimeout('not_allow = true',1000);
}

function switch_htm(){
	var f = document.all.fly;
	var buf = null;
	if(f.ed_mode == null || f.ed_mode == 'htm'){
	buff = f.innerHTML;
	f.innerText = buff;
	f.ed_mode = 'text';
	}
	else{
	buff = f.innerText;
	f.innerHTML = buff;
	f.ed_mode = 'htm';
	}
}
function edit_content(){
	lock = true;
	ob = window.event.srcElement
	ob.style.filter = "";
	ob.contentEditable  = true;
	ob.innerHTML = "<table border=0 style=border-collapse:collapse  height=121><tr><td width=100 height=121><p align=center><font face=Wingdings size=6>6</font></td></tr></table>	";
	
	//ob.innerHTML = ob.par.innerHTML;
	ob.focus();
	var f=document.gc_form;
	f.cid.value = ob.ref;
	f.f.value = ob.p;
	f.act.value = 'get';
	f.submit();

}
function show_html(){
	window.event.cancelBubble = false;
	var w1 = window.open("","_blank",'status=no,width=500,height=400,left=10,top=10');

	w1.document.write('<body topmargin="0" leftmargin="0">\\n');
	w1.document.write('<TEXTAREA STYLE="height:100%; width:100%; background-color:white; padding:3; border:inset #99ccff 0px; scrollbar-base-color:#99ccff; overflow=auto;">');
	w1.document.write(document.all.fly.innerHTML);
	w1.document.write('</TEXTAREA>');
	w1.close;
	return false;
}
function final_edit(){
	ob = window.event.srcElement
	//ob.contentEditable  = false;
	var fin_cont = ob.innerHTML;
	if(confirm('Guardar cambios?')){
	//alert(ob.tagName)
	var f=document.gc_form;
	f.cid.value = ob.ref;
	f.f.value = ob.p;
	f.c.value = document.all.fly.innerHTML;
	f.act.value = 'update';
	//alert(fin_cont)
	
        pDiv = document.createElement("DIV");
        pDiv.p = ob.p;
        pDiv.ref = ob.ref;
        pDiv.id = 'ce';
        pDiv.innerHTML = fin_cont;
        ob.par.innerHTML = ""; 
        
        ob.par.replaceNode(pDiv);
	
        //document.body.insertBefore(pDiv,ob.p);  
	//document.all.tt.innerHTML = fin_cont; 
	//ob.par.innerHTML = fin_cont; 
	
	f.submit();
	}
 	cansel_edit();
}
function cansel_edit(){
	ff = document.all.fly
	ff.contentEditable  = false;
	ff.innerText='';
	ff.style.filter='alpha(opacity=50)';
	
	lock = false;
	document.all.fly.style.display = 'none'

}

