
function ToolbarElement(idObjIn,idFormIn,defStyleIn,overStyleIn,activeStyleIn,isActivableIn,imgSrcOverIn,imgSrcActiveIn){this.idObj=idObjIn;this.idForm=idFormIn;this.activable=isActivableIn;this.imgSrc=document.getElementById(this.idForm+":"+this.idObj).src;this.imgSrcOver=imgSrcOverIn;this.imgSrcActive=imgSrcActiveIn;this.defStyle=defStyleIn;this.activeStyle=activeStyleIn;this.overStyle=overStyleIn;this.bottoneAttivo=false;ToolbarElement.prototype.isBottoneAttivo=function(){return this.bottoneAttivo;}
ToolbarElement.prototype.isActivable=function(){return this.activable;}
ToolbarElement.prototype.getIdObj=function(){return this.idObj;}
ToolbarElement.prototype.getIdForm=function(){return this.idForm;}
ToolbarElement.prototype.getDefStyle=function(){return this.defStyle;}
ToolbarElement.prototype.getActiveStyle=function(){return this.activeStyle;}
ToolbarElement.prototype.getOverStyle=function(){return this.overStyle;}
ToolbarElement.prototype.seleziona=function(element){if(this.overStyle!=null&&this.overStyle!=''&&this.overStyle!=' '&&this.overStyle!='null'){rimuoviCalsseImgToolbar(element,this.defStyle);aggiungiCalsseImgToolbar(element,this.overStyle);}
if(this.imgSrcOver!=null&&this.imgSrcOver!=''&&this.imgSrcOver!=' '&&this.imgSrcOver!=null){element.src=document.getElementById(this.idForm+":"+this.idObj+"_imgOverVal").src;}}
ToolbarElement.prototype.deseleziona=function(element){if(!this.bottoneAttivo){if(this.overStyle!=null&&this.overStyle!=''&&this.overStyle!=' '&&this.overStyle!='null'){aggiungiCalsseImgToolbar(element,this.defStyle);rimuoviCalsseImgToolbar(element,this.overStyle);}
if(this.imgSrcOver!=null&&this.imgSrcOver!=''&&this.imgSrcOver!=' '&&this.imgSrcOver!=null){element.src=this.imgSrc;}}else{if(this.activeStyle!=null&&this.activeStyle!=''&&this.activeStyle!=' '&&this.activeStyle!='null'){rimuoviCalsseImgToolbar(element,this.defStyle);rimuoviCalsseImgToolbar(element,this.overStyle);aggiungiCalsseImgToolbar(element,this.activeStyle);}
if(this.imgSrcActive!=null&&this.imgSrcActive!=''&&this.imgSrcActive!=' '&&this.imgSrcActive!=null){element.src=document.getElementById(this.idForm+":"+this.idObj+"_imgActiveVal").src;}}}
ToolbarElement.prototype.attiva=function(element){if(this.activeStyle!=null&&this.activeStyle!=''&&this.activeStyle!=' '&&this.activeStyle!='null'){rimuoviCalsseImgToolbar(element,this.defStyle);rimuoviCalsseImgToolbar(element,this.overStyle);aggiungiCalsseImgToolbar(element,this.activeStyle);}
if(this.imgSrcActive!=null&&this.imgSrcActive!=''&&this.imgSrcActive!=' '&&this.imgSrcActive!=null){element.src=document.getElementById(this.idForm+":"+this.idObj+"_imgActiveVal").src;}
this.bottoneAttivo=true;}
ToolbarElement.prototype.disattiva=function(element){if(this.activeStyle!=null&&this.activeStyle!=''&&this.activeStyle!=' '&&this.activeStyle!='null'){aggiungiCalsseImgToolbar(element,this.defStyle);rimuoviCalsseImgToolbar(element,this.overStyle);rimuoviCalsseImgToolbar(element,this.activeStyle);}
if(this.imgSrcActive!=null&&this.imgSrcActive!=''&&this.imgSrcActive!=' '&&this.imgSrcActive!=null){element.src=this.imgSrc;}
this.bottoneAttivo=false;}}
function Toolbar(){this.toobarObjects=new Array();Toolbar.prototype.addObject=function(toolbarElement){this.toobarObjects[this.toobarObjects.length]=toolbarElement;}
Toolbar.prototype.select=function(element){for(var i=0;i<this.toobarObjects.length;i++){if(element.id==(this.toobarObjects[i].getIdForm()+":"+this.toobarObjects[i].getIdObj())){this.toobarObjects[i].seleziona(element);}}}
Toolbar.prototype.unselect=function(element){for(var i=0;i<this.toobarObjects.length;i++){if(element.id==(this.toobarObjects[i].getIdForm()+":"+this.toobarObjects[i].getIdObj())){this.toobarObjects[i].deseleziona(element);}}}
Toolbar.prototype.attiva=function(element){var oggDaAttivare=null;for(var i=0;i<this.toobarObjects.length;i++){if(element.id==(this.toobarObjects[i].getIdForm()+":"+this.toobarObjects[i].getIdObj())){oggDaAttivare=this.toobarObjects[i];}}
if(oggDaAttivare!=null&&oggDaAttivare.isActivable()){for(var i=0;i<this.toobarObjects.length;i++){if(element.id!=(this.toobarObjects[i].getIdForm()+":"+this.toobarObjects[i].getIdObj())&&this.toobarObjects[i].isActivable()&&this.toobarObjects[i].isBottoneAttivo()){this.toobarObjects[i].disattiva(document.getElementById(this.toobarObjects[i].getIdForm()+":"+this.toobarObjects[i].getIdObj()));}}
oggDaAttivare.attiva(element);}}}
function aggiungiCalsseImgToolbar(imgElement,className){if(className!=null&&className!=''&&className!=' '&&className!=null){gisJQuery(imgElement).addClass(className);}}
function rimuoviCalsseImgToolbar(imgElement,className){if(className!=null&&className!=''&&className!=' '&&className!=null){gisJQuery(imgElement).removeClass(className);}}
