// JavaScript Document
function detectar_IE6() // Detecta si estamos en IE6 o mas bajo
{
	var ieVer=/*@cc_on function(){ switch(@_jscript_version){ case 1.0:return 3; case 3.0:return 4; case 5.0:return 5; case 5.1:return 5; case 5.5:return 5.5; case 5.6:return 6; case 5.7:return 7; case 5.8:return 8; }}()||@*/0;
	if (ieVer==6) pngfix();
}
// Funcion ROLLOVER
function cambia_m(id,ruta)
{
	var idd="#" + id; 
	$(idd).attr('src',ruta);
	$(idd).css('border','0');
	$(idd).css('cursor','pointer');
	
	detectar_IE6();
}

function cambio_investigacion(id,fecha)
{
  $('#punto').focus();
  $('#titulo_investigacion').html('cargando ..');
  $('#fecha_investigacion').html(fecha);
  $('#tex_investigacion').html('cargando ..');
  $('#ddinvestigacion').html('');
  $('#gi').html('');
  doAjax('saca_investigacion.php','id=' + id ,'fin_carga_investigacion','post','1');
}

function fin_carga_investigacion(xml_evento)
{
   var numero=xml_evento.getElementsByTagName("investigacion").length;
   var cont='';
   for(i=0;i<numero;i++) // Por cada archivo resultante
    {
		     // Cogemos el id del pueblo, es el id del pueblo en la base de datos.
			 var nombre = xml_evento.getElementsByTagName("nombre")[i].firstChild.nodeValue;
 			 var descarga = xml_evento.getElementsByTagName("descarga")[i].firstChild.nodeValue;
			 var des = xml_evento.getElementsByTagName("desc")[i].firstChild.nodeValue; 			 
					 
	}
    $('#titulo_investigacion').html(nombre);
    $('#tex_investigacion').html(des);	
	if(descarga!='nada') $('#ddinvestigacion').html('<div id="descarga_investigacion"> <a id="descarga" href="ficheros/investigacion/' + descarga + '" onmouseover="menu_over(\'b_des\',\'descargar_bot\',\'investigacion\');" onmouseout="menu_out(\'b_des\',\'descargar_bot\',\'investigacion\');"><img id="b_des" src="imagenes/investigacion/descargar_bot.png" border="0" /></a></div>');
   // FOTOS	
   var contf='';
   var numerof=xml_evento.getElementsByTagName("fotos").length;
   for(i=0;i<numerof;i++) // Por cada archivo resultante
    {
		     // Cogemos el id del pueblo, es el id del pueblo en la base de datos.
			 var srcf = xml_evento.getElementsByTagName("src")[i].firstChild.nodeValue;
			 idenlace="enlace" + i;
			 contf=contf + '<a id="' + idenlace  +  '" href="galerias/fotos/investigacion/' + srcf + '"><img src="galerias/fotos/investigacion/T' + srcf + '" width="58" /></a>';
	}
	if(numerof>0)
	{
		contT='<div id="galeria_investigacion"><div style=" width:280px; height:10px; float:left;"></div>';
		contT=contT+ '<a id="etodas" onclick="$(\'#enlace0\').click();" onmouseover="menu_over(\'b_gal_t\',\'vertodas_bot\',\'investigacion\');" onmouseout="menu_out(\'b_gal_t\',\'vertodas_bot\',\'investigacion\');"><img style="cursor:pointer" id="b_gal_t" src="imagenes/investigacion/vertodas_bot.png" border="0" /></a>';
		contT=contT + '<div id="fotos_cont">' + contf + '</div></div>';
		$('#gi').html(contT);
		$('#fotos_cont a').lightBox();
		
	}
     detectar_IE6();
}

function cambio_servicio(id,fecha)
{
  $('#punto').focus();
  $('#titulo_investigacion').html('cargando ..');
  $('#fecha_investigacion').html(fecha);
  $('#tex_investigacion').html('cargando ..');
  $('#gi').html('');
  doAjax('saca_servcios.php','id=' + id ,'fin_carga_servicio','post','1');
}

