var JSON={
	copyright:'(c)2005 JSON.org',
	license:'http://www.crockford.com/JSON/license.html',
	stringify:function(v){var a=[];
	function e(s){a[a.length]=s;}
	function g(x){
		var c,i,l,v;
		switch(typeof x)
		{
			case'object':
				if(x){
					if(x instanceof Array) {
						e('[');
						l=a.length;
						for(i=0;i<x.length;i+=1){
							v=x[i];
							if(typeof v!='undefined'&&typeof v!='function'){
								if(l<a.length){
									e(',');
								}
								g(v);
							}
						}
						e(']');
						return;
					}else if(typeof x.valueOf=='function'){
						e('{');
						l=a.length;
						for(i in x){
							v=x[i];
							if(typeof v!='undefined'&&typeof v!='function'&&(!v||typeof v!='object'||typeof v.valueOf=='function')) {
								if(l<a.length){e(',');}
									g(i);
									e(':');
									g(v);
								}
						}
						return e('}');
					}
				}
				e('null');
				return;
			case'number':
				e(isFinite(x)?+x:'null');
				return;
			case'string':
				l=x.length;
				e('"');
				for(i=0;i<l;i+=1){
					c=x.charAt(i);
					if(c>=' '){
						if(c=='\\'||c=='"'){
							e('\\');
						}
						e(c);
					}else{
						switch(c){
							case'\b':
								e('\\b');
								break;
							case'\f':
								e('\\f');
								break;
							case'\n':
								e('\\n');
								break;
							case'\r':
								e('\\r');
								break;
							case'\t':
								e('\\t');
								break;
							default:
								c=c.charCodeAt();
								e('\\u00'+Math.floor(c/16).toString(16)+(c%16).toString(16));
						}
					}
				}
				e('"');
				return;
			case'boolean':
				e(String(x));
				return;
			default:
				e('null');
				return;
			}
		}
		g(v);
		return a.join('');
	},parse:function(text){
		return(/^(\s+|[,:{}\[\]]|"(\\["\\\/bfnrtu]|[^\x00-\x1f"\\]+)*"|-?\d+(\.\d*)?([eE][+-]?\d+)?|true|false|null)+$/.test(text))&&eval('('+text+')');
		}
	};

