/**
* JSAX package containing:
*  ../WFM.js
*  ../Event.js
*  ../Reference.js
*  ../DOM.js
*  ../proto/Element.js
*  ../detectBrowser.js
*  ../compat/browser_msie.js
*  ../compat/png_alpha.js
*  ../compat/innerSize.js
*  ../proto/String.js
*  ../JSAX.js
* 
*  61952 Bytes total
* 
* Created at 2008-03-11 01:58:25
*/

/**
* JSAX - JavaScript (Standard) Abstractions for X(HT)ML
*
* written by Florian Sax 20051229 <flosax(at)users.sourceforge.net>
* Copyright (C) 2005 Florian Sax
*
* This program 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.
* 
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*
*
* You can also find the GPL at the following internet adress: <http://www.gnu.org/copyleft/gpl.html>
*
* @version: 20060626
*/
if( !JSAX)window.JSAX = {
	Version: 20060626,
/**
* JSAX.JSload - include and require for JavaScript ( uses JSAX.HTTP)
*
* @parent JSAX.JSload
*/
JSload: {
	dir: "",
	end: ".js",
/**
* JSAX.JSload.solvPath - This is a helper function for JSAX.JSload.require( fn).
*/
	solvePath: function( file){
		var file = file;
		if( file.indexOf( "?") == -1
		 && ( file.toLowerCase().indexOf( JSAX.JSload.end) == -1
		 || file.toLowerCase().lastIndexOf( JSAX.JSload.end) +JSAX.JSload.end.length != file.length)){
			file += JSAX.JSload.end;
		}
		if( JSAX.JSload.dir){
			if( JSAX.JSload.dir.lastIndexOf( "/") != JSAX.JSload.dir.length -1){
				JSAX.JSload.dir += "/";
			}
		}else{
			JSAX.JSload.dir = "./";
		}
		if( file.indexOf( JSAX.JSload.dir) != 0){
			file = JSAX.JSload.dir+file;
		}
		return file;
	},
/**
* This is a alias to JSAX.HTTP.request
*/
	read: function( file){
		return JSAX.HTTP.request( file, arguments[1], arguments[2], arguments[3]);
	},

/**
* JSAX.JSload.passthrew - Returnes the content of the requested file directly in the document
* NOTE that google is not able to do these actions.
* 
* @param String file - The file which should be pasted into the document
*/
	passthrew: function( file){
		JSAX.HTTP.request( file, "alert( ...); document.write( ...);");
	},

/**
* JSAX.JSload.execute - Execute JavaScript without failure
* 
* @param String code - The code which should be run.
* @param String file - The fileName which will be shown in the alert on a failure
*
* @return Boolean - True on success false on an error.
*/
	execute: function( code, file){
		try{
			eval( code);
		}catch( e){
			var correction = 82; // NOTE this must be set to this lineNumber
			var error = "Error";
			if( e.lineNumber){
				var line = e.lineNumber -correction -1;
				error += " on line "+line;
			}
			alert( error+" in file "+file+": "+e.message+"\n\n"+code);
			return false;
		}
		return true;
	},

/**
* JSAX.JSload.include - Include a JavaScript file.
* 
* @param String file - The path of the .js file (for example: include( "./myLib/myScript.js", "./myLib/myOtherScript.js"))
* @param String [file2] - The name of the 2. file
* @param String [file3] - ...
*
* @return String - The number of files which could be loaded without failure.
*/
	include: function( file){
//		var file = JSAX.JSload.solvePath( file);
		if( arguments.length > 1){
			var succeed = 0;
			for( var i=0; i < arguments.length; i++){
				if( JSAX.JSload.include( arguments[i])){
					succeed++;
				}
			}
			return succeed;
		}

		var code = JSAX.JSload.read( file);
		return JSAX.JSload.execute( code, file);
	},
	
	requiredFiles : [],
/**
* JSAX.JSload.require - Include a JSAX library once. this function has a pathcorrection.
* 
* @param String file - The name of the JSAX object (for example: include( "proto/String"))
* @param String [file2] - The name of the 2. script
* @param String [file3] - ...
*
* @return String - The number of files which could be loaded without failure.
*/
	require: function( file){
		var file = JSAX.JSload.solvePath( file);
			var succeed = 0;
		if( arguments.length == 1 && typeof( arguments[0]) == "object"){
			arguments = arguments[0];
		}
		if( arguments.length > 1){
			for( var i=0; i < arguments.length; i++){
				if( JSAX.JSload.require( arguments[i])){
					succeed++;
				}
			}
			return succeed;
		}

		if( typeof( JSAX.JSload.requiredFiles[file]) != "string"){
			var content = read( file)
			JSAX.JSload.execute( content, file);
			JSAX.JSload.requiredFiles[file] = content;
			return ;
		}
		return true;
	}
},

/**
* JSAX.HTTP - file reading ( works only on the host of the HTML file wich this is on)
* This procedure is called Ajax
*
* @parent JSAX.HTTP
*/
HTTP: {

/**
* JSAX.HTTP - file reading ( works only on the host of the HTML file wich this is on)
* 
* @param String URL - The path to the file (or script)
* @param String [method] - The request method (GET or POST, default=GET) to send the data
* @param Array [data] - The request data ( as a HTMLform)
*
* @return String - The result of your request (file content, script result)



	function ajaxRequest(url, method, param, onSuccess, onFailure){
		var xmlHttpRequest = new XMLHttpRequest();
		xmlHttpRequest.onreadystatechange = function() {
			if (xmlHttpRequest.readyState == 4 && xmlHttpRequest.status == 200) onSuccess(xmlHttpRequest);
			else if (xmlHttpRequest.readyState == 4 && xmlHttpRequest.status != 200) onFailure(xmlHttpRequest);
		};
		xmlHttpRequest.open(method, url, true);
		if (method == 'POST') xmlHttpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		xmlHttpRequest.send(param);
	}
*/
	objects: [],
	request: function( URL, eval, method, data){
		if( !method){
			var method = "GET";
		}
		if( !data){
			var data = null;
		}
		var reqObj = JSAX.HTTP.requestObject();
		if( !reqObj){
			return false;
		}
		if( eval){ // asynchron
			reqObj.open( method, URL, true);
//			if( data){
				reqObj.send( data);
//			}
			while( eval.indexOf( "...") != -1){
				eval = eval.replace( "...", "window.JSAX.HTTP.objects[id].responseText");
			}
			reqObj.eval = eval;
			reqObj.URL = URL;
			var id = JSAX.HTTP.objects.length;
			JSAX.HTTP.objects[id] = reqObj;
			reqObj.onreadystatechange = JSAX.HTTP.respond( id);
			return true;
		}else{ // wait
			reqObj.open( method, URL, false);
			reqObj.send( data);
			return reqObj.responseText;
		}
	},
	states: ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'],
	respond: function( id){
		var reqObj = JSAX.HTTP.objects[id];
		if( reqObj.readyState == "1"){
			setTimeout( "JSAX.HTTP.respond( "+id+");", 10);
			return;
		}
//		alert( JSAX.HTTP.states[reqObj.readyState]+" "+reqObj.URL);
		var e = false;
		try{
			eval( reqObj.eval);
		}catch( e){
			alert( e.message);
		}
		if( reqObj.readyState == 0){
			alert( "failed to load URL( "+reqObj.URL+").");
		}
		reqObj.onreadystatechange = null;
		window.JSAX.HTTP.objects[id] = null;
	},
/**
* Internal helper function for JSAX.HTTP.request()
* @return Object - XMLHttpRequest request Object
*/
	requestObject: function(){
		if( typeof( XMLHttpRequest) != "undefined"){
			return new XMLHttpRequest();
		}else{ // M$IE
			var possible = new Array(
				"Microsoft.XMLHTTP",
				"Msxml2.XMLHTTP",
				"MSXML2.XMLHTTP.3.0",
				"MSXML2.XMLHTTP.4.0"
			);
			var reqObj = false;
			var done = false;
			for( var i=0; i < possible.length; i++){
				try{
					reqObj = new ActiveXObject( possible[i]);
					done = true;
				}catch( e){
					reqObj = false;
				}
				if( done){
					return reqObj;
				}
			}
		}
		return false;
	}
	
},
/**
* object handling helpers
* @parent JSAX.object
*/
object: {

/**
* JSAX.object.concat - Makes a new object of any number of objects, the first object is the most dominating. This function does not modify the given objects, it makes a copy.
* @param Object object1
* @param [Object object2]
* @return Object - Combined object of object1 and object2 ... where object2 has priority if a value exists in both objects.
*/
	concat: function( object1, object2){
		var newObj = new Object();
		for( var i = 0; i < arguments.length; i++){
			for( var child in arguments[i]){
				newObj[child] = arguments[i][child];
			}
		}
		return newObj;
	},
/**
* JSAX.object.glue - Makes a new object of any number of objects, the first object is the most dominating. This function does not modify the given objects, it makes a copy. This function is a alias of JSAX.object.concat
* @param Object object1
* @param [Object object2]
* @return Object - Combined object of object1 and object2 ... where object2 has priority if a value exists in both objects.
*/
	glue: function( object1, object2){
		return JSAX.object.concat( object1, object2);
	},
/**
* JSAX.object.attachTo - Assigns attach to target. This function has no return, the target object will be modified.
* @param Object attach - The object you wan to attach to the target (for example your prototype library).
* @param Object target - The target object. CAUTION: the original of this object will be modified.
* @return Object combined object of object1 and object2 where object2 has priority if a value exists in both objects.
*/
	attachTo: function( attach, target){
		for( var child in attach){
			try{
				target[child] = attach[child];
			}catch( e){}
		}
	}
},
/**
* container to gather prototype extensions
* @parent JSAX.proto
*/
proto: {}

};

