var winW, winH, 		// dimensões de janela
	imgW, imgH, 		// dimensões da imagem
	refH,				// referência .top 
	panL;				// coordenada panorama .left
var TIhandle,
	commStat = new Array(false, true);

function init(iW,iH) {
imgW=iW;
imgH=iH;
panL=0;

if(document.getElementById) {
	winW=document.body.clientWidth;
 	winH=document.body.clientHeight;
	if((winW==0) || (winH==0)) {
		winW=window.innerWidth;
	 	winH=window.innerHeight;
	}
//	alert("width="+winW+" height="+winH);
	refH=Math.floor((winH-imgH)/2);
	document.getElementById("panorama").style.top=refH;
	document.getElementById("panorama").style.visibility='visible';
	document.getElementById("command").style.top=refH;
	if(winH-refH-imgH>40)  {
		document.getElementById("commleft").style.top=refH+imgH;
		document.getElementById("commrght").style.top=refH+imgH;
		document.getElementById("commrght").style.visibility='visible';
	}
	else {
		document.getElementById("commleft").style.top=0;
		document.getElementById("commrght").style.top=0;
		document.getElementById("commrght").style.visibility='visible';
	}
}
else if (document.all) {
	winW=document.body.clientWidth;
  	winH=document.body.clientHeight;
	refH=Math.floor((winH-imgH)/2);
	document.all.panorama.style.top=refH;
	document.all.panorama.style.visibility='visible';
	document.all.command.style.top=refH;
}
else if (document.layers) {
	winW=window.innerWidth;
	winH=window.innerHeight;
	refH=Math.floor((winH-imgH)/2);
	document.all.panorama.top=(winH-imgH)/2;
	document.all.panorama.visibility='visible';
	document.all.command.top=(winH-imgH)/2;
}

return;
}

function scroll(step) {
if(step<0) {
i=panL-step;
if(i<0) panL=i;
else panL=0;
}
else {
i=panL-step;
if(i+imgW>winW) panL=i;
else panL=winW-imgW;
}
if(document.getElementById) {
	document.getElementById("panorama").style.left=panL;
	if(commStat[0] && (panL>=0)) { document.getElementById("commleft").style.visibility='hidden'; commStat[0]=false; }
	if(!commStat[0] && (panL<0)) { document.getElementById("commleft").style.visibility='visible'; commStat[0]=true; }
	if(commStat[1] && (panL+imgW<=winW)) { document.getElementById("commrght").style.visibility='hidden'; commStat[1]=false; }
	if(!commStat[1] && (panL+imgW>winW)) { document.getElementById("commrght").style.visibility='visible'; commStat[1]=true; }
}
else if (document.all) {
	
}
else if (document.layers) {

}
str="scroll("+step+")";
TIhandle=setTimeout(str,20);
return;
}

function stopScroll() {
clearTimeout(TIhandle);
return;
}