<!--

function nil() {} // a stupid thing

function gallery(gone) // go home!
{
	loop = parent.frames.length;
	if (loop == 0 || !parent.frames[0].name.indexOf("cene"))
	{
		if (!gone) gone = "index.php";
		location.replace(gone)
	}
}


function spool(way)  // for image swapping in the navigation
{
	if (document.images[way].src.indexOf("_off") == -1)
	{
		state = "normal";
		if (document.images[way].src.indexOf(state) != -1) state = "on"
		document.images[way].src="common_images/btn_"+way+"_"+state+".gif";
	}
}

function navi(state,nr,pic)  // for image swapping in the navigation
{
	document.images["navi" + nr].src="common_images/navi_" + pic + "_" + state + ".gif";
}

function subnavi(nr,state) // for image swapping of the 'about' section subnavigation 
{
	if (document.images[thumbName[nr]].src.indexOf("_2") < 1)
	{
		document.images[thumbName[nr]].src = themThumbs[nr][state].src;
	}
}

function blink(nr)  // for chaning the thumb and prev/next button activity
{
	if(sectionid != 15)
	{
		document.images["thmb" + activeThumb].src= themThumbs[activeThumb].src;
		document.images["thmb" + nr].src= themThumbs[thumbqty].src;
	}
	else // this for the About -section
	{
		document.images[thumbName[nr]].src= themThumbs[nr][2].src;
		document.images[thumbName[activeThumb]].src= themThumbs[activeThumb][0].src;
	}
	
	activeThumb = nr;
	
	if(sectionid != 15) // the next and prev buttons, only if in a gallery
	{
		if (activeThumb == 0) 
		{
			document.images["prev"].src="common_images/btn_prev_off.gif";
		}
		else
		{
			if (document.images["prev"].src.indexOf("_on") != -1)
			{
				document.images["prev"].src="common_images/btn_prev_on.gif";
			}
			else
			{
				document.images["prev"].src="common_images/btn_prev_normal.gif";
			}
		}
		
		if (activeThumb < (thumbqty-1)) 
		{
			if (document.images["next"].src.indexOf("_on") != -1)
			{
				document.images["next"].src="common_images/btn_next_on.gif";
			}
			else
			{
				document.images["next"].src="common_images/btn_next_normal.gif";
			}
		}
		else
		{
			document.images["next"].src="common_images/btn_next_off.gif";
		}
	}
}


function flip(picNr)  // loading the content into the scene-frame from the thumbnails
{
	if (picNr != activeThumb) // change if the picture isn't the one we're showing
	{
		if (sectionid != 15)
		{
			show = "gallerypic.php?nr=" + sectionid + "," + picNr;
		}
		else
		{
			//show = "aboutstuff.php?id=" + thumbName[picNr];
		}	
		parent.frames['scene'].location.replace(show);
		blink(picNr);
	}
}


function flick(to) // the next and prev buttons
{
	if ( to == -1 && activeThumb > 0 )
	{		
		flip(activeThumb + to);
	}
	
	if ( to == 1 && activeThumb < (thumbqty-1) )
	{
		flip(activeThumb + to);
	}
}


// three cookie functions
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*60*1000)); //*24*60*60*1000
		var expires = "; expires="+date.toGMTString();
	}
	else expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
createCookie(name,"",-1);
}

function killEnter(myfield,e)
{
	var keycode;
	if (window.event) keycode = window.event.keyCode;
	else if (e) keycode = e.which;
	else return true;
	if (keycode==13) { return false; }
	else return true;
}
