// "(c) 2010 Geoin Firenze"

function TabulaJs(){};TabulaJs.ROAD=1;TabulaJs.SATELLITE=2;TabulaJs.HYBRID=3;TabulaJs.TERRAIN=4;TabulaJs.ANAGLYPH=5;function browser_info(){};browser_info._init_vars=function(){if((!window.navigator.userAgent)&&(!window.navigator.appName))
throw new Error("Unknown Browser !");var agent=window.navigator.userAgent.toUpperCase();var name=window.navigator.appName.toUpperCase();browser_info._var_loaded=true;browser_info._is_gecko=false;browser_info._is_mozilla=false;browser_info._is_netscape=false;browser_info._is_opera=false;browser_info._is_safari=false;browser_info._is_ie=false;browser_info._is_chrome=false;if(agent.indexOf("CHROME/")!=-1){browser_info._is_chrome=true;return;}
if(agent.indexOf("OPERA/")!=-1){browser_info._is_opera=true;return;}
if(agent.indexOf("SAFARI")!=-1){browser_info._is_safari=true;return;}
if((agent.indexOf("NETSCAPE/")!=-1)||(agent.indexOf("NAVIGATOR/")!=-1)){browser_info._is_gecko=true;browser_info._is_netscape=true;return;}
if(agent.indexOf("FIREFOX/")!=-1){browser_info._is_gecko=true;browser_info._is_firefox=true;return;}
if(name.indexOf("MICROSOFT")!=-1){browser_info._is_ie=true;return;}
if(agent.indexOf("MOZILLA/")!=-1){browser_info._is_mozilla=true;browser_info._is_gecko=true;return;}};browser_info.support_png=function(){var ver_0=new version();ver_0.init("5.5");var ver_1=new version();ver_1.init("7.0");var ver=browser_info.get_version();if((browser_info.is_internet_explorer())&&(ver.is_greather(ver_0))&&(ver.is_younger(ver_1)))
return false;return true;};browser_info.get_version=function(){if(browser_info._version)
return browser_info._version;var ver_str="";if(browser_info.is_internet_explorer()){var params=navigator.appVersion.split("MSIE ");params=params[1].split("; ");ver_str=params[0];}
if(browser_info.is_chrome()){var params=navigator.userAgent.split("Chrome/");params=params[1].split(" ");browser_info._version=params[0];return browser_info._version;}
if(browser_info.is_safari()){var params=navigator.userAgent.split("Safari/");params=params[0].split("Version/");params=params[1].split(" ");browser_info._version=params[0];return browser_info._version;}
if(browser_info.is_gecko()){var params=navigator.userAgent.split("Navigator/");if(params.length>1){params=params[1].split(" ");ver_str=params[0];}else{params=navigator.userAgent.split("Netscape/");if(params.length>1){params=params[1].split(" ");ver_str=params[0];}else{params=navigator.userAgent.split("Firefox/");if(params.length>1){params=params[1].split(" ");ver_str=params[0];}else{params=navigator.userAgent.split("Mozilla/");if(params.length>1){params=params[1].split(" ");ver_str=params[0];}}}}}
if(browser_info.is_opera())
ver_str=parseFloat(navigator.appVersion.toString());if(ver_str!=""){browser_info._version=new version();browser_info._version.init(ver_str);return browser_info._version;}else
throw Error("Unsupported Browser");};browser_info.is_internet_explorer=function(){if(!browser_info._var_loaded)
browser_info._init_vars();return browser_info._is_ie;};browser_info.is_gecko=function(){if(!browser_info._var_loaded)
browser_info._init_vars();return browser_info._is_gecko;};browser_info.is_mozilla=function(){if(!browser_info._var_loaded)
browser_info._init_vars();return browser_info._is_mozilla;};browser_info.is_firefox=function(){if(!browser_info._var_loaded)
browser_info._init_vars();return browser_info._is_firefox;};browser_info.is_netscape=function(){if(!browser_info._var_loaded)
browser_info._init_vars();return browser_info._is_netscape;};browser_info.is_opera=function(){if(!browser_info._var_loaded)
browser_info._init_vars();return browser_info._is_opera;};browser_info.is_safari=function(){if(!browser_info._var_loaded)
browser_info._init_vars();return browser_info._is_safari;};browser_info.is_chrome=function(){if(!browser_info._var_loaded)
browser_info._init_vars();return browser_info._is_chrome;};browser_info.language=function(){if(browser_info.is_internet_explorer())
return TabulaJs.Lang.brw2lan(window.navigator.userLanguage);if((browser_info.is_gecko())||(browser_info.is_opera())||(browser_info.is_safari())||(browser_info.is_chrome()))
return TabulaJs.Lang.brw2lan(window.navigator.language);return TabulaJs.Lang.IT;};browser_info.window_size=function(){var r=new rect(0,0,window.innerWidth,window.innerHeight,true);if(browser_info.is_internet_explorer()){r=new rect(0,0,parseFloat(document.documentElement.offsetWidth),parseFloat(document.documentElement.offsetHeight),true);var ver=browser_info.get_version();if(ver<7){var w_off=0;var h_off=4;r.width-=w_off;r.height-=h_off;}}
if(browser_info.is_opera())
r=new rect(0,0,document.body.clientWidth,Math.max(document.body.clientHeight,window.innerHeight),true);var l_space=dom_inspector.get_style_property("marginLeft",document.body)+
dom_inspector.get_style_property("borderLeftWidth",document.body)+
dom_inspector.get_style_property("paddingLeft",document.body);var r_space=dom_inspector.get_style_property("marginRight",document.body)+
dom_inspector.get_style_property("borderRightWidth",document.body)+
dom_inspector.get_style_property("paddingRight",document.body);var t_space=dom_inspector.get_style_property("marginTop",document.body)+
dom_inspector.get_style_property("borderTopWidth",document.body)+
dom_inspector.get_style_property("paddingTop",document.body);var b_space=dom_inspector.get_style_property("marginBottom",document.body)+
dom_inspector.get_style_property("borderBottomWidth",document.body)+
dom_inspector.get_style_property("paddingBottom",document.body);r.left+=l_space;r.top+=t_space;r.width-=(l_space+r_space);r.height-=(t_space+b_space);return r;};function class_manager(){}
class_manager.toggle_class_name=function(node,class_name){if(!class_name)
return false;if(class_manager.has_class_name(node,class_name)){class_manager.remove_class_name(node,class_name);return false;}else{class_manager.append_class_name(node,class_name);return true;}}
class_manager.append_class_name=function(node,class_name){if(!class_name)
return;if(!node.className)
node.className=class_name;else
if(!class_manager.has_class_name(node,class_name)){var className=node.className+" "+class_name;node.className=className.split(/\s+/).join(' ');}}
class_manager.remove_class_name=function(node,class_name){if(!class_name)
return;var className=node.className;if(className){className=className.replace(new RegExp('\\b'+class_name+'\\b'),'');className=className.replace(/\s+/g,' ');node.className=className.replace(/\s+$/g,'');}}
class_manager.has_class_name=function(node,class_name){if(!class_name)
return false;return new RegExp('\\b'+class_name+'\\b').test(node.className);}
function collection_iterator(){this._pos=-1;this._cll=null;}
new collection_iterator();collection_iterator.prototype._is_valid_idx=function(idx,cll){if((idx<0)||(idx>=cll.length))
return false;return true;}
collection_iterator.prototype.init=function(cll){var method_name="collection.prototype.init(Array)";if(!cll)
throw new Error(method_name+": Invalid instance object");this._cll=cll;}
collection_iterator.prototype.get=function(idx){var method_name="collection_iterator.prototype.get(integer)";if(!this._is_valid_idx(idx,this._cll))
throw new Error(method_name+": Index out of bounds idx="+idx+" length="+this._cll.length);return this._cll[idx];}
collection_iterator.prototype.size=function(){return(!this._cll)?0:this._cll.length;}
collection_iterator.prototype.reset=function(){this._pos=-1;}
collection_iterator.prototype.get_current=function(){return this._cll[this._pos];}
collection_iterator.prototype.move_next=function(){this._pos++;return this._is_valid_idx(this._pos,this._cll);}
function collection_inv_iterator(){this._pos=0;this._cll=null;}
new collection_inv_iterator();collection_inv_iterator.prototype._is_valid_idx=function(idx,cll){if((idx<0)||(idx>=cll.length))
return false;return true;}
collection_inv_iterator.prototype.init=function(cll){var method_name="collection_inv_iterator.prototype.init(Array)";if(!cll)
throw new Error(method_name+": Invalid instance object");this._cll=cll;this._pos=cll.length;}
collection_inv_iterator.prototype.get=function(idx){var method_name="collection_inv_iterator.prototype.get(integer)";if(!this._is_valid_idx(idx,this._cll))
throw new Error(method_name+": Index out of bounds idx="+idx+" length="+this._cll.length);return this._cll[idx];}
collection_inv_iterator.prototype.size=function(){return(!this._cll)?0:this._cll.length;}
collection_inv_iterator.prototype.reset=function(){this._pos=this._cll.length;}
collection_inv_iterator.prototype.get_current=function(){return this._cll[this._pos];}
collection_inv_iterator.prototype.move_next=function(){this._pos--;return this._is_valid_idx(this._pos,this._cll);}
function collection(cll){if(cll)
this._list=cll;else
this._list=new Array();}
new collection();collection.prototype._get_idx_from_val=function(val){for(var k=0;k<this._list.length;k++){if(this._list[k]===val)
return k;}
return-1;}
collection.prototype._is_valid_idx=function(idx){if((idx<0)||(idx>=this._list.length))
return false;return true;}
collection.prototype.toString=function(){return"collection";}
collection.prototype.isValidIdx=function(idx){return this._is_valid_idx(idx);}
collection.prototype.push=function(val){var method_name="collection.prototype.push(object)";if(!val)
throw new Error(method_name+": Invalid instance object");this._list.push(val);}
collection.prototype.add=function(val){var method_name="collection.prototype.add(object)";if(!val)
throw new Error(method_name+": Invalid instance object");this._list.unshift(val);}
collection.prototype.insert=function(val,idx){var method_name="collection.prototype.insert(object, idx)";if(!val)
throw new Error(method_name+": Invalid instance object");if((idx!==0)&&(!this._is_valid_idx(idx)))
throw new Error(method_name+": Index out of bounds");this._list.splice(idx,0,val);}
collection.prototype.update=function(val,idx){var method_name="collection.prototype.update(object, idx)";if(!val)
throw new Error(method_name+": Invalid instance object");if(!this._is_valid_idx(idx))
throw new Error(method_name+": Index out of bounds");this._list[idx]=val;}
collection.prototype.pop=function(){var ret=this._list.pop();return ret;}
collection.prototype.remove=function(val){if(!val)
return;var idx=this._get_idx_from_val(val);return this.remove_idx(idx);}
collection.prototype.remove_idx=function(idx){if(!this._is_valid_idx(idx))
return-1;this._list.splice(idx,1);return idx;}
collection.prototype.clear=function(){this._list=new Array();}
collection.prototype.get=function(idx){var method_name="collection.prototype.get";if(!this._is_valid_idx(idx,this._list))
throw new Error(method_name+": Index out of bounds");return this._list[idx];}
collection.prototype.get_count=function(){return(!this._list)?0:this._list.length;}
collection.prototype.get_idx=function(val){return this._get_idx_from_val(val)}
collection.prototype.get_iterator=function(){var it=new collection_iterator();it.init(this._list);it.reset();return it;}
collection.prototype.get_inv_iterator=function(){var it=new collection_inv_iterator();it.init(this._list);it.reset();return it;}
function dom_factory(){}
dom_factory.NAMESPACE="";dom_factory.create_element=function(tag_str){if((dom_factory.NAMESPACE!="")&&(self.document.createElementNS))
return self.document.createElementNS(dom_factory.NAMESPACE,tag_str);return self.document.createElement(tag_str);}
dom_factory.create_comment=function(content){return self.document.createComment((!content)?"":content);}
dom_factory.create_text_node=function(str){return self.document.createTextNode((!str)?"":str);}
function dom_inspector(){}
dom_inspector.get_computed_style=function(trg,param){var method_name="dom_inspector.get_computed_style(HtmlElement, String)";if(!trg){var exc=new Error("Invali instance object: HtmlElement");exc.name=method_name;throw exc;}
if(window.getComputedStyle){param=(param==null)?"":param;return window.getComputedStyle(trg,param);}
if(trg.currentStyle)
return trg.currentStyle;return trg.style;}
dom_inspector.is_child=function(child,root){if((child==null)||(root==null))
return false;var cur=child;while(cur!=root){cur=cur.parentNode;if(cur==null)
return false;}
if(cur==root)
return true;else
return false;}
dom_inspector.get_style_property=function(param,trg){var st=dom_inspector.get_computed_style(trg,null);var val=st[param];var ret=parseInt(val);if(isNaN(ret))
ret=0;return ret;}
dom_inspector.get_total_sz=function(obj){var method_name="dom_inspector.get_total_sz(HtmlElement)";if(!obj){var exc=new Error("Invali instance object: HtmlElement");exc.name=method_name;throw exc;}
return new size(obj.offsetWidth+
dom_inspector.get_style_property("marginLeft",obj)+
dom_inspector.get_style_property("marginRight",obj),obj.offsetHeight+
dom_inspector.get_style_property("marginTop",obj)+
dom_inspector.get_style_property("marginBottom",obj));}
dom_inspector.get_abs_sz=function(obj){var method_name="dom_inspector.get_abs_sz(HtmlElement)";if(!obj){var exc=new Error("Invali instance object: HtmlElement");exc.name=method_name;throw exc;}
return new size(obj.clientWidth,obj.clientHeight);}
dom_inspector.get_abs_pos=function(obj){var method_name="dom_inspector.get_abs_pos(HtmlElement)";if(!obj){var exc=new Error("Invalid instance object: HtmlElement");exc.name=method_name;throw exc;}
var curleft=0;var curtop=0;if(obj.offsetParent){curleft=obj.offsetLeft;curtop=obj.offsetTop;while(obj=obj.offsetParent){curleft+=obj.offsetLeft;curtop+=obj.offsetTop;}}
return new point(curleft,curtop);}
dom_inspector.get_abs_client_area_pos=function(obj){var method_name="dom_inspector.get_abs_client_area_pos(HtmlElement)";if(!obj){var exc=new Error("Invalid instance object: HtmlElement");exc.name=method_name;throw exc;}
var curtop=0;var curleft=0;var h_margin=0;var v_margin=0;if(obj.offsetParent){curleft=obj.offsetLeft;curtop=obj.offsetTop;h_margin=dom_inspector.get_style_property("borderLeftWidth",obj)+dom_inspector.get_style_property("paddingLeft",obj);v_margin=dom_inspector.get_style_property("borderTopWidth",obj)+dom_inspector.get_style_property("paddingTop",obj);curleft+=h_margin;curtop+=v_margin;while(obj=obj.offsetParent){curleft+=obj.offsetLeft;curtop+=obj.offsetTop;h_margin=dom_inspector.get_style_property("borderLeftWidth",obj)+dom_inspector.get_style_property("paddingLeft",obj);v_margin=dom_inspector.get_style_property("borderTopWidth",obj)+dom_inspector.get_style_property("paddingTop",obj);curleft+=h_margin;curtop+=v_margin;}}
return new point(curleft,curtop);}
dom_inspector.get_pos=function(obj){var method_name="dom_inspector.get_pos(HtmlElement)";if(!obj){var error=new Error("Invalid instance object: HtmlElement");error.name=method_name;throw error;}
var curleft=0;var curtop=0;if(obj.offsetParent){curleft=obj.offsetLeft;curtop=obj.offsetTop;}
return new point(curleft,curtop);}
dom_inspector.get_abs_bounds=function(obj){var method_name="dom_inspector.get_abs_bounds(HtmlElement)";if(!obj){var error=new Error("Invalid instance object: HtmlElement");error.name=method_name;throw error;}
var location=dom_inspector.get_abs_pos(obj);var sz=dom_inspector.get_abs_sz(obj);return new rect(location.x,location.y,sz.width,sz.height,true);}
dom_inspector.erase_tag=function(trg,destroy){for(;trg.childNodes.length>0;){var node=trg.childNodes[0];trg.removeChild(node);if(destroy)
delete node;}}
dom_inspector.clear_opacity=function(trg){var method_name="dom_inspector.clear_opacity(HtmlElement)";if(!trg)
throw new Error(method_name+" invalid html element node");if(browser_info.is_internet_explorer()){var cur_filter=trg.style.filter;var start=cur_filter.indexOf("alpha(opacity=");var end=cur_filter.indexOf(")",start+14);if(end>start){var flt=cur_filter.substr(0,start);if(end+1<cur_filter.length-1)
flt+=cur_filter.substr(end+1);trg.style.filter=(flt=="")?null:flt;}}
if(browser_info.is_opera())
trg.style.opacity="";if(browser_info.is_safari())
trg.style.opacity="";if(browser_info.is_gecko())
trg.style.opacity="";}
dom_inspector.set_opacity=function(trg,val){var method_name="dom_inspector.set_opacity(HtmlElement, double)";if(!trg)
throw new Error(method_name+" invalid html element node");val=Math.max(0,val);val=Math.min(1,val);if(browser_info.is_internet_explorer()){var cur_filter=trg.style.filter;if(cur_filter.indexOf("(opacity=")>=0){var start=cur_filter.indexOf("(opacity=")+9;var end=cur_filter.indexOf(")",start);if(end>start){var flt=cur_filter.substr(0,start);flt+=(val*100);flt+=cur_filter.substr(end);trg.style.filter=flt;}}else{trg.style.filter="alpha(opacity="+(val*100)+") "+trg.style.filter;}
return;}
trg.style.opacity=val;}
dom_inspector.getElementsByAttribute=function(parentNode,tagName,attName,attValue)
{var tags=parentNode?parentNode.getElementsByTagName(tagName):document.getElementsByTagName(tagName);;var arr=[];for(var i=0;i<tags.length;i++)
if((typeof(attValue)=="undefined"&&tags[i].hasAttribute(attName))||(tags[i].getAttribute(attName)==attValue))
arr.push(tags[i]);return arr;}
function EventManager(){this._listeners={};this._scopes={};}
EventManager.CALASS_NAME="EventManager";EventManager.prototype.toString=function(){return EventManager.CALASS_NAME;};EventManager.prototype.isEmpty=function(){for(var prp in this._listeners){return false;}
return true;}
EventManager.prototype.existListener=function(eventName){if(this._listeners[eventName]==null)
return false;return(this._listeners[eventName].get_count()>0);}
EventManager.prototype.addListener=function(eventName,callBackFunction,scope){var method_name="EventManager.prototype.addListener(eventName, callBackFunction)";if(!eventName||!callBackFunction){var exc=new Error("Invalid instance object: "+!eventName?"eventName":callBackFunction);exc.name=method_name;throw exc;}
var fctCll,scopeCll;if(!this._listeners[eventName]){fctCll=new collection();scopeCll=new collection();this._listeners[eventName]=fctCll;this._scopes[eventName]=scopeCll;}else{fctCll=this._listeners[eventName];scopeCll=this._scopes[eventName];}
fctCll.push(callBackFunction);scopeCll.push(scope?scope:this);};EventManager.prototype.removeListener=function(eventName,callBackFunction){var method_name="EventManager.prototype.removeListener(eventName, callBackFunction)";if(!eventName||!callBackFunction){var exc=new Error("Invalid instance object: "+!eventName?"eventName":callBackFunction);exc.name=method_name;throw exc;}
var listenerCll=this._listeners[eventName];var scopeCll=this._scopes[eventName];if(listenerCll&&scopeCll){var idx=listenerCll.get_idx(callBackFunction);listenerCll.remove_idx(idx);scopeCll.remove_idx(idx);}};EventManager.prototype.fireEvent=function(eventName){var params=[];for(var i=1;i<arguments.length;i++){params.push(arguments[i]);}
var listenersCll=this._listeners[eventName];var scopeCll=this._scopes[eventName];var returnValue=true;for(var i=0;listenersCll&&i<listenersCll.get_count();i++){var fct=listenersCll.get(i);var scope=scopeCll.get(i);var ret=fct.apply(scope,params);if(!ret)
returnValue=false;}
return returnValue;};function generic_animator(){this._current=0;this._duration=0;this._starting=0;this._timer=null;this._looped=false;this._animator=null;this._reverse=false;this._started=false;this._interrupt=false;this._tmp_target=null;this._obs=new Array();};generic_animator.TIME_OUT=30;generic_animator.prototype.setDuration=function(val){this.set_duration_time(val);};generic_animator.prototype._raise_start=function(trg,controlled){for(k=0;k<this._obs.length;k++)
this._obs[k].start_animation(this,trg,controlled);};generic_animator.prototype._raise_end=function(trg,controlled){for(k=0;k<this._obs.length;k++)
this._obs[k].end_animation(this,trg,controlled);};generic_animator.prototype._virtual_internal_start=function(trg,controlled){return;};generic_animator.prototype._virtual_internal_step=function(trg,controlled){return;};generic_animator.prototype._virtual_internal_end=function(trg){return;}
generic_animator.prototype._virtual_internal_interrupt=function(trg){return;};generic_animator.prototype._virtual_get_target=function(trg){return trg;};generic_animator.prototype._clone=function(ret){ret._current=this._current;ret._duration=this._duration;ret._starting=this._starting;ret._timer=this._timer;ret._looped=this._looped;if(this._animator)
ret._animator=this._animator.clone();ret._reverse=this._reverse;ret._started=this._started;ret._interrupt=this._interrupt;ret._tmp_target=this._tmp_target;if(this._obs)
ret._obs=this._obs.concat([]);};generic_animator.prototype.clone=function(){var ret=new generic_animator();this._clone(ret);return ret;};generic_animator.prototype.set_loop_mode=function(val){this._looped=!!val;};generic_animator.prototype.set_duration_time=function(val){var method_name="generic_animator.prototype.set_duration_time(long)";if(val<0)
throw new Error(method_name+" Invalid parameter value");this._duration=val*1000;};generic_animator.prototype.get_duration_time=function(){return this._duration;};generic_animator.prototype.set_internal_animator=function(val){var method_name="generic_animator.prototype.set_internal_animator(generic_animator)";var err=-1;if(!val)
throw new Error(method_name+" Invalid parameter value");this._animator=val;};generic_animator.prototype.get_internal_animator=function(){return this._animator;};generic_animator.prototype.attach_observer=function(obs){var method_name="generic_animator.prototype.attach_observer(i_animator_observer)";var method=reflection.obj_implement_interface(obs,new i_animator_observer())
if(method!="")
throw new Error(method_name+" Invalid interface implementation: <i_animator_observer."+method+">");this._obs.push(obs);};generic_animator.prototype.detach_observer=function(obs){if(!obs)
return;this._obs.pop(obs);};generic_animator.prototype.start=function(trg,controlled){var method_name="generic_animator.prototype.start(HTML node, bool)";if(!trg)
throw new Error("Invalid instance object");if(this._timer)
window.clearInterval(this._timer);this._raise_start(trg,controlled);var d=new Date();this._starting=d.getTime();this._current=this._starting;this._virtual_internal_start(this._virtual_get_target(trg),controlled);if(this._animator)
this._animator.start(this._virtual_get_target(trg),true);if(!controlled){var fct=reflection.bind(this,this.step,true,trg,controlled);this._timer=window.setInterval(fct,generic_animator.TIME_OUT);}
this._tmp_target=trg;this._started=true;this._interrupt=false;};generic_animator.prototype.step=function(trg,controlled){var method_name="generic_animator.prototype.step";if(!trg)
throw new Error("Invalid instance object");var d=new Date();this._current=d.getTime();if((!controlled)&&(this._current-this._starting)>this._duration&&!this._looped){this.end(trg);}else{this._virtual_internal_step(this._virtual_get_target(trg),controlled);if(this._animator)
this._animator.step(this._virtual_get_target(trg),true);}};generic_animator.prototype.end=function(trg){this._tmp_target=null;this._started=false;var method_name="generic_animator.prototype.end";if(!trg)
throw new Error("Invalid instance object");if(this._timer)
window.clearInterval(this._timer);this._virtual_internal_end(this._virtual_get_target(trg));this._current=null;if(this._animator)
this._animator.end(this._virtual_get_target(trg),true);this._raise_end(trg);};generic_animator.prototype.is_started=function(trg){return this._started&&!this._interrupt;};generic_animator.prototype.interrupt=function(trg){if(this._timer)
window.clearInterval(this._timer);if(!this._started)
return;this._interrupt=true;if(trg==null)
trg=this._tmp_target;this._virtual_internal_interrupt(this._virtual_get_target(trg));this._current=null;if(this._animator)
this._animator.interrupt(this._virtual_get_target(trg));this._tmp_target=null;this._raise_end(trg);};generic_animator.prototype.reverse=function(val){if(val==this._reverse)
return;this._reverse=val;};function fade_animator(){generic_animator.call(this);this.end_val=0;this.start_val=1;};TabulaJs.FadeAnim=function(){return new fade_animator();};fade_animator.CLASS_NAME="fade_animator";fade_animator.prototype=new generic_animator();fade_animator.prototype._clone=function(ret){generic_animator.prototype._clone.call(this,ret);ret.end_val=this.end_val;ret.start_val=this.start_val;};fade_animator.prototype.toString=function(){return fade_animator.CLASS_NAME;};fade_animator.prototype.clone=function(){var ret=new fade_animator();this._clone(ret);return ret;};fade_animator.prototype._virtual_internal_start=function(trg,controlled){var prestep=(this._current-this._starting)/this._duration;var step=(!this._reverse)?prestep:1-prestep;step=this.start_val+((this.end_val-this.start_val)*step);dom_inspector.set_opacity(trg,step);};fade_animator.prototype._virtual_internal_step=function(trg,controlled){var prestep=(this._current-this._starting)/this._duration;var step=(!this._reverse)?prestep:1-prestep;step=this.start_val+((this.end_val-this.start_val)*step);dom_inspector.set_opacity(trg,step);};fade_animator.prototype._virtual_internal_end=function(trg){var prestep=this._duration/this._duration;var step=(!this._reverse)?prestep:1-prestep;step=this.start_val+((this.end_val-this.start_val)*step);dom_inspector.set_opacity(trg,step);};fade_animator.prototype._virtual_internal_interrupt=function(trg){if(!trg)
return;this._virtual_internal_end(trg);};function hash_item(){this.key=null;this.value=null;}
new hash_item();function hash_table_iterator(){this._ht=null;this._position=-1;}
new hash_table_iterator();hash_table_iterator.prototype._is_valid_idx=function(idx){if((idx<0)||(idx>=this._ht.get_count()))
return false;return true;}
hash_table_iterator.prototype.init=function(ht){var method_name="hash_table_iterator.prototype.init(String)";if(!ht){var exc=new Error("Invalid hash_table instance into "+method_name);exc.name=method_name;throw exc;}
this._ht=ht;}
hash_table_iterator.prototype.reset=function(){this._position=-1;}
hash_table_iterator.prototype.get_current=function(){var key=this._ht.get_key(this._position);var ret=new hash_item();ret.key=key;ret.value=this._ht.get_element(key);return ret;}
hash_table_iterator.prototype.move_next=function(){this._position++;return this._is_valid_idx(this._position);}
function hash_table_inv_iterator(){hash_table_iterator.call(this);}
hash_table_inv_iterator.prototype=new hash_table_iterator();hash_table_inv_iterator.prototype.reset=function(){this._position=this._ht.get_count();}
hash_table_inv_iterator.prototype.move_next=function(){this._position--;return this._is_valid_idx(this._position);}
function hash_table(){this._keys=new Array();}
new hash_table();hash_table.prototype._is_valid_idx=function(idx){if((idx<0)||(idx>=this._keys.length))
return false;return true;}
hash_table.prototype._get_key_idx=function(key){var cur_key="";for(var k=0;k<this._keys.length;k++){cur_key=this._keys[k];if(cur_key==key)
return k;}
return-1;}
hash_table.prototype.toString=function(){return"hash_table ("+this._keys.length+" elements)";}
hash_table.prototype.exist_key=function(key){if(this[key]==null)
return false;return true;}
hash_table.prototype.get_count=function(){return this._keys.length;}
hash_table.prototype.get_key=function(idx){var method_name="hash_table.prototype.get_key(Long)";if(!this._is_valid_idx(idx)){var exc=new Error("Index out of bounds :<"+idx+">");exc.name=method_name;throw exc;}
return this._keys[idx];}
hash_table.prototype.add_or_change=function(key,val){var method_name="hash_table.prototype.add_or_change(String, Object)";if(!this.exist_key(key))
this.add(key,val);else
this[key]=val;}
hash_table.prototype.add=function(key,val){var method_name="hash_table.prototype.add(String, Object)";if(this.exist_key(key)){var exc=new Error("Key already exist :<"+key+">");exc.name=method_name;throw exc;}
this._keys.push(key);this[key]=val;}
hash_table.prototype.remove=function(key){var method_name="hash_table.prototype.remove(String)";if(!this.exist_key(key)){var exc=new Error("Key not found :<"+key);exc.name=method_name;throw exc;}
var idx=this._get_key_idx(key);this._keys.splice(idx,1);delete this[key];}
hash_table.prototype.get_element=function(key){var method_name="hash_table.prototype.get_element(String)";if(!this.exist_key(key)){var exc=new Error("Key not found :<"+key+">");exc.name=method_name;throw exc;}
return this[key];}
hash_table.prototype.clear=function(){var cur_key="";for(var k=0;k<this._keys.length;k++){cur_key=this._keys[k];delete this[cur_key];}
this._keys=new Array();}
hash_table.prototype.get_iterator=function(){var ret=new hash_table_iterator();ret.init(this);ret.reset();return ret;}
hash_table.prototype.get_inv_iterator=function(){var ret=new hash_table_inv_iterator();ret.init(this);ret.reset();return ret;}
TabulaJs.HttpConnector=function(){this._request=null;this._last_error=null;this._ht=null;};TabulaJs.HttpConnector.CLASS_NAME="TabulaJs.HttpConnector";TabulaJs.HttpConnector.GET="GET";TabulaJs.HttpConnector.POST="POST";TabulaJs.HttpConnector.PUT="PUT";TabulaJs.HttpConnector.DELETE="DELETE";TabulaJs.HttpConnector.HEAD="HEAD";TabulaJs.HttpConnector.OPTIONS="OPTIONS";TabulaJs.HttpConnector.PARAM_NAME="xml_msg";TabulaJs.HttpConnector.str_2_dom=function(txt){if(!txt)
return null;var xmlDom=null;if(typeof DOMParser=="object"||typeof DOMParser=="function"){xmlDom=new DOMParser().parseFromString(txt,"text/xml");}else{if(window.ActiveXObject){xmlDom=new ActiveXObject("Microsoft.XMLDOM");xmlDom.loadXML(txt);}else{var method_name="TabulaJs.HttpConnector.prototype.str_2_dom()";var err=new Error("DomDocument object not supported");err.name=method_name;throw err;}}
return xmlDom;};TabulaJs.HttpConnector.encodeParam=function(val){if(!val)
return val;return encodeURIComponent(val);};TabulaJs.HttpConnector.prototype._addHeaderParam=function()
{if(!this._ht)
return;for(var it=this._ht.get_iterator();it.move_next();)
{var item=it.get_current();this._request.setRequestHeader(item.key,item.value);}};TabulaJs.HttpConnector.prototype._connectorStateChange=function(successHandler,failHandler,scope,parameters){if(this.readyState()!=4)
return;parameters.unshift(this);try{var code=this.status();if((code<200)||(code>299)){failHandler.apply(scope,parameters);return;}
successHandler.apply(scope,parameters);}catch(exc){var debug=exc;}finally{this.abort();}};TabulaJs.HttpConnector.prototype._init=function(){if(this._request)
return;var method_name="HttpConnector.prototype._init()";var xhr=null;if(typeof XMLHttpRequest=="undefined"){supported=false;var msxmls=["MSXML3","MSXML2","Microsoft"];for(var i=0;i<msxmls.length;i++){try{req=new ActiveXObject(msxmls[i]+".XMLHTTP")
if(req){xhr=req;i=msxmls.length+1;}}catch(e){}}}
else
xhr=new XMLHttpRequest();if(!xhr){var err=new Error("Http request not supported");err.name=method_name;throw err;}
this._request=xhr;};TabulaJs.HttpConnector.prototype.toString=function(){return"TabulaJs.HttpConnector";};TabulaJs.HttpConnector.prototype.sendSync=function(url,method,param_txt,successHandler,failHandler,scope){this._init();if(this._request.readyState!=4&&this._request.readyState!=0){this.abort();}
this._last_error=null;this._request.open(method,url,false);if(method==TabulaJs.HttpConnector.POST){this.setRequestHeader("Content-type","application/x-www-form-urlencoded");}
this._addHeaderParam();this._request.send(param_txt);var scope=scope?scope:this;var params=[this];for(var i=6;i<arguments.length;i++){params.push(arguments[i]);}
try{if(this.status()!=200){if(failHandler)
failHandler.apply(scope,params);}else{if(successHandler)
successHandler.apply(scope,params);}}catch(exc){this._last_error=exc.message;}finally{if((successHandler)||(failHandler))
this.abort();}};TabulaJs.HttpConnector.prototype.sendAsync=function(url,method,param_txt,successHandler,failHandler,scope){this._init();if(this._request.readyState!=4&&this._request.readyState!=0){this.abort();}
var params=[];for(var i=6;i<arguments.length;i++){params.push(arguments[i]);}
try{this._request.open(method,url,true);var state_fct=reflection.bind(this,this._connectorStateChange,true,successHandler,failHandler,scope,params);this._request.onreadystatechange=state_fct;if(method==TabulaJs.HttpConnector.POST){this.setRequestHeader("Content-type","application/x-www-form-urlencoded");}
this._addHeaderParam();this._request.send(param_txt);this._last_error=null;}catch(e){this._last_error=e.message
if(failHandler){params.unshift(this);failHandler.apply(scope,params);}
this.abort();}};TabulaJs.HttpConnector.prototype.readyState=function(){return this._request.readyState;};TabulaJs.HttpConnector.prototype.status=function(){if(this._request.readyState==0)
return 401;else
return this._request.status;};TabulaJs.HttpConnector.prototype.getResponseText=function(){if(this._request.readyState==0)
return this._last_error;else
return this._request.responseText;};TabulaJs.HttpConnector.prototype.getText=function(){return this.getResponseText();};TabulaJs.HttpConnector.prototype.statusText=function(){if(this._request.readyState==0)
return this._last_error;else
return this._request.statusText;};TabulaJs.HttpConnector.prototype.statusDescription=function(){switch(this.status()){case 100:return"Continue";case 101:return"Switching Protocols";case 200:return"OK";case 201:return"Created";case 202:return"Accepted";case 203:return"Non-Authoritative Information";case 204:return"No Content";case 205:return"Reset Content";case 206:return"Partial Content";case 300:return"Multiple Choices";case 301:return"Moved Permanently";case 302:return"Found";case 303:return"See Other";case 304:return"Not Modified";case 305:return"Use Proxy";case 306:return"(unused, but reserved)";case 307:return"Temporary Redirect";case 400:return"Bad Request";case 401:return"Unauthorized";case 402:return"Payment Required";case 403:return"Forbidden";case 404:return"Not Found";case 405:return"Method Not Allowed";case 406:return"Not Acceptable";case 407:return"Proxy Authentication Required";case 408:return"Request Timeout";case 409:return"Conflict";case 410:return"Gone";case 411:return"Length Required";case 412:return"Precondition Failed";case 413:return"Request Entity Too Large";case 414:return"Request-URI Too Long";case 415:return"Unsupported Media Type";case 416:return"Requested Range Not Satisfiable";case 417:return"Expectation Failed";case 500:return"Internal Server Error";case 501:return"Not Implemented";case 502:return"Bad Gateway";case 503:return"Service Unavailable";case 504:return"Gateway Timeout";case 505:return"HTTP Version Not Supported";case 509:return"Bandwidth Limit Exceeded";default:return"Error on http request";}};TabulaJs.HttpConnector.prototype.setRequestHeader=function(name,val){if(!this._ht)
this._ht=new hash_table();this._ht.add_or_change(name,val);};TabulaJs.HttpConnector.prototype.getResponseDom=function(){return TabulaJs.HttpConnector.str_2_dom(this._request.responseText);};TabulaJs.HttpConnector.prototype.getDom=function(){return this.getResponseDom();};TabulaJs.HttpConnector.prototype.getResponseObj=function(){var str=this._request.responseText;return eval("("+str+")");};TabulaJs.HttpConnector.prototype.getObj=function(){return this.getResponseObj();};TabulaJs.HttpConnector.prototype.abort=function(){if(this._request){this.close();this._request.abort();}};TabulaJs.HttpConnector.prototype.close=function(){if(this._request){if(browser_info.is_gecko())
this._request.onreadystatechange=null;}};TabulaJs.HttpConnector.prototype.dispose=function(){if(this._request&&this._request.readyState!=4)
this.abort();else
this.close();};TabulaJs.HttpCrossConnector=function(){this._txt="";this._key=null;this._timeout=null;this._script=null;this._statusText="";this._status=200;};TabulaJs.HttpCrossConnector._KEY=0;TabulaJs.HttpCrossConnector.TIMEOUT=5000;TabulaJs.HttpCrossConnector.CLASSNAME="TabulaJs.HttpCrossConnector";TabulaJs.HttpCrossConnector.response=function(hnd,txt){if(!window[hnd])
return;window[hnd](txt);};TabulaJs.HttpCrossConnector._nextKey=function(){return"k_"+TabulaJs.HttpCrossConnector._KEY++;};TabulaJs.HttpCrossConnector.prototype._reset=function(){clearTimeout(this._timeout);this._timeout=null;var tmp=null;tmp=window[this._key];window[this._key]=null;delete tmp;this._key=null;this._txt="";document.getElementsByTagName("head")[0].removeChild(this._script);tmp=this._script;this._script=null;delete tmp;};TabulaJs.HttpCrossConnector.prototype._appendScript=function(url,param){var script=document.createElement("script");script.setAttribute("type","text/javascript");script.setAttribute("src",url+"?hnd="+this._key+((param)?"&"+param:""));document.getElementsByTagName("head")[0].appendChild(script);this._script=script;};TabulaJs.HttpCrossConnector.prototype._failure=function(onFailure,scope,params){this._status=404;this._statusText="Not Found";this._reset();if(onFailure){params.unshift(this);onFailure.apply(scope,params);}};TabulaJs.HttpCrossConnector.prototype._success=function(onSuccess,scope,results,custom_params){this._status=202;this._statusText="OK";this._reset();this._txt=results;custom_params.unshift(this);onSuccess.apply(scope,custom_params);};TabulaJs.HttpCrossConnector.prototype.toString=function(){return TabulaJs.HttpCrossConnector.CLASSNAME;};TabulaJs.HttpCrossConnector.prototype.getText=function(){return this._txt;};TabulaJs.HttpCrossConnector.prototype.getObj=function(){return eval("("+this._txt+")");};TabulaJs.HttpCrossConnector.prototype.getDom=function(){return TabulaJs.HttpConnector.str2dom(this.getText());};TabulaJs.HttpCrossConnector.prototype.status=function(){return this._status;};TabulaJs.HttpCrossConnector.prototype.statusText=function(){return this._statusText;};TabulaJs.HttpCrossConnector.prototype.statusDescription=function(){switch(this.status){case 100:return"Continue";case 101:return"Switching Protocols";case 200:return"OK";case 201:return"Created";case 202:return"Accepted";case 203:return"Non-Authoritative Information";case 204:return"No Content";case 205:return"Reset Content";case 206:return"Partial Content";case 300:return"Multiple Choices";case 301:return"Moved Permanently";case 302:return"Found";case 303:return"See Other";case 304:return"Not Modified";case 305:return"Use Proxy";case 306:return"(unused, but reserved)";case 307:return"Temporary Redirect";case 400:return"Bad Request";case 401:return"Unauthorized";case 402:return"Payment Required";case 403:return"Forbidden";case 404:return"Not Found";case 405:return"Method Not Allowed";case 406:return"Not Acceptable";case 407:return"Proxy Authentication Required";case 408:return"Request Timeout";case 409:return"Conflict";case 410:return"Gone";case 411:return"Length Required";case 412:return"Precondition Failed";case 413:return"Request Entity Too Large";case 414:return"Request-URI Too Long";case 415:return"Unsupported Media Type";case 416:return"Requested Range Not Satisfiable";case 417:return"Expectation Failed";case 500:return"Internal Server Error";case 501:return"Not Implemented";case 502:return"Bad Gateway";case 503:return"Service Unavailable";case 504:return"Gateway Timeout";case 505:return"HTTP Version Not Supported";case 509:return"Bandwidth Limit Exceeded";default:return"Error on http request";}};TabulaJs.HttpCrossConnector.prototype.send=function(url,timeout,param,onSuccess,onFailure,scope){if(this._script){this.abort();}
var time=timeout||TabulaJs.HttpCrossConnector.TIMEOUT;this._key=TabulaJs.HttpCrossConnector._nextKey();var me=this;var custom_params=new Array();for(var h=6;h<arguments.length;h++){custom_params.push(arguments[h]);}
try{window[this._key]=function(results){me._success(onSuccess,scope,results,custom_params);};this._appendScript(url,param);this._timeout=setTimeout(function(){me._failure(onFailure,scope,custom_params);},time);}catch(exc){this._last_error=exc.message;this._failure(onFailure,scope,custom_params);this.close();}};TabulaJs.HttpCrossConnector.prototype.abort=function(){this.close();};TabulaJs.HttpCrossConnector.prototype.close=function(){this._reset(this._key);};TabulaJs.HttpCrossConnector.prototype.dispose=function(){if(this._script)
this._abort();else
this.close();};function i_animator_observer(){}
new i_animator_observer();i_animator_observer.prototype.start_animation=function(animator,trg,controlled){}
i_animator_observer.prototype.end_animation=function(animator,trg,controlled){}
function i_enumerator(){}
new i_enumerator();i_enumerator.prototype.reset=function(){return;}
i_enumerator.prototype.get_current=function(){return null;}
i_enumerator.prototype.move_next=function(){return false;}
function i_operation_box(){};new i_operation_box();i_operation_box.prototype.update=function(id,min,max,current){};i_operation_box.prototype.clear=function(){};function i_operation_observer(){};new i_operation_observer();i_operation_observer.prototype.after_changed=function(src,min,max,cur){};function image_animator(){generic_animator.call(this);this._zoom_fct=1;this._delta=null;this.end_rect=null;this.start_rect=null;}
image_animator.prototype=new generic_animator();image_animator.prototype._clone=function(ret){generic_animator.prototype._clone.call(this,ret);ret._delta=this._delta;ret._zoom_fct=this._zoom_fct;if(this.end_rect)
ret.end_rect=this.end_rect.clone();if(this.start_rect)
ret.start_rect=this.start_rect.clone();};image_animator.prototype.clone=function(){var ret=new image_animator();this._clone(ret);return ret;};image_animator.prototype._zoom_to_rect=function(trg,cnt,sz){var method_name="image_animator.prototype._zoom_to_rect(HtmlElement, point, size)";var msg="";if(!trg)
msg="HtmlElement";if(!cnt)
msg="point";if(!sz)
msg="size";if(msg!="")
throw new Error(method_name+" Invalid instance object: "+msg);trg.style.width=sz.width+"px";trg.style.height=sz.height+"px";trg.style.left=(cnt.x-(sz.width/2))+"px";trg.style.top=(cnt.y-(sz.height/2))+"px";}
image_animator.prototype._virtual_internal_start=function(trg,controlled){var y_zc=this.end_rect.height/this.start_rect.height;this._zoom_fct=y_zc;var end_cnt=this.end_rect.get_center();var start_cnt=this.start_rect.get_center();this._delta=new point(end_cnt.x-start_cnt.x,end_cnt.y-start_cnt.y);}
image_animator.prototype._virtual_internal_step=function(trg,controlled){if(this._current==0)
return;var fct=1;if(this._zoom_fct>=1){fct=1+(this._current*((this._zoom_fct-1)/this._frames));var sz=new size(this.end_rect.width*fct,this.end_rect.height*fct);}else{fct=1-(this._current*((1-this._zoom_fct)/this._frames));sz=new size(this.start_rect.width*fct,this.start_rect.height*fct);}
var x_inc=fct*(this._delta.x/this._frames);var y_inc=fct*(this._delta.y/this._frames);var tmp;var cnt;if(this._zoom_fct>=1){tmp=this.end_rect.get_center();cnt=new point(tmp.x+this._current*x_inc,tmp.y+this._current*y_inc);}else{tmp=this.start_rect.get_center();cnt=new point(tmp.x-this._current*x_inc,tmp.y-this._current*y_inc);}
this._zoom_to_rect(trg,cnt,sz);}
image_animator.prototype._virtual_internal_end=function(trg){this._current=this._frames;this._virtual_internal_step(trg);}
function languages(){}
new languages();languages.DEFAULT=1;languages.IT=1;languages.EN=2;languages.FR=3;languages.brw2lan=function(lan){var val=lan.toUpperCase();if(val=="IT")
return languages.IT;if((val=="EN-US")||(val=="EN")||(val=="EN-CA"))
return languages.EN;return languages.IT;}
languages.lan2str=function(val){if(val==languages.EN)
return"EN";if(val==languages.IT)
return"IT";if(val==languages.FR)
return"FR";return"UNKNOWN";}
languages.str2lan=function(val){if(val=="EN")
return languages.EN;if(val=="IT")
return languages.IT;if(val=="FR")
return languages.FR;return languages.DEFAULT;}
languages.lan2desc=function(val){if(val==languages.EN)
return"English";if(val==languages.IT)
return"Italiano";if(val==languages.FR)
return"Français";return"UNKNOWN";}
function Login(){this._user=null;this._logged=null;this._error=null;this._statusCode=null;this._roles=null;this._eventManager=new EventManager();};TabulaJs.Login=function(){return new Login();};Login.USER_PARAMETER="user";Login.PASSWORD_PARAMETER="pws";Login.LOGIN="login";Login.LOGOUT="logout";Login.FAILED="failed";TabulaJs.Login.LOGIN=Login.LOGIN;TabulaJs.Login.LOGOUT=Login.LOGOUT;TabulaJs.Login.FAILED=Login.FAILED;Login.prototype.login=function(url,user,password){var cnn=new TabulaJs.HttpConnector();var p=Login.USER_PARAMETER+"="+encodeURIComponent(user)+"&"+Login.PASSWORD_PARAMETER+"="+encodeURIComponent(password);cnn.sendAsync(url,TabulaJs.HttpConnector.POST,p,this._connectionSuccess,this._connectionFailed,this);};Login.prototype.secureLogin=function(url,user,password){var cnn=new TabulaJs.HttpConnector();url=url+"/"+user+"/data.json";cnn.setRequestHeader("Crc",password);cnn.sendAsync(url,TabulaJs.HttpConnector.GET,"",this._connectionSuccess,this._connectionFailed,this);};Login.prototype.toString=function(){return"Login";};Login.prototype.logout=function(){this._user=null;this._logged=null;this._error=null;this._statusCode=null;this._roles=null;this._eventManager.fireEvent(Login.LOGOUT,this);};Login.prototype.addListener=function(eventName,callBackFunction,scope){this._eventManager.addListener(eventName,callBackFunction,scope);};Login.prototype.removeListener=function(eventName,callBackFunction){this._eventManager.removeListener(eventName,callBackFunction);};Login.prototype.verifyRole=function(roleName,objName){if(roleName!=null&&roleName!=undefined&&objName!=null&&objName!=undefined){return this._roles&&this._roles[roleName]&&this._roles[roleName].objects&&this._roles[roleName].objects[objName]!==undefined;}
return false;};Login.prototype.getRoles=function(objName){var roles=[];if(objName!=null&&objName!=undefined){for(var role in this._roles){if(this._roles[role].objects&&this._roles[role].objects[objName]!==undefined)
roles.push(role);}}
return roles;};Login.prototype.isLogged=function(){return!!this._logged;};Login.prototype.getStatusCode=function(){return this._statusCode;};Login.prototype.getErrorMessage=function(){return this._error;};Login.prototype.getUserName=function(){return this._user;};Login.prototype._connectionSuccess=function(cnn){var res;try{var res=cnn.getResponseObj();this._user=res.user;this._statusCode=res.statusCode;this._logged=res.logged;this._error=res.error;this._roles=res.rules;}catch(e){this._user=null;this._logged=false;this._statusCode=500;this._error=e.message;this._roles=null;}
if(this._logged)
this._eventManager.fireEvent(Login.LOGIN,this);else
this._eventManager.fireEvent(Login.FAILED,this);};Login.prototype._connectionFailed=function(cnn){this._user=null;this._logged=false;this._error=cnn.statusText();this._statusCode=cnn.status();this._roles=null;this._eventManager.fireEvent(Login.FAILED,this);};function operation_monitor(){this._last_value=-1;this._progress=null;this._is_valid=false;this._observers=new collection();this._operations=new hash_table();}
operation_monitor.prototype._get_value=function(){if(!this._is_valid){var tot_prog=0;var op_num=0;var it=this._operations.get_iterator();while(it.move_next()){var cur=it.get_current().value;tot_prog+=100*cur.get_current()/(cur.get_max()-cur.get_min());op_num++;}
this._progress=(op_num!=0)?tot_prog/op_num:100;this._is_valid=true;}
return this._progress;}
operation_monitor.prototype._update_obs=function(){var prog=this._get_value();if(this._last_value==prog)
return;this._last_value=prog;var it=this._observers.get_iterator();while(it.move_next()){var cur=it.get_current();cur.after_changed(this,0,100,prog);}
if(prog==100)
this.clear();}
operation_monitor.prototype.attach_operation_obs=function(obs){var method=reflection.obj_implement_interface(obs,new i_operation_observer())
if(method!="")
throw new Error(method_name+" Invalid interface implementation: <i_operation_observer."+method+">");this._observers.push(obs);}
operation_monitor.prototype.detach_operation_obs=function(obs){this._observers.remove(obs);}
operation_monitor.prototype.update=function(id,min,max,current){this._is_valid=false;if(!this._operations.exist_key(id)){var op=new operation();op.init(id,min,max,current);if(!op.is_completed())
this._operations.add(id,op);}else{var op=this._operations.get_element(id);op.init(id,min,max,current);}
this._update_obs();}
operation_monitor.prototype.clear=function(){this._operations.clear();}
function operation(){this._id=null;this._min=null;this._max=null;this._current=null;}
new operation();operation.prototype.get_max=function(){return this._max;}
operation.prototype.get_min=function(){return this._min;}
operation.prototype.get_current=function(){return this._current;}
operation.prototype.get_id=function(){return this._id;}
operation.prototype.init=function(id,min,max,current){this._min=(min!=null)?min:0;this._max=(max!=null)?max:100;this._id=id;this._current=current;}
operation.prototype.is_completed=function(){return(this.get_current()==this.get_max());}
function point(x_coord,y_coord,z_coord,m){this.x=(x_coord)?parseFloat(x_coord):0;this.y=(y_coord)?parseFloat(y_coord):0;this._z=(z_coord)?parseFloat(z_coord):null;this._measures=(m)?m:new Array();}
new point(0,0);point.get_distance=function(pnt1,pnt2){var x=pnt2.x-pnt1.x;var y=pnt2.y-pnt1.y;var proj_distance=Math.sqrt((x*x)+(y*y));if(pnt1._z){var delta_z=Math.abs(pnt1.get_z()-pnt2.get_z());var measure=Math.sqrt((proj_distance*proj_distance)+(delta_z*delta_z));proj_distance+=measure;}
return proj_distance;}
point.prototype.toString=function(){var res="";res+="point x="+this.x+" y="+this.y+" z="+this.z;return res;}
point.prototype.clone=function(){var pnt=new point(this.get_x(),this.get_y(),this.get_z());pnt._measures=this._measures.concat(this._measures);return pnt;}
point.prototype.get_x=function(){return this.x;}
point.prototype.set_x=function(val){this.x=(val)?parseFloat(val):0;}
point.prototype.get_y=function(){return this.y;}
point.prototype.set_y=function(val){this.y=(val)?parseFloat(val):0;}
point.prototype.get_z=function(){return this._z;}
point.prototype.set_z=function(val){this._z=(val)?parseFloat(val):null;}
point.prototype.put_measure=function(val,idx){var int_idx=parseInt(idx,10);this._measures[int_idx]=val;}
point.prototype.get_measure=function(idx){var int_idx=parseInt(idx,10);if(int_idx<0||int_idx>=this._measures.length)
return null;return this._measures[int_idx];}
point.prototype.shift=function(dx,dy,dz){this.x+=dx;this.y+=dy;if((this._z)&&(dz))
this._z+=dz;}
point.prototype.is_equal=function(val){if(!val)
return false;var z_condition=true;if(this._z)
z_condition=(this._z==val.get_z());return((this.x==val.x)&&(this.y==val.y)&&z_condition);}
point.prototype.distance=function(val){return point.get_distance(this,val);}
point.get_middle_point=function(p1,p2)
{var x=(p1.x+p2.x)/2.0;var y=(p1.y+p2.y)/2.0;var z=(p1.z==null&&p2.z==null)?null:(p1.z+p2.z)/2.0;var ml=Math.min(p1._measures.length,p2._measures.length);var m=[];for(var i=0;i<ml;i++)
{m[i]=(p1._measures[i]+p2._measures[i])/2.0;}
return new point(x,y,z,m);}
function rect(x,y,w,h,olt){this.left=(x)?x:0;this.top=(y)?y:0;this.width=(w)?w:0;this.height=(h)?h:0;this.origin_left_top=(!olt)?false:true;}
new rect(0,0,0,0,true);rect.get_intersect=function(rect_l,rect_r){var method_name="rect.get_intersect(rect, rect)";if((!rect_l)||(!rect_r)){var exc=new Error("Invalid parameter rectangle object instance");exc.name=method_name;throw exc;}
var l=Math.max(rect_l.left,rect_r.left);var r=Math.min(rect_l.get_right(),rect_r.get_right());var t=0;var b=0;if(rect_l.origin_left_top){t=Math.max(rect_l.top,rect_r.top);b=Math.min(rect_l.get_bottom(),rect_r.get_bottom());}else{t=Math.min(rect_l.top,rect_r.top);b=Math.max(rect_l.get_bottom(),rect_r.get_bottom());}
var ret=new rect(l,t,(r-l),Math.abs(t-b));return ret;}
rect.extend=function(l_rect,x_perc,y_perc){var method_name="rect.extend";if(!l_rect){var exc=new Error("Invalid parameter rectangle object instance");exc.name=method_name;throw exc;}
if((x_perc<0)||(y_perc<0)){var exc=new Error("Invalid parameter rectangle object instance");exc.name=method_name;throw exc;}
var h_inc=l_rect.width-(l_rect.width*x_perc);var v_inc=l_rect.height-(l_rect.height*y_perc);var l=l_rect.left+(h_inc/2.0);var t=(rect.origin_left_top==true)?l_rect.top+(v_inc/2.0):l_rect.top-(v_inc/2.0);var w=l_rect.width-h_inc;var h=l_rect.height-v_inc;var ret=new rect(l,t,w,h,rect.origin_left_top);return ret;}
rect.extend_from_perc=function(l_rect,x_perc,y_perc){var x_p=x_perc/100.0;var y_p=y_perc/100.0;return rect.extend(l_rect,x_p,y_p);}
rect.get_union=function(rect_l,rect_r){var method_name="rect.get_union";if((!rect_l)||(!rect_r)){var exc=new Error("Invalid parameter rectancle object instance");exc.name=method_name;throw exc;}
var l=Math.min(rect_l.left,rect_r.left);var r=Math.max(rect_l.get_right(),rect_r.get_right());var t=0;var b=0;if(rect_l.origin_left_top){t=Math.min(rect_l.top,rect_r.top);b=Math.max(rect_l.get_bottom(),rect_r.get_bottom());}else{t=Math.max(rect_l.top,rect_r.top);b=Math.min(rect_l.get_bottom(),rect_r.get_bottom());}
var ret=new rect(l,t,(r-l),Math.abs(t-b));ret.origin_left_top=rect_l.origin_left_top;return ret;}
rect.prototype.toString=function(){var res="";res+="rect left="+this.left+" top="+this.top+" width="+this.width+" height="+this.height;return res;}
rect.prototype.clone=function(){var res=new rect(this.left,this.top,this.width,this.height,this.origin_left_top);return res;}
rect.prototype.extend=function(x_perc,y_perc){var ret=rect.extend(this,x_perc,y_perc);this.left=ret.left;this.top=ret.top;this.width=ret.width;this.height=ret.height;}
rect.prototype.scale=function(fctx,fcty){this.width*=fctx;this.height*=fcty;}
rect.prototype.shift=function(dx,dy){this.left+=dx;if(this.origin_left_top)
this.top+=dy;else
this.top-=dy;}
rect.prototype.contains_point=function(pnt){if(pnt.x<this.left)
return false;if(pnt.x>this.get_right())
return false;if(this.origin_left_top){if(pnt.y<this.top)
return false;if(pnt.y>this.get_bottom())
return false;}else{if(pnt.y>this.top)
return false;if(pnt.y<this.get_bottom())
return false;}
return true;}
rect.prototype.contains_rect=function(rect){if(!this.contains_point(new point(rect.left,rect.top)))
return false;if(this.origin_left_top){if(!this.contains_point(new point(rect.left+rect.width,rect.top+rect.height)))
return false;}
else{if(!this.contains_point(new point(rect.left+rect.width,rect.top-rect.height)))
return false;}
return true;}
rect.prototype.get_center=function(){var x_c=this.left+(this.width/2);var fct=(this.origin_left_top)?1:-1;var y_c=this.top+(fct*(this.height)/2);return new point(x_c,y_c);}
rect.prototype.get_centre=function(){return this.get_center();}
rect.prototype.get_location=function(){return new point(this.left,this.top);}
rect.prototype.get_diagonal=function(){var d2=(this.width*this.width)+(this.height*this.height);var res=Math.sqrt(d2);return res;}
rect.prototype.get_right=function(){return(this.left+this.width);}
rect.prototype.get_bottom=function(){var fct=1;if(!this.origin_left_top)
fct=-1;return this.top+(fct*this.height);}
rect.prototype.get_size=function(){return new size(this.width,this.height);}
rect.prototype.is_equal=function(rect){if(!rect)
return false;if((rect.left!=this.left)||(rect.top!=this.top)||(rect.width!=this.width)||(rect.height!=this.height)||(rect.origin_left_top!=this.origin_left_top))
return false;return true;}
rect.prototype.is_empty=function(){return((isNaN(this.top)||isNaN(this.left))||(this.top==0)&&(this.left==0)&&(this.is_degenere()));}
rect.prototype.is_degenere=function(){return(isNaN(this.width)||isNaN(this.height))||((this.width==0)&&(this.height==0));}
rect.prototype.project=function(projctr){if(!projctr){throw new Error("Invalid projector instance.");}
var lt=new point(this.left,this.top);var rb=new point(this.get_right(),this.get_bottom());lt=projctr.project_pnt(lt);rb=projctr.project_pnt(rb);return new rect(lt.get_x(),lt.get_y(),Math.abs(lt.get_x()-rb.get_x()),Math.abs(lt.get_y()-rb.get_y()),false);}
function recursive_error(msg,inner){this.message=msg;this.inner_error=inner;}
new recursive_error();recursive_error.prototype=new Error();recursive_error.prototype._get_error_str=function(err){if(err==null)
return"";var str=":: ";if(err.fileName)
str+=err.fileName;if(err.lineNumber)
str+=" (line "+err.lineNumber+") - ";str+=err.name+": "+err.message;return str;}
recursive_error.prototype._get_recursive_msg=function(err){if(err==null)
return"";var str=this._get_error_str(err);if(err.inner_error)
str+="\n"+this._get_recursive_msg(err.inner_error);return str;}
recursive_error.prototype.get_message=function(){var str=this._get_error_str(this);str+="\n"+this._get_recursive_msg(this.inner_error);return str;}
function reflection(){};reflection.obj_implement_interface=function(obj,i_trg){if((!obj)||(!i_trg))
return"all members";for(var cur_prp in i_trg){if(obj[cur_prp]==null)
return cur_prp;}
return"";};reflection.bind=function(trg_obj,trg_fct,erase_def_param){var method_name="reflection.bind(Object, Function, Boolean)";var msg="";if(!trg_obj)
msg="Target Object";if(!trg_fct)
msg="Target Function";if((!trg_obj)||(!trg_fct)){var error=new Error("Invalid parameter instance :"+msg);error.name=method_name;throw error;}
var param=arguments;var fct=function(){try{var start=(erase_def_param)?0:arguments.length;for(k=3;k<param.length;k++){arguments[start]=param[k];start++;arguments.length++;}
var ret=trg_fct.apply(trg_obj,arguments);return ret;}catch(err){throw err;}};return fct;};TabulaJs.bind=reflection.bind;reflection.bind_function=function(trg_fct,erase_def_param){var method_name="reflection.bind_function(Function, Boolean)";if(!trg_fct){var error=new Error("Invalid parameter instance: Target Function");error.name=method_name;throw error;}
var param=arguments;var fct=function(){try{var start=(erase_def_param)?0:arguments.length;for(k=2;k<param.length;k++){arguments[start]=param[k];start++;arguments.length++;}
var ret=trg_fct.apply(null,arguments);return ret;}catch(err){alert(err);var error=new recursive_error("Unknown closure error",err);error.name=method_name;throw error;}};return fct;};function roller_animator(){generic_animator.call(this);this.increase_size=1;};roller_animator.prototype=new generic_animator();roller_animator.prototype._clone=function(ret){generic_animator.prototype._clone.call(this,ret);ret.increase_size=this.increase_size;};roller_animator.prototype.clone=function(){var ret=new roller_animator();this._clone(ret);return ret;};roller_animator.prototype._virtual_internal_start=function(trg,controlled){this.topPosition=trg.offsetTop;trg.style.position="absolute";trg.style.overflow="hidden";trg.parentNode.style.overflow="hidden";};roller_animator.prototype._virtual_internal_step=function(trg,controlled){var trg_height=dom_inspector.get_abs_sz(trg).height
if(this.topPosition+trg_height<0)
this.topPosition=dom_inspector.get_abs_sz(trg.parentNode).height;this.topPosition-=this.increase_size;trg.style.top=parseInt(this.topPosition)+"px";};roller_animator.prototype._virtual_internal_end=function(trg){this._virtual_internal_step(trg,false);};roller_animator.prototype._virtual_internal_interrupt=function(trg){if(!trg)
return;};function size(w,h){this.width=(w)?w:0;this.height=(h)?h:0;}
new size(0,0);size.prototype.toString=function(){var res="";res+="size W="+this.width+" H="+this.height;return res;}
size.prototype.delta=function(dx,dy){this.width+=dx;this.height+=dy;}
size.prototype.is_empty=function(){return((this.width==0)&&(this.height==0));}
size.prototype.is_degenere=function(){return((this.width==0)||(this.height==0));}
TabulaJs.Stream=function(str){this._cll=null;this.reset(str);};TabulaJs.Stream.CLASS_NAME="TabulaJs.Stream";TabulaJs.Stream.prototype.toString=function(){return TabulaJs.Stream.CLASS_NAME;};TabulaJs.Stream.prototype.reset=function(str){this._cll=null;this.append(str);};TabulaJs.Stream.prototype.append=function(str){if(!this._cll)
this._cll=new Array();if(str)
this._cll.push(str);};TabulaJs.Stream.prototype.build=function(){if(!this._cll)
return"";return this._cll.join("");};function UniqueValues(){};UniqueValues.generate=function(){var generatedTime1=parseInt(Math.random()*new Date().getTime());var generatedNumber1=parseInt(Math.random()*99999999);var generatedNumber2=parseInt(Math.random()*99999999);var generatedTime2=parseInt(Math.random()*new Date().getTime());var generatedNumber=("0000000000000000"+generatedNumber1+generatedNumber2)
var generatedTime=("0000000000000000"+generatedTime1+generatedTime2)
generatedNumber=generatedNumber.substr(generatedNumber.length-16)+
generatedTime.substr(generatedTime.length-16);var ret=generatedNumber.substr(0,8)+"-";ret+=generatedNumber.substr(8,4)+"-";ret+=generatedNumber.substr(12,4)+"-";ret+=generatedNumber.substr(16,4)+"-";ret+=generatedNumber.substr(20);return ret;};function unit_of_measure(){}
new unit_of_measure();unit_of_measure.KM=0;unit_of_measure.M=1;unit_of_measure.CM=2;unit_of_measure.MM=3;unit_of_measure.INCH=4;unit_of_measure.MI=5;unit_of_measure.inch_2_uom=function(uom){var inch_2_cm=2.54;if(uom==unit_of_measure.KM)
return inch_2_cm/100000.0;if(uom==unit_of_measure.M)
return inch_2_cm/100.0;if(uom==unit_of_measure.CM)
return inch_2_cm/1;if(uom==unit_of_measure.MM)
return inch_2_cm*10;if(uom==unit_of_measure.MI)
return((inch_2_cm/100000.0)/1609);return 1;}
unit_of_measure.mile_2_uom=function(uom){var mi_2_km=1.609;if(uom==unit_of_measure.MM)
return mi_2_km*1000000;if(uom==unit_of_measure.CM)
return mi_2_km*100000;if(uom==unit_of_measure.M)
return mi_2_km*1000;if(uom==unit_of_measure.KM)
return mi_2_km/1.0;if(uom==unit_of_measure.INCH)
return((mi_2_km*100000.0)/2.54);return 1;}
function UrlVerifier(){this._css_def="";this._css_hide="";this._css_show="";this._target_tag="";this._connected=false;this._server_timeout=null;this._animation_timeout=null;this._urls=null;}
UrlVerifier.ANIMATION_TIMEOUT=300;UrlVerifier.VERIFY_SERVER_TIMEOUT=90000;UrlVerifier.prototype._success=function(xhr,item){try{item.connected=true;this._upgradeCss();}catch(exc){this._failed(xhr,exc);}finally{if(xhr)
xhr.dispose();}}
UrlVerifier.prototype._failed=function(xhr,item){try{item.connected=false;item.err=item.url+" error ("+xhr.status()+"): "+xhr.statusText();this._upgradeCss();}catch(exc){}finally{if(xhr)
xhr.dispose();}}
UrlVerifier.prototype._verifyUrl=function(item){var xhr=new TabulaJs.HttpConnector();xhr.sendAsync(item.url,TabulaJs.HttpConnector.POST,item.params,this._success,this._failed,this,item);}
UrlVerifier.prototype._verifyUrls=function(){this._server_timeout=null;var it=this._urls.get_iterator();while(it.move_next()){var cur=it.get_current();this._verifyUrl(cur);}}
UrlVerifier.prototype._upgradeCss=function(){try{var it=this._urls.get_iterator();while(it.move_next()){var cur=it.get_current();if(!cur.connected){this._toggleCss(new Error(cur.err));return;}}
this._normalCss();}catch(exc){}finally{if(!this._server_timeout){var fct=reflection.bind(this,this._verifyUrls);this._server_timeout=window.setTimeout(fct,UrlVerifier.VERIFY_SERVER_TIMEOUT);}}}
UrlVerifier.prototype._toggleCss=function(exc){if(this._animation_timeout){window.clearTimeout(this._animation_timeout);this._animation_timeout=null;}
var trg=document.getElementById(this._target_tag);if(trg==null)
return;var css=trg.className;if(css==this._css_show)
trg.className=this._css_hide;else
trg.className=this._css_show;if(exc)
trg.setAttribute("title",exc.message);var fct=reflection.bind(this,this._upgradeCss,true);this._animation_timeout=window.setTimeout(fct,UrlVerifier.ANIMATION_TIMEOUT);}
UrlVerifier.prototype._normalCss=function(){var trg=document.getElementById(this._target_tag);if(trg==null)
return;trg.className=this._css_def;trg.setAttribute("title","Atualmente connesso");}
UrlVerifier.prototype.init=function(css_def,css_hide,css_show,tag){this._css_def=css_def;this._css_hide=css_hide;this._css_show=css_show;this._target_tag=tag;if(!this._urls)
this._urls=new collection();this._verifyUrls();}
UrlVerifier.prototype.appendUrl=function(server_url,send_str){if(!this._urls)
this._urls=new collection();this._urls.add({url:server_url,params:send_str,connected:false,err:""});}
UrlVerifier.prototype.stop=function(){if(this._server_timeout){window.clearTimeout(this._server_timeout);this._server_timeout=null;}
if(this._animation_timeout){window.clearTimeout(this._animation_timeout);this._animation_timeout=null;}}
function utility_lib(){}
new utility_lib();utility_lib.check_library=function(){var method_name="utility_lib.check_library()";var msg="";try{msg="";}catch(exc){var re=new Error("Depend library \""+msg+"\" not found: "+exc.message);re.name=method_name;throw re;}}
utility_lib.get_version=function(){var ver=new version();ver.init("1.0.0");return ver;}
function version(val){this._version="0.0.0.0";this.init(val);};version.SEPARATOR_CHAR=".";version.prototype.init=function(val){this._version=(!val)?"0.0.0.0":val;};version.prototype.toString=function(){return this._version;};version.prototype.get_subversions=function(sep){if(!sep)
sep=version.SEPARATOR_CHAR;var ret=this._version.split(sep);return ret;};version.prototype.is_same=function(ver){var method_name="version.prototype.is_same(version)";if(ver==null){var error=new Error("Invalid instance object: version");error.name=method_name;throw error;}
return(this._version==ver._version);};version.prototype.is_greather=function(ver){var method_name="version.prototype.is_greather(version)";if(ver==null){var error=new Error("Invalid instance object: version");error.name=method_name;throw error;}
var this_param=this.get_subversions();var ver_param=ver.get_subversions();var lower=Math.min(this_param.length,ver_param.length);for(var i=0;i<lower;i++){if(this_param[i]>ver_param[i])
return true;if(this_param[i]<ver_param[i])
return false;}
return(this_param.length>=ver_param.length);};version.prototype.is_younger=function(ver){return!(this.is_greather(ver));};function zoom_animator(){generic_animator.call(this);this._zoom_fct=1;this._delta=null;this.end_rect=null;this.start_rect=null;};zoom_animator.prototype=new generic_animator();zoom_animator.prototype._clone=function(ret){generic_animator.prototype._clone.call(this,ret);ret._zoom_fct=this._zoom_fct;ret._delta=this._delta;if(this.end_rect)
ret.end_rect=this.end_rect.clone();if(this.start_rect)
ret.start_rect=this.start_rect.clone();};zoom_animator.prototype.clone=function(){var ret=new zoom_animator();this._clone(ret);return ret;};zoom_animator.prototype._zoom_to_rect=function(trg,cnt,sz){var method_name="zoom_animator.prototype._zoom_to_rect(HtmlElement, point, size)";var msg="";if(!trg)
msg="HtmlElement";if(!cnt)
msg="point";if(!sz)
msg="size";if(msg!="")
throw new Error(method_name+" Invalid instance object: "+msg);trg.style.width=sz.width+"px";trg.style.height=sz.height+"px";trg.style.left=(cnt.x-(sz.width/2))+"px";trg.style.top=(cnt.y-(sz.height/2))+"px";};zoom_animator.prototype._virtual_internal_start=function(trg,controlled){var x_zc=this.end_rect.width-this.start_rect.width;var y_zc=this.end_rect.height-this.start_rect.height;this._zoom_fct=new point(x_zc,y_zc);var end_cnt=this.end_rect.get_center();var start_cnt=this.start_rect.get_center();this._delta=new point(end_cnt.x-start_cnt.x,end_cnt.y-start_cnt.y);};zoom_animator.prototype._virtual_internal_step=function(trg,controlled){if(this._current==0)
return;var prestep=(this._current-this._starting)/this._duration;sz=new size(this.start_rect.width+(this._zoom_fct.x*prestep),this.start_rect.height+(this._zoom_fct.y*prestep));var x_inc=(this._delta.x*prestep);var y_inc=(this._delta.y*prestep);var tmp=this.start_rect.get_center();var cnt=new point(tmp.x+x_inc,tmp.y+y_inc);this._zoom_to_rect(trg,cnt,sz);};zoom_animator.prototype._virtual_internal_end=function(trg){this._current=this._starting+this._duration;this._virtual_internal_step(trg);};
