//  code by philp@goodtech.co.uk

var out = new Image()
out.src = "images/transparent.gif"

var productionMapOver = new Image()
productionMapOver.src = "images/map_production_over.gif"

var studioMapOver = new Image()
studioMapOver.src = "images/map_studio_over.gif"

var loungeMapOver = new Image()
loungeMapOver.src = "images/map_lounge_over.gif"

var greenroomMapOver = new Image()
greenroomMapOver.src = "images/map_greenroom_over.gif"

//  browser detection

	ns4 = (document.layers)? true:false
	ie4 = (document.all)? true:false

//  map specific rollover functions

function rollover(imageName) {
	if (ns4){document.layers[imageName+"Span"].document.images[imageName].src = eval(imageName+"Over.src")}
	if (ie4){document[imageName].src = eval(imageName+"Over.src")}
}

function rollout(imageName) {
	if (ns4){document.layers[imageName+"Span"].document.images[imageName].src = out.src}
	if (ie4){document[imageName].src = out.src}
}

function innerLaunch (layerName) {
	showLayer (layerName + "Div");
	loadFile (layerName + "Div", layerName + ".html", layerName + "Frame");
	hideLayer (thisLayer);
}

function showLayer (layerName) {
	if (ns4){
		width = top.innerWidth
		height = top.innerHeight
		hspace = width - top.document[layerName].clip.width
		vspace = height - top.document[layerName].clip.height
		document[layerName].left = hspace / 2
		document[layerName].top = vspace / 2
		document[layerName].visibility = "show"
		document.killer.visibility = "show"
	}
	if (ie4) {
		width = parent.document.body.clientWidth
		height = parent.document.body.clientHeight
		hspace = width - parent.document.all[layerName].clientWidth
		vspace = height - parent.document.all[layerName].clientHeight
		parent.document.all[layerName].style.left = hspace / 2
		parent.document.all[layerName].style.top = vspace / 2
		parent.document.all[layerName].style.visibility = "visible"
		parent.document.all.killer.style.visibility = "visible"
	}
}

function loadFile (layerName,srcFile,frameName) {
	if (ns4) {document[layerName].src = [srcFile]}
	if (ie4) {parent[frameName].document.location = [srcFile]}
}

//  layer hide and kill functions

function hideLayer (layerName) {
	if (ns4) {
		window.document.layers[layerName].visibility = "hide"
		document[layerName].src = ""
	}
	if (ie4) {
		parent.document.all[layerName].style.visibility = "hidden"
	}
}

function killLayer (layerName) {
	if (ns4) {
		window.document.layers[layerName].src = "blank.html"
		window.document.layers[layerName].visibility = "hide"
		window.document.layers.killer.visibility = "hide"
	}
	if (ie4) {
		parent.document.all[layerName].style.visibility = "hidden"
		parent.document.all.killer.style.visibility = "hidden"
	}
}

//  text scroll functions

function scrollInit(layer){
	if (ns4) {TextCon = document.TextContent}
	if (ie4) {TextCon = [layer].style}
	if (ie4) {scrolling = Scroll.style}
	if (ns4) {scrolling = document.Scroll}
	TextCon.ypos = 58
	scrolling.ypos = 71
	topClip = 0
	botClip = 120
	cyclescroll = 1
}

function moveUp(height) {
	if (TextCon.ypos < 58) {
		TextCon.ypos += 20
		TextCon.top = TextCon.ypos
		topClip -= 20
		botClip -= 20
		if (ns4) {
			TextCon.clip.top = topClip
			TextCon.clip.bottom = botClip
		}
		if (ie4) TextCon.clip = "rect("+topClip+",300,"+botClip+",0)"
		scrolling.ypos = topClip / (height-120) * 100 + 71
		scrolling.top = scrolling.ypos
	}
}

function moveDown(height) {
	cycle = 0
	if (cyclescroll == 0){
		scrollInit('TextContent')
	}
	if (cyclescroll == 1){
	realHeight = 180 - height
	if (TextCon.ypos > realHeight){
		TextCon.ypos -= 20
		TextCon.top = TextCon.ypos	
		topClip += 20
		botClip += 20
		if (ns4) {
			TextCon.clip.top = topClip
			TextCon.clip.bottom = botClip
		}
		if (ie4) TextCon.clip = "rect("+topClip+",300,"+botClip+",0)"
		scrolling.ypos = topClip / (height-120) * 94 + 71
		scrolling.top = scrolling.ypos
	}
	}
}


//  360 panorama functions

function scroll360Init(){
	if (ns4) pana = document.panaram360
	if (ie4) pana = panaram360.style
	pana.xpos = 400
	rightClip = 0
	leftClip = 300
}

function right360() {
	if (pana.xpos > -2150) {
		pana.xpos -= 50
		pana.left = pana.xpos
		leftClip += 50
		rightClip += 50
		if (ns4) {
			pana.clip.left = rightClip
			pana.clip.right = leftClip
		}
		if (ie4) pana.clip = "rect(0,"+leftClip+",155,"+rightClip+")"
	}
}

function left360() {
	if (pana.xpos < 400) {
		pana.xpos += 50
		pana.left = pana.xpos
		leftClip -= 50
		rightClip -= 50
		if (ns4) {
			pana.clip.left = rightClip
			pana.clip.right = leftClip
		}
		if (ie4) pana.clip = "rect(0,"+leftClip+",155,"+rightClip+")"
	}
}