function Sarissa(){};
Sarissa.PARSED_OK="Document contains no parsing errors";
Sarissa.IS_ENABLED_TRANSFORM_NODE=false;
Sarissa.IS_ENABLED_XMLHTTP=false;
Sarissa.IS_ENABLED_SELECT_NODES=false;
var _sarissa_iNsCounter=0;
var _SARISSA_IEPREFIX4XSLPARAM="";
var _SARISSA_HAS_DOM_IMPLEMENTATION=document.implementation && true;
var _SARISSA_HAS_DOM_CREATE_DOCUMENT=_SARISSA_HAS_DOM_IMPLEMENTATION && document.implementation.createDocument;
var _SARISSA_HAS_DOM_FEATURE=_SARISSA_HAS_DOM_IMPLEMENTATION && document.implementation.hasFeature;
var _SARISSA_IS_MOZ=_SARISSA_HAS_DOM_CREATE_DOCUMENT && _SARISSA_HAS_DOM_FEATURE;
var _SARISSA_IS_SAFARI=(navigator.userAgent&&navigator.vendor&&(navigator.userAgent.toLowerCase().indexOf("applewebkit")!=-1||navigator.vendor.indexOf("Apple")!=-1));
var _SARISSA_IS_IE=document.all && window.ActiveXObject && navigator.userAgent.toLowerCase().indexOf("msie")>-1&&navigator.userAgent.toLowerCase().indexOf("opera")==-1;
if(!window.Node||!window.Node.ELEMENT_NODE){
	var Node={
		ELEMENT_NODE:1,
		ATTRIBUTE_NODE:2,
		TEXT_NODE:3,
		CDATA_SECTION_NODE:4,
		ENTITY_REFERENCE_NODE:5,
		ENTITY_NODE:6,
		PROCESSING_INSTRUCTION_NODE:7,
		COMMENT_NODE:8,
		DOCUMENT_NODE:9,
		DOCUMENT_TYPE_NODE:10,
		DOCUMENT_FRAGMENT_NODE:11,
		NOTATION_NODE:12};
};
if(_SARISSA_IS_IE){
	_SARISSA_IEPREFIX4XSLPARAM="xsl:";
	var _SARISSA_DOM_PROGID="";
	var _SARISSA_XMLHTTP_PROGID="";
	pickRecentProgID=function(idList,enabledList){
		var bFound=false;
		for(var i=0;i<idList.length&&!bFound;i++){
			try{
				var oDoc=new ActiveXObject(idList[i]);
				o2Store=idList[i];
				bFound=true;
				for(var j=0;j<enabledList.length;j++)
					if(i<=enabledList[j][1])
						Sarissa["IS_ENABLED_"+enabledList[j][0]]=true;
			}
			catch(objException){};
		};
		if(!bFound)
			throw"Could not retreive a valid progID of Class: "+idList[idList.length-1]+". (original exception: "+e+")";
		idList=null;return o2Store;};
		_SARISSA_DOM_PROGID=pickRecentProgID(["Msxml2.DOMDocument.5.0","Msxml2.DOMDocument.4.0","Msxml2.DOMDocument.3.0","MSXML2.DOMDocument","MSXML.DOMDocument","Microsoft.XMLDOM"],
											 [["SELECT_NODES",2],["TRANSFORM_NODE",2]]);
		_SARISSA_XMLHTTP_PROGID=pickRecentProgID(["Msxml2.XMLHTTP.5.0","Msxml2.XMLHTTP.4.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"],
												 [["XMLHTTP",4]]);
		_SARISSA_THREADEDDOM_PROGID=pickRecentProgID(["Msxml2.FreeThreadedDOMDocument.5.0","MSXML2.FreeThreadedDOMDocument.4.0","MSXML2.FreeThreadedDOMDocument.3.0"]);
		_SARISSA_XSLTEMPLATE_PROGID=pickRecentProgID(["Msxml2.XSLTemplate.5.0","Msxml2.XSLTemplate.4.0","MSXML2.XSLTemplate.3.0"],
													[["XSLTPROC",2]]);
		pickRecentProgID=null;
		Sarissa.getDomDocument=function(sUri,sName){
			var oDoc=new ActiveXObject(_SARISSA_DOM_PROGID);
			if(sName){
				if(sUri){
					oDoc.loadXML("<a"+_sarissa_iNsCounter+":"+sName+" xmlns:a"+_sarissa_iNsCounter+"=\""+sUri+"\" />");
					++_sarissa_iNsCounter;
				} else {
					oDoc.loadXML("<"+sName+"/>");
				}
			};
			return oDoc;
		};
		Sarissa.getParseErrorText=function(oDoc){
			var parseErrorText=Sarissa.PARSED_OK;
				if(oDoc.parseError!=0){
					parseErrorText="XML Parsing Error: "+oDoc.parseError.reason+"\nLocation: "+oDoc.parseError.url+"\nLine Number "+oDoc.parseError.line+", Column "+
					oDoc.parseError.linepos+":\n"+oDoc.parseError.srcText+"\n";
					for(var i=0;i<oDoc.parseError.linepos;i++){
						parseErrorText+="-";
					};
					parseErrorText+="^\n";
				};
				return parseErrorText;
		};
		Sarissa.setXpathNamespaces=function(oDoc,sNsSet){
			oDoc.setProperty("SelectionLanguage","XPath");
			oDoc.setProperty("SelectionNamespaces",sNsSet);
		};
		XSLTProcessor=function(){
			this.template=new ActiveXObject(_SARISSA_XSLTEMPLATE_PROGID);
			this.processor=null;
		};
		XSLTProcessor.prototype.importStylesheet=function(xslDoc){
			var converted=new ActiveXObject(_SARISSA_THREADEDDOM_PROGID);
			converted.loadXML(xslDoc.xml);
			this.template.stylesheet=converted;
			this.processor=this.template.createProcessor();
			this.paramsSet=new Array();
		};
		XSLTProcessor.prototype.transformToDocument=function(sourceDoc){
			this.processor.input=sourceDoc;
			var outDoc=new ActiveXObject(_SARISSA_DOM_PROGID);
			this.processor.output=outDoc;
			this.processor.transform();
			return outDoc;
		};
		XSLTProcessor.prototype.setParameter=function(nsURI,name,value){
			if(nsURI){
				this.processor.addParameter(name,value,nsURI);
			}else{
				this.processor.addParameter(name,value);
			};
			if(!this.paramsSet[""+nsURI]){
				this.paramsSet[""+nsURI]=new Array();
			};
			this.paramsSet[""+nsURI][name]=value;
		};
		XSLTProcessor.prototype.getParameter=function(nsURI,name){
			nsURI=nsURI||"";
			if(nsURI in this.paramsSet&&name in this.paramsSet[nsURI]){
				return this.paramsSet[nsURI][name];
			}else{
				return null;
			};
		};
	} else {
		if(_SARISSA_HAS_DOM_CREATE_DOCUMENT){
			Sarissa.__handleLoad__=function(oDoc){
				if(!oDoc.documentElement||oDoc.documentElement.tagName=="parsererror")
					oDoc.parseError=-1;
				Sarissa.__setReadyState__(oDoc,4);
			};
			_sarissa_XMLDocument_onload=function(){
				Sarissa.__handleLoad__(this);
			};
			Sarissa.__setReadyState__=function(oDoc,iReadyState){
				oDoc.readyState=iReadyState;
				if(oDoc.onreadystatechange!=null&&typeof oDoc.onreadystatechange=="function")
					oDoc.onreadystatechange();
				};
			Sarissa.getDomDocument=function(sUri,sName){
				var oDoc=document.implementation.createDocument(sUri?sUri:"",sName?sName:"",null);
				oDoc.addEventListener("load",_sarissa_XMLDocument_onload,false);
				return oDoc;
			};
			if(window.XMLDocument){
				XMLDocument.prototype.onreadystatechange=null;
				XMLDocument.prototype.readyState=0;
				XMLDocument.prototype.parseError=0;
				var _SARISSA_SYNC_NON_IMPLEMENTED=false;
				XMLDocument.prototype._sarissa_load=XMLDocument.prototype.load;
				XMLDocument.prototype.load=function(sURI){
					var oDoc=document.implementation.createDocument("","",null);
					Sarissa.copyChildNodes(this,oDoc);
					this.parseError=0;
					Sarissa.__setReadyState__(this,1);
					try{
						if(this.async==false&&_SARISSA_SYNC_NON_IMPLEMENTED){
							var tmp=new XMLHttpRequest();
							tmp.open("GET",sURI,false);
							tmp.send(null);
							Sarissa.__setReadyState__(this,2);
							Sarissa.copyChildNodes(tmp.responseXML,this);
							Sarissa.__setReadyState__(this,3);
						} else {
							this._sarissa_load(sURI);
						};
					}
					catch(objException){
						this.parseError=-1;
					}
					finally{
						if(this.async==false){
							Sarissa.__handleLoad__(this);
						};
					};
					return oDoc;
				};
			} else if(document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature('LS','3.0')){
				Document.prototype.async=true;
				Document.prototype.onreadystatechange=null;
				Document.prototype.parseError=0;
				Document.prototype.load=function(sURI){
					var parser=document.implementation.createLSParser(this.async?document.implementation.MODE_ASYNCHRONOUS:document.implementation.MODE_SYNCHRONOUS,null);
					if(this.async){
						var self=this;
						parser.addEventListener("load",function(e){
							self.readyState=4;
							Sarissa.copyChildNodes(e.newDocument,self.documentElement,false);
							self.onreadystatechange.call();
						},false);
					};
					try{
						var oDoc=parser.parseURI(sURI);
					}
					catch(e){
						this.parseError=-1;
					};
					if(!this.async)
						Sarissa.copyChildNodes(oDoc,this.documentElement,false);
						return oDoc;
				};
				Sarissa.getDomDocument=function(sUri,sName){
					return document.implementation.createDocument(sUri?sUri:"",sName?sName:"",null);
				};
			};
		};
	};
	if(!window.DOMParser){
		DOMParser=function(){};
		if(_SARISSA_IS_SAFARI){
			DOMParser.prototype.parseFromString=function(sXml,contentType){
				if(contentType.toLowerCase()!="application/xml"){
					throw"Cannot handle content type: \""+contentType+"\"";
				};
				var xmlhttp=new XMLHttpRequest();
				xmlhttp.open("GET","data:text/xml;charset=utf-8,"+encodeURIComponent(str),false);
				xmlhttp.send(null);
				return xmlhttp.responseXML;
			};
		} else if(Sarissa.getDomDocument&&Sarissa.getDomDocument()&&"loadXML"in Sarissa.getDomDocument()){
			DOMParser.prototype.parseFromString=function(sXml,contentType){
				var doc=Sarissa.getDomDocument();
				doc.loadXML(sXml);
				return doc;
			};
		};
	};
	if(window.XMLHttpRequest){
		Sarissa.IS_ENABLED_XMLHTTP=true;
	} else if(_SARISSA_IS_IE) {
		XMLHttpRequest=function(){
			return new ActiveXObject(_SARISSA_XMLHTTP_PROGID);
		};
		Sarissa.IS_ENABLED_XMLHTTP=true;
	};
	if(!window.document.importNode&&_SARISSA_IS_IE) {
		try{
			window.document.importNode=function(oNode,bChildren){
				var importNode=document.createElement("div");
				if(bChildren)
					importNode.innerHTML=Sarissa.serialize(oNode);
				else
					importNode.innerHTML=Sarissa.serialize(oNode.cloneNode(false));
				return importNode.firstChild;
			};
		}
		catch(e){};
	};
	if(!Sarissa.getParseErrorText){
		Sarissa.getParseErrorText=function(oDoc){
			var parseErrorText=Sarissa.PARSED_OK;
			if(oDoc&&oDoc.parseError&&oDoc.parseError!=0){
				if(oDoc.documentElement.tagName=="parsererror"){
					parseErrorText=oDoc.documentElement.firstChild.data;
					parseErrorText+="\n"+oDoc.documentElement.firstChild.nextSibling.firstChild.data;
				}else{
					parseErrorText=Sarissa.getText(oDoc.documentElement);
				};
			};
			return parseErrorText;
		};
	};
	Sarissa.getText=function(oNode,deep){
		var s="";
		var nodes=oNode.childNodes;
		for(var i=0;i<nodes.length;i++){
			var node=nodes[i];
			var nodeType=node.nodeType;
			if(nodeType==Node.TEXT_NODE||nodeType==Node.CDATA_SECTION_NODE){
				s+=node.data;
			}else if(deep==true&&(nodeType==Node.ELEMENT_NODE||nodeType==Node.DOCUMENT_NODE||nodeType==Node.DOCUMENT_FRAGMENT_NODE)){
				s+=Sarissa.getText(node,true);
			};
		};
		return s;
	};
	if(window.XMLSerializer){
		Sarissa.serialize=function(oDoc){
			var s=null;
			if(oDoc){
				s=oDoc.innerHTML ? oDoc.innerHTML : (new XMLSerializer()).serializeToString(oDoc);
			};
			return s;
		};
	} else {
		if(Sarissa.getDomDocument&&(Sarissa.getDomDocument("","foo",null)).xml) {
			Sarissa.serialize=function(oDoc){
				var s=null;
				if(oDoc){
					s=oDoc.innerHTML ? oDoc.innerHTML : oDoc.xml;
				};
				return s;
			};
			XMLSerializer=function(){};
			XMLSerializer.prototype.serializeToString=function(oNode){
				return oNode.xml;
			};
		};
	};
	Sarissa.stripTags=function(s){
		return s.replace(/<[^>]+>/g,"");
	};
	Sarissa.clearChildNodes=function(oNode){
		while(oNode.firstChild){
			oNode.removeChild(oNode.firstChild);
		};
	};
	Sarissa.copyChildNodes=function(nodeFrom,nodeTo,bPreserveExisting){
		if((!nodeFrom)||(!nodeTo)){
			throw"Both source and destination nodes must be provided";
		};
		if(!bPreserveExisting){
			Sarissa.clearChildNodes(nodeTo);
		};
		var ownerDoc=nodeTo.nodeType==Node.DOCUMENT_NODE ? nodeTo : nodeTo.ownerDocument;
		var nodes=nodeFrom.childNodes;
		if(ownerDoc.importNode&&(!_SARISSA_IS_IE)){
			for(var i=0;i<nodes.length;i++){
				nodeTo.appendChild(ownerDoc.importNode(nodes[i],true));
			};
		}else{
			for(var i=0;i<nodes.length;i++){
				nodeTo.appendChild(nodes[i].cloneNode(true));
			};
		};
	};
	Sarissa.moveChildNodes=function(nodeFrom,nodeTo,bPreserveExisting){
		if((!nodeFrom)||(!nodeTo)){
			throw"Both source and destination nodes must be provided";
		};
		if(!bPreserveExisting){
			Sarissa.clearChildNodes(nodeTo);
		};
		var nodes=nodeFrom.childNodes;
		if(nodeFrom.ownerDocument==nodeTo.ownerDocument){
			while(nodeFrom.firstChild){
				nodeTo.appendChild(nodeFrom.firstChild);
			};
		}else{
			var ownerDoc=nodeTo.nodeType==Node.DOCUMENT_NODE ? nodeTo:nodeTo.ownerDocument;
			if(ownerDoc.importNode&&(!_SARISSA_IS_IE)){
				for(var i=0;i<nodes.length;i++){
					nodeTo.appendChild(ownerDoc.importNode(nodes[i],true));
				};
			}else{
				for(var i=0;i<nodes.length;i++){
					nodeTo.appendChild(nodes[i].cloneNode(true));
				};
			};
			Sarissa.clearChildNodes(nodeFrom);
		};
	};
	Sarissa.xmlize=function(anyObject,objectName,indentSpace){
		indentSpace=indentSpace ? indentSpace : '';
		var s=indentSpace+'<'+objectName+'>';
		var isLeaf=false;
		if(!(anyObject instanceof Object)||anyObject instanceof Number
											||anyObject instanceof String||anyObject instanceof Boolean
											||anyObject instanceof Date){
			s+=Sarissa.escape(""+anyObject);
			isLeaf=true;
		}else{
			s+="\n";
			var itemKey='';
			var isArrayItem=anyObject instanceof Array;
			for(var name in anyObject){
				s+=Sarissa.xmlize(anyObject[name],(isArrayItem?"array-item key=\""+name+"\"":name),indentSpace+"   ");
			};
			s+=indentSpace;
		};
		return s+=(objectName.indexOf(' ')!=-1?"</array-item>\n":"</"+objectName+">\n");
	};
	Sarissa.escape=function(sXml){
		return sXml.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;");
	};
	Sarissa.unescape=function(sXml){
		return sXml.replace(/&apos;/g,"'").replace(/&quot;/g,"\"").replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&amp;/g,"&");
	};