// assign the main functions to window, so they are easy available
window.include		= JSAX.JSload.include;
window.require		= JSAX.JSload.require;
window.read		= JSAX.HTTP.request;

if( !JSAX.HTTP.requestObject()){
	alert( "Your browser does not support JavaScript HTTP reading!\nPlease download Firefox from 'http://www.mozilla.org/'.");
}




/*=WebFrameManager=0.12========================================_=[]=X
|                                                                   |
|     fully compatible with Mozilla, Konqueror and M$IE             |
|                                                                   |
|                                                                   |
|  written by Florian Sax <sax@startseite.ch> copyleft 01. 02. 2004 |
|                     this script is OpenSource(visite www.gnu.org) |
|__________________________________________________________________*/


/**
* eventTools
* some event handling helpers
* eventTools doesn not work without JSAX
* written by Florian Sax 20051229
*
* eventTools is protected by the GPL <http://www.gnu.org/copyleft/gpl.html>
*/

if( !window.JSAX){
	alert( "eventTools need JavaScript Abstractions for X(HT)ML (objects/JSAX.js) to work.");
}
JSAX.Event = {
	Version: 20071020,

	solv: function( e){
		if( typeof( e) == "undefined"){
			var event = window.event;
		}else{
			var event = e;
			try{
				window.event = event;
			}catch( e){}
		}
		if( !event){
			return null;
		}
		event.preventAction = function( p){
			this.cancelBubble = true;
		}
		if( !event.preventDefault){
			event.preventDefault = function( p){
				this.preventAction( 1);
				return false;
			}
		}else if( !event.stopPropagation){
			event.stopPropagation = function(){
				this.preventAction( 2);
				return false;
			}
		}
		if( event.clientX && !event.screenY){
			event.screenX = event.clientX;
			event.screenY = event.clientY;
		}
		if( event.offsetX && !event.layerX){
			event.layerX = event.offsetX;
			event.layerY = event.offsetY;
		}
		if( !event.target && event.srcElement){
			event.target = event.srcElement;
		}
		if( !event.charCode && event.keyCode){
			try{
				event.charCode = event.keyCode;
			}catch( e){}
		}
		if( !event.charCode && event.which){
			try{
				event.charCode = event.which;
			}catch( e){}
		}
		if( !event.clientX && event.x){
			event.clientX == event.x;
			event.clientY == event.y;
		}
		return event;
	},
	preventAction: function( e){
		var event = JSAX.Event.solv( e);
		if( !event)return null;
		event.preventAction();
		return false;
	},

	listen: function( e){
		var event = JSAX.Event.solv( e);


//		var eventName = JSAX.Event.keyName( event);
		JSAX.Event.history[JSAX.Event.history.length] = event;
		JSAX.Event.history[event.type] = event;

		if( JSAX.CJSED){
			JSAX.CJSED.checkElem( event.target, event);
		}

//		JSAX.Event.history.push( event);
//		JSAX.OutPut.show( "type:"+event.type+" - which:"+event.which+" - charCode:"+event.charCode+" - keyCode:"+event.keyCode+" - name:"+eventName+" - targetTag:"+elem.tagName, 1);
	},

	startListen: function(){
		/**
* JSAX JS Reference
* Gathered by Florian Sax under the GPL <http://www.gnu.org/copyleft/gpl.html>
*/

if( !window.JSAX){
	alert( "The reference is not able to work without JavaScript Abstractions for X(HT)ML (objects/JSAX.js).");
}

JSAX.reference = {
	Version: 20060108,

CSS: {
	properties: new Array( "background", "background-attachment", "background-color", "background-image", "background-position", "background-repeat", "border", "border-top", "border-right", "border-bottom", "border-left", "border-collapse", "border-color", "border-top-color", "border-right-color", "border-bottom-color", "border-left-color", "border-spacing", "border-style", "border-top-style", "border-right-style", "border-bottom-style", "border-left-style", "border-width", "border-top-width", "border-right-width", "border-bottom-width", "border-left-width", "bottom", "caption-side", "clear", "clip", "color", "content", "counter-increment", "counter-reset", "cursor", "direction", "display", "empty-cells", "float", "font", "font-family", "font-size", "font-style", "font-variant", "font-weight", "height", "left", "letter-spacing", "line-height", "list-style", "list-style-image", "list-style-position", "list-style-type", "margin", "margin-top", "margin-right", "margin-bottom", "margin-left", "max-height", "max-width", "min-height", "min-width", "orphans", "outline", "outline-color", "outline-style", "outline-width", "overflow", "padding", "padding-top", "padding-right", "padding-bottom", "padding-left", "page-break-after", "page-break-before", "page-break-inside", "position", "quotes", "right", "table-layout", "text-align", "text-decoration", "text-indent", "text-transform", "top", "unicode-bidi", "vertical-align", "visibility", "white-space", "widows", "width", "word-spacing", "z-index")
}

,
DOM: {
},
standaloneFunctions: {
	"parseInt": {},
	"parseFloat": {},
	"parseNumber": {},
	"parseString": {},
	"typeof": {},
	"instanceof": {}
},
Objects: {
	Boolean: {
	},
	Number: {
		"JSAX.proto": JSAX.proto.Number
	},
	Math: {
		
	},
	Array: {
		push: {
			0: "Object" },
		pop: {},
		shift: {},
		unshift: {},
		join: {},
		"JSAX.proto": JSAX.proto.Array
	},
	String: {
		indexOf: {
			0: "indexOf( StringTofind)" },
		lastIndexOf: {
			0: "StringToFind" },
		search: {
			0: "RegExp" },
		substr: {
			0: "intStart, intEnd" },
		substring: {
			0: "intStart, intEnd" },
		fromCharCode: {
			0: "Event.which" },
		"JSAX.proto": JSAX.proto.String
	},
	RegExp: {
		match: {}
	},
	Date: {
	},
	Node: {
	},
	Element: {
		"JSAX.proto": JSAX.proto.Element
	},
	Object: {
		"JSAX.proto": JSAX.proto.Object
	},
	Function: {
	}
},
Events: {
	neededlisteners: {
		mousemove: {},
		mousedown: {},
		mouseup: {},
		keydown: {},
		keyup: {},
		scroll: {},
		submit: {}
		
	},
	listeners: {
		mousemove: {},
		mousedown: {},
		mouseup: {},
		mouseover: {},
		mouseout: {},
		dragstart: {},
		dragend: {},
		click: {},
		contextmenu: {},
		keydown: {},
//		keyup: {},
		keypress: {},
		scroll: {},
		submit: {}
		
	}
}
};

		try{
			JSAX.reference.Events.listeners;
		}catch( e){
			return false;
		}
		for( property in JSAX.reference.Events.listeners){
			document["on"+property] = JSAX.Event.listen;
		}
		return true;
	},

	keyName: function( e){
		if( e ){
			var event = e;
		}
		if( event.which){
			var num = event.which;
		}else{
			var num = event.keyCode;
		}
		if( event.which == 0){
			if( JSAX.Event.keys[event.charCode]){
				var eventName = JSAX.Event.keys[event.keyCode];
			}else{
				var eventName = "UNKNOWN";
			}
		}else if( JSAX.Event.keys[num]){
			var eventName = String.fromCharCode( num);
		}else{
			var eventName = JSAX.Event.keys[num];
		}
		if( typeof( eventName) == "undefined"){
			eventName = "UNKNOWN";
		}
		if( event.shiftKey){
			eventName = "Shift+"+eventName;
		}
		if( event.altKey){
			eventName = "Alt+"+eventName;
		}
		if( event.ctrlKey){
			eventName = "Ctrl+"+eventName;
		}
		if( event.metaKey){
			eventName = "Meta+"+eventName;
		}
		eventName.chopEnd( "+");

		return eventName;
	},

	history: new Array(),


	start: function(){
//		var events = {};
//		for( var eventName in JSAX.Event.events){
//			var num = JSAX.Event.events[eventName];
//			events[num] = eventName;
//		}
//		JSAX.Event.events = JSAX.object.glue( JSAX.Event.events, events);
//		
//		var keys = {};
//		for( var keyName in JSAX.Event.keys){
//			var num = JSAX.Event.keys[keyName];
//			keys[num] = keyName;
//		}
//		JSAX.Event.keys = JSAX.object.glue( JSAX.Event.keys, keys);

		if( JSAX.CJSED){
			JSAX.Event.startListen();
		}
	}

};
JSAX.Event.start();



