﻿function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function __selDate(sDate, iPositionID) {
		var oField = eval('document.forms[0].f0_v1_' + iPositionID);
		oField.value = sDate;
		eval('objJS_' + iPositionID).applyAttributeFilter()
}

//funcion pop -up imagenes
var ventana
var cont=0
var titulopordefecto = "IMAGEN AMPLIADA" 

function afoto(cual,titulo)
{
	if(cont==1){ventana.close();ventana=null}
	if(titulo==null){titulo=titulopordefecto}
	ventana=window.open('','ventana','resizable=yes,scrollbars=no')
	ventana.document.write('<html><head><title>' + titulo + '</title></head><body style="overflow:hidden" marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" scroll="no" onUnload="opener.cont=0"><img src="' + cual + '" onLoad="opener.redimensionar(this.width, this.height)">')
//	ventana.document.write('<div class=titulo1>'+texto+'</div></body></html>');
	ventana.document.close()
	cont++
}

function redimensionar(ancho,alto){
	ventana.resizeTo(ancho+12,alto+32)
	ventana.moveTo((screen.width-ancho)/2,(screen.height-alto)/2) //centra la ventana. Eliminar si no se quiere centrar el popup
}

function oculta_menu_ficha(){
	
	document.getElementById('contenido_primero').style.display='none';	
	
	if (document.getElementById('noticia_descripcion')){
		document.getElementById('noticia_descripcion').style.display='none';
	}
	
	if (document.getElementById('contenido_segundo')){
		document.getElementById('contenido_segundo').style.display='none';
	}
	if (document.getElementById('contenido_tercero')){
		document.getElementById('contenido_tercero').style.display='none';
	}

	
	document.getElementById('menu_contenido_primero').className='inactive';	
	if (document.getElementById('menu_contenido_segundo')){
		document.getElementById('menu_contenido_segundo').className='inactive';
	}
	if (document.getElementById('menu_contenido_tercero')){
		document.getElementById('menu_contenido_tercero').className='inactive';
	}
}

function muestra_menu_ficha(id_menu){
	if (document.getElementById(id_menu)){
		oculta_menu_ficha();
		document.getElementById(id_menu).style.display='inline';
		document.getElementById('menu_'+id_menu).className='active';
	}
}

function video(video){
	window.open (video,'videomov','width=300,height=300');
}



/*
Simple Image Trail script- By JavaScriptKit.com
Visit http://www.javascriptkit.com for this script and more
This notice must stay intact
DEBE EXISTIR EN LA PLANTILLA UNA CAPA QUE SE LLAME con el nombre definido en la variable __PREV_IMG_LAYER_ID
*/
var __PREV_IMG_offsetfrommouse=[15,25]; //image x,y offsets from cursor position in pixels. Enter 0,0 for no offset
var __PREV_IMG_displayduration=0; //duration in seconds image should remain visible. 0 for always.
var __PREV_IMG_defaultimageheight = 40;	// maximum image size.
var __PREV_IMG_defaultimagewidth = 40;	// maximum image size.
var __PREV_IMG_timer;
var __PREV_IMG_LAYER_ID = "preview_div_IMAGEN"

// variables general contador
var img_count=0;
var photos= new Array();



function __PREV_IMG_gettrailobj(){
if (document.getElementById) return document.getElementById(__PREV_IMG_LAYER_ID).style;
}