var xOp7Up,xOp6Dn,xIE4Up,xIE4,xIE5,xNN4,xUA=navigator.userAgent.toLowerCase();
if(window.opera){
	var i=xUA.indexOf('opera');
	if(i!=-1){
		var v=parseInt(xUA.charAt(i+6));
		xOp7Up=v>=7;
		xOp6Dn=v<7;
	}
}else if(navigator.vendor!='KDE'&&document.all&&xUA.indexOf('msie')!=-1){
	xIE4Up=parseFloat(navigator.appVersion)>=4;
	xIE4=xUA.indexOf('msie 4')!=-1;
	xIE5=xUA.indexOf('msie 5')!=-1;
}else if(document.layers){
	xNN4=true;
}
xMac=xUA.indexOf('mac')!=-1;

function xBackground(e,c,i){
	if(!(e=xGetElementById(e)))
		return'';
	var bg='';
	if(e.style){
		if(xStr(c)){
			if(!xOp6Dn)
				e.style.backgroundColor=c;
			else e.style.background=c;
		}
		if(xStr(i))e.style.backgroundImage=(i!='') ? 'url('+i+')' : null;
		if(!xOp6Dn)
			bg=e.style.backgroundColor;
		else
			bg=e.style.background;
		}
		return bg;
}

function xClientHeight(){var h=0;if(xOp6Dn)h=window.innerHeight;else if(document.compatMode=='CSS1Compat'&&!window.opera&&document.documentElement&&document.documentElement.clientHeight)h=document.documentElement.clientHeight;else if(document.body&&document.body.clientHeight)h=document.body.clientHeight;if(xDef(window.innerWidth,window.innerHeight,document.width)){h=window.innerHeight;if(document.width>window.innerWidth)h-=16;} return h;}
function xClientWidth(){
	var w=0;
	if(xOp6Dn) {
		w=window.innerWidth;
	} else if(document.compatMode=='CSS1Compat'&&!window.opera&&document.documentElement&&document.documentElement.clientWidth) {
		w=document.documentElement.clientWidth//FF;
		
	} else if(document.body&&document.body.clientWidth) {
		w=document.body.clientWidth;//IE
	}
	if(xDef(window.innerWidth,window.innerHeight,document.height)) {
		w=window.innerWidth;
		if(document.height>window.innerHeight)
			w-=16;
	}
	return w;
}
function xClip(e,t,r,b,l){if(!(e=xGetElementById(e)))return;if(e.style){if(xNum(l))e.style.clip='rect('+t+'px '+r+'px '+b+'px '+l+'px)';else e.style.clip='rect(0 '+parseInt(e.style.width)+'px '+parseInt(e.style.height)+'px 0)';}}
function xColor(e,s){if(!(e=xGetElementById(e)))return'';var c='';if(e.style&&xDef(e.style.color)){if(xStr(s))e.style.color=s;c=e.style.color;}return c;}
function xDef(){for(var i=0;i<arguments.length;++i){if(typeof(arguments[i])=='undefined')return false;}return true;}
function xDisplay(e,s){if(!(e=xGetElementById(e)))return null;if(e.style&&xDef(e.style.display)){if(xStr(s))e.style.display=s;return e.style.display;}return null;}
function xGetComputedStyle(oEle,sProp,bInt){var s,p='undefined';var dv=document.defaultView;if(dv&&dv.getComputedStyle){s=dv.getComputedStyle(oEle,'');if(s)p=s.getPropertyValue(sProp);}else if(oEle.currentStyle){var a=sProp.split('-');sProp=a[0];for(var i=1;i<a.length;++i){c=a[i].charAt(0);sProp+=a[i].replace(c,c.toUpperCase());}p=oEle.currentStyle[sProp];}else return null;return bInt?(parseInt(p)||0):p;}
function xGetElementById(e){if(typeof(e)!='string')return e;if(document.getElementById)e=document.getElementById(e);else if(document.all)e=document.all[e];else e=null;return e;}
function xHasPoint(e,x,y,t,r,b,l){if(!xNum(t)){t=r=b=l=0;}else if(!xNum(r)){r=b=l=t;}else if(!xNum(b)){l=r;b=t;}var eX=xPageX(e),eY=xPageY(e);return(x>=eX+l&&x<=eX+xWidth(e)-r&&y>=eY+t&&y<=eY+xHeight(e)-b);}
function xHeight(e,h){if(!(e=xGetElementById(e)))return 0;if(xNum(h)){if(h<0)h=0;else h=Math.round(h);}else h=-1;var css=xDef(e.style);if(e==document||e.tagName.toLowerCase()=='html'||e.tagName.toLowerCase()=='body'){h=xClientHeight();}else if(css&&xDef(e.offsetHeight)&&xStr(e.style.height)){if(h>=0){var pt=0,pb=0,bt=0,bb=0;if(document.compatMode=='CSS1Compat'){var gcs=xGetComputedStyle;pt=gcs(e,'padding-top',1);if(pt!==null){pb=gcs(e,'padding-bottom',1);bt=gcs(e,'border-top-width',1);bb=gcs(e,'border-bottom-width',1);}else if(xDef(e.offsetHeight,e.style.height)){e.style.height=h+'px';pt=e.offsetHeight-h;}}h-=(pt+pb+bt+bb);if(isNaN(h)||h<0)return;else e.style.height=h+'px';}h=e.offsetHeight;}else if(css&&xDef(e.style.pixelHeight)){if(h>=0)e.style.pixelHeight=h;h=e.style.pixelHeight;}return h;}

