function insertafoto(newfoto){
newfoto="../../fotos/mediana/"+newfoto;//creo el path de la foto selecionada
dato='<br><br><table width=600 cellspacing=0><tr><th scope=col><img src='+newfoto+'></th><th scope=col> </th></tr></table><br>';
//window.opener.document.noticias.texto.value+=dato; //el .document. es fundamental para firefox! sinó no anda!
var aTag = dato;
var eTag = " ";
var input = window.opener.document.noticias.texto;//el .document. es fundamental para firefox! sinó no anda!
input.focus();
//FOR IE
if (typeof document.selection != 'undefined') {
var range = window.opener.document.selection.createRange();
var insText = range.text;
range.text = aTag + insText + eTag;
range = window.opener.document.selection.createRange();
if (insText.length == 0) {
range.move('character', -eTag.length);
} else {
range.moveStart('character', aTag.length + insText.length + eTag.length);
}
range.select();
} else {
// FOR Gecko Browser
if (typeof input.selectionStart != 'undefined') {
var start = input.selectionStart;
var end = input.selectionEnd;
var insText = input.value.substring(start, end);
input.value = input.value.substr(0, start) + aTag + insText + eTag + input.value.substr(end);
var pos;
if (insText.length == 0) {
pos = start + aTag.length;
} else {
pos = start + aTag.length + insText.length + eTag.length;
}
input.selectionStart = pos;
input.selectionEnd = pos;
}
}
self.close();
}//end function