//total number of pages
var vinylNumPages = 4
var ceramicNumPages = 12
var woodNumPages = 7
//stop

var zindex = 100

function expand(val) {
	var im = document.getElementById('ex'+val)
	switch(val) {
	case 0:
		im.style.left = document.body.scrollLeft+event.clientX-event.offsetX-2
		im.style.top = document.body.scrollTop+event.clientY-event.offsetY-2
		break
	case 1:
		im.style.left = document.body.scrollLeft+event.clientX-event.offsetX-2
		im.style.top = document.body.scrollTop+event.clientY-event.offsetY-132
		break
	case 2:
		im.style.left = document.body.scrollLeft+event.clientX-event.offsetX-152
		im.style.top = document.body.scrollTop+event.clientY-event.offsetY-2
		break
	default:
		im.style.left = document.body.scrollLeft+event.clientX-event.offsetX-152
		im.style.top = document.body.scrollTop+event.clientY-event.offsetY-132
		break
	}
	im.style.zIndex = zindex
	zindex++
	im.style.visibility="visible"
}

function restore(val) {
	document.getElementById('ex'+val).style.visibility="hidden"
}

function swap(val) {
	var img = document.getElementById('room')
	img.src = rooms[val].src
	var t = document.getElementById('roomt')
	t.innerHTML = roomtext[val]
}

function writeI(val) {
	return '<img src="images/' + images[val] + '.jpg" alt="' + text[val] + '" width="150" height="150" border="0">'
}

function writeR() {
	return '<img src="images/' + images[0] + '_room.jpg" width="250" height="300" border="0" id="room"><br><span id="roomt">' + roomtext[0] + '</span>'
}

function writeE(val) {
	return '<img src="images/' + images[val] + '_big.jpg" alt="' + text[val] + '" border="0">'
}

function writeT(val) {
	return text[val]
}

function writeFV(val) {
	if(val == 1)
		return '<a href="vinyl2.htm#main"><img src="images/next.gif" alt="Next" width="55" height="20" border="0"></a>'
	if (val == vinylNumPages)
		return '<a href="vinyl' + (val-1) + '.htm#main"><img src="images/previous.gif" alt="Previous" width="86" height="20" border="0"></a>'
	
	return '<a href="vinyl' + (val-1) + '.htm#main"><img src="images/previous.gif" alt="Previous" width="86" height="20" border="0"></a><a href="vinyl' + (val+1) + '.htm#main"><img src="images/next.gif" alt="Next" width="55" height="20" border="0"></a>'
}

function writeFC(val) {
	if(val == 1)
		return '<a href="ceramic2.htm#main"><img src="images/next.gif" alt="Next" width="55" height="20" border="0"></a>'
	if (val == ceramicNumPages)
		return '<a href="ceramic' + (val-1) + '.htm#main"><img src="images/previous.gif" alt="Previous" width="86" height="20" border="0"></a>'
	
	return '<a href="ceramic' + (val-1) + '.htm#main"><img src="images/previous.gif" alt="Previous" width="86" height="20" border="0"></a><a href="ceramic' + (val+1) + '.htm#main"><img src="images/next.gif" alt="Next" width="55" height="20" border="0"></a>'
}

function writeFW(val) {
	if(val == 1)
		return '<a href="wood2.htm#main"><img src="images/next.gif" alt="Next" width="55" height="20" border="0"></a>'
	if (val == woodNumPages)
		return '<a href="wood' + (val-1) + '.htm#main"><img src="images/previous.gif" alt="Previous" width="86" height="20" border="0"></a>'
	
	return '<a href="wood' + (val-1) + '.htm#main"><img src="images/previous.gif" alt="Previous" width="86" height="20" border="0"></a><a href="wood' + (val+1) + '.htm#main"><img src="images/next.gif" alt="Next" width="55" height="20" border="0"></a>'
}