/**
* DOM.js
* written by Florian Sax 20051229
*
* DOM.js is protected by the GPL <http://www.gnu.org/copyleft/gpl.html>
*/
/*
JSAX.DOM = {
findPrototype: function(){
	if( this.__proto__){
		return this.__proto__;
	}else if( this.constructor.prototype){
		return this.constructor.prototype;
	}
	return this.prototype;
},
assignPrototype: function( object){
	if( typeof( object) == "undefined"){
		object = {};
	}
	if( !object.findPrototype){
		object.findPrototype = JSAX.DOM.findPrototype;
	}
	if( !object.prototype){
		object.findPrototype().prototype = object.findPrototype();
	}
	return true;
}
};
*/




if( !window.JSAX){
	alert( "Element.js is not able to work without JavaScript Abstractions for X(HT)ML (objects/JSAX.js).");
}

/**
* Returns boolean true if the element has the class else false
* @param Object elem - The element wich should be checked
* @param String className - The className (for example: <TAG class="kd CLASSNAME">)
* @return boolead true if elem has className else false
*/
window.isClassMember = function( elem, className){
	if( typeof( elem.className) != "string"){
		return false;
	}
	if( elem.className == className
	 || elem.className.indexOf( className+" ") == 0
	 || elem.className.lastIndexOf( " "+className) == elem.className.length -className -1
	 || elem.className.indexOf( " "+className+" ") != -1){
		return true;
	}
	return false;
};

/**
* Element.js
* Element prototype extensions
*
* @parent JSAX.proto.Element
*
* Copyright (C) 2006 Florian Sax <flosax(at)users.sourceforge.net> 20060202
* Element.js is protected by the GPL <http://www.gnu.org/copyleft/gpl.html>
*
* @version 20060227
*
* @example:  docement.body.insertBefore( document.createElement( "div"), docement.body.childNodes[0])
*/
JSAX.proto.Element = {
	"JSAX.proto.Element Version": 20060227,

/**
* Returns boolean true if the element has the class else false
* @param String className - The className (for example: <TAG class="kd CLASSNAME">)
* @return boolead true if elem has className else false
*/
isClassMember: function( className){
	return window.isClassMember( this, className);
},

/**
* Returns a list of all childNodes that have the given className
* @param String className - The className
* @return Array containing all elements that match the className
*/
getElementsByClassName: function( className){
	var elem = this;
	if( typeof( elem.getElementsByTagName) == "undefined"){
		elem = document;
	}
	if( typeof( elem.getElementsByTagName) == "function"){
		var allElems = elem.getElementsByTagName( "*");
	}else{
		var allElems = document.all;
	}
	var elems = new Array();
	for( var i=0; i < allElems.length; i++){
		if( isClassMember( allElems[i], className)){
			elems.push( allElems[i]);
		}
	}
	return elems;
},

/**
* Returns a list of all childNodes that have attribute with value
* @param String attrubute - The attrubute wich the elements must have.
* @param [Array value] - The value wich the attibute must be set to
* @return Array - All child Elements which matched the condistions of the given parameters
*/
getElementsBy: function( attribute, value){
	if( !value && !attribute){
		return false;
	}
	var elem = this;
	if( typeof( elem.getElementsByTagName) == "undefined"){
		elem = document;
	}
	if( typeof( elem.getElementsByTagName) == "function"){
		var allElems = elem.getElementsByTagName( "*");
	}else{
		var allElems = document.all;
	}
	var elems = new Array();
	for( var i=0; i < allElems.length; i++){
		if( typeof( value) == "undefined"){
			if( typeof( allElems[i][attribute]) != "undefined"){
				elems.push( allElems[i]);
			}
		}else if( allElems[i][attribute] == value){
			elems.push( allElems[i]);
		}
	}
	return elems;
},

/**
* Returns the value if the element has it. if not the innerHTML
* @return String - The content of the Element
*/
returnValue: function(){
	if( typeof( this.value) == "undefined"){
		return this.value;
	}else{
		return this.innerHTML;
	}
},

/**
* Removes the element (it can not be reviewed)
*/
removeNode: function(){
	this.parentNode.removeChild( this);
}



};

// assign getElementsByClassName to document as well
document.getElementsByClassName = JSAX.proto.Element.getElementsByClassName;




// the horrible procedure to pretend beein able to assign it to the Element.prototype in all Browsers
JSAX.proto.ElementPrototype = {
assign: function(){

	// get the a Element with prototype at JSAX.proto.Element.protoElem
	JSAX.proto.ElementPrototype.object = document.createElement( "DIV");
	
	// Mozilla & Opera(w3c)
	if( window.HTMLElement){
	//	alert( "HTMLElement");
		JSAX.proto.ElementPrototype.object = HTMLElement.prototype;
	
	// KHTML
	}else if( window["[[DOMElement.prototype]]"]){
	//	alert( "[[DOMElement.prototype]]");
		JSAX.proto.ElementPrototype.object = window["[[DOMElement.prototype]]"];
	
	// ?? Probably exists as well who knows, i do not know what safari or icab use
	}else if( window.DOMElement){
	//	alert( "DOMElement");
		JSAX.proto.ElementPrototype.object = DOMElement.prototype;
	
	// M$IE does not support element prototyping
	}else{
		JSAX.proto.ElementPrototype.object = false;
	}
	
	
	if( JSAX.proto.ElementPrototype){ // M O K
		JSAX.object.attachTo( JSAX.proto.Element, JSAX.proto.ElementPrototype.object);
	
	// M$IE
	// micro$oft does not support element prototyping at all, not even over objects. that's a shame.
	// so we assign it to all elements one by one and repeat this procedure recursivly after 0.1 sec
	}else{
		JSAX.proto.ElementPrototype.runtime = setInterval( "JSAX.proto.ElementPrototype.assignIE();", 100);
	}
},
assignIE: function(){
	return JSAX.proto.ElementPrototype.assignToAllElements( 'JSAX.proto.Element');
},
assignToAllElements: function( objP){
	var obj = eval( objP);
	var elems = document.getElementsByTagName( "*");
	for( var i=0; i < elems.length; i++){
		JSAX.object.attachTo( obj, elems[i]);
	}
}
};

JSAX.proto.ElementPrototype.assign();




document.getElementsByClassName = JSAX.proto.Element.getElementsByClassName;
window.getElementsByClassName = JSAX.proto.Element.getElementsByClassName;
document.getElementsBy = JSAX.proto.Element.getElementsBy;
window.getElementsBy = JSAX.proto.Element.getElementsBy;


//Element.prototype.getElementsByClassName = getElementsByClassName;





window.byId = function( id){
	if( !document.getElementById){
		if( document.all){
			var all = document.all;
		}else if( !document.getElementsByTagName){
			var all = document.getElementsByTagName("*");
		}else{
			return false;
		}
		if( all[id]){
				return all[i];
		}
	}
	return document.getElementById( id);
};
document.byId = window.byId;




/**
* detectBrowser.js
* this is a collection of usefull javascript functions
* written by Florian Sax 20051219
*
* detectBrowser.js is protected by the GPL <http://www.gnu.org/copyleft/gpl.html>
*/

if( !window.JSAX){
	alert( "browser.js was designed to be run in a package of JavaScript Abstractions for X(HT)ML (objects/JSAX.js).");
}



