function em_addstyle(textarea, blogcode){
	input = prompt("Entre el texto a formatear\n["+blogcode+"]xxx[/"+blogcode+"]", '');
	if(input!='' && input!=null){
		textarea.value += "["+blogcode+"]"+input+"[/"+blogcode+"]";
	}
	textarea.focus();
}

function em_addurl(textarea){
	input = prompt("Entre el URL\n[url]xxx[/url]", 'http://');
	if(input!='' && input!=null){
		textarea.value += "[url]"+input+"[/url]";
	}
	textarea.focus();
}

function em_addlink(textarea){
	input1 = prompt("Entre el URL\n[url=xxx]...[/url]", 'http://');
	if(input1!='' && input1!=null){
		input2 = prompt("Entre el nombre\n[url=...]xxx[/url]", '');
		if(input2!='' && input2!=null){
			textarea.value += "[url="+input1+"]"+input2+"[/url]";
		}
	}
	textarea.focus();
}

function em_addemail(textarea){
	input = prompt("Entre la dirección de e-mail\n[email]xxx[/email]", '');
	if(input!='' && input!=null){
		textarea.value += "[email]"+input+"[/email]";
	}
	textarea.focus();
}

function em_addimage(textarea){
	input = prompt("Entre el URL\n[img]xxx[/img]", 'http://');
	if(input!='' && input!=null){
		textarea.value += "[img]"+input+"[/img]";
	}
	textarea.focus();
}

function em_linkout(){ 
	if(!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	for(var i=0; i<anchors.length; i++){
		var anchor = anchors[i];
		if(anchor.getAttribute("href") && anchor.getAttribute("rel") == "external"){
			anchor.target = "_blank"; 
		} 
	}
} 
// window.onload = em_linkout;
