// Fill in the array with picture descriptions
pics = new Array();
pics[0] = 'Our parking lot is spacious and provides ample room to service our guests with a wide variety of parking needs.';
pics[1] = 'Pull right up to your room to make packing and unpacking a breeze.';
pics[2] = 'Our new flat screen cable TVs ensure that you will enjoy your favorite programs or the daily news.';
pics[3] = 'Our spotless rooms and courteous service welcomes our guests every time.';
pics[4] = 'Fresh towels and complimentary toiletries are provided daily.';
pics[5] = 'Our rooms with two double beds provide a restful place for up to 4 people to relax and enjoy a pleasant stay.';
pics[6] = 'Our rooms with a comfortable queen sized bed provide a relaxing retreat for up to 2 people.';

// Leave everything else below this line alone

var boxPos = 1;
var boxTotal;

function preshuttle() {
	boxTotal = 0;
	temp1 = new Array();
	temp1 = document.getElementsByTagName('div');
	for (i=0 ; i<temp1.length ; i++) {
		if (temp1[i].className == 'box1') {
			temp1[i].style.display = 'none';
			temp1[i].style.position = 'absolute';
			boxTotal++;
		}
	}
}

function shuttle(foo) {
	var increment = foo;
	if (boxPos+increment == 0) boxPos = boxTotal;
	else if (boxPos+increment > boxTotal) boxPos = 1;
	else boxPos = boxPos+increment;
	if (document.getElementById('home')) {
		preshuttle()
		document.getElementById('homebox'+boxPos).style.display = 'block';
		document.getElementById('switchBox').style.height = document.getElementById('homebox'+boxPos).offsetHeight + 'px';
	}
	if (document.getElementById('rooms')) {
		document.getElementById('picture').childNodes[0].src = '/images/rooms_pic_'+boxPos+'.jpg';
		document.getElementById('text').innerHTML = pics[boxPos-1];
	}
}

// THIS FUNCTION ACTIVATES EMAIL FORMS
function activate(brillig) {
	document.getElementById('config').name = "config";
	document.getElementById('config').value = brillig;
}

function setup() {
	// OUTBOUND LINKS OPEN IN A NEW WINDOW UNLESS EXPLICITLY TOLD OTHERWISE
	// FORCE SAME WINDOW: rel="self" in anchor
	// FORCE EXTERNAL WINDOW: rel="external" in anchor 
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors.length; i++) {
		var URL = anchors[i].href;
		if ((URL.search('berlinvillageinn')===-1 && URL.search('http')!==-1 && anchors[i].rel !== 'self') || anchors[i].rel === 'external') anchors[i].target = "_blank";
	}
	if (document.getElementById('home')) {
		document.getElementById('arrows1').style.display = 'block';
		document.getElementById('switchBox').style.height = document.getElementById('homebox1').offsetHeight + 'px';
		preshuttle()
		document.getElementById('homebox1').style.display = 'block';
	}
	if (document.getElementById('rooms')) {
		document.getElementById('arrows2').style.display = 'block';
		boxTotal = pics.length;
	}
}

window.onload = setup;