JSAX.browser = {
	Version: 20060128,
	text: "",
	msie: function(){
		if( (JSAX.browser.text.indexOf( "msie") != -1
		 || JSAX.browser.text.indexOf( "explorer") != -1)
		 && !JSAX.browser.opera()){
			return true;
		}
		return false;
	},
	gecko: function(){
		if( JSAX.browser.text.indexOf( "gecko") != -1
		 && !JSAX.browser.konq()){
			return true;
		}
		return false;
	},
	mozi: function(){
		if( JSAX.browser.text.indexOf( "mozilla") != -1
		 && !JSAX.browser.konq()
		 && !JSAX.browser.msie()
		 && !JSAX.browser.opera()){
			return true;
		}
		return false;
	},
	konq: function(){
		if( JSAX.browser.text.indexOf( "khtml") != -1
		 || JSAX.browser.text.indexOf( "safari") != -1){
			return true;
		}
		return false;
	},
	opera: function(){
		if( JSAX.browser.text.indexOf( "opera") != -1){
			return true;
		}
		return false;
	},

	mac: function(){
		if( JSAX.browser.text.indexOf( "mac") != -1
		 || JSAX.browser.text.indexOf( "osx") != -1){
			return true;
		}
		return false;
	},
	mswin: function(){
		if( JSAX.browser.text.indexOf( "windows") != -1){
			return true;
		}
		return false;
	},
	linux: function(){
		if( JSAX.browser.text.indexOf( "linux") != -1){
			return true;
		}
		return false;
	},
	unix: function(){
		if( JSAX.browser.linux()
		 || JSAX.browser.mac()){
			return true;
		}
		return false;
	},

	start: function(){
		JSAX.browser.text = window.navigator.userAgent.toLowerCase();
	}
};
JSAX.browser.start();




/**
* browser_msie.js
* this is a collection of usefull javascript functions
* written by Florian Sax 20051219
*
* browser_msie.js is protected by the GPL <http://www.gnu.org/copyleft/gpl.html>
*/


if( !window.JSAX){
	alert( "browser_msie.js was designed to be run in a package of JavaScript Abstractions for X(HT)ML (objects/JSAX.js).");
}

if( ( navigator.userAgent.toLowerCase().indexOf( "msie") != -1
   || navigator.userAgent.toLowerCase().indexOf( "explorer") != -1)
 && navigator.userAgent.toLowerCase().indexOf( "opera") == -1){
//	alert( "You are still using Microsoft InternetExplorer!?");

}
	/**
* compat.png_alpha
* makes alpha transparancy of png's compatibel to M$IE
* written by Florian Sax 20060222
*
* compat.png_alpha is protected by the GPL <http://www.gnu.org/copyleft/gpl.html>
*/

if( !window.JSAX){
	window.JSAX = {};
}
if( !JSAX.compat){
	JSAX.compat = {};
}

JSAX.compat.PNG_alpha = {
	Version: 20060228,

	replaceImages: function(){
		if( typeof( document.body.runtimeStyle) == "undefined"){
			return false;
		}
		var ae = document.getElementsByTagName( "*");
		if( ae.length < 1){
			ae = document.all;
		}
		var s = 0;
		for( var i = 0; i < ae.length; i++){
			if( ae[i].src && ae[i].src.toLowerCase().indexOf( ".png") > 1){
				JSAX.compat.PNG_alpha.doImage( ae[i]);
				s++;
			}else if( ae[i].style.background && ae[i].style.background.toLowerCase().indexOf( ".png") > 1){
				JSAX.compat.PNG_alpha.doBG( ae[i]);
				s++;
			}
		}
		return s;
	},

	doBG: function( elem){

		if( elem.style.background.toLowerCase().indexOf( "url") != -1){
			var img = elem.style.background.substring(
				elem.style.background.indexOf( "(") +1,
				elem.style.background.indexOf( ")"));
			if( elem.runtimeStyle.filter.indexOf( img) > 1){
				return;
			}

			elem.runtimeStyle.background = "";
			elem.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod='crop', src='"+img+"')";
		}
		return;
	},

	cssProperties: ["height", "width", "border", "cursor"],
	doImage: function( elem){

		if( elem.tagName.toLowerCase() == "img"){
			if( elem.parentNode.runtimeStyle.filter.indexOf( elem.src) > 1){
				return;
			}
			if( elem.parentNode.tagName.toLowerCase() != "span"
			 || elem.parentNode.runtimeStyle.filter.toLowerCase().indexOf( ".png") == -1){
				var cont = document.createElement( "span");
				elem.parentNode.insertBefore( cont, elem);
				cont.appendChild( elem);
			}
			if( elem.className)elem.parentNode.className = elem.className;
			for( var i = 0; i < JSAX.compat.PNG_alpha.cssProperties.length; i++){
				var prop = JSAX.compat.PNG_alpha.cssProperties[i];
				if( elem.style[prop]){
					elem.parentNode.runtimeStyle[prop] = elem.style[prop];
				}
			}
			elem.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=0)";
			elem.parentNode.runtimeStyle.display = "inline-block";
			elem.parentNode.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod='scale', src='"+elem.src+"')";
		}
		return;
	},

	runId: false
};


if( navigator.userAgent.toLowerCase().indexOf( "msie") != -1
 && navigator.userAgent.toLowerCase().indexOf( "opera") == -1){
	JSAX.compat.PNG_alpha.runId = setInterval( "JSAX.compat.PNG_alpha.replaceImages();", 1000);
}




	/**
* innerSize.js
* this is a collection of usefull javascript functions
* written by Florian Sax 20051219
*
* innerSize.js is protected by the GPL <http://www.gnu.org/copyleft/gpl.html>
*/



JSAX.compat.innerSize = {
	onWindowResize: function(){
		if( document.body && document.body.clientHeight){
			window.innerHeight = document.body.clientHeight;
			window.innerWidth  = document.body.clientWidth;
		}else{
			window.innerHeight = 0;
			window.innerWidth  = 0;
		}
	},
	windowCheck: function(){
		if( window.innerHeight != document.body.clientHeight
		 || window.innerWidth != document.body.clientWidth){
			JSAX.compat.innerSize.onWindowResize();
		}
	}
}

if( typeof( window.innerWidth) == "undefined"){ // for M$IE
	JSAX.compat.innerSize.onWindowResize();
	setInterval( "JSAX.compat.innerSize.windowCheck();", 1000);
};


