// RANDOM PICTURE FUNCTIONALITY...
// Random image script adapted for Fabbelous
// Written by Oscar Björkman 2008
// www.oscarb.se

// Trim-function
String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g, "");
}

var i = Math.round( Math.random() * (pictures.length - 1) );

var tmp = pictures[i].split('|', 6);
var cat = tmp[0].trim();
var f = tmp[1].trim();

// En eller Sv?
randomPicture = (LNG == "sv") ? new Array(f, cat, tmp[2].trim(), tmp[3].trim()) : new Array(f, cat, tmp[4].trim(), tmp[5].trim());

cacheImage = new Image();
cacheImage.src = 'illustration/' + randomPicture[1] + '/' + randomPicture[0];

function printRandomImage() {
	document.write('<img src="illustration/' + randomPicture[1] + '/' + randomPicture[0] + '" alt="' + randomPicture[2] + '">');
}
