// This creates rollovers for the main nav buttons so they change colour on rollover of the whole block rather than just the href link

//set the variables
var promoEffect   = {};
promoEffect.divs  = [];
promoEffect.re    = /showbox\d+/;

//defensive test
if( document.getElementsByTagName ) {
	//get all the div tags
	promoEffect.allDivs = document.getElementsByTagName( "div" );
	
	//filter out the ones we need
	for( var i=0; i<promoEffect.allDivs.length; i++ ) {          
		if ( promoEffect.re.test( promoEffect.allDivs[i].id ) ) {
			promoEffect.divs.push( promoEffect.allDivs[i] );
		}
	}
	
	//apply event handlers
	for ( var i=0; i<promoEffect.divs.length; i++ ) {
		promoEffect.divs[i].aTag    = ( promoEffect.divs[i].getElementsByTagName( "a"    ) )? promoEffect.divs[i].getElementsByTagName( "a"    ) : "";
		
		//check we have what we need before we move on
		if ( promoEffect.divs[i].aTag ) {
			promoEffect.divs[i].onclick = function() {
				location.href = this.aTag[0].href;
			}
		
			promoEffect.divs[i].onmouseover = function() {
				this.style.cursor = 'pointer';
				this.aTag[0].className = "boxlink_hover";
			}
			
			promoEffect.divs[i].onmouseout = function() {
				this.aTag[0].className = "boxlink";
			}
		} 	
	}
}