<!--

var _jslib_isIE=document.all?true:false;
var _jslib_isNS=document.layers?true:false;
var _jslib_isNS6=document.getElementById&&!document.all?true:false;

function jsGetObject(name) {
    if(_jslib_isIE) {
        return document.all[name];
    } else if(_jslib_isNS) {
        return document.layers[name];
    } else if (_jslib_isNS6) {
        return document.getElementById(name);
    }
    
    return null;
}

//funciones varias para el portal ....
function personaliza_portal(id_sede, ruta){
	var imagenCabecera = "", imagenTitulo = "", lototipoTerritorial = "", territorial = "", direccion = "", urlInicio = "";
	switch(id_sede){
		case 1:
			imagenCabecera = ruta + "graf/territoriales/img_asempal.jpg";
			imagenTitulo = ruta + "graf/territoriales/tit_asempal.jpg";
			territorial = "Portal de Innovaci&#243;n :: Confederaci&#243;n Empresarial de la provincia de Almer&iacute;a";			
			document.title = "Portal de Innovacion :: Confederacion Empresarial de la provincia de Alemeria";
			logotipoTerritorial = ruta + "graf/territoriales/logo_almeria.gif";
			logotipoTerritorial = "<img src="+logotipoTerritorial+" alt="+territorial+"><br>";
			direccion = "Paseo de Almer&iacute;a, 69 - 7&#170; <br/>04001 - ALMER&Iacute;A<BR/>Telfs.: 950 62 10 80<BR/>Fax: 950 62 13 02<BR/>E-mail: asempal@asempal.es <BR/>"; 
			urlInicio = "<a href='http://www.asempal.es'>ASEMPAL :: </a>";
			break;
		case 2:
			imagenCabecera = ruta + "graf/territoriales/img_cec.jpg";
			imagenTitulo = ruta + "graf/territoriales/tit_cec.jpg";
			territorial = "Portal de Innovaci&#243;n :: Confederaci&#243;n de Empresarios de la provincia de C&aacute;diz";			
			document.title = "Portal de Innovacion :: Confederacion de Empresarios de la provincia de Cadiz";
			logotipoTerritorial = ruta + "graf/territoriales/logo_cadiz.gif";
			logotipoTerritorial = "<img src="+logotipoTerritorial+" alt="+territorial+"><br>";
			direccion = "Avda. Marconi, 37. <br/>11011 C&Aacute;DIZ<BR/>Telfs.: 956 29 09 19<BR/>Fax: 956 29 09 50<BR/>E-mail: info@ceccadiz.org <BR/>"; 
			urlInicio = "<a href='http://www.ceccadiz.org'>CEC :: </a>";
			break;
		case 3:
			imagenCabecera = ruta + "graf/territoriales/img_ceco.jpg";
			imagenTitulo = ruta + "graf/territoriales/tit_ceco.jpg";
			territorial = "Portal de Innovaci&#243;n :: Confederaci&#243;n de Empresarios de C&#243;rdoba";			
			document.title = "Portal de Innovacion :: Confederacion de Empresarios de Cordoba";
			logotipoTerritorial = ruta + "graf/territoriales/logo_cordoba.gif";
			logotipoTerritorial = "<img src="+logotipoTerritorial+" alt="+territorial+"><br>";
			direccion = "Avd. Gran Capit&aacute;n 12 - 2&#170; <br/>14001 C&Oacute;RDOBA <BR/>Tel&eacute;fono:957 478 443 <BR/>Fax: 957 478 819 <BR/>E-mail: ceco@ceco-cordoba.es <BR/>"; 
			urlInicio = "<a href='http://www.ceco-cordoba.es'>CECO :: </a>";
			break;
		case 4:
			imagenCabecera = ruta + "graf/territoriales/img_cge.jpg";
			imagenTitulo = ruta + "graf/territoriales/tit_cge.jpg";
			territorial = "Portal de Innovaci&#243;n :: Confederaci&#243;n Granadina de Empresarios";			
			document.title = "Portal de Innovacion :: Confederacion Granadina de Empresarios";
			logotipoTerritorial = ruta + "graf/territoriales/logo_granada.gif";
			logotipoTerritorial = "<img src="+logotipoTerritorial+" alt="+territorial+"><br>";
			direccion = "C/. Maestro Montero, 23. 18004 GRANADA <BR/>Telfs.: 958 53 50 41 <BR/> Fax: 958 53 50 42<BR/>E-mail: cge@cea.es <BR/>";
			urlInicio = "<a href='http://www.cge.es'>CGE :: </a>";
			break;
		case 5:
			imagenCabecera = ruta + "graf/territoriales/img_foe.jpg";
			imagenTitulo = ruta + "graf/territoriales/tit_foe.jpg";
			territorial = "Portal de Innovaci&#243;n :: Federaci&#243;n Onubense de Empresarios";			
			document.title = "Portal de Innovacion :: Federacion Onubense de Empresarios";
			logotipoTerritorial = ruta + "graf/territoriales/logo_huelva.gif";
			logotipoTerritorial = "<img src="+logotipoTerritorial+" alt="+territorial+"><br>";
			direccion = "Avda. de la R&iacute;a, 3, Aptdo. Correos, 17<br/> 21001, HUELVA<BR/>Telfs.: 959 20 83 00<BR/>Fax: 959 20 83 10<BR/>E-mail: info@foe.es <BR/>"; 
			urlInicio = "<a href='http://www.foe.es'>FOE :: </a>";
			break;
		case 6:
			imagenCabecera = ruta + "graf/territoriales/img_cej.jpg";
			imagenTitulo = ruta + "graf/territoriales/tit_cej.jpg";
			territorial = "Portal de Innovaci&#243;n :: Confederaci&#243;n de Empresarios de Ja&eacute;n";			
			document.title = "Portal de Innovacion :: Confederacion de Empresarios de Jaen";
			logotipoTerritorial = ruta + "graf/territoriales/logo_jaen.gif";
			logotipoTerritorial = "<img src="+logotipoTerritorial+" alt="+territorial+"><br>";
			direccion = "Paseo de la Estaci&oacute;n 30,8a planta<BR/>CP 23003 Ja&eacute;n <BR/>Tfno: 953.29.40.22 <BR/>Fax: 953.29.40.24 <BR/>"; 
			urlInicio = "<a href='http://www.cej.es'>CEJ :: </a>";
			break;
		case 7:
			imagenCabecera = ruta + "graf/territoriales/img_cem.jpg";
			imagenTitulo = ruta + "graf/territoriales/tit_cem.jpg";
			territorial = "Portal de Innovaci&#243;n :: Confederaci&#243;n de Empresarios de M&aacute;laga";			
			document.title = "Portal de Innovacion :: Confederacion de Empresarios de Malaga";
			logotipoTerritorial = ruta + "graf/territoriales/logo_malaga.gif";
			logotipoTerritorial = "<img src="+logotipoTerritorial+" alt="+territorial+"><br>";
			direccion = "San Lorenzo 20 29001 M&Aacute;LAGA<BR/>Telfs.: 952 06 06 23<BR/>Fax: 952 06 01 40<BR/>E-mail: info@cem-malaga.es <BR/>"; 
			urlInicio = "<a href='http://www.cem-malaga.es'>CEM :: </a>";
			break;
		case 8:
			imagenCabecera = ruta + "graf/territoriales/img_ces.jpg";
			imagenTitulo = ruta + "graf/territoriales/tit_ces.jpg";
			territorial = "Portal de Innovaci&#243;n :: Confederaci&#243;n de Empresarios de Sevilla";			
			document.title = "Portal de Innovacion :: Confederacion de Empresarios de Sevilla";
			logotipoTerritorial = ruta + "graf/territoriales/logo_sevilla.gif";
			logotipoTerritorial = "<img src="+logotipoTerritorial+" alt="+territorial+"><br>";
			direccion = "Avda. Rep&uacute;blica Argentina, 25, Plta. 4&#186;<br/> 41011, SEVILLA<BR/>Telfs.: 954 99 11 00<BR/>Fax: 954 99 11 02<BR/>E-mail: info@cesevilla.es <BR/>"; 
			urlInicio = "<a href='http://www.cesevilla.es'>CES :: </a>";
			break;
		case 9:
			imagenCabecera = ruta + "graf/img_cea.jpg";
			imagenTitulo = ruta + "graf/logo_innocea.gif";
			territorial = "Portal de Innovaci&oacute;n :: Confederaci&oacute;n de Empresarios de Andaluc&iacute;a";
			document.title = "Portal de Innovacion :: Confederacion de Empresarios de Andalucia";
			logotipoTerritorial = "";
			direccion = ""; 
			urlInicio = "<a href='http://www.cea.es'>CEA :: </a>";
			if(typeof(document.all["mapa"]) != "undefined")
				document.all["mapa"].style.display = '';
			break;
		default:
	}
	/* NUEVO DISEÑO */	
	var obj = jsGetObject("imgCabecera");  
	obj.style.backgroundImage="url("+imagenCabecera+")";
	obj = jsGetObject("imgLogo");  
	obj.style.backgroundImage="url("+imagenTitulo+")";
	obj = jsGetObject("logoTerritorial");  
	obj.innerHTML = logotipoTerritorial + direccion;
	
	/* PORTAL CON EL DISEÑO ANTIGUO 
	document.all["cabecera"].style.backgroundImage="url("+imagenCabecera+")";
	document.all["cabecera"].innerHTML = urlInicio + document.all["cabecera"].innerHTML;
	document.all["nombreTerritorial"].innerHTML = territorial;*/
}

