/***************************************************************************************
Copyright (C) 2001 ab_ditto
This script is made by and copyrighted to ab_ditto at back.to/ab or ab_ditto@hotmail.com
This may be used freely as long as this msg is intact!
***************************************************************************************
excepted from this copyright is the (seperatly marked) NN6 "scrollbarkiller" by Eddie Traversa
***************************************************************************************/

function getBrowserWidth(){
  if (window.innerWidth){
      return window.innerWidth;}
  else if (document.documentElement && document.documentElement.clientWidth != 0){
      return document.documentElement.clientWidth;    }
  else if (document.body){return document.body.clientWidth;}
      return 0;
}

//*****parameters to set*****
var impad='pic11.jpg'; //the path to your panorama-pic
//if you have troubles with NN & large pics try using a .gif instead of a .jpg
var imwid=14537; //the width of your pic
var imhei=1520; //the height of your pic
var postop=390; //the top position of the panorama on your page
var panwid=560; //the width of the shown area
var panhei=150; //the height of the shown area
var poslef=getBrowserWidth()/2-panwid/2-20; //the left position of the panorama on your page
//if it differs from the image-height, the image gets scaled in length and height
//*****additional parameters*****
var buttl='images/flecha_anter.jpg'; //path to the left-button (if you use your own pics)
var buttr='images/flecha_sig.jpg'; //path to the right-button (if you use your own pics)
var buttw=20; //width of one button
var butth=15; //height of a button
var speed=50; //timeout between moves; set it lower to increase speed
var move=5; // movement at one step in pixel
//*****nothing more to do, have fun :)
var tim=0;
var noscroll=true;
var imw=imwid*panhei/imhei;
var imh=panhei;
var imstart=panwid/2-imw*1.5;
var jumpa=panwid/2-imw*2.5;
var jumpwida=imw-move;
var jumpb=panwid/2-imw/2;
var jumpwidb=imw+move;
var conwid=buttw+(5*1);
var contop=postop+(imh*1)+(10*1);
var conlefa=poslef+(panwid/2)-conwid;
var conlefb=poslef+(panwid/2);
var imstart=-500;



// Esta función la he creado yo
function setPhoto (ruta) {
	impad = ruta;
}

function sr(i){
  if (!noscroll) {
    now = parseFloat(document.getElementById("pano"+i).style.left);
    if (-1*now<(poslef+panwid)) now-= move;
    //now-=move;
//	if(!noscroll){
//	now=parseFloat(document.getElementById("pano").style.left);
        //if (-1*now==(poslef+panwid)) return;
//        if (now<=jumpa){now+=jumpwida;} else{now-=move;}
//        document.getElementById("pano").style.left=now;
  //      document.getElementById('divnow').innerHTML=now;
    document.getElementById("pano"+i).style.left=now+'px';
    tim=setTimeout("sr("+i+")",speed);
  }
}

function sl (i) {
  if (!noscroll) {
    now = parseFloat(document.getElementById("pano"+i).style.left);
    if (now<0) now+=move;
    document.getElementById("pano"+i).style.left=now+'px';
    tim=setTimeout("sl("+i+")",speed);
  }
}

function stop(){clearTimeout(tim); noscroll=true}
//***************************************************************************************
//NN6 "scrollbarkiller" by Eddie Traversa
if (document.getElementById && !document.all){document.write('<div id="kill-scrollbars" style="position:relative">');}
//***************************************************************************************

// Esta función la he creado yo
function showPhoto (i) {
        panoramatop=postop+250*(i-1);
	document.write("<style>");
	document.write("DIV.panorama {position:absolute; left:"+poslef+"px; top:"+postop+"px; width:"+panwid+"px; height:"+panhei+"px; z-index:1; clip:rect(0px,"+panwid+"px,"+panhei+"px,0px); overflow:hidden;}");
	document.write("DIV.left {position:absolute; left:"+conlefa+"px; top:"+contop+"px; width:"+conwid+"px; z-index:1; text-align:right;}");
	document.write("DIV.right {position:absolute; left:"+conlefb+"px; top:"+contop+"px; width:"+conwid+"px; z-index:1; text-align:left;}");
	document.write("</style>");

	document.write("<div id='panorama"+i+"' class='panorama' style='top:"+panoramatop+"px'>");
	document.write("<div id='pano"+i+"' style='position:absolute; left:"+imstart+"px; width:"+imw*3+"px; height:"+imh+"px; z-index:2; visibility:visible;'>");
	document.write("<table><tr><td nowrap><img src='"+impad+"' width="+imw+"px height="+imh+"px /></td></tr></table>");
	document.write("</div></div>");
	document.write("<div id='left"+i+"' class='left' style='top:"+(contop+250*(i-1))+"px'><a href='javascript://' onmouseover='noscroll=false; sl("+i+")' onmouseout='stop()'><img src='"+buttl+"' width="+buttw+"px height="+butth+"px border='0' /></a></div>");
	document.write("<div id='right"+i+"' class='right' style='top:"+(contop+250*(i-1))+"px'><a href='javascript://' onmouseover='noscroll=false; sr("+i+")' onmouseout='stop()'><img src='"+buttr+"' width="+buttw+"px height="+butth+"px border='0' /></a></div>");
}