function __PREV_IMG_gettrailobjnostyle(){
if (document.getElementById) return document.getElementById(__PREV_IMG_LAYER_ID);
}
function __PREV_IMG_truebody(){
  return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
}
function __PREV_IMG_hidetrail(){
	__PREV_IMG_gettrailobj().display="none";
	document.onmousemove=""
	__PREV_IMG_gettrailobj().left="-500px"
	clearTimeout(__PREV_IMG_timer);
}
function __PREV_IMG_showtrail(imagename,title,width,height){
	i = imagename;t = title;w = width;h = height;
	__PREV_IMG_timer = setTimeout("__PREV_IMG_show('"+i+"',t,w,h);",200);
}
function __PREV_IMG_show(imagename,title,width,height){
  var docwidth=document.all? __PREV_IMG_truebody().scrollLeft+__PREV_IMG_truebody().clientWidth : pageXOffset+window.innerWidth - __PREV_IMG_offsetfrommouse[0];
	var docheight=document.all? Math.min(__PREV_IMG_truebody().scrollHeight, __PREV_IMG_truebody().clientHeight) : Math.min(window.innerHeight);
	if( (navigator.userAgent.indexOf("Konqueror")==-1  || navigator.userAgent.indexOf("Firefox")!=-1 || (navigator.userAgent.indexOf("Opera")==-1 && navigator.appVersion.indexOf("MSIE")!=-1)) && (docwidth>650 && docheight>500)) {
		( width == 0 ) ? width = __PREV_IMG_defaultimagewidth: '';
		( height == 0 ) ? height = __PREV_IMG_defaultimageheight: '';
		width+=30;
		height+=55;
		__PREV_IMG_defaultimageheight = height;
		__PREV_IMG_defaultimagewidth = width;
		document.onmousemove=__PREV_IMG_followmouse;

    // Aquí el código que pintará dentro de la capa
		newHTML = '<div class="border_preview" style="background:#FFF;width:'+  width +'px;height:'+ height +'px"><div id="loader_container"><div id="loader"><div align="center">Loading template preview...</div><div id="loader_bg"><div id="progress"> </div></div></div></div>';
		newHTML = newHTML + '<h2 class="title_h2">' + ' '+title + '</h2>'
   	newHTML = newHTML + '<div class="preview_temp_load"><img onload="javascript:__PREV_IMG_remove_loading();" src="' + imagename + '" border="0"></div>';
		newHTML = newHTML + '</div>';

/*		if(navigator.userAgent.indexOf("MSIE")!=-1 && navigator.userAgent.indexOf("Opera")==-1 ){
			newHTML = newHTML+'<iframe src="about:blank" scrolling="no" frameborder="0" width="'+width+'" height="'+height+'"></iframe>';
		}
*/
		__PREV_IMG_gettrailobjnostyle().innerHTML = newHTML;
		__PREV_IMG_gettrailobj().display="block";
	}
}
function __PREV_IMG_remove_loading() {
  document.getElementById("loader_container").style.display='none';
}
function __PREV_IMG_followmouse(e){
	var xcoord=__PREV_IMG_offsetfrommouse[0]
	var ycoord=__PREV_IMG_offsetfrommouse[1]
	var docwidth=document.all? __PREV_IMG_truebody().scrollLeft+__PREV_IMG_truebody().clientWidth : pageXOffset+window.innerWidth-15
	var docheight=document.all? Math.min(__PREV_IMG_truebody().scrollHeight, __PREV_IMG_truebody().clientHeight) : Math.min(window.innerHeight)
	if (typeof e != "undefined"){
		if (docwidth - e.pageX < __PREV_IMG_defaultimagewidth + 2*__PREV_IMG_offsetfrommouse[0]){
			xcoord = e.pageX - xcoord - __PREV_IMG_defaultimagewidth; // Move to the left side of the cursor
		} else {
			xcoord += e.pageX;
		}
		if (docheight - e.pageY < __PREV_IMG_defaultimageheight + 2*__PREV_IMG_offsetfrommouse[1]){
			ycoord += e.pageY - Math.max(0,(2*__PREV_IMG_offsetfrommouse[1] + __PREV_IMG_defaultimageheight + e.pageY - docheight - __PREV_IMG_truebody().scrollTop));
		} else {
			ycoord += e.pageY;
		}
	} else if (typeof window.event != "undefined"){
		if (docwidth - event.clientX < __PREV_IMG_defaultimagewidth + 2*__PREV_IMG_offsetfrommouse[0]){
			xcoord = event.clientX + __PREV_IMG_truebody().scrollLeft - xcoord - __PREV_IMG_defaultimagewidth; // Move to the left side of the cursor
		} else {
			xcoord += __PREV_IMG_truebody().scrollLeft+event.clientX
		}
		if (docheight - event.clientY < (__PREV_IMG_defaultimageheight + 2*__PREV_IMG_offsetfrommouse[1])){
			ycoord += event.clientY + __PREV_IMG_truebody().scrollTop - Math.max(0,(2*__PREV_IMG_offsetfrommouse[1] + __PREV_IMG_defaultimageheight + event.clientY - docheight));
		} else {
			ycoord += __PREV_IMG_truebody().scrollTop + event.clientY;
		}
	}
	__PREV_IMG_gettrailobj().left=xcoord+"px"
	__PREV_IMG_gettrailobj().top=ycoord+"px"
}



// funcion de mover imágenes

function back(){

if (img_count>0){

window.status='Galería de imágenes';
img_count --;
//document.images.intro.src=photos[img_count];
window.document.getElementById('mini_galery').src=photos[img_count];
}

}

function go(){


if (img_count<photos.length-1){

img_count++;
window.document.getElementById('mini_galery').src=photos[img_count];
//document.images.intro.src=photos[img_count];

}

else window.status='Fin de las imágenes'

}
// galeria inmigracion
function CargarInmigracion(){
	
photos[0]='images/040305proyectovivir1.jpg';
photos[1]='images/050516carpetaeducativa1.jpg';
photos[2]='images/050721saharauis1.jpg';
photos[3]='images/051111migraciones2.jpg';

	
}


// galeria polideportivo Benicalap
function CargarBenicalap(){
	
photos[0]='images/ComplejoBenicalap5.jpg';
photos[1]='images/ComplejoBenicalap3.jpg';
photos[2]='images/ComplejoBenicalap1.jpg';


	
}


