	sfHover = function() {
		
	var sfEls = document.getElementById("cat_610262_divs").getElementsByTagName("li");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}

$j(document).ready(function(){	
/*ie6 hovers*/
sfHover();

/*Add links to sponsors*/		
$j("#sponsors td.photogalleryItem a").each
 (function (i) {
			if($j(this).attr('title')!=""){ //if it's not blank, then shoot it to the url, if it's blank, then let it lightbox
				newUrl = 'http://'+$j(this).attr('title');
				$j(this).attr('href',newUrl);
				$j(this).attr('target','_blank');
				$j(this).attr('rel','');
				$j(this).removeAttr('onclick');
			}
			});

/*Initialise accordion!*/

$j("#accordion").accordion({
	autoHeight: false,
	event: "mouseover"

});


/*remove sponsors box if contains empty message */
var emptySponsors=$j("#sponsors td.photogalleryItem:contains('This photo gallery has no pictures.')").length;
if(emptySponsors!=0){
	$j("#sponsors").html('<p>There are currently no sponsors for this discipline, if you wish to become a sponsor please <a href="/contact-us" title="Contact us and become a sponsor">contact us</a>.</p>');
}

/*Only show the events subnav on the pages it's needed*/

//Find the body id
var bodyId = $j("body").attr("id");
//Define what pages need it
var eventPages=["Show Jumping Events","Dressage Events","Rally Events","Show Horse Events","Eventing Events","Events Calendar"];
//Loopy function
function oc(a)
{
  var o = {};
  for(var i=0;i<a.length;i++)
  {
    o[a[i]]='';
  }
  return o;
}
//Sort through the array
if( bodyId in oc(eventPages) ) {$j("div#eventsnav").attr("style","display:block"); }else{ $j("div#eventsnav").remove(); }


});
