//***************************************************************************************/
//*****parameters to set*****
divid="panorama"; //the id of the div container that will hold the panorama
impad='images/full2.jpg'; //the path to your panorama-pic


imwid=1705; //the width of the pic
imhei=280; //the height of the pic
panwid=800; //the width of the shown area

//var panwid; //the width of the shown area
panhei=280; //the height of the shown area
//if it differs from the image-height, the image gets scaled in length and height
speed=15; //timeout between moves; set it lower to increase speed
move=1; // movement at one step in pixel
//*****nothing more to do, have fun :)
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;



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 slstart(){
	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("slstart()",30);
	}
}

function Area_MouseOver(obj){		
	now=parseFloat(document.getElementById("pano").style.left);
	var rect = new Array();
	rect = obj.coords.split(',');
	//alert((imwid + now) + ' ' + rect[0] + ' ' + xPos);
	
	oShow = document.getElementById("ShowItem");
	
	oShow.style.top = rect[1] + 'px';
	oShow.style.left= (imwid + now + Number(rect[0])) + 'px';
	iHeight = Number(rect[3]) - Number(rect[1]);
	oShow.style.height=iHeight+'px';
	iWidth = Number(rect[2]) - Number(rect[0]);
	oShow.style.width=iWidth+'px';
	
	
	document.getElementById('ItemTitle').innerHTML = obj.myprop;
	oShow.style.visibility='visible'; 
	
	//alert('' + Number(rect[3]) +  ' - ' + Number(rect[1]) + ' = ' + iHeight + ' px');
	
	//arr = split(obj.coords);
	//alert(rect[1] + ' ' + obj.clientLeft + ' ' + now);
}

function Area_MouseOut(){
	oShow = document.getElementById("ShowItem");
	oShow.style.visibility='hidden';
}

function stop(){clearTimeout(tim); noscroll=true}

function shownow() {
	w = document.getElementById('id_panorama').clientWidth;
	
	panwid=w; //the width of the shown area
	
	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;
	
	document.getElementById(divid).style.height=panhei+"px";
	
	document.getElementById(divid).innerHTML='';
	
	tp="<div id='panorama2' style='position:absolute; width:"+panwid+"px; height:"+panhei+"px; clip:rect(0px,"+panwid+"px,"+panhei+"px,0px); overflow:hidden;'>";
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 id='pan1' src='"+impad+"' width="+imw+"px height="+imh+"px border='0'><img id='pan2' src='"+impad+"' width="+imw+"px height="+imh+"px border='0'><img id='pan3' src='"+impad+"' width="+imw+"px height="+imh+"px border='0'>";
tp=tp+"</div>";
tp=tp+"</div>";
	

	
	//usemap='#PanoramaMap'
	document.getElementById(divid).innerHTML=tp;
	
	for(i=1;i<=3;i++){
		oImg = document.getElementById('pan'+i);
		oImg.useMap = '#PanoramaMap';
	}
	
}

function preload(){
	
	
	
	shownow();
	//stop();
	noscroll=false;
	slstart();
}


onload=preload;
onresize=shownow;
