/*	This is the main unobtrusifier function - you can put
	all of your unobtrusified stuff in here
*/
function unobtrusifier() {
	
	/* This will check if the "mylinks" id exists.
	*/
	if(document.getElementById('mylinks')) {
		
		/*	This creates an array of all of the "a" tags in the "mylinks" div.
		*/
		var links = document.getElementById('mylinks').getElementsByTagName('a');
		
		/* 	This calculates how many items are in the array. It's best to calulate it
			outside of the loop, so it doesn't have to constantly do the same calculation
		*/
		linklength = links.length;
		
		/* 	This loops through the array, for as many times as there are items. As we only have
			2 items, it will loop through twice. The first value "var i = 0" is the initialization -
			it is only run once, as the very beginning. The second value, "i<linklength" is the condition. 
			If he condition is met, it will enter the loop.
			The third value, "i++" will be run at the end of each loop. In this case, it is incrementing
			"i" by one, each time it is run.
		*/
		for(var i=0;i<linklength;i++) {
			
			/* 	This is what is performed on each element in the array. You call the item by using the
				array name, which is "links" and appending [i], which will use the current element in
				the loop.
				When using an anonymous function such as this, you cannot refer to the element using
				links[i] andmore, because the onclick is not part of the loop when you click it, it is
				then part of the elemeent.
				I have the function alerting the "title" attribute of the link.
			*/
			links[i].onclick = function() { alert(this.title); return false; };
		};		
	};
};

/*	This is the "domLoader" function - It will wait until
	it can "see" the 'bottom' id. You can also make it run
	on a tag, so if you only use a <cite> at the bottom,
	you could do:
	
	var unobtrusifier = new domFunction(unobtrusifier, { 'cite' : 'tag'});
*/
var unobtrusifier = new domFunction(unobtrusifier, { 'bottom' : 'id'});