if( !window.JSAX){
	alert( "JSAX.proto.String needs JavaScript Abstractions for X(HT)ML (objects/JSAX.js) to work.");
}
/**
* String prototype library - string.js
* this is a collection of usefull javascript functions
* written by Florian Sax 20051217
*
* Copyright (C) 2006 Florian Sax <flosax(at)users.sourceforge.net>
* String.js is protected by the GPL <http://www.gnu.org/copyleft/gpl.html>
* @version 20060215
*/
JSAX.proto.String = {

	"JSAX.proto.String Version": 20060215,

/**
* Removes whitespaces from the end and the beginning of this
*
* @return String
*/
trim: function(){
	var string = this.toString();
/*	while( string[0] == "\n" || string[0] == "\t" || string[0] == " "){
		string = string.substr( 1);
	}
	while( string[-1] == "\n" || string[-1] == "\t" || string[-1] == " "){
		string = string.substr( 0, -1);
	}*/
	while( string.length > 0 &&
		( string.charCodeAt( 0) == 9
		|| string.charCodeAt( 0) == 10
		|| string.charCodeAt( 0) == 13
		|| string.charCodeAt( 0) == 32)){
			string = string.substring( 1);
	}
	while( string.length > 0 &&
		( string.charCodeAt( string.length -1) == 9
		|| string.charCodeAt( string.length -1) == 10
		|| string.charCodeAt( string.length -1) == 13
		|| string.charCodeAt( string.length -1) == 32)){
			string = string.substring( 0, string.length -1);
	}
	return string;
},

/**
* Splits the string and removes the whitespaces from the end and beginning of evrey item
*
* @param String sep - The separator used in the string
*
* @return Array
*
* @example " test, item , whaterer,3, 5, tsst".trimSplit( ",")
*/
trimSplit: function( sep){
	var string = this.toString();
	var array = string.trim().chopEnd( sep).split( sep);
	for( var i=0; i < array.length; i++){
		array[i] = array[i].trim();
	}
	return array;
},

/**
* Splits the string caseindsensitiv and removes the whitespaces from the end and beginning of evrey item
*
* @param String sep - The separator used in the string
*
* @return Array
*/
trimSpliti: function( sep){
	var string = this.toString();
	var array = string.trim().chopEnd( sep).spliti( sep);
	for( var i=0; i < array.length; i++){
		array[i] = array[i].trim();
	}
	return array;
},

/**
* Splits the string caseindsensitiv
*
* @param String sep - The separator used in the string
*
* @return Array
*/
spliti: function( sep){
	var string = this.toString();
	var array = new Array();
	var pos = string.posi( sep);
	while( pos != -1){
		array.push( string.substr( 0, pos));
		string = string.substr( pos +sep.length);
		pos = string.posi( sep);
	}
	return array;
},


/**
* Split this string with multiple possible separators
*
* @param Array [args] - The separators used in the string (default= [",", ".", ";", ":", "\n", "\t", " ", "-", "_"])
*
* @return Array
*
* @example "this,is.a_st-ring!".smartSplit( [",",".","_","-","!"])
*/
smartSplit: function( args, keepEmpty, trim){
	var seps = [];
	if( typeof( args) == "object"){
		seps = args;
	}else if( typeof( args) == "string" && args.length){
		seps.push( args);
	}
	if( !seps.length){
		seps = [",", ".", ";", ":", "\n", "\t", " ", "-", "_"];
	}
	var string = this.toString();
	var array = [];
	var sep = seps[1];
	var part = "";
	var pos, cpos = 0;
	while( string.length){
		pos = -1;
		for( var i = 0; i < seps.length; i++){
			cpos = string.pos( seps[i]);
			if( cpos > -1 && ( cpos < pos || pos == -1)){
				sep = seps[i];
				pos = cpos;
			}
		}
		if( pos == -1){
			part = string;
			string = "";
		}else{
			part = string.substr( 0, pos);
			string = string.substr( pos +sep.length);
		}
		if( trim){
			part = part.trim();
		}
		if( keepEmpty || part.length){
			array.push( part);
		}
	}
	return array;
},


/**
* JSAX.proto.String.pos - returns the first position of find
*
* @param Mixed find - Can be a string or a array of strings
* @param Boolean addLength - The length of the matched string will be added to the return if this parameter is set
*
* @return Number - The first match or -1
*
* @example "testString".pos( "S")
* @example "testString".pos( ["r", "S", "q"])
*/
pos: function( find, addLength){
	if( typeof( find) == "string" || typeof( find) == "number"){
		var find = [find];
	}
	if( typeof( find) != "object" || !find.length){
		return -1;
	}
	var pos = -1;
	var p = -1;
	var c = "";
	var s = this.toString();
	for( var i = 0; i < find.length; i++){
		p = s.indexOf( find[i]);
		if( ( p != -1 && ( pos == -1 || p < pos))
		 || ( addLength && p == pos && c.length < find[i].length)){
			pos = p;
			c = find[i];
		}
	}
	if( addLength && pos > -1){
		pos += c.length;
	}
	return pos;
},

/**
* JSAX.proto.String.posi - Returns the first position of find without case sensitivity
*
* @param Mixed find - Can be a string or a array of strings
* @param Boolean addLength - The length of the matched string will be added to the return if this parameter is set
*
* @return Number - The first match or -1
*
* @example "testString".posi( "S")
*
* NOTE miltiple find does not work. needs fix
*/
posi: function( find, addLength){
	return this.toString().toLowerCase().pos( find.toLowerCase(), addLength);
},

/**
* JSAX.proto.String.posi - Returns the last position of find in this
*
* @param Mixed find - Can be a string or an array of strings
* @param Boolean addLength - The length of the matched string will be added to the return if this parameter is set
*
* @return Number - The first from the right match or -1
*
* @example "testString".lpos( "S")
* @example "testString".lpos( ["r", "S", "q"])
*/
lpos: function( find, addLength){
	if( typeof( find) == "string" || typeof( find) == "number"){
		var find = [find];
	}
	if( typeof( find) != "object" || !find.length){
		return -1;
	}
	var pos = -1;
	var p = -1;
	var c = "";
	var s = this.toString();
	for( var i = 0; i < find.length; i++){
		p = s.lastIndexOf( find[i]);
		if( p > pos
		 || ( addLength && p == pos && c.length < find[i].length)){
			pos = p;
			c = find[i];
		}
	}
	if( addLength && pos > -1){
		pos += c.length;
	}
	return pos;
},
/**
* NOTE miltiple find does not work. needs fix
*/
lposi: function( find, addLength){
	return this.toString().toLowerCase().lpos( find.toLowerCase(), addLength);
},

posr: function( find, addLength){
	return this.toString().lpos( find, addLength);
},
/**
* NOTE miltiple find does not work. needs fix
*/
posri: function( find, addLength){
	return this.toString().lposi( find, addLength);
},
/**
* NOTE must be rewritten
*/
rpos: function( find, addLength){
	var lastPos = this.toString().lpos( find, addLength);
	if( lastPos == -1){
		return -1;
	}
	return this.toString().length -( lastPos +find.length);
},
/**
* NOTE miltiple find does not work. needs fix
*/
rposi: function( find, addLength){
	return this.toString().toLowerCase().posr( find.toLowerCase(), addLength);
},

/**
* Returns the number the string occuring in this
* @return Number - The numer of times find is in this
*/
indexCount: function( find){
	return this.toString().split( find).length -1
},
indexCounti: function( find){
	return this.toString().toLowerCase().split( find.toLowerCase()).length -1
},

/**
* Returns the position of the first occuring hidden character (space, tab, linebrake) or -1
* @return Number - The position of the first white space
*/
whitePos: function(){
	var c = [" ", "\t", "\n"];
	return this.toString().pos( c);
},
/**
* This is a deprechiated alias to WhitePos() and it will be removed. please use whitePos().
*/
whiteCharPos: function(){
	return this.toString().whitePos();
},

/**
* returns true if this has at least one uppercase character
* @return Boolean
*/
hasUpperCase: function(){
	return ( ( this.toString().toLowerCase() != this.toString()) ? true : false )
},
/**
* returns true if this has at least one uppercase character
* @return Boolean
*/
hasLowerCase: function(){
	return ( ( this.toString().toUpperCase() != this.toString()) ? true : false )
},


/**
* Chop the biginning by string, or string list
*
* @param Mixed charsOrArray - A string or a list of string you want to have removed from the beginning
*
* @return String
*
* @example "testString".chopBegin( "te")
* @example "testString".chopBegin( ["ing", "r", "t", "tes"])
*/
chopBegin: function( charsOrArray){
	var a = [];
	if( typeof( charsOrArray) == "object"){
		a = charsOrArray;
	}else if( arguments.length > 1){
		for( var i = 0; i < arguments.length; i++){
			a.push( arguments[i]);
		}
	}else{
		a = charsOrArray;
	}

	s = this.toString();
	while( s.pos( a) == 0){
		s = s.substr( s.pos( a, 1));
	}
	return s;
},

/**
* Chop the end by string, length or string list
*
* @param Mixed charsOrArray - A position number, a string or a list of string you want to have removed from the end
*
* @return String
*
* @example "testString".chopEnd( "te")
* @example "testString".chopEnd( ["ing", "r", "t", "tes"])
*/
chopEnd: function( charsOrArray){
	var a = [];
	if( typeof( charsOrArray) == "object"){
		a = charsOrArray;
	}else if( arguments.length > 1){
		for( var i = 0; i < arguments.length; i++){
			a.push( arguments[i]);
		}
	}else{
		a = charsOrArray;
	}

	s = this.toString();
	while( s.lpos( a, 1) == s.length){
		s = s.substr( 0, s.lpos( a));
	}
	return s;
},

/**
* Returns true if this could be a number
*
* @return Boolean - True or false
*/
canBeANumber: function(){
	if( parseInt( this).toString() != parseInt( "this is a string").toString()){
		return true;
	}else{
		return false;
	}
},

/**
* replace all string with another
*/
str_replace: function( search, replace){
	var string = this.toString();
	if( search === null){
		return string;
	}
	if( !string.length){
		return "";
	}
	var search = search.toString();
	if( !search.length){
		return string;
	}
	var newString = "";
	while( string.length){
		var pos = string.pos( search);
		if( pos == -1){
			newString += string;
			string = "";
		}else{
			newString += string.substring( 0, pos);
			newString += replace;
			string = string.substring( pos+search.length);
		}
	}
	return newString;
},

/**
* replace all string with another without casesensitivity
*/
stri_replace: function( search, replace){
	var string = this.toString();
	if( search === null){
		return string;
	}
	if( !string.length){
		return "";
	}
	var search = search.toString();
	if( !search.length){
		return string;
	}
	var newString = "";
	while( string.length){
		var pos = string.posi( search);
		if( pos == -1){
			newString += string;
			string = "";
		}else{
			newString += string.substring( 0, pos);
			newString += replace;
			string = string.substring( pos+search.length);
		}
	}
	return newString;
},

/**
* Replaces all newline chars "\n" with <br/>\n
*
* @return String
*/
nl2br: function(){
	var string = this.toString();
	string = string.str_replace( "\n", "<br/>\n");
	return string;
},

/**
* Escapes Tags, specialchars and hiddenchars for viewing HTML
*
* @return String
*/
txt2html: function(){
	var string = this.toString();
	string = string.str_replace( "&", "&amp;");
	string = string.str_replace( "<", "&lt;");
	string = string.str_replace( ">", "&gt;");
	string = string.str_replace( "\t", "    ");
	string = string.str_replace( "  ", "&nbsp; ");
	string = string.nl2br();
	return string;
},


/**
* Removes all script comments from the string
*
* @return String
*/
removeScriptComments: function(){
	var string = this.toString();
	string = string.replace( /\/\/.*/g, "");

//	alert( string.search( /\/\/?[^\n]\n/gi));
//	alert( string.search( /\/\/.*/));
//	alert( string.search( /\/?[^\12]\12/gi));
//	string = string.replace( /\/\/ */gi, "");
//	alert(string.search( /(\/\*)[^(\*\/)]+(\*\/)/));
//	string = string.replace( /(\/\*)[^(\*\/)]+(\*\/)/, "");
	var start = string.indexOf( "/*");
	var end = string.indexOf( "*/");
	while( start != -1 && end != -1){
		string = string.substring( 0, start)+string.substring( end+2);
		start = string.indexOf( "/*");
		end = string.indexOf( "*/");
	}
	if( start != -1 && end == -1){
		string = string.substring( 0, start);
	}
	return string;
},


/**
* Removes all tags from the string
*
* @return String
*/
stripTags: function(){
	return this.toString().replace(/<\/?[^>]+>/gi, "");
},

/**
* Escapes HTML specialchars as the browser does it himself
*/
escapeHTML: function(){
	var div = document.createElement( 'div');
	var text = document.createTextNode( this.toString());
	div.appendChild( text);
	return div.innerHTML;
},

/**
* unescaped escaped HTML
*/
unescapeHTML: function(){
	var max = 4096;
	var num = this.toString().length /max;
	var string = "";
	for( var i = 0; i < num; i++){
		var div = document.createElement('div');
		div.innerHTML = this.substr( i*max, (i+1)*max-1).stripTags();
		string += div.childNodes[0].nodeValue;
	}
	return string;
}
};

