/** Functions **/
	
	/* Roadmap slider */
	
		var roadmapSlide = new Array(); //an array of the roadmap slides
		var roadmapSlideButton = new Array(); //an array of the roadmap slide buttons
		var currentRoadmapSlide = 1;
		var totalRoadmapSlides = 0;
		var roadmapTimer = 0;
		function roadmapSlider(timeout,animated) {
			return roadmapSlider(timeout,animated,null,true);
		}
		function roadmapSlider(timeout,animated,select,showButton) {
			
			//create an array of the roadmap slides
			$("div.roadmap-slide").each(function (i) {
				count = (i + 1);
				roadmapSlide[count] = $(this);
			});
			
			//set total number of slides
			totalRoadmapSlides = roadmapSlide.length - 1;
			
			//create an array of the roadmap slide buttons
			$("a.roadmap-slide-button").each(function (i) {
				count = (i + 1);
				roadmapSlideButton[count] = $(this);
				$(this).click(function(){
					clearInterval(roadmapTimer);
					//changeRoadmapSlider(i);
					return true;
				});
			});
			
			//fadeOut all but first slide
			$("div.roadmap-slide").not(roadmapSlide[currentRoadmapSlide]).css("display","none");
			
			if(select == null){
				if(animated == 1){
					//set animation interval
					roadmapTimer = setInterval(function(){
						changeRoadmapSlider();
					}, timeout);
				}
			} else {
				var selectIndex = 0;
				for(i=1;i<=totalRoadmapSlides;i++){
					if(roadmapSlideButton[i].text() == select){
						selectIndex = i;
						break;
					}
				}
				
				if(selectIndex > 0 && currentRoadmapSlide!=selectIndex) changeRoadmapSlider(selectIndex-1);
			}
			
			if(showButton == false){
				$('a.button-roadmap').hide();
			}
		}
		
		function changeRoadmapSlider(selected) {
			// if a slide button has been clicked
			if (typeof selected != 'undefined') {
				currentRoadmapSlide = selected + 1;
				$("div.roadmap-slide").stop(true,true);
			}
			else {
				if (currentRoadmapSlide == totalRoadmapSlides) {
					currentRoadmapSlide = 1;
				}
				else {
					currentRoadmapSlide = currentRoadmapSlide + 1;
				}
			}
			// fade out current and show next
			if ($.browser.msie && $.browser.version.substr(0,1)<7) {
				$("div.roadmap-slide").css("display", "none");
				roadmapSlide[currentRoadmapSlide].css("display", "block");							
				$("a.roadmap-slide-button").removeClass("active");							
				roadmapSlideButton[currentRoadmapSlide].addClass("active");
				Cufon.replace('ul.roadmap-menu>li>a', {hover: true, fontFamily: 'kozuka-gothic-pro-light' });
			}
			else {
				$("div.roadmap-slide").fadeOut();
				roadmapSlide[currentRoadmapSlide].pause(400).fadeIn();							
				$("a.roadmap-slide-button").pause(400).removeClass("active");							
				roadmapSlideButton[currentRoadmapSlide].pause(400).addClass("active");	
				Cufon.replace('ul.roadmap-menu>li>a', {hover: true, fontFamily: 'kozuka-gothic-pro-light' });
			}
		}
	
	
$(document).ready(function(){
	/**
	 * Site designed and created by NuBlue (www.nublue.co.uk)
	 */
	/** Page setup  **/
	
		//Open external links in new tab
		$("a.external").attr({ target: "_blank" });
		
		//Remove outlines from clicked links
		$("a").click(function() {
			$(this).blur();
		});
		
		//disappearing default field values
		$("input.toggle, textarea.toggle").each(function() { this.defaultText = this.value; $(this).focus(function() { if (this.value == this.defaultText) this.value = ""; }).blur(function() { if (this.value == "" && this.defaultText) this.value = this.defaultText; });} );
	
		//navigation hover states
		$(".submenu-wrapper1").hover(
			function () {
				$(this).prev().addClass('active');
			},
			function () {
				$(this).prev().removeClass('active');
			}
		);
		
		//ie6 navigation hover fix
		if ($.browser.msie && $.browser.version.substr(0,1)<7) {
			$("ul#navigation li").hover(
				function () {
					$(this).children('.submenu-wrapper1').css('display', 'block');
				},
				function () {
					$(this).children('.submenu-wrapper1').css('display', 'none');
				}
			);
		}
		
		//back buttons
		$("a.button-back").click(function () {
			history.go(-1);
			return false;
		});
	
		//print buttons
		$("a.icon-print").click(function () {
			window.print();
			return false;
		});
	
});