function fin_carga_servicio(xml_evento)
{
   var numero=xml_evento.getElementsByTagName("servicio").length;
   var cont='';
   for(i=0;i<numero;i++) // Por cada archivo resultante
    {
		     // Cogemos el id del pueblo, es el id del pueblo en la base de datos.
			 var nombre = xml_evento.getElementsByTagName("nombre")[i].firstChild.nodeValue;
 		
			 var des = xml_evento.getElementsByTagName("desc")[i].firstChild.nodeValue; 			 
					 
	}
    $('#titulo_investigacion').html(nombre);
    $('#tex_investigacion').html(des);	

   // FOTOS	
   var contf='';
   var numerof=xml_evento.getElementsByTagName("fotos").length;
   for(i=0;i<numerof;i++) // Por cada archivo resultante
    {
		     // Cogemos el id del pueblo, es el id del pueblo en la base de datos.
			 var srcf = xml_evento.getElementsByTagName("src")[i].firstChild.nodeValue;
			 idenlace="enlace" + i;
			 contf=contf + '<a id="' + idenlace  +  '" href="galerias/fotos/servicios/' + srcf + '"><img src="galerias/fotos/servicios/T' + srcf + '" width="58" /></a>';
	}
	if(numerof>0)
	{
		contT='<div id="galeria_servicios"><div style=" width:280px; height:10px; float:left;"></div>';
		contT=contT+ '<a id="etodas" onclick="$(\'#enlace0\').click();" onmouseover="menu_over(\'b_gal_t\',\'vertodas_bot\',\'investigacion\');" onmouseout="menu_out(\'b_gal_t\',\'vertodas_bot\',\'investigacion\');"><img style="cursor:pointer" id="b_gal_t" src="imagenes/investigacion/vertodas_bot.png" border="0" /></a>';
		contT=contT + '<div id="fotos_cont">' + contf + '</div></div>';
		$('#gi').html(contT);
		$('#fotos_cont a').lightBox();
		
	}
     detectar_IE6();
}


function cambio_noticia(id,fecha)
{
  $('#punto').focus();
  $('#titulo_investigacion').html('cargando ..');
  $('#fecha_investigacion').html(fecha);
  $('#tex_investigacion').html('cargando ..');
   $('#ddinvestigacion').html('');
  $('#gi').html('');
  doAjax('saca_noticias.php','id=' + id ,'fin_carga_noticias','post','1');
}

function fin_carga_noticias(xml_evento)
{
   var numero=xml_evento.getElementsByTagName("noticia").length;
   var cont='';
   for(i=0;i<numero;i++) // Por cada archivo resultante
    {
		     // Cogemos el id del pueblo, es el id del pueblo en la base de datos.
			 var nombre = xml_evento.getElementsByTagName("nombre")[i].firstChild.nodeValue;
 		      var descarga = xml_evento.getElementsByTagName("descarga")[i].firstChild.nodeValue;
			 var des = xml_evento.getElementsByTagName("desc")[i].firstChild.nodeValue; 			 
					 
	}
    $('#titulo_investigacion').html(nombre);
    $('#tex_investigacion').html(des);	
		if(descarga!='nada') $('#ddinvestigacion').html('<div id="descarga_investigacion"> <a id="descarga" href="ficheros/noticias/' + descarga + '" onmouseover="menu_over(\'b_des\',\'descargar_bot\',\'investigacion\');" onmouseout="menu_out(\'b_des\',\'descargar_bot\',\'investigacion\');"><img id="b_des" src="imagenes/investigacion/descargar_bot.png" border="0" /></a></div>');
   // FOTOS	
   var contf='';
   var numerof=xml_evento.getElementsByTagName("fotos").length;
   for(i=0;i<numerof;i++) // Por cada archivo resultante
    {
		     // Cogemos el id del pueblo, es el id del pueblo en la base de datos.
			 var srcf = xml_evento.getElementsByTagName("src")[i].firstChild.nodeValue;
			 idenlace="enlace" + i;
			 contf=contf + '<a id="' + idenlace  +  '" href="galerias/fotos/noticias/' + srcf + '"><img src="galerias/fotos/noticias/T' + srcf + '" width="58" /></a>';
	}
	if(numerof>0)
	{
		contT='<div id="galeria_servicios"><div style=" width:280px; height:10px; float:left;"></div>';
		contT=contT+ '<a id="etodas" onclick="$(\'#enlace0\').click();" onmouseover="menu_over(\'b_gal_t\',\'vertodas_bot\',\'investigacion\');" onmouseout="menu_out(\'b_gal_t\',\'vertodas_bot\',\'investigacion\');"><img style="cursor:pointer" id="b_gal_t" src="imagenes/investigacion/vertodas_bot.png" border="0" /></a>';
		contT=contT + '<div id="fotos_cont">' + contf + '</div></div>';
		$('#gi').html(contT);
		$('#fotos_cont a').lightBox();
		
	}
     detectar_IE6();
}