JSAX.object.attachTo( JSAX.proto.String, String.prototype);



JSAX.WFM = {
	Version: 20060211,

style: {
	win:	{
		background:	'#E0E0E0',
		margin:		4,
		width:		600,
		height:		400
	},
	res:	{
		width:		160,
		height:		40,
		thick:		6,
		background:	'#AACCFF'
	},
	bar:	{
		height: 	20,
		background:	'#AACCFF',
		color:		'#444444'
	}
},
config: {
	frameWidth	: 600,
	frameHeight	: 400,
	border		: 4,
	resizeWidth	: 160,
	resizeHeight	: 40,
	resizeThick	: 8,
	barHeight	: 25,
	backColor	: '#E0E0E0',
	fieldBackColor	: '#E0E0E0',
	frontColor	: '#AACCFF',
	textColor	: '#444444',
	textColor	: '#AACCFF'
},


buttons: [
	['JSAX.WFM.hide',	'_'],
	['JSAX.WFM.fullScreen',	'[ ]'],
	['JSAX.WFM.close',	'X']],

top: 10,


/**
* open the submitted url as new window
*
* @param string URLorElem - The URL or Element wich should be loaded in the WF
* @param string [title]   - The Id of the WF
* @param string [params]  - Additional parameters
*/
open: function( URLorElem, title, params){
	if( !byId( 'taskBar')){
		JSAX.WFM.start();
		JSAX.WFM.startElem = URLorElem;
//		setTimeout( "JSAX.WFM.open( JSAX.WFM.startElem, '"+arguments[1]+"', '"+arguments[2]+"');", 200);
//		return;
	}
	var HTML = false;
	var elem = false;
	var URL  = false;
	if( typeof( URLorElem) == "string"){
		if( URLorElem.indexOf( "<") != -1
		 || URLorElem.length > 511){
			HTML = URLorElem;
		}else{
			URL  = URLorElem;
		}
	}else{
		if( URLorElem.tagName){
			elem = URLorElem;
			if( elem.tagName.toLowerCase() == "a"){
				URL = elem.href;
			}else{
				elem = URLorElem;
			}
			if( !title || title == "undefined"){
				if( elem.title){
					var title = elem.title;
				}else{
					var title = elem.innerHTML.stripTags().substr( 0, 128);
				}
			}
			if( URL){
				elem = false;
			}
		}else{
			return;
		}
	}

	
	if( title && title != "undefined"){
		var id = title;
	}else{
		if( URL){
			var id = URL;
		}else if( HTML){
			var id = "HTML";
		}else if( elem.title){
			var id = elem.title;
		}else if( elem.id){
			var id = elem.id;
		}else{
			var id = elem.tagName;
		}
	}
	var chopChars = ['"', '=', "'"];
	id = id.stripTags();
	for( var i=0; i < chopChars.length; i++){
		if( id.indexOf( chopChars[i]) != -1){
			id = id.trimSplit( chopChars[i])[0]+"";
		}
	}
	var illegalChars = [
		["&nbsp;", " "], 
		["\n", " "],
		["\t", " "],
		[" ", " "],
		["*", ""],
		["+", ""],
		["  ", " "],
		["  ", " "]];
	for( var i=0; i < illegalChars.length; i++){
		id = id.str_replace( illegalChars[i][0], illegalChars[i][1]);
	}
	if( id > 255){
		id = id.substr( 0, 255);
	}

	// recive parameters
	var config = JSAX.WFM.config;
	if( arguments[2] && typeof arguments[2] != "undefined"){
		if( typeof arguments[2] == "string"){
			config = JSAX.object.concat( config, JSAX.WFM.string2object( arguments[2]));
		}else{
			config = JSAX.object.concat( config, arguments[2]);
		}
	}

	var newId = id.trim();
	var i = 1;
	while( byId( newId+'_win')){
		i++;
		newId = id+' ('+i+')';
	}
	id = newId;
//	alert( "\""+id+"\"");

	var winId = id+'_win';
	var wBarId = id+'_wBar';
	var resizeId = id+'_resize';

	var resizeY = config.resizeHeight -config.resizeThick;
	var wBar = '<table id="'+wBarId+'" name="'+id+'" cellpadding="0" cellspacing="1">'+
		'<td id="'+id+'_title" name="'+id+'" onmousedown="JSAX.WFM.beginDrag( this.id);" style="cursor: move;">'+
		id+
//			'<form onsubmit="byId('+frmId+').src=this.'+id+'_input.value;"><input id="'+id+'_input" name="'+id+'_input" value="'+id+'"><input type=submit value=get></form>'+
			'</td>';
	for( var i = 0; i < JSAX.WFM.buttons.length; i++){
		var key   = JSAX.WFM.buttons[i][0];
		var value = JSAX.WFM.buttons[i][1];
		wBar += '<td onclick="'+key+'( \''+id+'\');" id="'+id+'_'+key+'" style="font: 14px bold sans-serif; width: 22px; background: '+config.backColor+'; vertical-align: middle;" valign="middle" align="center">'+value+'</td>';
	}
	wBar += '</table>';

	var resize = '<div align=right name="'+id+'" id="'+resizeId+'" onmousedown="JSAX.WFM.beginDrag( this.id);" cellpadding="0" cellspacing="0" style=" cursor: se-resize;">'+
		'<div style="width: '+config.resizeThick+'px; height: '+resizeY+'px; background: '+config.resizeColor+'; font: 0px none none;"></div>'+
		'<div style="width: 100%; height: '+config.resizeThick+'px; background: '+config.resizeColor+'; font: 0px none none;"></div></div>';

	var frmId = id+'_frm';
	if( URL){
		var frame = '<iframe id="'+frmId+'" frameborder="0" marginheight="0" marginwidth="0" src="'+URL+'"></iframe>';
	}else{
		var frame = '<div id="'+frmId+'" style="overflow: scroll;"></div>';
	}


	var html = wBar+frame+resize;

	var win		= document.createElement( 'div');
	win.config	= config;
	win.id		= winId;
	win.name	= id;
	win.className	= 'WFM_Container';
	win.style.padding	= 0;
	win.style.position	= 'absolute';
	win.style.left		= window.mouseX+"px";
	win.style.top		= window.mouseY+"px";
	win.style.background	= config.backColor;
	win.innerHTML		= '<div style="position: relative">'+html+'</div>';
	win.style.zIndex	= JSAX.WFM.top++;

	win.show = function( e){
		var wins = document.getElementsByClassName( 'WFM_Container');
		for( var i = 0; i < wins.length; i++){
			if( wins[i].id != this.id){
				var el = wins[i];
				if( el.style.zIndex >= this.style.zIndex){
					el.style.zIndex = el.style.zIndex -1;
				}
				if( !JSAX.browser.mozi()
				 && !JSAX.browser.msie()
				 && el.frm.tagName.toLowerCase() == "iframe"){
					JSAX.WFM.hideElem( el.frm);
				}
			}
		}
		this.style.zIndex = JSAX.WFM.top -1;
		JSAX.WFM.showElem( this.frm);
//		alert( this.frm.style.left);
	};
	win.hide = function( e){
		var wins = document.getElementsByClassName( 'WFM_Container');
		if( wins.length > 1){
			var elem = wins[0];
			for( var i = 0; i < wins.length; i++){
				if( wins[i].id != this.id){
					var el = wins[i];
					if( el.style.zIndex > elem.style.zIndex
					 && el.style.visibility != "hidden"){
						elem = el;
					}else if( elem.id == this.id){
						elem = el;
					}
					if( el.style.zIndex >= this.style.zIndex){
						el.style.zIndex = el.style.zIndex -1;
					}
				}
			}
			if( elem.style.visibility != "hidden"){
				JSAX.WFM.showElem( elem.frm);
			}
		}
		JSAX.WFM.hideElem( this);
		JSAX.WFM.hideElem( this.frm);
		this.style.zIndex = JSAX.WFM.top -1;
		this.onclick = "";
		setTimeout( "if( byId( '"+this.id+"'))byId( '"+this.id+"').onclick = byId( '"+this.id+"').show;", 1);
	};
	win.onclick = win.show;
//	win.onmousemove = win.show;

	// hide the other frames if the browser does not support iframe zIndexing
	if( !JSAX.browser.mozi() && !JSAX.browser.msie()){
		var wins = document.getElementsByClassName( 'WFM_Container');
		for( var i = 0; i < wins.length; i++){
			var el = byId( wins[i].name+"_frm");
			if(  el.tagName.toLowerCase() == "iframe"){
				JSAX.WFM.hideElem( el);
			}
		}
	}
	document.body.appendChild( win);

	win.frm = byId( frmId);
	if( !URL){
		if( elem){
			win.frm.appendChild( elem);
		}else{
			win.frm.innerHTML = HTML;
		}
	}else{
		if( JSAX.browser.konq() || JSAX.browser.msie()){
			win.frm.src = URL;
		}
	}

	win.bar = byId( wBarId);
	win.res = byId( resizeId);

	win.frm.style.position		= 'absolute';
	win.frm.style.left		= config.border+"px";
	win.frm.style.top		= (config.barHeight +config.border *2)+"px";
	win.frm.style.width		= config.frameWidth+"px";
	win.frm.style.height		= config.frameHeight+"px";
	win.frm.style.background	= config.fieldBackColor;

	win.res.name	= id;

	win.style.width			= (config.frameWidth +config.border *2)+"px";
	win.style.height		= (config.frameHeight +config.barHeight +config.border *3)+"px";

	var posXlimit = document.body.clientWidth +document.body.scrollLeft -win.offsetWidth -config.resizeThick;
	var posYlimit = document.body.clientHeight +document.body.scrollTop -win.offsetHeight -config.resizeThick;
	if( posXlimit < 0)posXlimit = 0;
	if( posYlimit < 0)posYlimit = 0;
	if( win.offsetLeft > posXlimit){
		win.style.left		= posXlimit+"px";
	}
	if( win.offsetTop > posYlimit){
		win.style.top		= posYlimit+"px";
	}
	
	win.bar.style.position		= 'absolute';
	win.bar.style.left		= config.border+"px";
	win.bar.style.top		= config.border+"px";
	win.bar.style.height		= config.barHeight+"px";
	win.bar.style.width		= config.frameWidth+"px";
	win.bar.style.cursor		= 'default';
	win.bar.style.color		= config.textColor;
	win.bar.style.border		= '1px solid '+config.backColor;
	win.bar.style.background	= config.frontColor;
//	win.bar.style.font-weight	= 'bold';

	win.res.style.position		= 'absolute';
	win.res.style.width		= config.resizeWidth+"px";
	win.res.style.height		= config.resizeHeight+"px";
	win.res.style.left		= (config.frameWidth +config.border *2 -config.resizeWidth +config.resizeThick)+"px";
	win.res.style.top		= (config.frameHeight +config.barHeight -config.resizeHeight +config.resizeThick +config.border *3)+"px";
	win.res.style.zIndex		= -1;
/*
	win.res.onmouseover = function( e){
		this.style.zIndex	= 10;
//		byId( this.name+"_frm").style.zIndex = -1;
	};
	win.res.onmouseout = function( e){
		this.style.zIndex	= -1;
	};
*/
//		byId(id+'_input').style.border = '1 solid '+.config.backColor;
//		byId(id+'_input').style.spacing = 0;
//		byId(id+'_input').style.background = config.frontColor;

	

	return true;
},

/**
* makes the WF window by id fullscreen or back to the size before
*/
fullScreen: function( myId){

	var win = byId( myId+'_win');

	if( !win){
		return;
	}

	if( win.res.style.display == 'none'){
		win.style.left           = win.config.left+"px";
		win.style.top            = win.config.top+"px";
		win.res.style.display    = 'block';
		JSAX.WFM.resizeWin( win);
		return;
	}

	var winWidth  = window.innerWidth;
	var winHeight = window.innerHeight;

	var winPosX = document.body.scrollLeft;
	var winPosY = document.body.scrollTop;

	if( JSAX.browser.mozi() || JSAX.browser.opera()){
		winHeight -= 15;
		winWidth -= 16;
	}

	var contY = win.frm.offsetTop;
	var objW  = winWidth -win.config.border *2;

	win.bar.style.width = objW+"px";

	JSAX.WFM.actualizeView();

	win.config.left  = win.offsetLeft+"px";
	win.config.top   = win.offsetTop+"px";

	win.frm.style.width  = objW+"px";
	win.frm.style.height = winHeight -contY -win.config.border+"px";

	win.style.width  = winWidth+"px";
	win.style.height = winHeight+"px";
	win.style.left   = winPosX+"px";
	win.style.top    = winPosY+"px";

	win.res.style.display	= 'none';

	JSAX.WFM.actualizeView();
	window.scroll( winPosX, winPosY);

	win.show();

	return JSAX.Event.preventAction();
},

/**
* close window with submitted id
*/
close: function( id){
	var win = byId( id+'_win');
	win.hide();
	document.body.removeChild( win);
	JSAX.WFM.top--;
	JSAX.WFM.actualizeView();
},

/**
* hide window with submitted id
*/
hide: function( myId){
	var win = byId( myId+'_win');
	if( !win){
		return false;
	}
	if( win.style.visibility == 'hidden'){
		return true;
	}
	var taskBar = byId( 'taskBar');
	if( !taskBar){
		JSAX.WFM.start();
		taskBar = byId( 'taskBar');
	}
	byId( 'tskBar').style.display = 'block';

	var td = document.createElement( 'td');
	td.id = myId+'_margin';
	td.style.background = win.config.frontColor;
	td.style.color = win.config.textColor;
	taskBar.appendChild( td);
	var button = '<div id="'+myId+'_reveal" onclick="JSAX.WFM.reveal( \''+myId+'\');" style="width: 100%; height: '+win.config.barHeight+';">'+myId+'</div>';
	byId( myId+'_margin').innerHTML = button;

//	window.scroll( 0, 0);

	win.hide();

	JSAX.WFM.actualizeView();
//	alert( document.getElementsByClassName( 'WFM_Container')[0].frm.style.left);
//	alert( document.getElementsByClassName( 'WFM_Container')[1].frm.style.left);
	return false;
},

/**
* reveal window with submitted id
*/
reveal: function( myId){
	var win = byId(myId+'_win');
	if( !win){
		return false;
	}
	JSAX.WFM.showElem( win);
	var taskBar = byId( 'taskBar');
	if( byId( myId+'_margin')){
		taskBar.removeChild( byId( myId+'_margin'));
	}
	if( !taskBar.childNodes.length){
		byId( 'tskBar').style.display = "none";
	}
	var winPosX = win.offsetLeft;
	var winPosY = win.offsetTop;

	window.scroll( winPosX, winPosY);
	win.show();
	JSAX.WFM.actualizeView();
},


/**
* the following 4 functions are for window movement & resize
*/
beginDrag: function( targetId){
	// hide all frame for better performance
	var myId = byId( targetId).getAttribute( 'name');
	var win = byId( myId+'_win');

	win.show();
	var wins = document.getElementsByClassName( 'WFM_Container');
	for( var i = 0; i < wins.length; i++){
		var el = byId( wins[i].name+"_frm");
		if( el.tagName.toLowerCase() == "iframe"){
			JSAX.WFM.hideElem( el);
		}
	}
	
	JSAX.WFM.lastX = window.mouseX;
	JSAX.WFM.lastY = window.mouseY;
	JSAX.WFM.curId = myId;

	if( targetId == myId+'_resize'){
		byId( myId+'_resize').style.zIndex = 10;
		JSAX.WFM.dragMode = 'resize';
	}else{
		JSAX.WFM.dragMode = 'drag';
	}

	document.onmousemove	= JSAX.WFM.doDrag;
	document.onmouseup	= JSAX.WFM.endDrag;

//	JSAX.OutPut.show( JSAX.WFM.dragMode, 1);

	return JSAX.Event.preventAction();
},

doDrag: function( e){	

	var myId = JSAX.WFM.curId;

	var difX	= window.mouseX -JSAX.WFM.lastX;
	var difY	= window.mouseY -JSAX.WFM.lastY;

	var minimumX	= 0;//80+parseInt( frm.left);
	var minimumY	= 0;//50+parseInt( frm.top);

	var elem = byId( myId+'_win');
	if( JSAX.WFM.dragMode == 'resize'){
		elem = elem.res;
	}else{
		minimumX = -1000;
	}

	var newX	= elem.offsetLeft +difX;
	var newY	= elem.offsetTop +difY;
	if( newX < minimumX){
		newX = minimumX;
	}
	if(newY < minimumY){
		newY = minimumY;
	}

	elem.style.left	= newX+"px";
	elem.style.top	= newY+"px";

	JSAX.WFM.lastX	= window.mouseX;
	JSAX.WFM.lastY	= window.mouseY;

//	JSAX.OutPut.show( JSAX.WFM.dragMode+" to X: "+newX+" Y: "+newY, 1);

	return JSAX.Event.preventAction( e);
},

endDrag: function( e){

	JSAX.WFM.doDrag( {});
	var myId = JSAX.WFM.curId;

	// review all frames wich were hidden for better performance
	var wins = document.getElementsByClassName( 'WFM_Container');
	for( var i = 0; i < wins.length; i++){
		var el = byId( wins[i].name+"_frm");
		if( JSAX.browser.mozi()
		 || JSAX.browser.msie()
		 || wins[i].name == myId
		 || el.tagName.toLowerCase() != "iframe"){
			JSAX.WFM.showElem( el);
		}
	}

	if( JSAX.WFM.dragMode == 'resize'){
		JSAX.WFM.resizeWin( byId( myId+'_win'));
		byId( myId+'_resize').style.zIndex = -1;
	}
	JSAX.WFM.dragMode  = '';
	document.onmousemove = null;
	document.onmouseup   = null;

	JSAX.WFM.actualizeView();
	return JSAX.Event.preventAction( e);
},

resizeWin: function( win){
//	win.res.style.zIndex = -1;

	var posX = win.res.offsetLeft +win.config.resizeWidth -win.config.resizeThick;
	var posY = win.res.offsetTop +win.config.resizeHeight -win.config.resizeThick;
//	var dragW = win.res.style.width);
//	var dragH = win.res.style.height);
//	var contX = win.frm.style.left);
	var contY = win.frm.offsetTop;
//	var titlH = win.bar.style.height);
	var objW = posX -win.config.border *2;

	win.bar.style.width = objW+"px";

	win.frm.style.width  = objW+"px";
	win.frm.style.height = (posY -contY -win.config.border)+"px";

	win.style.width  = posX+"px";
	win.style.height = posY+"px";
},

/**
* this function solves the config parameters in open( URLorElem, name, parameters)
*/
string2object: function( params, s1, s2){
	if( !s1)s1 = ",";
	if( !s2)s2 = "=";
	var a = params.trimSplit( s1);
	var obj = new Array()
	for( var i = 0; i < a.length; i++){
		if( !a[i].length){
			continue;
		}
		a[i] = a[i].trimSplit( s2);
		if( typeof( a[i][1]) == "undefined"){
			obj[a[i][0]] = true;
		}else{
			obj[a[i][0]] = a[i][1];
		}
	}
	return obj;
},


hideElem: function( elem){
	if( elem.style.visibility == "hidden"){
		return;
	}
	elem.style.visibility = "hidden";
	if( JSAX.browser.konq()){
		elem.oldLeft = parseInt( elem.style.left);
		elem.style.left = "-9999px";
	}else{
//		elem.style.display = "none";
	}
},
showElem: function( elem){
	if( elem.style.visibility == ""){
		return;
	}
	elem.style.visibility = "";
	if( JSAX.browser.konq()){
		elem.style.left = elem.oldLeft+"px";
	}else{
//		elem.style.display = "";
	}
	return;
//	alert( elem.id);
},


actualizeView: function(){
	if( JSAX.browser.opera()){
		// this line is just here to get sure the things are going to be refreshed
//		byId( 'taskBar').innerHTML = byId( 'taskBar').innerHTML+'';
	}
},


mMove: function( e){
	var event = JSAX.Event.solv( e);
	window.mouseX = event.clientX +document.body.scrollLeft;
	window.mouseY = event.clientY +document.body.scrollTop;
//	JSAX.WFM.placeTaskBar( e);
},

placeTaskBar: function(){
	var tskBar = byId( 'tskBar');
	if( !tskBar){
		JSAX.WFM.start();
		return;
	}
	if( tskBar.style.display == "none"){
		return;
	}
//	if( !JSAX.browser.msie()){
//	}else{
//		var top = parseInt( document.body.clientHeight);
//	}

	var top  = document.body.scrollTop +window.innerHeight -tskBar.offsetHeight;
	var width = window.innerWidth;
	var oldH = document.body.scrollHeight;
	var oldW = document.body.scrollWidth;
	if( JSAX.browser.mozi() || JSAX.browser.opera()){
		top -= 15;
		width -= 16;
	}
//	alert( top);
	tskBar.style.width = width+'px';
	tskBar.style.top   = top+'px';
	tskBar.style.left  = document.body.scrollLeft+'px';
	return;
	
},

start: function(){
	if( !document.body){
		return;
	}
	var height =  JSAX.WFM.config.barHeight +JSAX.WFM.config.border *2;
	var taskBar = document.createElement( "div");
	taskBar.id			= "tskBar";
	taskBar.innerHTML		= '<table width="100%" cellpadding="0" cellspacing="'+JSAX.WFM.config.border+'"><tr id="taskBar"></tr></table>';
	taskBar.style.cursor		= "default";
	taskBar.style.position		= "fixed";
	taskBar.style.left		= "0px";
	taskBar.style.bottom		= "0px";
	taskBar.style.width		= "100%";
	taskBar.style.height		= height+"px";
	taskBar.style.background	= JSAX.WFM.config.backColor;
	taskBar.style.display		= "none";
	taskBar.onmouseover = function(){
		this.style.zIndex = "999";
	};
	taskBar.onmouseout = function(){
		this.style.zIndex = "";
	};
	
	
	if( !window.mouseX){
		window.mouseX = 0;
		window.mouseY = 0;
	}
	document.body.appendChild( taskBar);
	try{
		document.body.onmousemove	= JSAX.WFM.mMove;
//		document.body.onscroll		= JSAX.WFM.placeTaskBar;
	}catch( e){
	}
}
};

/*
if( window.attachEvent){
	window.attachEvent( 'onload', JSAX.WFM.start);
}else if( window.addEventListener){
	window.addEventListener( 'load', JSAX.WFM.start, false);
}*/