function alternar_img(nombre,fuente) {
    nombre.src = fuente;
}

function alternar_img2(nombre,fuente) {
	alert(nombre);    
	alert(funte);
}

function ampliar_imagen(direccion) {
	window.open (direccion, 'imagen','height=425,width=500,scrollbars=no,top=65,left=140');
}

function checkYear(year) { 
	return (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) ? 1 : 0;
}

function fecha_a_texto(fecha){
  //implementar 
}

function lanza_noticias_mes(nivel){
	var ADate = new Date();
	var AMonth = ADate.getUTCMonth() + 1;
	var AYear = ADate.getUTCFullYear();
	var AMonthStr = '';
	
	if (String(AMonth).length == 1) {
		AMonthStr = "0" + AMonth;
	} else {
		AMonthStr = AMonth
	}
	document.location.replace(nivel + "noticias/noticias_buscador_mes.aspx?pos_comienzo=1&amp;pos_fin=10&amp;bus_anio_mes=" + AYear + "/" + AMonthStr + "/" + "&amp;bus_titulo="); 
}

function validarformulario(campos){
	for(i=0;i<campos.length;i++){
		obj=eval("document.f."+campos[i]);
		if (obj.value == ""){
			alert("Ha de rellenar el campo ["+obj.name+"]");
			obj.focus();
			return;
		}
	}
	document.f.submit();
}

