
var anet=new function(){};anet.Event=function(evt){if(window.event){this._evt=window.event;this._src=window.event.fromElement;this._dst=window.event.toElement;this._x=window.event.x;this._y=window.event.y;}else if(evt){this._evt=evt;this._src=evt.target;this._dst=evt.relatedTarget;this._x=evt.pageX;this._y=evt.pageY;}}
anet.Event.prototype={exitedFromElement:function(element){if(!this._src||!this._dst)
return(false);var fromNode=this._src;var toNode=this._dst;for(;fromNode;fromNode=fromNode.parentNode)
if(fromNode==element)
break;if(!fromNode)
return(false);for(;toNode;toNode=toNode.parentNode){if(toNode==fromNode)
return(false);}
return(true);},getSource:function(){return(this._src);},getDestination:function(){return(this._dst);},consume:function(){if(!this._evt)
return;if(this._evt.stopPropagation){this._evt.stopPropagation();this._evt.preventDefault();}
try{this._evt.cancelBubble=true;this._evt.returnValue=false;}catch(e){}},toString:function(){return("Evt [ x = "+this._x+", y = "+this._y+" ]");},getX:function(){return(this._x);},getY:function(){return(this._y);},getButton:function(){if(!this._evt)
return(null);if(this._evt.button)
return(this._evt.button);return(this._evt.which);}};anet.array=new function(){this.remove=function(list,element){var result=false;var array=[];for(var index in list){if(list[index]==element)
result=true;else
array.push(list[index]);}
list.length=0;for(var index in array)
list.push(array[index]);array=null;return(result);};};anet.dom=new function(){this.isElementNode=function(node){if(!node)
return(-1);return(node.nodeType==1);};this.show=function(node){if(node){node.style.visibility="visible";node.style.display="";}};this.hide=function(node){if(node){node.style.visibility="hidden";node.style.display="none";}};this.isShowing=function(node){if(!node)
return(false);return(node.style.display.toLowerCase()!="none");};this.addEventListener=function(target,type,func,bubbles){if(!target)
return;if(document.addEventListener)
target.addEventListener(type,func,bubbles);else if(document.attachEvent)
target.attachEvent("on"+type,func,bubbles);else
target["on"+type]=func;};this.removeEventListener=function(target,type,func,bubbles){if(!target)
return;if(document.removeEventListener)
target.removeEventListener(type,func,bubbles);else if(document.detachEvent)
target.detachEvent("on"+type,func,bubbles);else
target["on"+type]=null;};this.setOpacity=function(node,val){if(!node)
return;if(node.filters){try{node.filters["alpha"].opacity=val*100;}catch(e){}}else if(node.style.opacity){node.style.opacity=val;}};this.getX=function(node){if(!node)
return(0);return(parseInt(node.style.left));};this.getY=function(node){if(!node)
return(0);return(parseInt(node.style.top));};this.getWidth=function(node){if(!node)
return(0);return(parseInt(node.style.width));};this.getHeight=function(node){if(!node)
return(0);return(parseInt(node.style.height));};this.setX=function(node,x){if(node)
node.style.left=x+"px";};this.setY=function(node,y){if(node)
node.style.top=y+"px";};this.setWidth=function(node,width){if(node)
node.style.width=width+"px";};this.setHeight=function(node,height){if(node)
node.style.height=height+"px";};};anet.ajax=new function(){this._connections=new Array();this.send=function(url,callback,data,timeout,callbackError,errorData){var param=null,requestType="POST";if(!data)
requestType="GET";else{param=encodeURIComponent(data.toJSONString());if(!param.length){requestType="GET";param=null;}}
var index=this._createConnection();this._connections[index].handler=callback;this._connections[index].errorHandler=callbackError;this._connections[index].errorData=errorData;this._connections[index].http.open(requestType,url,true);if(requestType=="POST"){this._connections[index].http.setRequestHeader("Content-length",param.length);this._connections[index].http.setRequestHeader("Connection","close");this._connections[index].http.setRequestHeader("Connection","close");}
if(timeout)
this._connections[index].timer=setTimeout(function(){anet.ajax._abortConnection(index);},timeout*1000);this._connections[index].http.onreadystatechange=function(){var http=anet.ajax._connections[index].http;if(http.readyState!=4)
return;if(anet.ajax._connections[index].timer)
clearTimeout(anet.ajax._connections[index].timer);if(http.status!=200)
return;if(anet.ajax._connections[index].handler){var json=http.responseText.parseJSON();anet.ajax._connections[index].handler(json);}
anet.ajax._deleteConnection(index);};this._connections[index].http.send(param);}
this._createXMLHttpRequest=function(){try{return new ActiveXObject("Msxml2.XMLHTTP");}catch(e){}
try{return new ActiveXObject("Microsoft.XMLHTTP");}catch(e){}
try{return new XMLHttpRequest();}catch(e){}
alert("XMLHttpRequest not supported");};this._createConnection=function(){var http=this._createXMLHttpRequest();var connection={http:http,timer:null,handler:null,errorHandler:null,errorData:null,rpc:null,data:null,callbackData:null};var index=this._connections.push(connection);return(index-1);};this._abortConnection=function(index){this._connections[index].http.abort();this._connections[index].timer=null;if(this._connections[index].errorHandler)
this._connections[index].errorHandler(this._connections[index].errorData);this._deleteConnection(index);};this._deleteConnection=function(index){this._connections[index]=null;};};(function(){var m={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},s={array:function(x){var b=false,f,v,n=0,hash=false;for(var i in x){v=x[i];f=s[typeof v];if(f&&i!=n){hash=true;break;}
n++;}
var a=hash?["{"]:["["];for(var i in x){v=x[i];f=s[typeof v];if(f){v=f(v);if(typeof v=='string'){if(b)
a.push(",");if(hash)
a.push(s.string(i),":",v);else
a.push(v);b=true;}}}
a.push(hash?"}":"]");return(a.join(""));},'boolean':function(x){return String(x);},'null':function(x){return"null";},number:function(x){return isFinite(x)?String(x):"null";},object:function(x){if(x){if(x instanceof Array){return s.array(x);}
var a=["{"],b,f,i,v;for(i in x){v=x[i];f=s[typeof v];if(f){v=f(v);if(typeof v=="string"){if(b){a.push(",");}
a.push(s.string(i),":",v);b=true;}}}
a.push("}");return(a.join(""));}
return'null';},string:function(x){if(/["\\\x00-\x1f]/.test(x)){x=x.replace(/([\x00-\x1f\\"])/g,function(a,b){var c=m[b];if(c)
return c;c=b.charCodeAt();return'\\u00'+
Math.floor(c/16).toString(16)+
(c%16).toString(16);});}
return('"'+x+'"');}};Object.prototype.toJSONString=function(){return s.object(this);};Array.prototype.toJSONString=function(){return s.array(this);};})();String.prototype.parseJSON=function(){try{return!(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(this.replace(/"(\\.|[^"\\])*"/g,'')))&&eval("("+this+")");}catch(e){return(false);}};anet.Rpc=function(url,distantObjectName,callbackObjectName){this._url=url;this._distantObjectName=distantObjectName;this._callbackObjectName=(callbackObjectName&&callbackObjectName.length)?callbackObjectName:distantObjectName;this._timeout=null;this._staticSession=null;this._dynamicSession=null;this._startCommunicationCallback=null;this._stopCommunicationCallback=null;};anet.Rpc.prototype={setTimeout:function(timeout){this._timeout=timeout;},setStaticSession:function(staticSession){this._staticSession=staticSession;},setDynamicSession:function(dynamicSession){this._dynamicSession=dynamicSession;},setCommunicationCallbacks:function(startHdlr,stopHdlr){this._startCommunicationCallback=startHdlr;this._stopCommunicationCallback=stopHdlr;},call:function(method,serverParams,clientData){var data={object:this._distantObjectName,method:method,session:(this._dynamicSession&&this._dynamicSession.length)?eval(this._dynamicSession.toString()):this._staticSession.toString(),params:serverParams};requestData=encodeURIComponent(data.toJSONString());var index=anet.ajax._createConnection();anet.ajax._connections[index].rpc=this;anet.ajax._connections[index].handler=method;anet.ajax._connections[index].data=clientData;anet.ajax._connections[index].http.open("POST",this._url,true);anet.ajax._connections[index].http.setRequestHeader("Content-length",requestData.length);anet.ajax._connections[index].http.setRequestHeader("Connection","close");if(this._timeout)
anet.ajax._connections[index].timer=setTimeout(function(){anet.ajax._abortConnection(index);},this._timeout*1000);anet.ajax._connections[index].http.onreadystatechange=function(){var http=anet.ajax._connections[index].http;if(http.readyState!=4)
return;if(anet.ajax._connections[index].timer)
clearTimeout(anet.ajax._connections[index].timer);if(anet.ajax._connections[index].rpc._callbackObjectName){var json=http.responseText.parseJSON();var callbackData={HTTP:http.status,method:anet.ajax._connections[index].handler,data:anet.ajax._connections[index].data,error:json.error,response:json.response};anet.ajax._connections[index].callbackData=callbackData;if(http.status==200&&!json.error){eval(anet.ajax._connections[index].rpc._callbackObjectName+"."+
anet.ajax._connections[index].handler+"Response"+"(anet.ajax._connections["+index+"].callbackData)");}else if(eval(anet.ajax._connections[index].rpc._callbackObjectName+".error")){eval(anet.ajax._connections[index].rpc._callbackObjectName+".error(anet.ajax._connections["+index+"].callbackData)");}}
anet.ajax._deleteConnection(index);};anet.ajax._connections[index].http.send(requestData);}};String.prototype.escapeHTML=function(){return(this.split("&").join("&amp;").split("<").join("&lt;").split(">").join("&gt;"));};String.prototype.escapeHTMLParam=function(){return(this.split("&").join("&amp;").split("<").join("&lt;").split(">").join("&gt;").split("\"").join("&quot;").split("'").join("&apos;"));};
