var hs;

function setSpinPos() {
	hs[0][0] = "530";
	hs[0][1] = "140";
	hs[1][0] = "670";
	hs[1][1] = "150";
	hs[2][0] = "640";
	hs[2][1] = "225";
	
}

function init () {
	if (ie || ns6) {
		for (l=1;l<=anzahl_hs;l++) {
			eval("mlegend" + l +" = new Layer('legend" + l +"',true)");
			eval("mlegend" + l + ".setVis(true)");
		}
	}

/*
	if (start_spin!='undefined') {
		hs = new Array(anzahl_spins); 
		for (var a=0; a<anzahl_spins; a++) {
			hs[a] = new Array(anzahl_hs);
		}

		setSpinPos();
				
		mhs1 = new Layer('hs1',true);
		mhs1.moveTo(hs[start_spin-1][0],hs[start_spin-1][1]);
		mhs1.setVis(true);
	
		for (h=0; h< anzahl_spins; h++) {
			eval("mshs" + h +" = new Layer('shs" + h +"',true)");
			eval("mshs" + h + ".moveTo(hs[" + h + "][0],hs[" + h + "][1])");
			eval("mshs" + h + ".setVis(true)");
	        }
	}
*/
	  
}

function getPage(s) {
	stopPanning ()
	mhs1.moveTo(hs[s][0],hs[s][1]);
	eval('document.location.href = "spin' + (s+1) + '.html";');
}

function getPano(s) {
	stopPanning ()
	mhs1.moveTo(hs[s][0],hs[s][1]);
	window.document.ptviewer.newPanoFromList(s);	
}

function stopPanning () {
       if (document.ptviewer) {
		if (navigator.appVersion.indexOf("Win") == -1 && document.all) {
		} else {
			document.ptviewer.stopAutoPan();
		}
	}
}

function anleitung() {
	stopPanning ();
	var popup = window.open('','','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=auto,resizable=no,copyhistory=no,width=300,height=300,');
	var d = popup.document;
	d.write('<!doctype html public -//W3C//DTD HTML 4.0 Transitional//EN" http://www.w3.org/TR/REC-html40/loose.dtd><HTML><HEAD>');
	d.write('<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <TITLE>spin-Anleitung</TITLE> </HEAD> <BODY bgcolor="#FFFFFF" topmargin="0" leftmargin="0" marginwidth="0" marginheight="0">');
	d.write('<MAP name="control">');
	d.write('<AREA shape=rect coords="52,267,244,292"  alt="schliessen/close" href="javascript:window.close()">');
	d.write('</MAP>');
	d.write('<img src="fileadmin/lehner/rundgang/images/anleitung.gif" width="300" height="300" border="0" usemap="#control">');
	d.write('</BODY></HTML>');
	d.close();
}


var legendImgOn = new Image();
legendImgOn.src = "fileadmin/lehner/rundgang/images/button_o.gif";
var legendImgOff = new Image();
legendImgOff.src = "fileadmin/lehner/rundgang/images/button.gif";

function chgImg (img) {
	if (document.images['img' + img].src != legendImgOn.src) { 
		document.images['img' + img].src = legendImgOn.src;
	} else {
		document.images['img' + img].src = legendImgOff.src;	
	}
}

/*
function wechsel (img) {
	if (eval("document.images['img' + img].src != hsimage" + img + "On.src")) { 
		eval("document.images['img' + img].src = hsimage" + img + "On.src");
	} else {
		eval("document.images['img' + img].src = hsimage" + img + "Off.src");	
	}
}
*/

var activedot = false;

function mousehs(n) {
        if (activedot == false && n >= 0) {
                n = Math.floor(n/2) + 1;
                activedot = n;
                document.images['img' + n].src = legendImgOn.src;
                //if (ie || ns6) eval("mlegend" + n + ".setWeight(true)");
        } else if(activedot != false) {
               document.images['img' + activedot].src = legendImgOff.src;
               // if (ie || ns6) eval("mlegend" + activedot + ".setWeight(false)");
                activedot = false;
       }
}

var popupopen = false;
var popupwindow;
var objektnr;
function hotspot(objnr,panangle,tilt) {
        objektnr = objnr;

        if (document.ptviewer && panangle) {
                if (navigator.appVersion.indexOf("Win") == -1 && document.all) {
                } else {
			document.ptviewer.moveTo(panangle,tilt,95,20);
			if (!document.all) document.ptviewer.waitWhilePanning();
                }
        }
     
	    if (popupopen == true && popupwindow.closed == false) popupwindow.close();
	       popupwindow = window.open('../popup' + objektnr + '.html','Produktinformation','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width='+ (objekt[objektnr]["size-x"]) +',height=' + (objekt[objektnr]["size-y"]) +',');
	       popupwindow.focus();
	       popupopen = true;
	      
}



function extLink(link) {
	 stopPanning();
        var extWindow = window.open(link, 'newWindow');
}