/***************************************************************************************
Copyright (C) 2008 Andreas Berger
This script is made by and copyrighted to Andreas Berger - andreas_berger@bretteleben.de
It may be used for free as long as this msg is intact!
****************************************************************************************
Version 20081005
***************************************************************************************/
//erforderliche parameter
divid="panorama"; //die id des div containers der das panorama enthalten soll
//impad='pic.jpg'; //pfad zum bild
impad = imageURL;
imwid=1140; //breite des bildes in pixel
imhei=162; //höhe des bildes in pixel
panwid=400; //breite des anzeigebereichs in pixel
panhei=162; //höhe des anzeigebereichs in pixel
//weicht die anzeigehöhe von der höhe des bildes ab, dann wird dieses entsprechend proportional skaliert
speed=80; //timeout zwischen den einzelnen bewegungen, je kleiner der wert desto schneller das scrollen
move=5; // schrittweite je bewegung in pixel
//das wars auch schon, viel spass :)
tim=0;noscroll=true;
imw=imwid*panhei/imhei;imh=panhei;imstart=panwid/2-imw*1.5;
jumpa=panwid/2-imw*2.5;jumpwida=imw-move;
jumpb=panwid/2-imw/2;jumpwidb=imw+move;
conwid=15;panhei+=30;contop=(imh*1)+(10*1);
conlefa=panwid/2-conwid;conlefb=panwid/2;
function sr(){
	if(!noscroll){
	now=parseFloat(document.getElementById("pano").style.left);
  if (now<=jumpa){now+=jumpwida;} else{now-=move;}
  document.getElementById("pano").style.left=now+"px";
	tim=setTimeout("sr()",speed);}}

function sl(){
	if(!noscroll){
	now=parseFloat(document.getElementById("pano").style.left);
  if (now>=jumpb){now-=jumpwidb;} else{now+=move;}
  document.getElementById("pano").style.left=now+"px";
	tim=setTimeout("sl()",speed);}}

function stop(){clearTimeout(tim); noscroll=true}

function shownow() {
	document.getElementById(divid).style.height=panhei+"px";
	document.getElementById(divid).innerHTML=tp;
	noscroll=false;
	sr();}

tp="<div id='panorama2' onmouseover='noscroll=true; stop()' onmouseout='noscroll=false; sr()'>";
tp=tp+"<div id='pano' style='position:absolute; left:"+imstart+"px; top:0px; width:"+imw*3+"px; height:"+imh+"px; z-index:2; visibility:visible;'>";
tp=tp+"<img src='"+impad+"' width="+imw+"px height="+imh+"px><img src='"+impad+"' width="+imw+"px height="+imh+"px><img src='"+impad+"' width="+imw+"px height="+imh+"px>";
tp=tp+"</div>";
//tp=tp+"<div id='left'><a href='javascript://' onmouseover='noscroll=false; sl()' onmouseout='stop()'>&lt;</a></div>";
//tp=tp+"<div id='right'><a href='javascript://' onmouseover='noscroll=false; sr()' onmouseout='stop()'>&gt;</a></div>";
tp=tp+"<</div>";

document.write("<style>");
document.write("#panorama2 {position:absolute;width:"+panwid+"px; height:"+panhei+"px; clip:rect(0px,"+panwid+"px,"+panhei+"px,0px); overflow:hidden;}");
document.write("#left {position:absolute; left:"+conlefa+"px; top:"+contop+"px; width:"+conwid+"px; z-index:1; text-align:right;}");
document.write("#right {position:absolute; left:"+conlefb+"px; top:"+contop+"px; width:"+conwid+"px; z-index:1; text-align:left;}");
document.write("#right a, #left a {text-decoration:none;}");
document.write("</style>");

onload=shownow;
