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

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

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

This file is part of MudTextFlow.

	MudTextFlow 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.
	
	MudTextFlow 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 content = "";
var containers = "";

var textflow;


////////////////////////////////////////////////////////////////////////////////
// FUNCTIONS

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

function onWindowResize() {
	textflow.update();
}

////////////////////////////////////////////////////////////////////////////////
// INIT

function callMudText(txt, cnt){
	conts = new Array(containers);
	mudInit(txt, cnt);
}

function mudInit(content, containers) {
	
	initDHTMLAPI();
	textflow = new MudTextFlow(content, containers.toString().split(","));
	textflow.update();
	window.onresize = onWindowResize;
	
}

// 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;
}*/