function level(ordinal, levelName, imagesrc, imagesrcE, contentWidth, width, height)
{
	this.clipbottom = getClipBottom(document.getElementById('plan'));
	this.clipright = getClipRight(document.getElementById('plan'));
		
	this.ordinal = ordinal;
	this.levelname = levelName;
	this.image = new Image();
	this.image.src = imagesrc;
	this.imageE = new Image();
	if (!imagesrcE==""){
		this.imageE.src = imagesrcE;
		this.enlargeable = 1;
	}
	else 
		this.enlargeable = 0;
	this.imageE.width = width;
	this.imageE.height = height;
	this.hotspots = new Array();
	this.AddHotSpot = addhotspot;
	this.ShowHotSpots = showhotspots;
	this.HideHotSpots = hidehotspots;
	this.TransformHotSpots = transformhotspots;
	this.size = "normal";
	this.contentWidth = contentWidth;
}

function ChangeLevel(newActive)
{
if ( newActive != activeLevel){
	var tab=document.getElementById("tab"+newActive);
	tab.src = supportPath+"/tabs_dn.gif";
	zIndexToStore = tab.style.zIndex;
	tab.style.zIndex = 600;
	tab = document.getElementById("tab"+activeLevel);
	tab.src = supportPath+"/tabs_up.gif";
	tab.style.zIndex = zIndexToStore ; 
	tab = document.getElementById("lab"+newActive);
	var oldHTML = tab.innerHTML;
	var re = new RegExp("black","gi");
	var newHTML = oldHTML.replace(re, "white");
	tab.innerHTML = newHTML;
	tab = document.getElementById("lab"+activeLevel);
	oldHTML = tab.innerHTML;
	re = new RegExp("white","gi");
	newHTML = oldHTML.replace(re, "black");
	tab.innerHTML = newHTML;
	oldZindex = zIndexToStore;
	levelChange = 1;
	if(mapString.length){
		if (document.getElementById("lab"+newActive).innerHTML.indexOf(mapString) != -1)
			ShowMap();
		else if (MapActive())
			HideMap();
		if (MapActive()){
			activeLevel = newActive;
			return false;
		}
	}
	if(infoString.length){
		if (document.getElementById("lab"+newActive).innerHTML.indexOf(infoString) != -1){
			ShowInfo();
		}
		else if (InfoOpen())
			HideInfo();
		if (InfoOpen()){
			activeLevel = newActive;
			return false;
		}
	}
	ShowNavigation(newActive);	 
	
	zoom_out()
	
	
	if (activeLevel < levels.length){
		window.status="active "+newActive;
 	   levels[activeLevel].HideHotSpots();
 	   levels[newActive].ShowHotSpots();
    }
		activeLevel = newActive;

	var planImg = document.getElementById("plan");
	planImg.src = levels[activeLevel].image.src;
	OpenCam(levels[activeLevel].hotspots[0].id);
	if(enlarged)
		setTimeout("moveElementsForSizeToggle("+enlarged+", "+0+")", 500);

}
return false;

}

function addhotspot(hSpot)
{
	var curIndex = this.hotspots.length;
	hSpot.ind = curIndex;
	this.hotspots[curIndex] = hSpot;
}

function showhotspots()
{
	var ii, nHSpots = this.hotspots.length;
	window.status="nHSpots = "+nHSpots;
	for (ii = 0; ii < nHSpots; ii ++)
	{
		if(editor || (this.hotspots[ii].visflag & C_DELETED) == 0){
			var prefix = (this.hotspots[ii].visited)?'g':'r';
			var iHSpot = document.getElementById(prefix+this.hotspots[ii].id);
			window.status="nHSpots = "+iHSpot.style;
			iHSpot.style.display = "block";
		}
	}
}
function hidehotspots()
{
	var ii, nHSpots = this.hotspots.length;
	for (ii = 0; ii < nHSpots; ii ++)
	{
			var iHSpot = document.getElementById("r"+this.hotspots[ii].id);
			if (iHSpot){
				iHSpot.style.display = "none";
			}
			iHSpot = document.getElementById("s"+this.hotspots[ii].id);
			if (iHSpot)
				iHSpot.style.display = "none";
			iHSpot = document.getElementById("g"+this.hotspots[ii].id);
			if (iHSpot)
				iHSpot.style.display = "none";
		}	
}


