// JavaScript Document
Common = {}

// Common.addEvent(obj, name, fun): add _fun_ as a handler for event _name_
//	on element _obj_. This will choose the most appropriate event-handling
//	system based on the browser.
//	e.g.  Common.addEvent(myElement, 'click', function() { ... });

Common.addEvent = function(obj, name, fun) {
	if (obj.addEventListener) {
		// Mozilla, Safari, Opera, and other W3C-compatible browsers
		obj.addEventListener(name, fun, false);
	} else if (obj.attachEvent) {
		// IE 5+
		obj.attachEvent('on'+name, fun);
	} else {
		// Save the previous event handler, and call it before the new one.
		// This is only needed for IE4 and below.
		var oldHandler = obj['on'+name];
		obj['on'+name] = function(e) {
			if (!e) var e = window.event;
			if (oldHandler) oldHandler(e);
			fun(e);
		};
	}
};

function getURL(url)
{
	var nohttp = url.split('//')[1];
	var result = nohttp.split('/')[1];
	return result;
}

function ChangeActive() {
	void(0);
	var url=window.location.href;	
	links = document.getElementsByTagName('a');
	for(var i = 0; i<links.length; i++) {		
		if(document.links[i].href==url){			
			my_sub=links[i].id.substring(0,4);
			if (my_sub!=""){
				document.getElementById(my_sub).style.display="";
				mysub_image=my_sub+"_image";
				document.getElementById(mysub_image).src='tl_files/AAPB/collapsebtn.gif';
			} 
			if (document.links[i].id.substring(0,3)=="sub")
			{
				links[i].style.color='#0B416C';
			}
		} 
	}
}

//window.onload=ChangeActive;
Common.addEvent(window, 'load', function() {
	//ChangeActive();
});
