// JavaScript Document


App = {};

window.addEvent("unload", function(event){
	
});

window.addEvent("domready", function(){
	var tempEl = null, scaleTabIndex = null;
	
	//========= initiate tool tip class
	App.toolTip = new Tips('.tooltip', {className: "tips" });
	
	//==========create an instance of the notify class
	App.roar = new Roar({ position: "topLeft", duration: 10000 });
	
});
		
		
		
		
/***********************************************/
/**********    EXTEND NATIVES    		********/
/***********************************************/
Element.implement({
	hide: function(){
		this.setStyle("display", "none");
	},
	show: function(){
		this.setStyle("display", "block");
	},
	visible: function(){
		this.setStyle("visibility", "visible");
	},
	invisible: function(){
		this.setStyle("visibility", "hidden");
	}
});


/*******************************************/
/**********    UTLITY FUNCTIONS	    ********/
/*******************************************/
App.storeEvents = function(el, eventName, arr){
	var events = {
        'el': el,
        'eventName': eventName
    };
	if (arr){
		arr.push(events);
	} else {
	    App.events.push(events);	
	}
	
	//alert(events + " " + App.events)
}
App.garbageEvents = function(){
	var i = 0;
    for (i=0; i<App.events.length;i++){
		if(App.events[i].el){
			App.events[i].el.removeEvents();
		}
	}
}

App.collectGarbage = function(object){
	if (object){
		$each(object, function(item, i){
			//if ($type(item) == "element"){ item.destroy(); }
			if ($type(item) == "array"){ item.empty(); }
			item = null;
		});	
	}
	object = null;
}

		