/**
 * BAZAKI.NL
 * General functions and declarations
 * Copyright 2007 Sander Beck
 */

//GENERAL DECLARATIONS
var img_menu = new Array ('home','nieuws','forum','gps-logs','media','teamriders','about');   
var img_dir = BASE_URL+'images/layout/';
var img_prereq = 'but_';


//Build the menu
var on_images = new Array();   
var off_images = new Array();
for (var i = 0; i < img_menu.length; i++ ) 
{ 
	on_images[i] = new Image(); 
	off_images[i] = new Image(); 
	on_images[i].src = img_dir+img_prereq+img_menu[i]+'_on.gif';
	off_images[i].src = img_dir+img_prereq+img_menu[i]+'_off.gif'; 
}


// Swap on- off- images
function swap(id,onoff) { 
	if( onoff == 1 )document.getElementById('menuid'+id).src = on_images[id-1].src;
	if( onoff == 2 )document.getElementById('menuid'+id).src = off_images[id-1].src
}


// Screen detect and configuration
function getWindowHeight() {
  if (typeof(window.innerWidth) == 0) {
    return window.innerHeight;
  } else if (document.documentElement && document.documentElement.clientHeight) {
    return document.documentElement.clientHeight;
  } else if (document.body && document.body.clientHeight) {
    return document.body.clientHeight;
  }
}


// Set the correct screen height
function setHeight() {
	var height = getWindowHeight();
	contentObj = document.getElementById("contentForumHolder");	
	contentHeight = contentObj.clientHeight;  	
	if(height > contentHeight+200) document.getElementById("contentForumHolder").style.height = height-200+"px";
}	


// Clear textfields preset text and turn to black
function clearText(thefield) {
	if (thefield.defaultValue == thefield.value) {
		thefield.value = "";
		thefield.style.color = "#000000";
	}
	else thefield.value = thefield.defaultValue;
}