		function linkFade(x,y,z) {
			$(x).hoverIntent(function() {
				$(this).css({color:y});
			}, function() {
				$(this).animate({color:z},650);
			});
		}
		
		//equalise the height of whatever elements are passed
		function sameHeight(x) {
			var arrayH =new Array();
			var i = 0;
			var maxH = 0;
			$(x).each(function() {
				arrayH[i] = $(this).height();
				i = i+1;
			});
			maxH = arrayH[0];
			var y = 0;
			for (y=0;y<=(arrayH.length-1);y++) {
				if (arrayH[y] > maxH) {
					maxH = arrayH[y];
				};
			};
			$(x).each(function() {
				$(this).css({height:maxH});
			});
		}

		$(document).ready(function() {
		
			sameHeight("#sub-stories h2");

			//detect browser - link fade doesn't work well in older IE
			var browser=navigator.appName;
			var b_version=navigator.appVersion;
			var version=parseFloat(b_version);
			//if browser is IE and less than 7 then disable link fading
			if ((browser=="Microsoft Internet Explorer") && (version<7))
			{} else {
				//various mouse over fades for links
				linkFade("p.arrow a","#b8400b","#404801");
				linkFade("h3.menuheader span","#B8400B","#fff");
				linkFade(".nav-menu ul.top-level li a","#B8400B","#fff");
				linkFade(".nav-menu ul.categoryitems li a","#000","#fff");
				linkFade("p.main-btn a","#FFFF33","#fff");
				linkFade("#more-news h2","#b8400b","#333");
			};
			
			//more-news hide/show
			var headHeight = ($("#more-news h2").height()+20);
			var spanHeight = $("#more-news").height();

			$("#more-news").css({height:headHeight,overflow:"hidden"});
			$("#more-news h2").addClass("more-show").css({cursor:"pointer"});
			
			var openState = 0; //openState is closed
			
			$("#more-news h2").click(function(){
				if (openState == 0) {
					//is closed, open it
					$("#more-news").animate({height:spanHeight},500,function() {
						$("#more-news h2").removeClass("more-show");
						$("#more-news h2").addClass("more-hide");
					});
					openState = 1;
				}else{
					//is open, close it
					$("#more-news").animate({height:headHeight},500,function() {
						$("#more-news h2").removeClass("more-hide");
						$("#more-news h2").addClass("more-show");
					});
					openState = 0;
				};
			});
		
		});
		
		var player = null; 
		function playerReady(thePlayer) { player = window.document[thePlayer.id]; };
		function loadMovie(movie) { 
			player.sendEvent("LOAD",movie);
			player.sendEvent("PLAY","true");
		};
		
		 //---------------------------------\\
		//--------homepage promo tabs--------\\
		
		function liSet(x){
			$("[class="+x+"]").children("a").css({
				color:"#B8400B",
				background:"url(img/tiny-play.gif) no-repeat left #fff",
				borderBottom:"1px solid #9e9e9e",
				borderLeft:"1px solid #9e9e9e",
				borderRight:"1px solid #9e9e9e",
				borderTop:"1px solid #fff",
				paddingLeft:"20px"
			});
		};
		
		$(document).ready(function(){
			//count list items and give each an ID
			var liCount = 0;
			$("#promo-list ul").children("li").each(function(){
				liCount = liCount + 1;
				$(this).attr("class", "li"+liCount);
				$(this).children("a").attr("href", "#");
			});
			
			//set current ID as the latest
			var liCurrent = "li"+liCount;
			liSet(liCurrent);
			$("#promo-list h3").css({display:"none"});
	
			$("#promo-list ul li a").click(function() {
				//revert current li
				$("[class="+liCurrent+"]").children("a").css({
					color:"#242424",
					background:"none",
					borderBottom:"none",
					borderLeft:"none",
					borderRight:"none",
					borderTop:"none",
					paddingLeft:".3em"
				});

				//change current tab to attr class of this and change display
				liCurrent = $(this).parent("li").attr("class");
				$(this).css({
					color:"#B8400B",
					background:"url(img/tiny-play.gif) no-repeat left #fff",
					borderBottom:"1px solid #9e9e9e",
					borderLeft:"1px solid #9e9e9e",
					borderRight:"1px solid #9e9e9e",
					borderTop:"1px solid #fff",
					paddingLeft:"20px"
				});
			});

		});