function xLeft(e,iX){
	if(!(e=xGetElementById(e)))
		return 0;
	var css=xDef(e.style);
	if(css&&xStr(e.style.left)){
		if(xNum(iX))
			e.style.left=iX+'px';
		else{
			iX=parseInt(e.style.left);
			if(isNaN(iX))
			iX=0;
		}
	}else if(css&&xDef(e.style.pixelLeft)){
		if(xNum(iX))
			e.style.pixelLeft=iX;
		else
			iX=e.style.pixelLeft;
	}
	return iX;
}
function xMoveTo(e,x,y){xLeft(e,x);xTop(e,y);}
function xNum(){
	for(var i=0;i<arguments.length;++i){
		if(isNaN(arguments[i])||typeof(arguments[i])!='number')
			return false;
		}
		return true;
}
function xOffsetLeft(e){if(!(e=xGetElementById(e)))return 0;if(xDef(e.offsetLeft))return e.offsetLeft;else return 0;}
function xOffsetTop(e){if(!(e=xGetElementById(e)))return 0;if(xDef(e.offsetTop))return e.offsetTop;else return 0;}
function xPageX(e){if(!(e=xGetElementById(e)))return 0;var x=0;while(e){if(xDef(e.offsetLeft))x+=e.offsetLeft;e=xDef(e.offsetParent)?e.offsetParent:null;}return x;}
function xPageY(e){if(!(e=xGetElementById(e)))return 0;var y=0;while(e){if(xDef(e.offsetTop))y+=e.offsetTop;e=xDef(e.offsetParent)?e.offsetParent:null;}return y;}
function xParent(e,bNode){if(!(e=xGetElementById(e)))return null;var p=null;if(!bNode&&xDef(e.offsetParent))p=e.offsetParent;else if(xDef(e.parentNode))p=e.parentNode;else if(xDef(e.parentElement))p=e.parentElement;return p;}
function xResizeTo(e,w,h){xWidth(e,w);xHeight(e,h);}
function xScrollLeft(e,bWin){var offset=0;if(!xDef(e)||bWin||e==document||e.tagName.toLowerCase()=='html'||e.tagName.toLowerCase()=='body'){var w=window;if(bWin&&e)w=e;if(w.document.documentElement&&w.document.documentElement.scrollLeft)offset=w.document.documentElement.scrollLeft;else if(w.document.body&&xDef(w.document.body.scrollLeft))offset=w.document.body.scrollLeft;}else{e=xGetElementById(e);if(e&&xNum(e.scrollLeft))offset=e.scrollLeft;}return offset;}
function xScrollTop(e,bWin){var offset=0;if(!xDef(e)||bWin||e==document||e.tagName.toLowerCase()=='html'||e.tagName.toLowerCase()=='body'){var w=window;if(bWin&&e)w=e;if(w.document.documentElement&&w.document.documentElement.scrollTop)offset=w.document.documentElement.scrollTop;else if(w.document.body&&xDef(w.document.body.scrollTop))offset=w.document.body.scrollTop;}else{e=xGetElementById(e);if(e&&xNum(e.scrollTop))offset=e.scrollTop;}return offset;}
function xShow(e){return xVisibility(e,1);}
function xHide(e){return xVisibility(e,0);}
function xStr(s){for(var i=0;i<arguments.length;++i){if(typeof(arguments[i])!='string')return false;}return true;}
function xTop(e,iY){
	if(!(e=xGetElementById(e)))
		return 0;
	var css=xDef(e.style);
	if(css&&xStr(e.style.top)){
		if(xNum(iY))
			e.style.top=iY+'px';
		else {
			iY=parseInt(e.style.top);
		if(isNaN(iY))iY=0;}
	}else if(css&&xDef(e.style.pixelTop)){
		if(xNum(iY))
			e.style.pixelTop=iY;
		else
			iY=e.style.pixelTop;
		}return iY;
}
function xVisibility(e,bShow){
	if(!(e=xGetElementById(e)))return null;
	if(e.style&&xDef(e.style.visibility)){
		if(xDef(bShow))e.style.visibility=bShow?'visible':'hidden';
		return e.style.visibility;}
	return null;}
