/*************************************************/
/****Variabler for slideshow/gallerinavigasjon****/
/*************************************************/
var imgObj 		= '';
var imgList 	= '';
var textList	= '';
var imgPath		= '';
var headerObj	= '';
var tekstObj	= '';
var header		= '';
var img			= '';
var text		= '';
var boolSlide   = '';
var imgA		= '';
/*********************End*************************/

function init_gallery()
{
	imgObj 		= document.images['fullimg'];
	imgList 	= document.getElementById('imglist');
	textList	= document.getElementById('textlist');
	imgPath		= 'http://kundeweb.aggressive.no/users/hovringenhotell.no/galleri/'
	headerObj	= document.getElementById('header');
	tekstObj	= document.getElementById('tekst');
	boolSlide	= false;
	imgA		= document.getElementById('img');
}

function move_prev()
{
	var index = imgList.selectedIndex;
	
	if(index != 1)
	{
		header	= imgList.options[index-1].text;
		img		= imgList.options[index-1].value;
		text	= textList.options[index-1].text;		
		
		index -= 1;
	}
	else
	{
		index = imgList.options.length-1;

		header	= imgList.options[index].text;
		img		= imgList.options[index].value;
		text	= textList.options[index].text;
	}
	
	imgList.selectedIndex = index;
	textList.selectedIndex = index;
	
	imgObj.src = imgPath + img;
	imgObj.alt = header;
	headerObj.innerText = header;
	tekstObj.innerText = text;

}

function move_next()
{
	var index = imgList.selectedIndex;
	
	if(index == (imgList.options.length-1))
	{
		header	= imgList.options[0].text;
		img		= imgList.options[0].value;
		text	= textList.options[0].text;
		
		index = 0;	
	}
	else
	{		
		header	= imgList.options[index+1].text;
		img		= imgList.options[index+1].value;
		text	= textList.options[index+1].text;
		
		index += 1
	}
	
	imgList.selectedIndex = index;
	textList.selectedIndex = index;
	
	imgObj.src = imgPath + img;
	imgObj.alt = header;
	headerObj.innerText = header;
	tekstObj.innerText = text;

}
	
function slide_start()
{
	if(boolSlide)
	{
		move_next();
		setTimeout('slide_start()',3500);
	}
}