function transformhotspots(toSize)
{
	var ii, newX, newY, newXA;
	var  nHSpots = this.hotspots.length;
	if (this.size != toSize)
	{
		this.size = toSize;
	
			for (ii = 0; ii < nHSpots; ii ++)
		{
if	((this.hotspots[ii].visflag & C_DELETED) == 0){   
	 
			if (toSize == "enlarge"){

				document.getElementById("r"+this.hotspots[ii].id).style.left = this.hotspots[ii].EX-8+"px";
				document.getElementById("r"+this.hotspots[ii].id).style.top = this.hotspots[ii].EY-8+"px";
				document.getElementById("g"+this.hotspots[ii].id).style.left = this.hotspots[ii].EX-8+"px";
				document.getElementById("g"+this.hotspots[ii].id).style.top = this.hotspots[ii].EY-8+"px";
				document.getElementById("s"+this.hotspots[ii].id).style.left = this.hotspots[ii].EX-86+"px";
				document.getElementById("s"+this.hotspots[ii].id).style.top = this.hotspots[ii].EY-86+"px";
				document.getElementById("e"+this.hotspots[ii].id).style.left = this.hotspots[ii].EX-15+"px";
				document.getElementById("e"+this.hotspots[ii].id).style.top =  this.hotspots[ii].EY-15+"px";
				//Math.floor(this.hotspots[ii].EY-40*Math.sin(pi/8*this.hotspots[ii].dir) - 15)+"px";
				//Math.floor(parseFloat(this.hotspots[ii].EX)+40*Math.cos(pi/8*this.hotspots[ii].dir) - 15)+"px";

			
			} else if (toSize == "reduce"){
				document.getElementById("r"+this.hotspots[ii].id).style.left = this.hotspots[ii].RX-8+"px";
				document.getElementById("r"+this.hotspots[ii].id).style.top = this.hotspots[ii].RY-8+"px";
				document.getElementById("g"+this.hotspots[ii].id).style.left = this.hotspots[ii].RX-8+"px";
				document.getElementById("g"+this.hotspots[ii].id).style.top = this.hotspots[ii].RY-8+"px";
				document.getElementById("s"+this.hotspots[ii].id).style.left = this.hotspots[ii].RX-86+"px";
				document.getElementById("s"+this.hotspots[ii].id).style.top = this.hotspots[ii].RY-86+"px";

				
			}  else {
				document.getElementById("r"+this.hotspots[ii].id).style.left = this.hotspots[ii].NX-8+"px";
				document.getElementById("r"+this.hotspots[ii].id).style.top = this.hotspots[ii].NY-8+"px";
				document.getElementById("g"+this.hotspots[ii].id).style.left = this.hotspots[ii].NX-8+"px";
				document.getElementById("g"+this.hotspots[ii].id).style.top = this.hotspots[ii].NY-8+"px";
				document.getElementById("s"+this.hotspots[ii].id).style.left = this.hotspots[ii].NX-86+"px";
				document.getElementById("s"+this.hotspots[ii].id).style.top = this.hotspots[ii].NY-86+"px";
				document.getElementById("e"+this.hotspots[ii].id).style.left = this.hotspots[ii].NX-15+"px";
				document.getElementById("e"+this.hotspots[ii].id).style.top =  this.hotspots[ii].NY-15+"px";
			} 
		}
			}
	}
}





function addLevel(levelName, imagesrc, imagesrcE, contentWidth, width, height)
{
     var oldlen = levels.length;
 	 levels[oldlen]= new level(oldlen, levelName, imagesrc, imagesrcE, contentWidth, width, height);

}


function ShowInfo()
{
	// disable navigation
	var nvig = document.getElementById("navigation");
	if (nvig)
		nvig.style.display = "none";
	document.getElementById("info_tab").style.display="block";
	infoIsActive = true;

	// show main photo
   levels[activeLevel].HideHotSpots();
	OpenCam(0);
    levels[activeLevel].HideHotSpots();
	return true;
}
function HideInfo()
{	
   	document.getElementById("info_tab").style.display="none";
	var nvig = document.getElementById("navigation");
	if (nvig){
		nvig.style.display = "block";
		updateNavigation();
	}
	infoIsActive = false;
	
}
function InfoOpen()
{
	return infoIsActive;
}

function ShowMap()
{
	// disable navigation
	var nvig = document.getElementById("navigation");
	if (nvig)
		nvig.style.display = "none";
	document.getElementById("mapcage").style.visibility="visible";
map.enableGoogleBar();
	// hide hotspots
   levels[activeLevel].HideHotSpots();
	// show main photo
	OpenCam(0);
   levels[activeLevel].HideHotSpots();
	mapIsActive = true;
	ShowGoogeHelp();
	return true;
}
function HideMap()
{	
   	document.getElementById("mapcage").style.visibility="hidden";
	var nvig = document.getElementById("navigation");
	if (nvig){
		nvig.style.display = "block";
		updateNavigation();
	}
	mapIsActive = false;
	HideGoogeHelp();

	
}
function MapActive()
{
	return mapIsActive;
}

function addMap(lat, lng, scale, edit)
{
   document.getElementById("mapcage").style.visibility="hidden";
   if (!GBrowserIsCompatible()){
   	   alert("incompatible browser");
   }
   var opts = {showOnLoad: true};
   
    map = new GMap2(document.getElementById("mapcage"), {googleBarOptions: opts});
	if (map){
		map.addControl(new GSmallMapControl());
		map.addControl(new GMapTypeControl());
		var pt = new GLatLng(lat, lng);
		map.setCenter(pt, scale); 
//		map.enableGoogleBar();
		map.enableScrollWheelZoom();
		if (mapType == "Satellite")
			map.setMapType(G_SATELLITE_MAP);
		if (mapType == "Hybrid")
			map.setMapType(G_HYBRID_MAP);
		if (edit){
			marker = new GMarker(pt,{draggable: true})
			map.addOverlay(marker);
			marker.disableDragging();
			GEvent.addListener(map, 'singlerightclick', function(point,src,marker) { OpenMap4Edit(marker);} ); 
		} else {
			marker = new GMarker(pt)
			map.addOverlay(marker);
			GEvent.addListener(map, 'click', function(point,src,marker) { HideGoogeHelp();} ); 

		}
	}
	addLevel("map", "", "", 0, 0, 1.0, 1.0, 0, 0);
}
function addInfo()
{
	addLevel("info", "", "", 0, 0, 1.0, 1.0, 0, 0);

}
<!-- 
 --><!-- 
 -->