function xWidth(e,w){
	if(!(e=xGetElementById(e)))
		return 0;
	if(xNum(w)){
		if(w<0)
			w=0;
		else
			w=Math.round(w);
	}else
		w=-1;
	var css=xDef(e.style);
	if(e==document || e.tagName.toLowerCase()=='html' || e.tagName.toLowerCase()=='body'){//if elment is body
		w=xClientWidth();
	}else if(css&&xDef(e.offsetWidth)&&xStr(e.style.width)){
		if(w>=0){
			var pl=0,pr=0,bl=0,br=0;
			if(document.compatMode=='CSS1Compat'){
				var gcs=xGetComputedStyle;
				pl=gcs(e,'padding-left',1);
				if(pl!==null){
					pr=gcs(e,'padding-right',1);
					bl=gcs(e,'border-left-width',1);
					br=gcs(e,'border-right-width',1);}
					else if(xDef(e.offsetWidth,e.style.width)){
						e.style.width=w+'px';
						pl=e.offsetWidth-w;
					}
				}
				w-=(pl+pr+bl+br);
				if(isNaN(w)||w<0) {
					return;
				} else
					e.style.width=w+'px';
		}
		w=e.offsetWidth;
	}else if(css&&xDef(e.style.pixelWidth)){
		if(w>=0)
			e.style.pixelWidth=w;
			w=e.style.pixelWidth;
	}
	return w;
}

