anchor.diff:      });  
   */    
       
  +    //$("body").append('<div id="loading"></div>');
  +    //$("#loading").css("color","red");
  +    $(document).ajaxStart(function(){
  +    // this is weird, it will not show if the alert is not included??
  +       //return false;
  +       //var img = $('<a href="#"><img src="static/images/jquery/ajax-loader.gif" /></a>')
  +       $("#loading").show();
  +       //alert ("start Ajax");
  +       //return false;
  +     });
  +
  +    $(document).ajaxComplete(function(){
  +       //alert ("complete Ajax");
  +       $("#loading").hide();
  +       //return false;
  +     });
  +    
  +    
       $("#generate").click(function(){ 
       
          $.ajax({
  
positive.code:         </div>
    </html:form>
  </body>
   </html>
negative.code:        return false;
        }); 
              
              
              
       $("#add0").click(function(){    
       // click 'add' for 000001
            alert ("top add");
         
         
                   var trNode = $(this).parents('tr:eq(0)');
            //alert(trNode.children('td:eq(1)').children('input:eq(0)').attr("value")+"-"+trNode.children('td:eq(2)').children('input:eq(0)').attr("value"));
  
           if (trNode.children('td:eq(1)').children('input:eq(0)').attr("value") == "") {
             alert("must enter research area code");
           } else if (trNode.children('td:eq(2)').children('input:eq(0)').attr("value") == "") {
             alert("must enter research area");
           } else {
           
           // check if code exists
               var raExist
               $.ajax({
                   url: 'researchAreas.do',
                   type: 'GET',
                   dataType: 'html',
                   data:'researchAreaCode='+trNode.children('td:eq(1)').children('input:eq(0)').attr("value")+'&addRA=Y',
                   cache: false,
                   async: false,
                   timeout: 1000,
                   error: function(){
                      alert('Error loading XML document');
                   },
                   success: function(xml){
                      $(xml).find('h3').each(function(){
                         raExist = $(this).text();
                      //alert(raExist);
          
                       });
                    }
                 });   // end ajax  
           
           
             if (raExist == 'false') {
                 var ulTag = $("#example");
                                                            
                 var item_text = trNode.children('td:eq(1)').children('input:eq(0)').attr("value") +" : "+trNode.children('td:eq(2)').children('input:eq(0)').attr("value");
                 var listitem = setupListItem(item_text);
                 //alert(listitem.html());
              // need this ultag to force to display folder.
              var childUlTag = $('<ul></ul>').attr("id","ul"+i);
              childUlTag.appendTo(listitem);
                 listitem.appendTo(ulTag);
                 //alert("ultagid "+ulTag.attr("id").substring(2));
                 // force to display folder icon
                 $("#example").treeview({
                     add: listitem
                 // toggle: function() {
                 //   var subul=this.getElementsByTagName("ul")[0]
                 //   if (subul.style.display=="block")
                 //      alert("You've opened this Folder!")
                 //   } 
                 });
                 
                 // apend to sqlScripts
                 sqlScripts = sqlScripts +"#;#"+getInsertClause(trNode.children('td:eq(1)').children('input:eq(0)').attr("value"), '000001', trNode.children('td:eq(2)').children('input:eq(0)').attr("value"));
                 //alert("sqlScripts = "+sqlScripts);
              }  else {
                   alert ("Research Area Code already exist");
              }
             };                                
         
          
         return false;
        }); // add0 
              
           
    // }); // $(document).ready
  
  