
var InTrouble = {
	init: function(){
                InTrouble.getTroublePage();
                InTrouble.getTroubleList();
                                     
	},



getTroublePage:function(){

$$('.hlsubmenu a').each(function(item) { 
	item.addEvent('click', function(e) { 
		new Event(e).stop(); 
		var url = this.getProperty('href'); 

	 new Ajax (url, { 
                        autoCancel: true,
			method: 'get',
                        update: $('maindiv'),
                        onRequest: 

                             function() {
                 			   
                 $('maindiv').empty().setHTML("<div class='divloader'> <img src='http://www.zipcodezoo.com/gallery/css/img/loading.gif' alt='Loading' /> </div>");
                 
                 
			}, 

                       
                        onFailure: function(){
                       

 $('maindiv').empty().setHTML("<div class='divloader'> No Species in Trouble Found. </div>");

                        },

                       
  
            evalScripts: true
                
		}).request();  
	}.bind(item)); 
});
},




getTroubleList:function(){

$$('.listalph a').each(function(item) { 
	item.addEvent('click', function(e) { 
		new Event(e).stop(); 
		var url = this.getProperty('href');  

	 new Ajax (url, { 
                        autoCancel: true,
			method: 'get',
                        update: $('tlist'),
                        onRequest: 

                             function() {			   
                 $('tlist').empty().setHTML("<div class='divloader'> <img src='/Indexes/images/indexes-loader.gif' alt='Loading' /> Loading... </div>");
                 
                 
			}, 

                       
                        onFailure: function(){
                       

 $('tlist').empty().setHTML("<div class='divloader'> No Species Found. </div>");

                        },  
            
          evalScripts: true      
		}).request();  
	}.bind(item)); 
});
}





};
window.addEvent('domready', InTrouble.init);

 