/*
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 __MIALERT(stext){
	alert('texto'+stext);
	}
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(){
	//alert('borro');
	__PREV_IMG_gettrailobj().display="none";
	document.onmousemove=""
	__PREV_IMG_gettrailobj().left="-500px"
	clearTimeout(__PREV_IMG_timer);
	
}
function __PREV_IMG_showtrail(imagename,title,width,height){
		//alert('entro'+imagename);
i = imagename;t = title;w = width;h = height;
	__PREV_IMG_timer = setTimeout("__PREV_IMG_show('"+i+"',t,w,h);",250);
}
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" 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>';
		
		if (title!=''){
		newHTML = newHTML + '<h2 class="title_h2" style="padding:10px 10px;width:550px;background-color:#FFFFFF;margin-bottom:0px">' + ' '+title + '</h2>';
		}else{
			//newHTML = newHTML + '<h2 class="title_h2" >' + ' '+title + '</h2>';
			newHTML = newHTML + '';
		}
		
		
   	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';

	
}
// 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';
	
}