function CompruebaEmail(cadena)
{
	cadena = cadena.toLowerCase();
	if(cadena == ""){
		alert("Debe especificar su dirección de correo electrónico.");
		return false;
	}
			
	// validar la cuenta de correo usando una expresión regular (RegExp)
	if(cadena.search(/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/ig)){
		alert("La cuenta de correo electrónico no es válida, debes escribirla de forma: nombre@servidor.dominio");
		return false;
	}
	return true;
}

function ValidarFecha(fecha)
{
	re=/^[0-9][0-9]\/[0-9][0-9]\/[0-9][0-9][0-9][0-9]$/
	if(fecha.length==0 || !re.exec(fecha))
	{
		return false;
	}

	var d = new Date()
	d.setFullYear(fecha.substring(6,10), 
	fecha.substring(3,5)-1,
	fecha.substring(0,2))

	if(d.getMonth() != fecha.substring(3,5)-1 || d.getDate() != fecha.substring(0,2))
	{
		return false;
	}

	return true;
}

function redimensionar(imagen,imagenSRC, w){
	document.images[imagen].onload = "";
	ObjImagen = new Image;
	ObjImagen.src = imagenSRC; 
	if (ObjImagen.width > w)
	{
		if(ObjImagen.height >= ObjImagen.width){
			div = ObjImagen.height / w;
			document.images[imagen].width = ObjImagen.width /div;
			document.images[imagen].height = w;
		} 
		else{
			div = ObjImagen.width / w;
			document.images[imagen].height = ObjImagen.height /div;
			document.images[imagen].width = w;
		}
	}
	document.images[imagen].src = imagenSRC;
	document.images[imagen].style.visibility = "visible";
	document.images[imagen].style.display = "";
}

//-->