// galería imagenes de mestalla
function CargarMestalla(){
	
photos[0]='images/mestalla1.jpg';
photos[1]='images/ESTADIO1.jpg';
photos[2]='images/ESTADIO3.jpg';
photos[3]='images/ESTADIO4.jpg';
photos[4]='images/ESTADIO5.jpg';
//photos[5]='images/ESTADIO6.jpg';
photos[5]='images/ESTADIO7.jpg';
photos[6]='images/ESTADIO8.jpg';

//photos[5]='images/ESTADIO5.jpg';
	
}


// galería imagenes de TABACALERA
function CargarTabacalera(){
	
photos[0]='images/tabacalera1.jpg';
photos[1]='images/tabacalera2.jpg';
photos[2]='images/tabacalera3.jpg';
photos[3]='images/tabacalera4.jpg';
photos[4]='images/tabacalera5.jpg';
	
}

// galería imagenes de RUSAFFA
function CargarRussafa(){
	
photos[0]='images/distrito_eixample2.jpg';
photos[1]='images/plaza_manuel_granero1.jpg';
photos[2]='images/plaza_manuel_granero2.jpg';
	
}

// galería imagenes de AVE
function CargarAVE(){
	
photos[0]='images/PARQUECENTRAL1.jpg';
photos[1]='images/PARQUECENTRAL2.jpg';
photos[2]='images/PARQUECENTRAL3.jpg';
photos[3]='images/PARQUECENTRAL4.jpg';
photos[4]='images/PARQUECENTRAL5.jpg';
	
}

// galería imagenes de valencia
function CargarValencia(){
	
photos[0]='images/valencia1.jpg';
photos[1]='images/valencia2.jpg';
photos[2]='images/valencia3.jpg';
photos[3]='images/valencia4.jpg';
photos[4]='images/valencia5.jpg';
photos[5]='images/valencia6.jpg';
photos[6]='images/valencia7.jpg';
photos[7]='images/valencia8.jpg';
photos[8]='images/valencia9.jpg';
photos[9]='images/valencia10.jpg';
photos[10]='images/valencia11.jpg';
photos[11]='images/valencia12.jpg';
photos[12]='images/valencia13.jpg';
photos[13]='images/valencia14.jpg';
photos[14]='images/valencia15.jpg';
//photos[15]='images/valencia16.jpg';

//photos[5]='images/ESTADIO5.jpg';
	
}

// galería monumentos
function CargarMonumentos(){
	
photos[0]='images/monumentos1.jpg';
photos[1]='images/monumentos2.jpg';
photos[2]='images/monumentos3.jpg';
photos[3]='images/monumentos4.jpg';

	
}


/** funcion pestaña multimedia noticias **/

function showDownloads() {
    document.getElementById('multimedia').src="resources/image/pestanya_multimedia_on.gif"
	document.getElementById('new').src="resources/image/pestanya_noticias_off.gif"
	document.getElementById('cuerpo_noticia').style.display='none'
	document.getElementById('descargas').style.display='inline'
}

function showNew() {
    document.getElementById('multimedia').src="resources/image/pestanya_multimedia_off.gif"
	document.getElementById('new').src="resources/image/pestanya_noticias_on.gif"
	document.getElementById('cuerpo_noticia').style.display='inline'
	document.getElementById('descargas').style.display='none'
}


																							
/** FUNCIONES MULTIMEDIA **/
function muestraMulti(archivo,tipo){
	document.forms[0].arcMul.value=archivo;
	document.forms[0].arcTipo.value=tipo;
	document.forms[0].submit();
}

function Votar(){
	document.forms[0].action='check_question.asp';

	document.forms[0].submit();
	
}

function SendForm(){
var iPos;
var bisNumeric;

bisNumeric = false;


iPos = window.document.getElementById('email_home').value.indexOf('@');



if ((window.document.getElementById('email_home').value.length<5) || (iPos<=0)){
alert('Por favor, introduzca un email correcto.')
window.document.getElementById('email_home').focus();
return false;
}



bisNumeric = isNumerico (window.document.getElementById('cp_home'), 'Código Postal', true, false, true,false);


if ((window.document.getElementById('cp_home').value.length<5) || !(bisNumeric)){
alert('Por favor, introduzca un código postal correcto.')
window.document.getElementById('cp_home').focus();
return false;
}
document.forms[0].action="send_welcome.asp";
document.forms[0].submit();
}

/** recomendar a un amigo **/
function enviar(){
	var capa = document.getElementById('send_friend');
	capa.style.display='inline';
	capa.style.top=(window.screen.width-300)/2+'px';
	capa.style.left=(window.screen.width-250)/2+'px';

	
}

function enviaroff(){
document.getElementById('send_friend').style.display='none'
}
/** imprimir **/
function imprimir() { 
	if (window.print) {
		window.print(); 
	}
	else {
		alert('No se ha podido imprimir la página'); 
	}
}

/*** equipo de gobierno **/
function ver(nombreCapa){
document.getElementById(nombreCapa).style.display='inline';
}
function ocultar(nombreCapa){
document.getElementById(nombreCapa).style.display='none';
}


