/////////////////////////////////////
function AniadirFavoritos() {
 window.external.AddFavorite("http://duroFelguera.rodiles.com/index.asp", "Duro Felguera");
}
/////////////////////////////////////
function Imprimir() {
  window.print();
}
/////////////////////////////////////
function irA(idMenu,idRecurso) {
 if (idRecurso==0) {
  location.href="index.asp";
 } else {
  var direccion="index.asp?MP="+idMenu;
  location.href=direccion;
 }
}

/////////////////////////////////////
function volver() {
 history.back(-1);
}
///////////////////////////////////////////////////////////

function CambiarCSS(accion){

	 var cssAnterior = document.getElementById("cssPortal").href;
	 if (accion == "mas") {
		 switch (cssAnterior) {
		 	case "css/portal/portal.css":
				document.getElementById("cssPortal").href = "css/portal/portal_xl.css";
			break;

			case "css/portal/portal_s.css":
				document.getElementById("cssPortal").href = "css/portal/portal.css";
			break;
		 }
	 }else if (accion == "menos") {
	 	switch (cssAnterior) {
		 	case "css/portal/portal.css":
				document.getElementById("cssPortal").href = "css/portal/portal_s.css";
			break;

		 	case "css/portal/portal_xl.css":
				document.getElementById("cssPortal").href = "css/portal/portal.css";
			break;
		 }
	 }
}
////////////////////////////////////////////////////////////////////////////////

function abrirAsociacion(iAportacion)
{
	windowa = window.open('popup/asociardoc.asp?idAportacion=' + iAportacion,'AsociarImagen','resizable=no, top=80, left=180, width=350, height=150, status=no');
}

////////////////////////////////////////////////////////////////////////////////
//Esta función vacía la caja de texto del formulario de Comunidades Virtuales
function borrarComentario()
{
	document.getElementById("textoAportacion").value = '';
}


/////////////////////////////////////////////////////////////////////////////
function ConsultarEmpresas(sFormulario,iLineaNegocio,idEmpresaBuscar){ 

    	document.frames.cargardatos.RecargarEmpresas(iLineaNegocio);
	    document.forms[sFormulario].empresa.options[0].text="Cargando datos ..."
	    setTimeout("CargarEmpresas('"+sFormulario+"',0, '"+idEmpresaBuscar+"');",500);     
}


//Carga las actividades empresariales
function CargarEmpresas(sFormulario, iLineaNegocio, idEmpresa2){
	
	//Llama a la función tantas veces como sea necesario hasta que se cargue el iframe con los datos
	//Así evita las posibles rupturas de la página
	if (!document.frames["cargardatos"].loaded){
	    setTimeout("CargarEmpresas('"+sFormulario+"', "+iLineaNegocio+", '"+idEmpresa2+"')",100);
	    return;
	}
	
    	document.forms[sFormulario].empresa.options[0].text="Cargando datos ..."
    	var oArrayEmpresas = document.frames["cargardatos"].aEmpresas;
      
       //Vaciamos el array antes de recargarlo.
              document.forms[sFormulario].empresa.options.length=1;      
   
                for(i=0;i<oArrayEmpresas.length;i++){                	
	     	document.forms[sFormulario].empresa.options[i+1] = new Option(oArrayEmpresas[i][1],oArrayEmpresas[i][0]);
	     	//if (oArrayEmpresas[i][0] == iLineaNegocio){
			if (oArrayEmpresas[i][0] == idEmpresa2){
	  		document.forms[sFormulario].empresa.options[i+1].selected = true; 
	                }
	}
    	//Cuando termina de cargar, el primer elemento es "Seleccione"
    	document.forms[sFormulario].empresa.options[0].text="- Seleccione -";           
}

function confirmarBorrado(oForm) {
	var bOk = confirm("¿Esta seguro de que desea borrar ese elemento?");
	
	// Deshabilitar la validación del formulario
	if(bOk && document.getElementById(oForm))
		document.getElementById(oForm).onsubmit=function() {return true;};
	
	return bOk;
}