Index: trunk/grails-app/services/AssetTreeService.groovy
===================================================================
--- trunk/grails-app/services/AssetTreeService.groovy	(revision 319)
+++ trunk/grails-app/services/AssetTreeService.groovy	(revision 322)
@@ -3,5 +3,5 @@
     boolean transactional = false
 
-    def js = new JavascriptService()
+    def js = new JsUtilService()
 
     def g = new org.codehaus.groovy.grails.plugins.web.taglib.ApplicationTagLib()
@@ -84,5 +84,5 @@
 
                 div(class: paneCloseHtmlClass()) {
-                    a( href: js.hrefToggle(paneHtmlId()) ) {
+                    a( href: js.toggle(paneHtmlId()) ) {
                         img(src: closeImg())
                     }
@@ -106,5 +106,5 @@
                 div( class: 'buttons') {
                     span(class: 'button') {
-                        input( type: 'button', value: g.message(code: 'default.close.text'), onclick: js.onclickToggle(paneHtmlId()) )
+                        input( type: 'button', value: g.message(code: 'default.close.text'), onclick: js.toggle(paneHtmlId(), "onclick") )
                     }
                 } // button div
@@ -132,5 +132,5 @@
                                 li() {
                                     if(site.sections) {
-                                        a(href: hrefToggleBranch(nextDivId()) ) {
+                                        a(href: toggleBranch(nextDivId()) ) {
                                             img( src: branchImg(divId), id: divId+'img' )
                                         }
@@ -152,5 +152,5 @@
                                                 li() {
                                                     if(section.assets) {
-                                                        a( href: hrefToggleBranch(nextDivId()) ) {
+                                                        a( href: toggleBranch(nextDivId()) ) {
                                                             img(src: branchImg(divId), id: divId+'img' )
                                                         }
@@ -173,5 +173,5 @@
                                                                 li() {
                                                                     if(asset.assetSubItems) {
-                                                                        a( href: hrefToggleBranch(nextDivId()) ) {
+                                                                        a( href: toggleBranch(nextDivId()) ) {
                                                                             img(src: branchImg(divId), id: divId+'img' )
                                                                         }
@@ -197,5 +197,5 @@
                                                                                 li() {
                                                                                     if(assetSubItemL1.subItems) {
-                                                                                        a( href: hrefToggleBranch(nextDivId()) ) {
+                                                                                        a( href: toggleBranch(nextDivId()) ) {
                                                                                             img(src: branchImg(divId), id: divId+'img' )
                                                                                         }
@@ -218,5 +218,5 @@
                                                                                                 li() {
                                                                                                     if(assetSubItemL2.subItems) {
-                                                                                                        a( href: hrefToggleBranch(nextDivId()) ) {
+                                                                                                        a( href: toggleBranch(nextDivId()) ) {
                                                                                                             img( src: branchImg(divId), id: divId+'img' )
                                                                                                         }
@@ -239,5 +239,5 @@
                                                                                                                 li() {
                                                                                                                     if(assetSubItemL3.subItems) {
-                                                                                                                        a( href: hrefToggleBranch(nextDivId()) ) {
+                                                                                                                        a( href: toggleBranch(nextDivId()) ) {
                                                                                                                             img( src: branchImg(divId), id: divId+'img' )
                                                                                                                         }
@@ -260,5 +260,5 @@
                                                                                                                                 li() {
             //                                                                                                                         if(assetSubItemL4.subItems) {
-            //                                                                                                                             a( href: hrefToggleBranch(nextDivId()) ) {
+            //                                                                                                                             a( href: toggleBranch(nextDivId()) ) {
             //                                                                                                                                 img( src: branchImg(divId), id: divId+'img' )
             //                                                                                                                             }
@@ -365,6 +365,6 @@
     }
 
-    def hrefToggleBranch(divId) {
-       'javascript: toggleBranch(\"' + divId + '\", \"' + divId + 'img' +'\", \"' + bulletTreeMinusImg() +'\", \"' + bulletTreePlusImg() + '\");'
+    def toggleBranch(divId) {
+        js.toggleWithImg(divId, divId + 'img', bulletTreeMinusImg(), bulletTreePlusImg())
     }
 