function xZIndex(e,uZ){if(!(e=xGetElementById(e)))return 0;if(e.style&&xDef(e.style.zIndex)){if(xNum(uZ))e.style.zIndex=uZ;uZ=parseInt(e.style.zIndex);}return uZ;}

function xDisableDrag(id,last){
	if(!window._xDrgMgr)
		return;
	var ele=xGetElementById(id);
	ele.xDraggable=false;
	ele.xODS=null;
	ele.xOD=null;
	ele.xODE=null;
	xRemoveEventListener(ele,'mousedown',_xOMD,false);
	if(_xDrgMgr.mm&&last){
		_xDrgMgr.mm=false;
		xRemoveEventListener(document,'mousemove',_xOMM,false);}
}
var _xDrgMgr={
	ele:null,mm:false
};

function xEnableDrag(id,fS,fD,fE){

	var ele=xGetElementById(id);
//	ccc('Enable drug' + ele.xDraggable)
	if(ele.xDraggable == undefined) {
		ele.xDraggable=true;
		ele.xODS=fS;
		ele.xOD=fD;
		ele.xODE=fE;
		xAddEventListener(ele,'mousedown',_xOMD,false);
		if(!_xDrgMgr.mm){
			_xDrgMgr.mm=true;
			xAddEventListener(document,'mousemove',_xOMM,false);
		}
	}
}

