function ft() {
	this.ob=document.getElementById("foto"); this.ob.ondblclick=dobleclick
	this.f=document.getElementById("ifoto")
	this.r=document.getElementById("rfoto")
	this.x=document.getElementById("xfoto"); this.x.onclick=function() {f1.off=true; f1.cierra()}
	this.s=document.getElementById("foto").style
	this.u="";			this.bajandoi=false;	this.off=false
	this.rtext="";			this.n="f1"
	this.l=0;			this.t=0
	this.w=0;			this.h=0; this.b=0
	this.cerrando=false;		this.cambia=cambialo
	this.muestra=muestraFT;		this.esconde=escondeFT
	this.ref=esaRef;		this.img=esaFoto
	this.redimension=redimensiona;	this.aversiya=sigueprobando
	this.ac=actualiza;		this.cierra=cierralo
	this.clipb=clipB;		this.centra=centralo
	this.reset=resetealo;		this.mueve=muevelo
	this.x0=0;			
	this.y0=0;
	this.drag=false

this.ob.oncontextmenu=dobleclick
this.ob.onmousedown=posraton
this.ob.onmousemove=muevepos
this.ob.onclick=function() {return false}
this.ob.onmouseup=function() {f1.drag=false; return false}
}
function scrollY() {
	var scrolly=0;
	if(typeof(window.pageYOffset)=='number') scrolly=window.pageYOffset
	else {
		if(document.documentElement.scrollTop) scrolly=document.documentElement.scrollTop
		else if(document.body.scrollTop) scrolly=document.body.scrollTop
	}
	return scrolly;
}
function muevepos(event) {var x,y;
	if(f1.drag) {
	if(window.event) {x=window.event.clientX; y=window.event.clientY+scrollY()}
	else {x=event.clientX; y=event.clientY+scrollY()}
	var dx=x-f1.x0,dy=y-f1.y0
	f1.mueve(dx,dy); f1.x0=x; f1.y0=y
	return false}
}
function altoV() {
	var alto=0;
	if(typeof(window.innerHeight)=='number') alto=window.innerHeight
	else {
		if(document.documentElement.clientHeight) alto=document.documentElement.clientHeight
		else { if(document.body.clientHeight) alto=document.body.clientHeight }
	}
	return alto;
}
function posraton(event) {
	f1.x0=window.event?window.event.clientX:event.clientX;
	f1.y0=window.event?window.event.clientY:event.clientY;
	f1.y0+=scrollY();
	f1.drag=true
	return false
}
function muevelo(dx, dy) {
	this.l+=dx; this.t+=dy
	this.s.left=this.l+"px"; this.s.top=this.t+"px"
}
function cambialo(rutaImg,descImg) {
	this.u=new Image();	this.u.src=rutaImg
	this.rtext=descImg
	this.muestra()
	if(this.u.complete) this.ac()
	else {this.bajandoi=true; this.aversiya()}
}
function sigueprobando(esto) {
	if(this.u.complete) {this.bajandoi=false; this.ac()}
	else pruebaluego=setTimeout(this.n+".aversiya()",1000)
}
function actualiza() {
	this.w=this.u.width+4;	this.h=this.u.height+29;	this.redimension(this.w,this.h)
	this.x.style.left=this.w-24+"px"
	this.img(this.u.src);	this.ref(this.rtext)
	this.b=this.h;	this.s.clip="rect(0 "+this.w+"px "+this.h+"px 0)"
	this.centra()
}
function muestraFT(obj) {this.s.display="block"}
function escondeFT(obj) {this.s.display="none"}
function esaRef(texto) {this.r.innerHTML=texto}
function esaFoto(iurl) {this.u=iurl; this.f.src=this.u}
function redimensiona(x,y) {
	if(x) this.s.width=x+"px"
	if(y) this.s.height=y+25+"px"
}
function centralo() {
	var scrollV=scrollY()
	var alto=altoV()
	var total=parseInt((alto-this.h)/2+scrollV)
	this.l=parseInt((screen.availWidth-this.w)/2); this.s.left=this.l+"px"
	this.t=total; this.s.top=this.t+"px"
}
function dobleclick() {if(!f1.cerrando) {f1.cerrando=true; f1.cierra()}; return false}
function clipB(b) {this.b=b; this.s.clip="rect(0 "+this.w+"px "+b+"px 0)"}

function cierralo() {
	if(this.bajandoi) clearTimeout(pruebaluego)
	if(this.cerrando&&this.off) clearTimeout(temps)
	if(this.b>9&&this.cerrando&&!this.off&&!this.bajandoi) {this.clipb(this.b-10); temps=setTimeout(this.n+".cierra()",20)}
	else this.reset()
}
function resetealo() {
	this.cerrando=false; this.bajando=false; this.off=false; 
	this.img("../gvs.jpg"); this.ref("Cargando..."); this.redimension(222,100)
	this.esconde()
}