function init_dw_Scroll_1() {
			
				var wndo = new dw_scrollObj('dnoticia', 'cdnoticia');
				wndo.setUpScrollbar("dragBar1", "track1", "v", 1, 1);
				wndo.setUpScrollControls('scrollbar1');
				
				
}



function carga_evento(id)
{	
 // Precarga
 $('#titulo_evento').html('Cargando ..');
 $('#des_evento').html('Cargando ..');
 // Fin de precarga
 doAjax('saca_evento.php','id=' + id,'fin_carga_evento','post','1');
}

function fin_carga_evento(xml_evento)
{
   var numero=xml_evento.getElementsByTagName("evento").length;
   var cont='';
   for(i=0;i<numero;i++) // Por cada archivo resultante
    {
		     // Cogemos el id del pueblo, es el id del pueblo en la base de datos.
			 var nombre = xml_evento.getElementsByTagName("nombre")[i].firstChild.nodeValue;
 			 var des = xml_evento.getElementsByTagName("desc")[i].firstChild.nodeValue; 			 
			 
	}
    $('#titulo_evento').html(nombre);
    $('#des_evento').html(des);
	// Las fotos
	
	
	// FOTOS	
   var contf='';
   var numerof=xml_evento.getElementsByTagName("fotos").length;
   for(i=0;i<numerof;i++) // Por cada archivo resultante
    {
		     // Cogemos el id del pueblo, es el id del pueblo en la base de datos.
			 var srcf = xml_evento.getElementsByTagName("src")[i].firstChild.nodeValue;
			 idenlace="enlace" + i;
			 contf=contf + '<a id="' + idenlace  +  '" href="galerias/fotos/eventos/' + srcf + '"><img src="galerias/fotos/eventos/T' + srcf + '" width="58" /></a>';
	}
	if(numerof>0)
	{
		contT='<div id="galeria_noticias"><div style=" width:280px; height:10px; float:left;"></div>';
		contT=contT+ '<a id="etodas" onclick="$(\'#enlace0\').click();" onmouseover="menu_over(\'b_gal_t\',\'vertodas_bot\',\'investigacion\');" onmouseout="menu_out(\'b_gal_t\',\'vertodas_bot\',\'investigacion\');"><img style="cursor:pointer" id="b_gal_t" src="imagenes/investigacion/vertodas_bot.png" border="0" /></a>';
		contT=contT + '<div id="fotos_cont">' + contf + '</div></div>';
		$('#gi').html(contT);
		$('#fotos_cont a').lightBox();
		
	}
	else $('#gi').html('');
     detectar_IE6();
	 
	
}


function completa()
{
  var idd="div.slideshow a";	 
  $(idd).click();
}

function cambia_evento(dia,mes,ano)
{
	var fecha=dia + "/" + mes + "/" + ano;
	doAjax('cambia_evento.php','fecha=' + fecha,'fin_cambia_evento','post','0');
}
function fin_cambia_evento(html_evento)
{
 $('#izq_calendario').html(html_evento);
 detectar_IE6();
}