function _xOMD(e){
//	ccc('Mouse Down')
	var evt=new xEvent(e);
	var ele=evt.target;
	while(ele&&!ele.xDraggable){
		ele=xParent(ele);
	}
	if(ele){
		xPreventDefault(e);
		ele.xDPX=evt.pageX;
		ele.xDPY=evt.pageY;
		_xDrgMgr.ele=ele;
//		ccc('Listen mouseup');
		xAddEventListener(document,'mouseup',_xOMU,false);
		if(ele.xODS){
			ele.xODS(ele,evt.pageX,evt.pageY);
		}
	}
}
function _xOMM(e){
	var evt=new xEvent(e);
	if(_xDrgMgr.ele){
		xPreventDefault(e);
		var ele=_xDrgMgr.ele;
		var dx=evt.pageX-ele.xDPX;
		var dy=evt.pageY-ele.xDPY;
		ele.xDPX=evt.pageX;
		ele.xDPY=evt.pageY;
		if(ele.xOD){
			ele.xOD(ele,dx,dy);
		}else{
			xMoveTo(ele,xLeft(ele)+dx,xTop(ele)+dy);
		}
	}
}
function _xOMU(e){
//	ccc('Mouse Up' +  _xDrgMgr)
	if(_xDrgMgr.ele){
		xPreventDefault(e);
		xRemoveEventListener(document,'mouseup',_xOMU,false);
		if(_xDrgMgr.ele.xODE){
			var evt=new xEvent(e);
			_xDrgMgr.ele.xODE(_xDrgMgr.ele,evt.pageX,evt.pageY);
		}
		_xDrgMgr.ele=null;
	}
}

