/*******************************************************************************

FILE: mud_Scripts.js
REQUIRES: mud_API.js
AUTHOR: Takashi Okamoto mud(tm) - http://www.mudcorp.com/
VERSION: 1.0 - initial public release
DATE: 07/22/2005

--------------------------------------------------------------------------------

This file is part of MudShiftContent.

	MudShiftContent is free software; you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation; either version 2 of the License, or
	(at your option) any later version.
	
	MudShiftContent is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.
	
	You should have received a copy of the GNU General Public License
	along with Foobar; if not, write to the Free Software
	Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

*******************************************************************************/

////////////////////////////////////////////////////////////////////////////////
// GLOBAL VARS

var imgs;

////////////////////////////////////////////////////////////////////////////////
// MOUSE EVENTS

function setOnMouseClick() {
	var elements = document.getElementsByTagName("a");
	for (var i = 0; i < elements.length; i++) {
		switch(elements[i].className) {
			case "next":
				elements[i].onclick = function() {
					 imgs.move('next');
					 return false;
				}
				break;
			case "prev":
				elements[i].onclick = function() {
					 imgs.move('prev');
					 return false;
				}
				break;
		}
	}
}


////////////////////////////////////////////////////////////////////////////////
// INIT
//+++ alteration +++

function mudInit() {
	initDHTMLAPI();
	setOnMouseClick();
	// images gallery
	// MudShiftContent(id, unitY, unitTotal)
	imgs = new MudShiftContent('imgs', 300, 3);
	// show content-wrapper
	getObject('content-wrapper').visibility = "visible";
}

////////////////////////////////////////////////////////////////////////////////
// EVENTS

// gecko, safari, konqueror and generic
if (typeof window.addEventListener != 'undefined') {
	window.addEventListener('load', mudInit, false);
}
// opera 7
else if (typeof document.addEventListener != 'undefined') {
	document.addEventListener('load', mudInit, false);
}
// win/ie
else if (typeof window.attachEvent != 'undefined') {
	window.attachEvent("onload", mudInit);
}
// rest
else {
	window.onload = mudInit;
}