var bigLinks = function(){

	/*  Make a block elements (div) clickable (to first and only link).

			author: mike foskett - http://websemantics.co.uk

			version 1 - 23/06/2009

			parameters:

				initClass:             pass in the element name to search,

						followed by a list of class names.

			Each block has the hoverClass added on mouse over.

	*/

	var hoverClass='hover'; // class added to container on mouseover

 

	/* author: Simon Willisons - http://simonwillison.net/2004/May/26/addLoadEvent/ */

	function addLoadEvent(f){var o=window.onload;if(typeof window.onload!='function'){window.onload=f;}else{window.onload=function(){if(o){o();}f();};}}

 

	function blockClicked(){window.location=this.getElementsByTagName('a')[0].href;}

	function hoverOn(){this.className+=this.className?' '+hoverClass:hoverClass;}

	function hoverOff(){this.className=this.className.replace(' '+hoverClass,'').replace(hoverClass,'');}

 

	function attachActions(o){

		// add events only if there's a single contained link

		if (o.getElementsByTagName('a')[0] && !o.getElementsByTagName('a')[1]){

			o.onclick=blockClicked;

			o.onmouseover=hoverOn;

			o.onmouseout=hoverOff;

	} }

 

	function initClass(){

		if (arguments.length>1){ // must be at least 2 arguments

			for(var i=arguments.length-1;i>-0;i--){

				var objs=document.getElementsByTagName(arguments[0]); // 1st argument is the elements to search

				// cycle through elements using a 'fast' loop

				for(var j=objs.length-1;j>-1;j--){

					if (objs[j].className.match(arguments[i])){ // 2+ arguments are class name(s) to match

						attachActions(objs[j]);

	}              } } } }

 

	return{

		addLoadEvent:addLoadEvent,

		initClass:initClass

	};

 

}();

 

bigLinks.addLoadEvent(function(){

  bigLinks.initClass('div','bigLink');

});