function xDeleteCookie(name,path){if(xGetCookie(name)){document.cookie=name+"="+"; path="+((!path)?"/":path)+"; expires="+new Date(0).toGMTString();}}
function xGetCookie(name){var value=null,search=name+"=";if(document.cookie.length>0){var offset=document.cookie.indexOf(search);if(offset!=-1){offset+=search.length;var end=document.cookie.indexOf(";",offset);if(end==-1)end=document.cookie.length;value=unescape(document.cookie.substring(offset,end));}}return value;}
function xSetCookie(name,value,expire,path){document.cookie=name+"="+escape(value)+((!expire)?"":("; expires="+expire.toGMTString()))+"; path="+((!path)?"/":path);}

function xAddEventListener(e,eT,eL,cap){
	if(!(e=xGetElementById(e)))return;
		eT=eT.toLowerCase();
		if((!xIE4Up&&!xOp7Up)&&e==window){
			if(eT=='resize'){
				window.xPCW=xClientWidth();
				window.xPCH=xClientHeight();
				window.xREL=eL;xResizeEvent();
				return;
			}
			if(eT=='scroll'){
				window.xPSL=xScrollLeft();
				window.xPST=xScrollTop();
				window.xSEL=eL;
				xScrollEvent();
				return;
			}
		}
		var eh='e.on'+eT+'=eL';
		if(e.addEventListener)
			e.addEventListener(eT,eL,cap);
		else if(e.attachEvent)
			e.attachEvent('on'+eT,eL);
		else eval(eh);
}
function xResizeEvent(){if(window.xREL)setTimeout('xResizeEvent()',250);var cw=xClientWidth(),ch=xClientHeight();if(window.xPCW!=cw||window.xPCH!=ch){window.xPCW=cw;window.xPCH=ch;if(window.xREL)window.xREL();}}
function xScrollEvent(){if(window.xSEL)setTimeout('xScrollEvent()',250);var sl=xScrollLeft(),st=xScrollTop();if(window.xPSL!=sl||window.xPST!=st){window.xPSL=sl;window.xPST=st;if(window.xSEL)window.xSEL();}}
function xEvent(evt){var e=evt||window.event;if(!e)return;if(e.type)this.type=e.type;if(e.target)this.target=e.target;else if(e.srcElement)this.target=e.srcElement;if(e.relatedTarget)this.relatedTarget=e.relatedTarget;else if(e.type=='mouseover'&&e.fromElement)this.relatedTarget=e.fromElement;else if(e.type=='mouseout')this.relatedTarget=e.toElement;if(xOp6Dn){this.pageX=e.clientX;this.pageY=e.clientY;}else if(xDef(e.pageX,e.pageY)){this.pageX=e.pageX;this.pageY=e.pageY;}else if(xDef(e.clientX,e.clientY)){this.pageX=e.clientX+xScrollLeft();this.pageY=e.clientY+xScrollTop();}if(xDef(e.offsetX,e.offsetY)){this.offsetX=e.offsetX;this.offsetY=e.offsetY;}else if(xDef(e.layerX,e.layerY)){this.offsetX=e.layerX;this.offsetY=e.layerY;}else{this.offsetX=this.pageX-xPageX(this.target);this.offsetY=this.pageY-xPageY(this.target);}if(e.keyCode){this.keyCode=e.keyCode;}else if(xDef(e.which)&&e.type.indexOf('key')!=-1){this.keyCode=e.which;}this.shiftKey=e.shiftKey;this.ctrlKey=e.ctrlKey;this.altKey=e.altKey;}
function xPreventDefault(e){if(e&&e.preventDefault)e.preventDefault();else if(window.event)window.event.returnValue=false;}
function xRemoveEventListener(e,eT,eL,cap){if(!(e=xGetElementById(e)))return;eT=eT.toLowerCase();if((!xIE4Up&&!xOp7Up)&&e==window){if(eT=='resize'){window.xREL=null;return;}if(eT=='scroll'){window.xSEL=null;return;}}var eh='e.on'+eT+'=null';if(e.removeEventListener)e.removeEventListener(eT,eL,cap);else if(e.detachEvent)e.detachEvent('on'+eT,eL);else eval(eh);}
function xStopPropagation(evt){if(evt&&evt.stopPropagation)evt.stopPropagation();else if(window.event)window.event.cancelBubble=true;}

function purge(d) {
	var a=d.attributes,i,l,n;
	if(a){
		l=a.length;
		for(i=0;i<l;i+=1){
			n=a[i].name;
			if(typeof d[n]==='function'){
				d[n]=null;
			}
		}
	}
	a=d.childNodes;
	if(a){
		l=a.length;
		for(i=0;i<l;i+=1){
			purge(d.childNodes[i]);
		}
	}
}

function inArray(value, arr) {
	if(arr && value) {
		
		for(var i in arr) {
			if(arr[i] == value) {
				return true;
			}
		}
	}
	return false;
}
