
var ven_foto = '';


/* 
Simple Image Trail script- By JavaScriptKit.com 
Visit http://www.javascriptkit.com for this script and more 
This notice must stay intact 
*/  

var w=1
var h=1 

if (document.getElementById){document.write('<div id="ver_foto"><img src="img/flot_top.png" width="339" height="38" class="headers" onclick="hidetrail()" style="cursor:pointer;"><div id="cont"><h1 id="titulo"></h1><p id="epigrafe_reemplazar"></p><p><a href="javascript:;" onclick="hidetrail();">[cerrar]</a></div><img src="img/flot_bot.png" width="339" height="22" class="headers"></div>');
}



function gettrailobj(){
	if( document.getElementById ){
			return document.getElementById("ver_foto").style;
	} else if( document.all ){
			return document.all.ver_foto.style;
	}
} 



function truebody(){ 
	return ( !window.opera && document.compatMode && document.compatMode!="BackCompat" ) ? document.documentElement : document.body;
} 



function hidetrail(){
	//document.getElementById('ttimg').src='/img/blank.gif';
	
	gettrailobj().visibility="hidden";
	//gettrailobj1().left=-1000;
	gettrailobj().top=0;
}


		
function showtrail(width,height,file,tit,epi,tipo) {
	tipo=tipo;
	if( navigator.userAgent.toLowerCase().indexOf('opera') == -1 ){ 
		w=width;
		h=height; 
		ventana = document.getElementById('cont');
		//ventana.innerHTML="";
		 if( tipo=='det' ){
			w=width;
			h=height;
			
			f = document.getElementById('epigrafe_reemplazar');
			f.innerHTML="";
			f.innerHTML=f.innerHTML.replace("",epi);
			g = document.getElementById('titulo');
			g.innerHTML="";
			g.innerHTML=g.innerHTML.replace("",tit);
			
			//document.onmousemove=followmouse;
			gettrailobj().visibility="visible";
			gettrailobj().display="block";
			centrar();
		} 
	}
}



function centrar(e){

	if( navigator.userAgent.toLowerCase().indexOf('opera') == -1 ){
		
		
        var foreItem=document.getElementById('ver_foto');
        var scrollLeft = (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);
        var scrollTop  = (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
        var clientWidth;
        if (window.innerWidth) {
                clientWidth = (window.__safari ? window.innerWidth : Math.min(window.innerWidth, document.documentElement.clientWidth));
            } else {
                clientWidth = document.documentElement.clientWidth;
            }
        var clientHeight;
        if (window.innerHeight) {
            clientHeight = (window.__safari ? window.innerHeight : Math.min(window.innerHeight, document.documentElement.clientHeight));
        } else {
            clientHeight = document.documentElement.clientHeight;
        }
     
        gettrailobj().left = scrollLeft+((clientWidth)/2)-20+'px';
        gettrailobj().top = scrollTop+((clientHeight-300)/2)+'px';

	}
}


function followmouse(e){
	if( navigator.userAgent.toLowerCase().indexOf('opera') == -1 ){
		var xcoord=20;
		var ycoord=20;
		if( typeof e != "undefined" ){
			xcoord+=e.pageX;
			ycoord+=e.pageY;
		} else if( typeof window.event !="undefined" ){
			xcoord+=truebody().scrollLeft+event.clientX;
			ycoord+=truebody().scrollTop+event.clientY;
		}

		var docwidth = document.all ? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15;
		var docheight = document.all ? Math.max( truebody().scrollHeight, truebody().clientHeight ) : Math.max( document.body.offsetHeight, window.innerHeight );
		
			if (xcoord+w+5<docwidth*0.8)
		xcoord=xcoord-w-(20*2);

		if (ycoord-truebody().scrollTop+h>truebody().clientHeight)
	//	ycoord=ycoord-h;
	

		gettrailobj().left=xcoord+"px";
		gettrailobj().top=ycoord+"px";
	}
}

