function confirmLink(theLink, theText){
    if (theText == '' || typeof(window.opera) != 'undefined') {
        return true;
    }
    var is_confirmed = confirm(theText);
    if (is_confirmed) {
        theLink.href += '&confirmado=1';
    }
    return is_confirmed;
}

function doPreview(wich, where){
	var objFile = document.getElementById(wich);
	var objImg = document.getElementById(where);
	objImg.src = objFile.value;
}

function openW(mypage,myname,w,h,features){
	if(screen.width){
		var winl = (screen.width-w)/2;
		var wint = (screen.height-h)/2;
	} else {
		winl = 0;wint =0;
	}
	if (winl < 0) winl = 0;
	if (wint < 0) wint = 0;

	var settings = 'height=' + h + ',';
	settings += 'width=' + w + ',';
	settings += 'top=' + wint + ',';
	settings += 'left=' + winl + ',';
	settings += features;

	win = window.open(mypage,myname,settings);
	win.window.focus();
}

function getOptions(seccion){
	window.frames['iframeOculto'].location = 'carga_dinamica.php?seccion='+seccion;
}

function fillSelect(arrOptions){
	var cantidad = arrOptions.length;
	var mi_objeto = document.frmCompendios.subseccion;
	
	mi_objeto.options.length = 0;
	
	for (i = 0; i < cantidad; i++){
		mi_objeto.options[i] = new Option(arrOptions[i].nombre);
		mi_objeto.options[i].value = arrOptions[i].id;
	}
	mi_objeto.options[0].selected = true;
}
//------------------------------------------------------------------------
function nueva_opcion(objeto,nombre,codigo){
  	var obj = document.getElementById(objeto);
	var ind = obj.options.length;

	obj.options[ind] = new Option(nombre,codigo);
	obj.options[ind].selected = true;
}
//------------------------------------------------------------------------
function openWin(ventana,popW,popH,nombre_ventana){
	if (nombre_ventana == undefined){
		var nom = 'Window';
	} else {
		var nom = nombre_ventana;
	}
	var w = 0, h = 0;

   	w = screen.width;
   	h = screen.height;

	var leftPos = (w-popW)/2, topPos = (h-popH)/2;
	
    popupWindow=open(''+ventana+'',nom,'resizable=no,scrollbars=yes,width='+popW+',height='+popH+',top='+topPos+',left='+leftPos);
    if (popupWindow.opener == null)
		popupWindow.opener = self;
}