$(document).ready(function() {
	
	// main nav dropdowns
		
		// give li a .over class for IE & keep hover state on parent link
		$("div#header ul li").hover( function() {
    		$(this).addClass("over");
    		$("a:first", this).addClass("highlight");
  		}, function () {
    		$(this).removeClass("over");
    		$("a:first", this).removeClass("highlight");
  		});
  		
  		// return false on Services main nav
		$('a#main-services').click(function() {
  			return false;
		});
  		
  	// make Sector navigation li fully clickable
  	
		$("div.sectorContent div#sectorNav ul li").click(function() {
  			window.location = ($("a:first", this).attr("href"));
		});
		
		// give it a hover hand
		$("div.sectorContent div#sectorNav ul li").hover(function () {
    		$(this).addClass("hoverIt");
    		$(this).addClass("hit");
		}, function () {
    		$(this).removeClass("hoverIt");
    		$(this).removeClass("hit");
  		});
  		
  	// services drops
  		
  		// hide all service info
  		$("div.serviceInfo-inner").hide();
  		
  		// give each an 'inactive' class
  		$("div.serviceInfo").addClass("inactive");
  		
  		// on hover
		$("div.serviceInfo").hover(function () {
    		$(this).addClass("hoverIt");
    		$(this).removeClass("inactive");
		}, function () {
    		$(this).removeClass("hoverIt");
    		$(this).addClass("inactive");
  		});
  		
  		// reveal text
  		$("div.serviceInfo").click( function() {
  			
  			// if a link has been clicked stop propgation of events
  			$('div.serviceInfo a').click(function(e) {
  				e.stopPropagation();
			});
  			
  			// if not a link then carry on...
	  			$("div.serviceInfo-inner").slideUp("slow"); // hide any currently active
	  			$("div.serviceInfo").removeClass("current"); // remove current class from all
	  			
	  			// if current clicked text area is hidden show it
	  			if ($(this).children("div").is(":hidden")) {
	  				$(this).children("div").slideDown("slow"); // show clicked	
	  				$(this).addClass("current"); // set active class
	  			}
  			
  			return false;
  		});
  		
  	// clear form inputs
  		
  		// if value matches title (default)
  		$(".clearText").focus( function() {
			if ($(this).val() == $(this).attr("title")) {
				$(this).val("");
			}
		// if no value then reset to default
		}).blur( function() {
			if ($(this).val() == "") {
				$(this).val($(this).attr("title"));
			}
		});
		
	// homepage showcase links
		
		$("div#clientShowcase").click(function() {
  			window.location = ("/clients/");
		});
		
	// make sector hub arrows clickable
		
		$("div#sectorHub ul li").hover(function () {
    		$("a", this).addClass("jsover");
		}, function () {
    		$("a", this).removeClass("jsover");
  		});
	
		$("div#sectorHub ul li").click( function() {
			// get child href
			var hubLink = $("a", this).attr("href");
			window.location = (hubLink);
		});
	
});

$(window).load(function() {

	$("div#clientShowcase").orbit({
		animation: 'horizontal-slide',      // fade, horizontal-slide, vertical-slide, horizontal-push
		animationSpeed: 800,                // how fast animations are
		timer: true, 			 			// true or false to have the timer
		advanceSpeed: 4000, 		 		// if timer is enabled, time between transitions 
		pauseOnHover: false, 		 		// if you hover pauses the slider
		startClockOnMouseOut: false, 	 	// if clock should start on MouseOut
		startClockOnMouseOutAfter: 1000, 	// how long after MouseOut should the timer start again
		directionalNav: true, 		 		// manual advancing directional navs
		captions: false, 			 		// do you want captions?
		captionAnimation: 'fade', 		 	// fade, slideOpen, none
		captionAnimationSpeed: 800, 	 	// if so how quickly should they animate in
		bullets: false,			 			// true or false to activate the bullet navigation
		bulletThumbs: false,		 		// thumbnails for the bullets
		bulletThumbLocation: '',		 	// location from this file where thumbs will be
		afterSlideChange: function(){} 	 	// empty function 
	});
	
});
