
(typeof fw=="undefined"?fw={}:"");
fw.PwObject=function () {
	
	this.error=function (msg) {
		alert("Framework error\n\n"+msg);
	}
	this.p=function(defValue,v,p) {
		return this.paramValue(defValue,v,p,this.isUndefined)
	}
	this.pn=function (defValue,v,p) {
		return this.paramValue(defValue,v,p,this.isNull)
	}
	this.pnu=function (defValue,v,p) {
		return this.paramValue(defValue,v,p,this.isUndefinedOrNull)
	}
	this.paramValue=function (defValue,v,p,validator) {
		if (validator(v)) {
			return defValue;
		} else if (validator(p)) {
			return v;
		} else {
			return (validator(v[p])?v:v[p]);
		}
	}
	this.isUndefinedOrNull=function (v) {
		return null==v || typeof v=="undefined";
	}
	this.isUndefined=function (v) {
		return typeof v=="undefined";
	}
	this.isNull=function (v) {
		return null==v;
	}
	this.getParentTag=function (tagName, el) {
		el = el.parentNode;
		while (el && el.tagName != tagName) {
			el = el.parentNode;
		}
		return el;
	}

	this.IE = document.all;

}

fw.PwObject.inherits(Function);
fw.PwObject.objects={};
fw.PwObject.counter=0;
fw.PwObject.registerObj=function (obj) {
	var id="id"+(fw.PwObject.counter++);
	obj.id=id;
	fw.PwObject.objects[id]=obj;
}

