/*************************************************************************************
Funções em Javascript para o editor
**************************************************************************************/
//Função para Trocar Imagens
function TrocaImg(imagem,tipo){ 
 if(tipo==1){
  eval("document.images."+ imagem +".src = '../images/admin/"+ imagem +".gif'");	
	}else if(tipo==2){
		eval("document.images."+ imagem +".src = '../images/admin/"+ imagem +"_on.gif'");	
	}
} 
//Inserir HTML no ActiveX
function InserirHTML(editor,html){
  var Editor = "";				
		eval('document.all.'+ editor +'.DOM.selection.clear()');				
		eval('document.all.'+ editor +'.DOM.selection.createRange().pasteHTML("'+ html +'")');		
		Editor = eval('document.all.'+ editor +'.DOM.parentWindow');
		Editor.document.focus();
}
//Inserir HTML no Body
function InserirHTMLBody(editor,html){
  var Editor = "";								
		Editor = eval('document.all.'+ editor +'.DOM.parentWindow');
		Editor.document.all.tags("BODY")[0].innerHTML = Editor.document.all.tags("BODY")[0].innerHTML + html
		Editor.document.focus();
}

//Negrito
function Negrito(editor){
  var Editor = "";
		Editor = eval('document.all.'+ editor +'.DOM.parentWindow');
  Editor.document.execCommand('Bold');
		Editor.document.focus();
}
//Italico
function Italico(editor){
  var Editor = "";
		Editor = eval('document.all.'+ editor +'.DOM.parentWindow');
  Editor.document.execCommand('Italic');
		Editor.document.focus();
}
//Sublinhado
function Sublinhado(editor){
  var Editor = "";
		Editor = eval('document.all.'+ editor +'.DOM.parentWindow');
  Editor.document.execCommand('Underline');
		Editor.document.focus();
}
//Riscado
function Riscado(editor){
  var Editor = "";
		Editor = eval('document.all.'+ editor +'.DOM.parentWindow');
  Editor.document.execCommand('StrikeThrough');
		Editor.document.focus();
}
//Alinhar a Esquerda
function AlinharEsquerda(editor){
  var Editor = "";
		Editor = eval('document.all.'+ editor +'.DOM.parentWindow');
  Editor.document.execCommand('JustifyLeft');
		Editor.document.focus();
}
//Alinhar a Direita
function AlinharDireita(editor){
  var Editor = "";
		Editor = eval('document.all.'+ editor +'.DOM.parentWindow');
  Editor.document.execCommand('JustifyRight');
		Editor.document.focus();
}
//Alinhar ao Centro
function AlinharCentro(editor){
  var Editor = "";
		Editor = eval('document.all.'+ editor +'.DOM.parentWindow');
  Editor.document.execCommand('JustifyCenter');
		Editor.document.focus();
}
//Alinhar Justificado
function AlinharJustificado(editor){
  var Editor = "";
		Editor = eval('document.all.'+ editor +'.DOM.parentWindow');
  Editor.document.execCommand('JustifyFull');
		Editor.document.focus();
}
//Lista
function Lista(editor){
  var Editor = "";
		Editor = eval('document.all.'+ editor +'.DOM.parentWindow');
  Editor.document.execCommand('insertunorderedlist');
		Editor.document.focus();
}
//Lista Ordenada
function ListaOrdenada(editor){
  var Editor = "";
		Editor = eval('document.all.'+ editor +'.DOM.parentWindow');
  Editor.document.execCommand('insertorderedlist');
		Editor.document.focus();
}
//Indent
function Indent(editor){
  var Editor = "";
		Editor = eval('document.all.'+ editor +'.DOM.parentWindow');
  Editor.document.execCommand('Indent');
		Editor.document.focus();
}
//Outdent
function Outdent(editor){
  var Editor = "";
		Editor = eval('document.all.'+ editor +'.DOM.parentWindow');
  Editor.document.execCommand('Outdent');
		Editor.document.focus();
}
//Cor de Fundo
function BackColor(editor) {
	var Editor = "";
	Editor = eval('document.all.'+ editor +'.DOM.parentWindow');
	Editor.document.execCommand('backcolor', 'teste', '0000FF');
	/*var backColor = showModalDialog("editor_cores.asp", "", "font-family:Verdana; font-size:12; dialogWidth: 250pt; dialogHeight: 185pt");
	if(backColor != null) {
		Editor.document.execCommand('backcolor', '', backColor);
		Editor.document.focus();
	}*/
}
//Cor da Fonte
function FontColor(editor) {
	var Editor = "";
	Editor = eval('document.all.'+ editor +'.DOM.parentWindow');
	Editor.document.execCommand('forecolor', 'teste', '0000FF');
	/*var foreColor = showModalDialog("../popup/popup_cores.asp", "", "font-family:Verdana; font-size:12; dialogWidth: 250pt; dialogHeight: 185pt");
	if(foreColor != null) {
		Editor.document.execCommand('forecolor', '', foreColor);
		Editor.document.focus();
	}*/
}
//Tipo de fonte
function FontName(editor,fonte){
  var Editor = "";
		Editor = eval('document.all.'+ editor +'.DOM.parentWindow');
  Editor.document.execCommand('fontname','',fonte);
		Editor.document.focus();
}
//Tamanho de fonte
function FontSize(editor,fonte){
  var Editor = "";
		Editor = eval('document.all.'+ editor +'.DOM.parentWindow');
  Editor.document.execCommand('fontsize','',fonte);
		Editor.document.focus();
}
//Criar Link
function CreateLink(editor){
  var Editor = "";
		Editor = eval('document.all.'+ editor +'.DOM.parentWindow');
  Editor.document.execCommand('CreateLink');
		Editor.document.focus();
}
//Subscript
function Subscript(editor){
  var Editor = "";
		Editor = eval('document.all.'+ editor +'.DOM.parentWindow');
  Editor.document.execCommand('Subscript');
		Editor.document.focus();
}
//Superscript
function Superscript(editor){
  var Editor = "";
		Editor = eval('document.all.'+ editor +'.DOM.parentWindow');
  Editor.document.execCommand('Superscript');
		Editor.document.focus();
}
//Recortar
function Cut(editor){
  var Editor = "";
		Editor = eval('document.all.'+ editor +'.DOM.parentWindow');
  Editor.document.execCommand('Cut');
		Editor.document.focus();
}
//Copiar
function Copy(editor){
  var Editor = "";
		Editor = eval('document.all.'+ editor +'.DOM.parentWindow');
  Editor.document.execCommand('Copy');
		Editor.document.focus();
}
//Paste
function Paste(editor){
  var Editor = "";
		Editor = eval('document.all.'+ editor +'.DOM.parentWindow');
  Editor.document.execCommand('Paste');
		Editor.document.focus();
}
//Undo
function Undo(editor){
  var Editor = "";
		Editor = eval('document.all.'+ editor +'.DOM.parentWindow');
  Editor.document.execCommand('Undo');
		Editor.document.focus();
}
//Undo
function Redo(editor){
  var Editor = "";
		Editor = eval('document.all.'+ editor +'.DOM.parentWindow');
  Editor.document.execCommand('Redo');
		Editor.document.focus();
}
//Selecionar tudo
function SelectAll(editor){
  var Editor = "";
		Editor = eval('document.all.'+ editor +'.DOM.parentWindow');
  Editor.document.execCommand('SelectAll');
		Editor.document.focus();
}
//Remover formatação
function RemoveFormat(editor){
  var Editor = "";
		Editor = eval('document.all.'+ editor +'.DOM.parentWindow');
  Editor.document.execCommand('RemoveFormat');
		Editor.document.focus();
}
//Linha Horizontal
function LinhaHorizontal(editor){
  var Editor = "";
		Editor = eval('document.all.'+ editor +'.DOM.parentWindow');
  Editor.document.execCommand('InsertHorizontalRule');
		Editor.document.focus();
}