// Image rotation Javascript
// Written by: 3rdSUN Solutions (www.3rdsun.com)

// Installation:
// 

function rotate() {
	current=document["swap"].src
	type=current.substring(current.length-4, current.length);
	randmax=current.substring(current.lastIndexOf("/")+1,current.lastIndexOf("."))-1;
	path=current.substring(0,current.lastIndexOf("/")+1);
	rotate=path+rand(randmax)+type;
	document["swap"].src = rotate;
}

//http://www.faqts.com/knowledge_base/view.phtml/aid/4005
function setBackgroundImage (id, imageURL) {
	current=imageURL;
	type=current.substring(current.length-4, current.length);
	randmax=current.substring(current.lastIndexOf("/")+1,current.lastIndexOf("."))-1;
	path=current.substring(0,current.lastIndexOf("/")+1);
	imageURL=path+rand(randmax)+type;
	


  if (document.layers)
    document[id].background.src = imageURL == 'none' ? null : imageURL;
  else if (document.all)
    document.all[id].style.backgroundImage = imageURL == 'none' ? 'none' 
: 'url(' + imageURL + ')';
  else if (document.getElementById)
    document.getElementById(id).style.backgroundImage = imageURL == 
'none' ? 'none' : 'url(' + imageURL + ')';
}


// The Central Randomizer 1.3 (C) 1997 by Paul Houle (houle@msc.cornell.edu)
// See:  http://www.msc.cornell.edu/~houle/javascript/randomizer.html

rnd.today=new Date();
rnd.seed=rnd.today.getTime();

function rnd() {
        rnd.seed = (rnd.seed*9301+49297) % 233280;
        return rnd.seed/(233280.0);
};

function rand(number) {
        return Math.ceil(rnd()*number);
};