
function nxObject(){};
nxObject.prototype.initDone=false;
nxObject.superClass=null;
nxObject.prototype.preInit=function(data){
	this.config=typeof data.config!="undefined"?data.config:new nxHash();
	this.status=new nxHash();
	this.defaultStatus=new nxHash();
	this.childs=[];this.propertyInit=[];
	this.registerToParent();
};
nxObject.prototype.objectInit=function(data){
	try{
		this.initProperties();
		this.copyStatusFromEval();
		this.prepareDefaultStatus();
		this.initStatus();
	}
	catch(e){
		return __core__.error("Object:Failed to init Object:"+e);
	};
	return true;
};
nxObject.prototype.postInit=function(data){};
nxObject.prototype.initProperties=function(){
	if(nxValid(this.propertylist))
		this.properties=this.propertylist.split(",");
	else
		this.properties=[];
};
nxObject.prototype.hasProperty=function(prop){
	return this.properties.contains(prop);
};
nxObject.prototype.copyStatusFromEval=function(){
	for(var i=0;i<this.properties.length;i++){
		try{
			this["update"+this.properties[i].toCamelCase()](true);
		}
		catch(e){
			__core__.error("Object:Failed to init:"+this.properties[i]+":"+e);
		};
	};
};
nxObject.prototype.prepareDefaultStatus=function(){
	var c=this.config.get("defaultStatus");
	if(nxValid(c)){
		var a=c.split(",");
		for(var i=0;i<a.length;i++){
			var b=a[i].split("=");
			if(b.length==2){
				this.defaultStatus.set(b[0],b[1]);
			}
			else 
				__core__.error("Object:Malformed default value:"+b);
		};
	};
};
nxObject.prototype.initStatus=function(){
	var c;
	for(var i=0;i<this.properties.length;i++){
		if(this.config.get("restore")!=null&&this.getId().substring(0,3)!="auto"&&this.config.get("restore").split(",").contains(this.properties[i])){
			c=__cookie__.get("obj_"+this.getId()+"["+this.properties[i]+"]");
			if(nxValid(c)){
				this["set"+this.properties[i].toCamelCase()](c,null,true,false);
				this.propertyInit[this.properties[i]]="cookie";
				continue;
			};
		};
		c=__depend__.load(this.getId(),this.properties[i]);
		if(nxValid(c)){
			this["set"+this.properties[i].toCamelCase()](c[0],[c[1]]);
			this.propertyInit[this.properties[i]]="depend";
			continue;
		};
		var c=this.defaultStatus.get(this.properties[i]);
		if(nxValid(c)){
			this["set"+this.properties[i].toCamelCase()](c);
			this.propertyInit[this.properties[i]]="default";
			continue;
		};
		if(this["reset"+this.properties[i].toCamelCase()]())
			continue;
		this.propertyInit[this.properties[i]]="none";
	};
};
nxObject.prototype.getNonInitProperties=function(){
	var a=[];for(var i=0;i<this.properties.length;i++)
	if(this.propertyInit[this.properties[i]]==false)
		a.push(this.properties[i]);
		return a;
};
nxObject.prototype.registerToParent=function(){
	var p=this.config.get("parent");
	if(nxValid(p)){
		var o=__registry__.get(p);
		if(nxValid(o)){
			o.registerChild(this);
		}
		else {
			__core__.error("Object:Parent is not(already)available!");
		};
	}
	else {};
};
nxObject.prototype.registerChild=function(o){
	this.childs.push(o.getId());
};
nxObject.prototype.getConfig=function(prop){
	return this.config.get(prop);
};
nxObject.prototype.getId=function(){
	return this.config.get("id");
};
function nxAddProperty(data){
	if(arguments.length!=1)
		return __core__.error("Object:There isn't support for old nxAddProperty-Style anymore!");
	if(data.constructor==null||typeof data.constructor=="undefined")
		return __core__.error("Object:Constructor isn't defined!");
	if(typeof data.name!="string")
		return __core__.error("Object:Malformed Property Name");
	var fname=data.name.toCamelCase();
	if(typeof data.constructor.propertylist!="string")
		data.constructor.propertylist="";
	if(data.constructor.propertylist!="")data.constructor.propertylist+=",";
		data.constructor.propertylist+=data.name;
	data.constructor["eval"+fname]=function(){};
	data.constructor["modify"+fname]=function(){
		return true;
	};
	data.constructor["checkfix"+fname]=function(v){
		return v;
	};
	if(typeof data.defaultValue!="undefined"){
		data.constructor["reset"+fname]=function(){
			return this["set"+fname](data.defaultValue);
		};
	}
	else {
		data.constructor["reset"+fname]=function(){};
	};
	data.constructor["get"+fname]=function(useEval,useCopy){
		var value;
		if(this.status.contains(data.name)){
			value=this.status.get(data.name);
		}
		else if(typeof useEval=="undefined"||useEval){
			value=this["eval"+fname]();
		};
		if(typeof value=="object"&&useCopy){
			var copy=[];
			copy.combine(value);
			return copy;
		};
		return value;
	};
	data.constructor["set"+fname]=function(value,tree,useDepend,useCookie){
		if(value==null)
			return false;
		if(typeof value!=data.type){
			value=__core__.normalize(value,data.type);
			if(typeof value!=data.type)
				return __core__.error("Object:"+this.getId()+" invalid value type couldn't be fixed:"+typeof value+"->"+data.type);
		};
		if(nxValid(data.allowed)&&!data.allowed.contains(value)){
			return __core__.error("Object:"+this.getId()+" this value is not allowed:"+value);
		};
		var curr=this["get"+fname](false);if(curr==value){
			return;
		};
		value=this["checkfix"+fname](value);
		if(!this["modify"+fname](value,curr)){
			return __core__.error("Object:"+this.getId()+" failed to set new value:"+data.name+"='"+value+"'");
		};
		this["change"+fname](value);
		if(!nxValid(useCookie)||useCookie){
			this["save"+fname](value);
		};
		if(tree==null||typeof tree!="object"){
			tree=[];
		};
		tree.push([this.getId(),data.name]);
		if(typeof useDepend=="undefined"||useDepend){
			this["depend"+fname](value,tree);
		};
		return true;
	};
	data.constructor["change"+fname]=function(value){
		this.status.set(data.name,value);
	};
	data.constructor["save"+fname]=function(value){
		try{
			var r=this.config.get("restore");
			if(this.getId().substring(0,3)!="auto"&&nxValid(r)&&r.split(",").contains(data.name))
				__cookie__.set("obj_"+this.getId()+"["+data.name+"]",value)
		}
		catch(e){
			return __core__.error("Error while storing cookie:"+e);
		};
	};
	data.constructor["update"+fname]=function(update){
		var value=this["eval"+fname]();
		if(!nxValid(value))
			return;
		if(update&&(!nxValid(data.evalModify)||data.evalModify!=false)){
			if(!this["modify"+fname](value)){};
		};
		return this["change"+fname](value);
	};
	data.constructor["depend"+fname]=function(value,tree){
		if(typeof tree!="object")
			tree=[];
		tree.push([this.getId(),data.name]);
		return __depend__.handle(this.getId(),data.name,value,tree);
	};
	data.constructor["handle"+fname]=function(value,tree){
		return this["set"+fname];
	};
};
function nxNode(){};
nxNode.prototype=new nxObject;
nxNode.superClass=nxObject.prototype;
nxAddProperty({"constructor":nxNode.prototype,"name":"class","type":"string","evalModify":false});
nxNode.prototype.evalClass=function(){
	return this.node.className;
};
nxNode.prototype.modifyClass=function(value){
	__node__.setClass(this.getNode(),value);
	return true;
};
nxNode.prototype.addClass=function(value){
	var o=this.getClass();
	if(o=="")
		return this.setClass(value);
	return this.setClass(o.addElement(value));
};
nxNode.prototype.removeClass=function(value){
	var o=this.getClass();
	if(o=="")
		return;
	return this.setClass(o.removeElement(value));
};
nxNode.prototype.removeMultipleClasses=function(values){
	var o=this.getClass();
	if(o=="")
		return;
	var a=o.split(" ");
	var b=[];
	for(var i=0;i<a.length;i++)
		if(!values.contains(a[i]))
			b.push(a[i]);
		return this.setClass(b.length==0?"":b.length==1?b[0]:b.join(" "));
};
nxNode.prototype.replaceClass=function(i,j){
	this.removeClass(i);
	this.addClass(j);
};
nxNode.prototype.fixBoxsizing=function(a){
	if(!nxValid(a))
		a=this;
	for(i in a){
		if(typeof a[i]=="function"||typeof a[i]=="string"||a[i]==null||a[i].nodeType==null||typeof a[i].nodeType=="undefined"||a[i].nodeType!=1)
			continue;
		if(a[i].tagName.toLowerCase()=="img"||(nxValid(a[i].type)&&a[i].type.toLowerCase()=="image"))
			continue;
		__node__.fixBoxModel(a[i]);
	};
};
nxAddProperty({"constructor":nxNode.prototype,"name":"display","type":"string","evalModify":false,"allowedValues":["","block","none","inline","inline-block","table-row","table-cell"]});
nxNode.prototype.evalDisplay=function(){
	return this.getStyle("display","string");
};
nxNode.prototype.modifyDisplay=function(value){
	return this.setStyle("display",value,"string");
};
nxAddProperty({"constructor":nxNode.prototype,"name":"position","type":"string","evalModify":false,"allowedValues":["","absolute","relative"]});
nxNode.prototype.evalPosition=function(){
	return this.getStyle("position","string");
};
nxNode.prototype.modifyPosition=function(value){
	return this.setStyle("position",value,"string");
};
nxAddProperty({"constructor":nxNode.prototype,"name":"visibility","type":"string","evalModify":false,"allowedValues":["","visible","hidden"]});
nxNode.prototype.evalVisibility=function(){
	return this.getStyle("visibility","string");
};
nxNode.prototype.modifyVisibility=function(value){
	return this.setStyle("visibility",value,"string");
};
nxAddProperty({"constructor":nxNode.prototype,"name":"color","type":"string","evalModify":false});
nxNode.prototype.evalColor=function(){
	return this.getStyle("color","color");
};
nxNode.prototype.modifyColor=function(value){
	return this.setStyle("color",value,"color");
};
nxAddProperty({"constructor":nxNode.prototype,"name":"backgroundColor","type":"string","evalModify":false});
nxNode.prototype.evalBackgroundColor=function(){
	return this.getStyle("backgroundColor","color");
};
nxNode.prototype.modifyBackgroundColor=function(value){
	return this.setStyle("backgroundColor",value,"color");
};
nxAddProperty({"constructor":nxNode.prototype,"name":"cursor","type":"string","evalModify":false});
nxNode.prototype.evalCursor=function(){
	var value=this.getStyle("cursor","string");
	if(value=="hand"&&__client__.getEngine()=="mshtml")
		value="pointer";
	return value;
};
nxNode.prototype.modifyCursor=function(value){
	if(value=="pointer"&&__client__.getEngine()=="mshtml")
		value="hand";
	return this.setStyle("cursor",value,"string");
};
nxAddProperty({"constructor":nxNode.prototype,"name":"height","type":"number","evalModify":false});
nxNode.prototype.evalHeight=function(){
	return this.getStyle("height","px");
};
nxNode.prototype.modifyHeight=function(value){
	return this.setStyle("height",value,"px");
};
nxAddProperty({"constructor":nxNode.prototype,"name":"width","type":"number","evalModify":false});
nxNode.prototype.evalWidth=function(){
	return this.getStyle("width","px");
};
nxNode.prototype.modifyWidth=function(value){
	return this.setStyle("width",value,"px");
};
nxNode.prototype.registerToParent=function(){
	var p=this.config.get("parent");
	var o=null;
	if(nxValid(p)){
		o=__registry__.get(p);
	}
	else {
		var pp=this.getNode().parentNode;
		if(nxValid(pp)){
			o=__registry__.getByNode(pp);
			if(nxValid(o))
				this.config.set("parent",o.getId());
		};
	};
	if(nxValid(o)){
		o.registerChild(this);
	}
	else {};
};
nxNode.prototype.preInit=function(data){
	this.childs=[];
	if(!nxValid(this.node))
		this.node=data.node;
	nxNode.superClass.preInit.call(this,data);
	if(this.setWidgetClass!=false)
		this.addClass(data.config.get("type"));
};
nxNode.prototype.getNode=function(){
	return this.node;
};
nxNode.prototype.getTagName=function(){
	return this.getNode().tagName.toLowerCase();
};
nxNode.prototype.addNodeEvent=function(prop,func){
	return __node__.addNodeEvent(this.node,this.getId(),prop,func);
};
nxNode.prototype.getStyle=function(prop,type){
	return __node__.getStyle(this.getNode(),prop,type);
};
nxNode.prototype.setStyle=function(prop,value,type){
	return __node__.setStyle(this.getNode(),prop,value,type);
};
nxNode.prototype.searchConfig=function(key){
	var d=this;
	var m=null;
	var c;
	while(nxValid(d)&&!nxValid(m)){
		m=d.config.get(key);
		if(nxValid(d.parent)){
			d=d.parent;
		}
		else {
			c=d.config.get("parent");
			d=nxValid(c)?__registry__.get(c):null;
		};
	};
	return m;
};
nxNode.prototype.replaceNode=function(n){
	var o=this.getNode();
	var p=o.parentNode;
	p.replaceChild(n,o);
	this.node=n;
};
function nxLayer(){};
nxLayer.prototype=new nxNode;
nxLayer.superClass=nxNode.prototype;
nxAddProperty({"constructor":nxLayer.prototype,"name":"zindex","type":"number","evalModify":false});
nxAddProperty({"constructor":nxLayer.prototype,"name":"alpha","type":"number","evalModify":false});
nxAddProperty({"constructor":nxLayer.prototype,"name":"y","type":"number","evalModify":false});
nxAddProperty({"constructor":nxLayer.prototype,"name":"x","type":"number","evalModify":false});
nxLayer.prototype.objectInit=function(data){
	nxLayer.superClass.objectInit.call(this,data);
	this.getNode().style.position="absolute";
	this.initMsLayer();
};
nxLayer.prototype.preInit=function(data){
	nxLayer.superClass.preInit.call(this,data);};
	nxLayer.prototype.initMsLayer=function(){
		this.msValid=false;
		if(__client__.getEngine()!="mshtml")
			return;
		if(!(__client__.getBrowserMajorVersion()==6||(__client__.getBrowserMajorVersion()==5&&__client__.getBrowserMinorVersion()==5)))
			return;
		this.msValid=true;
		this.setStyle("zIndex",101);
		this.msStatus=[];
		this.msLayer=document.createElement("iframe");
		with(this.msLayer){
			scrolling="no";
			marginheight="0";
			marginwidth="0";
			frameborder="0";
			src="javascript:false";
		};
		__node__.appendToBody(this.msLayer,this.getNode());
		this.getNode().style.zIndex=999;
		with(this.msLayer.style){
			position="absolute";
			display="block";
			zIndex=998;
			padding="0";
			margin="0";
			border="0 none";
			filter="progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)";
			color="#012345";
		};
		this.syncMsLayer();
		};
		nxLayer.prototype.syncMsLayer=function(){
			var n=this.getNode();
			this.syncMsLayerSub("width",n.offsetWidth,"px");
			this.syncMsLayerSub("height",n.offsetHeight,"px");
			this.syncMsLayerSub("left",__node__.getOffsetX(n),"px");
			this.syncMsLayerSub("top",__node__.getOffsetY(n),"px");};
			nxLayer.prototype.syncMsLayerSub=function(prop,value,unit){
				if(value==this.msStatus[prop])
					return false;
				if(!__node__.setStyle(this.msLayer,prop,value,unit))
					return false;
				this.msStatus[prop]=value;
				return true;
			};
			nxLayer.prototype.alignTo=function(node,mode,xoff,yoff){
				var x=nxValid(xoff)?xoff:0;var y=nxValid(yoff)?yoff:0;
					if(mode=="bl"){
						x+=__node__.getOffsetX(node);
						y+=__node__.getOffsetY(node)+__node__.getOffsetHeight(node);
					}
					else if(mode=="rt"){
						x+=__node__.getOffsetX(node)+__node__.getOffsetWidth(node);
						y+=__node__.getOffsetY(node);
					};
				with(this){
					setX(x);
					setY(y);
				};
			};
			nxLayer.prototype.modifyHeight=function(value){
				var r=this.setStyle("height",value,"px");
				if(r&&this.msValid)this.syncMsLayer();
					return r;
			};
			nxLayer.prototype.modifyWidth=function(value){
				var r=this.setStyle("width",value,"px");
				if(r&&this.msValid)this.syncMsLayer();
					return r;
			};
			nxLayer.prototype.evalZindex=function(){
				return this.getStyle("zIndex","int");
			};
			nxLayer.prototype.modifyZindex=function(value){
				return this.setStyle("zIndex",value,"int");
			};
			nxLayer.prototype.evalX=function(){
				return this.getStyle("left","int");
			};
			nxLayer.prototype.modifyX=function(value){
				var r=this.setStyle("left",value,"px");
				if(r&&this.msValid)this.syncMsLayer();
					return r;
			};
			nxLayer.prototype.evalX=function(){
				return this.getStyle("top","int");
			};
			nxLayer.prototype.modifyY=function(value){
				var r=this.setStyle("top",value,"px");
				if(r&&this.msValid)this.syncMsLayer();
					return r;
			};
			nxLayer.prototype.evalAlpha=function(){
				return __node__.getAlpha(this.getNode());
			};
			nxLayer.prototype.modifyAlpha=function(value){
				return __node__.setAlpha(this.getNode(),value);
			};
			nxLayer.prototype.modifyDisplay=function(value){
				var r=this.setStyle("display",value,"string");
				if(r&&this.msValid){
					this.syncMsLayerSub("display",value,"string");
					this.syncMsLayer();
				};
				return r;
			};
			nxLayer.prototype.modifyVisibility=function(value){
				var r=this.setStyle("visibility",value,"string");
				if(r&&this.msValid){
					this.syncMsLayerSub("visibility",value,"string");
					this.syncMsLayer();
				};
				return r;
			};
			var nxHover={
				add:function(config,node){
				__node__.addEvent(node,"mouseover",new Function("e","return nxHover.over(e);"));
				__node__.addEvent(node,"mouseout",new Function("e","return nxHover.out(e);"));
				var ndata=nxImage.parse(node.src);
				var s=config.get("image");
				if(!nxValid(s)){
					__core__.error("Hover:Need 'image' config flag!");
					return false;
				};
				node.nsrc=node.src;
				node.osrc=ndata.imagePath+s+"."+ndata.imageExtension;
				nxImage.register(node.nsrc,node.osrc);
				return true;
			},valid:function(e){
				var t=e.target.tagName.toLowerCase();
				return t=="img"||(t=="input"&&e.target.type.toLowerCase()=="image");
			},over:function(e){
				e=nxEvent(e);
				if(!this.valid(e))
					return;
				e.target.src=e.target.osrc;
			},out:function(e){
				e=nxEvent(e);
				if(!this.valid(e))
					return;
				e.target.src=e.target.nsrc;
			}
		}
		function nxHintMove(e){
			return nxHint.sync(nxEvent(e));
		};
		var nxHint={
			cache:[],maxwidth:200,dtags:["strong","em","i","b","u","ol","ul","li"],stags:["br","hr"],ready:false,init:function(){
				this.layerNode=document.createElement("div");
				document.body.appendChild(this.layerNode);
				this.textNode=document.createTextNode("");
				this.layerNode.appendChild(this.textNode);
				this.config=new nxHash();
				this.config.set("type","layer");
				this.config.set("id","nxHintLayer");
				this.layer=__registry__.add({"node":this.layerNode,"config":this.config,"type":"layer"});
				this.layer.setDisplay("none");
				this.layer.setClass("nxHint");
				this.layer.setPosition("absolute");
				this.layer.setX(0);
				this.layer.setY(0);
				this.ready=true;
			},add:function(config,node){
				var t=config.get("text");
				var p=this.cache.length;
				var r;
				__node__.addEvent(node,"mouseover",new Function("e","return nxHint.over(e);"));
				__node__.addEvent(node,"mouseout",new Function("e","return nxHint.out(e);"));
				for(var i=0;i<this.stags.length;i++)
					t=t.replace(new RegExp("\\["+this.stags[i]+"\\]","g"),"<"+this.stags[i]+">");for(var i=0;i<this.dtags.length;i++)
					t=t.replace(new RegExp("\\["+this.dtags[i]+"\\]","g"),"<"+this.dtags[i]+">");for(var i=0;i<this.dtags.length;i++)
					t=t.replace(new RegExp("\\[/"+this.dtags[i]+"\\]","g"),"</"+this.dtags[i]+">");this.cache[p]={"text":t};node.hintid=p;__node__.addClass(node,"hintparent");
					node.style.textDecoration="none";
					var cur=config.get("cursor");
					if(nxValid(cur)){
						if(cur=="hand"){
						node.style.cursor=__client__.getEngine()=="mshtml"?"hand":"pointer";
						}
						else {
							node.style.cursor=String(cur);
						};
					}
					else {
						node.style.cursor="help";
					};
					return true;
				},over:function(e){
					if(!this.ready)return;
					e=nxEvent(e);
					var i;
					var t=e.target;
					while(nxValid(t)&&!nxValid(t.hintid))
						t=t.parentNode;
						if(!nxValid(t)||!nxValid(t.hintid)){
							__core__.error("Hint:Invalid Tag or Hint ID");
							return false;
						};
						var newText=this.cache[t.hintid].text;
						for (var i = 0; i < newText.length; i++){
							newText=newText.replace("~`~",":")
							newText=newText.replace("`~`",";")
						}
						this.layerNode.innerHTML=newText;
						this.layerNode.className="nxHint";
						this.layer.setDisplay("block");
						if(this.layer.getNode().offsetWidth>this.maxwidth)
							this.layer.getNode().style.width=this.maxwidth+"px";
						this.mstart(e);
					},out:function(e){
						if(!this.ready)return;
						e=nxEvent(e);
						this.layerNode.innerHTML="";
						this.layer.setDisplay("none");
						this.layer.getNode().style.width="";
						this.mstop();
					},mstart:function(e){
						this.sync(e);
						__node__.addEvent(document,"mousemove",nxHintMove);
					},mstop:function(){
						__node__.removeEvent(document,"mousemove",nxHintMove);
					},sync:function(e){
						if(!this.ready)
							return;
						var mx=10;
						var w=window.getViewportWidth();
						var v=parseInt(w*0.66);
						if(nxValid(e.target.style)&&e.target.style.cursor=="help"&&__client__.getPlatform()=="win")
							mx=20;
						var dx=(e.x<v&&(e.x+this.maxwidth)<(w-40))?e.x+mx:e.x-this.layer.getNode().offsetWidth-4;
						var dy=e.y+12;
						this.layer.setX(dx);
						this.layer.setY(dy);
					}
};
__node__.addEvent(window,"load",new Function("nxHint.init()"));
function nxFormElement(){};
nxFormElement.prototype=new nxNode;
nxFormElement.superClass=nxNode.prototype;
nxAddProperty({"constructor":nxFormElement.prototype,"name":"value","type":"string"});
nxAddProperty({"constructor":nxFormElement.prototype,"name":"enabled","type":"boolean"});
nxFormElement.prototype.objectInit=function(data){
	nxFormElement.superClass.objectInit.call(this,data);
};
nxFormElement.prototype.preInit=function(data){
	nxFormElement.superClass.preInit.call(this,data);
	this.initElemType();
};
nxFormElement.prototype.isEnabled=function(){
	return !this.node.disabled;
};
nxFormElement.prototype.modifyEnabled=function(value){
	this.getNode().disabled=!value;
	var c=this.getClass();
	c=c.removeElement("enabled");
	c=c.removeElement("disabled");
	c=c.addElement(value?"enabled":"disabled");
	this.setClass(c);
	return true;
};
nxFormElement.prototype.evalEnabled=function(){
	return !this.getNode().disabled;
};
nxFormElement.prototype.evalValue=function(){
	return this.getNode().value;
};
nxFormElement.prototype.modifyValue=function(value){
	this.getNode().value=value;return true;
};
nxFormElement.prototype.getSimpleType=function(){
	var ftype=this.getNode().type;
	return nxValid(ftype)?ftype.toLowerCase():"";
};
nxFormElement.prototype.initElemType=function(){
	var ftag=this.getTagName();
	var ftype=this.getSimpleType();
	if(ftag=="img"||(ftag=="input"&&ftype=="image"))
		this.elemType="image";
	else if(ftag=="button"||(ftag=="input"&&ftype=="button"))
		this.elemType="button";
	else if(ftag=="input"&&ftype=="submit")
		this.elemType="submit";
	else if(ftag=="textarea")
		this.elemType="textarea";
	else if(ftag=="select")
		this.elemType="select";
	else if(ftag=="input"&&ftype=="hidden")
		this.elemType="hidden";
	else
		this.elemType="unknown";
};
nxFormElement.prototype.getElemType=function(){
	return this.elemType;
};
function nxButton(){};
nxButton.prototype=new nxFormElement;
nxButton.superClass=nxFormElement.prototype;
nxAddProperty({"constructor":nxButton.prototype,"name":"status","type":"string"});
nxAddProperty({"constructor":nxButton.prototype,"name":"text","type":"string"});
nxAddProperty({"constructor":nxButton.prototype,"name":"image","type":"string"});
nxButton.prototype.objectInit=function(data){nxButton.superClass.objectInit.call(this,data);
this.addNodeEvent("click","eval");};
nxButton.prototype.preInit=function(data){
	nxButton.superClass.preInit.call(this,data);
	this.initImage();
};
nxButton.prototype.eval=function(e){
	this.setStatus(this.config.get("value"));
};
nxButton.prototype.modifyStatus=function(value){
	var own=value==this.config.get("value");
	this.statusDependClass(own);
	this.statusDependEnabled(own);
	return true;
};
nxButton.prototype.statusDependClass=function(own){
	var classname=own?this.config.get("activeClass"):this.config.get("inactiveClass");
	if(nxValid(classname))
		return this.setClass(classname);
};
nxButton.prototype.statusDependEnabled=function(own){
	return this.setEnabled(!own);
};
nxButton.prototype.modifyText=function(value){
	var n=this.getNode();
	var t=this.getTagName();
	if(t=="input"&&this.getNode().type=="submit"){
		n.value=value;
		return true;
	}
	else if(t=="button"||(t=="input"&&this.getNode().type=="button")){
		n.firstChild.nodeValue=value;
		return true;
	}
	else if((t=="div"||t=="span"||t=="a")&&n.firstChild&&n.firstChild.nodeType==3){
		n.firstChild.nodeValue=value;
		return true;
	};
	return false;
};
nxButton.prototype.evalText=function(){
	var btype=this.getElemType();
	if(btype=="submit")
		return this.getNode().value;
	else if(btype=="button")
		return this.getNode().firstChild.nodeValue;
};
nxButton.prototype.initImage=function(){
	if(this.getElemType()!="image")
		return;
	var nsrc=this.getNode().src;
	var ndata=nxImage.parse(nsrc);
	this.imageBaseName=ndata.imageBaseName;
	this.imagePath=ndata.imagePath;
	this.imageExtension=ndata.imageExtension;
	this.imageName=ndata.imageName;
	var rimages=this.config.get("image");
	if(nxValid(rimages)){
		aimages=rimages.split(",");
		for(var i=0;i<aimages.length;i++)
			nxImage.register(this.imagePath+aimages[i]+"."+this.imageExtension)
	};
};
nxButton.prototype.evalImage=function(){
	return this.imageName;
};
nxButton.prototype.modifyImage=function(value){
	if(!nxValid(this.imagePath))
		this.initImagePath();
	var newsrc=this.imagePath+value+"."+this.imageExtension;
	this.getNode().src=newsrc;
	return true;
};
function nxToggle(){};
nxToggle.prototype=new nxButton;
nxToggle.superClass=nxButton.prototype;
nxToggle.prototype.objectInit=function(data){
	nxToggle.superClass.objectInit.call(this,data);
};
nxToggle.prototype.preInit=function(data){
	nxToggle.superClass.preInit.call(this,data);
};
nxToggle.prototype.eval=function(e){
	this.setStatus(this.getNextValue(true));
};
nxToggle.prototype.getNextPosition=function(value,arr,force){
	if(typeof arr=="undefined")
		var arr=this.config.get("value").split(",");
	var current=value!=null?value:this.getStatus();
	var pos=arr.indexOf(current);
	if(pos==-1)
		pos=force==true?0:null;
	else if(pos==(arr.length-1))
		pos=0;
	else
		pos++;
	return pos;
};
nxToggle.prototype.getNextValue=function(force){
	var arr=this.config.get("value").split(",");
	var pos=this.getNextPosition(null,arr,force);
	return arr[pos==-1?0:pos];
};
nxToggle.prototype.getPropertyByPosition=function(prop,pos){
	var c=this.config.get(prop);
	if(!nxValid(c))
		return;
	var arr=c.split(",");
	if(pos==null||pos>=arr.length){
		var def=this.config.get("default"+prop.toCamelCase());
		if(nxValid(def)){
			return def;
		}
		else {
			return null;
		};
	};
	return arr[pos];
};
nxToggle.prototype.modifyStatus=function(value){
	var pos=this.getNextPosition(value);
	var todo=["class","text","image"];
	var temp;
	for(var i=0;i<todo.length;i++){
		temp=this.getPropertyByPosition(todo[i],pos);
		if(nxValid(temp))
			this["set"+todo[i].toCamelCase()](temp);
	};
	return true;
};
nxToggle.prototype.evalStatus=function(){
	return "";
};

