/* 
// loaderscript for the random background images and css.
// BJG 2009 - http://bjorngustafsson.com
*/	

	// load a random images into the background image layer...
	function loadBgImg() {
			
	// get random number between 1 and n. n is the number of pictures you want to randomize.
	function rand(n) {
		return (Math.floor(Math.random()*n + 1));
	}
		// get random numbers between 1 and 6.
		var randomnumber = rand(4);
		
		// if the random number is even, set the background and favicon to white, and load the image.
		if (randomnumber %2 == 0) {
			jQuery("#bg_img").hide();
			document.getElementById('maincss').href = 'css/stylewhite.css';
			jQuery("#bg_img").load("bgimages.php?o="+randomnumber+"").fadeIn("slow");
			
			document.getElementById('info_menu').src = 'images/menu/svart/info.png';
			document.getElementById('collection_menu').src = 'images/menu/svart/collection.png';
			document.getElementById('stores_menu').src = 'images/menu/svart/stores.png';
			document.getElementById('press_menu').src = 'images/menu/svart/press.png';
			document.getElementById('contact_menu').src = 'images/menu/svart/contact.png';
		}
		// if the random number is odd, set the background and favicon to black, and load the image.
		else {
			jQuery("#bg_img").hide();
			document.getElementById('maincss').href = 'css/styleblack.css';			
			jQuery("#bg_img").load("bgimages.php?o="+randomnumber+"").fadeIn("slow");
			
			document.getElementById('info_menu').src = 'images/menu/vit/info.png';
			document.getElementById('collection_menu').src = 'images/menu/vit/collection.png';
			document.getElementById('stores_menu').src = 'images/menu/vit/stores.png';
			document.getElementById('press_menu').src = 'images/menu/vit/press.png';
			document.getElementById('contact_menu').src = 'images/menu/vit/contact.png';
		}
	}