function initHover() {
		$('.hoverMe').hover(
			function(){$(this).find('div.bubble:hidden').fadeIn(500);},
			function(){$(this).find('div.bubble:visible').fadeOut(500);}
		);
		$('#tick').hover(
			function(){$(this).find('div#validIcons:hidden').fadeIn(500);},
			function(){$(this).find('div#validIcons:visible').fadeOut(500);}
		);
}


$(document).ready(function() {
	/*  $("ul.accordian").accordion({
	active: true,
	header: '.accrodianHead',
	navigation: false,
	event: 'mouseover',
	autoheight: false,
	alwaysOpen: false, 
	selectedClass: 'parentDown'
	});*/
	/*$("ul.accordian").accordion({
		active: true,
		header: '.accordianHead',
		navigation: true,
		event: 'mouseover',
		animated: 'easeslide',
		selectedClass: 'down',
		autoHeight: false
	});*/
	//$("body").hide();
	//$("body").fadeIn(1000);
	/*$("#page").hoverFade({
		invert: true
	});*/
	
	//Cufon.set('fontFamily', 'Helvetica Neue LT Pro').replace('.accordian a')('h2');
	//Cufon.set('fontFamily', 'Helvetica Neue LT Pro').replace('.accordian a');
	

	initHover();

	$('.hideMeOnLoad').removeClass('.hideMeOnLoad').hide();

	
	$('.rotateMe').cycle({
		fx: 'fade',
		speed: 300,
		timeout: 8000,
		next: '.rotateMe',
		pause: 1
	});
	
	
	
	
	/*	
	var pageHTML = '<ul class="pagination">';
	var pageCount = 1;
	$('.news ul li').each(function(){
	  pageHTML += '<li>'+pageCount+'</li>';
	  pageCount++;
	});
	pageHTML += '</ul>';
	$('.news').append(pageHTML);*/
	
		
	$('.news ul').after('<div id="pager">').cycle({
		fx: 'fade',
		speed: 300,
		timeout: 5000,
		pause: 1,
		pager: '#pager'
	});
	
	$('.randomise').reorder();
	
	$('#loopedSlider').loopedSlider({
			containerClick: false, // Click container for next slide
			autoStart:5000, // Set to positive number for auto start and interval time
			restart: 10000, // Set to positive number for restart and restart time
			slidespeed: 1000, // Speed of slide animation
			fadespeed: 500, // Speed of fade animation
			autoHeight: false // Set to positive number for auto height and animation speed
    });
	
	/*$(".related-scroll").easySlider({
		loop: false,
		orientation: 'horizontal',
		autoplayDuration: 0,
		autogeneratePagination: false,
		restartDuration: 0,
		nextId: 'next1',
		prevId: 'prev1',
		pauseable: true
	});*/
	
	$(".related-scroll").easySlider({
		nextId: 'next1',
		prevId: 'prev1',

	});

	//	$("#twitter").getTwitter({
	//		userName: "contraNewMedia",
	//		numTweets: 10,
	//		loaderText: "Loading Tweets...",
	//		slideIn: false,
	//		showHeading: false,
	//		headingText: "Latest Tweets",
	//		showProfileLink: false
	//	});
	/*$("#follow").hover(
	function() {
	$("#twitter").slideToggle();
	},
	function() {
	$("#twitter").slideToggle();
	}								
	);*/
	$("#follow").click(
		function() {
			$("#twitter").slideToggle();
		}
	);
	
	
	
	$("ul.accordian").hoverFade({
		invert: true,
		startFade: false
	});
	
	$("div.details").hoverFade({
		invert: true,
		trigger: $(".container")
	});
	
	
	
	/*$("ul.pagination").hoverFade({
		invert: true,
	});*/
	
	var preLoadArray = [];
	var cache = [];
	$("ul.accordian li.down ul a").each(function() {
			var path = $(this).attr("href");
			var pathSplit = path.split("/");
			var endName = pathSplit[pathSplit.length-1];
			var thumb = pathSplit[pathSplit.length-2] + "_" + endName.substring(endName.lastIndexOf("/"), endName.indexOf("."));
			//alert(thumb);
			thumb = "/style/images/thumbs/" + thumb + ".png";
			var cacheImage = document.createElement('img');
			cacheImage.src = thumb;
			cache.push(cacheImage);
	});	
	
	$("ul.accordian").after('<div class="menuTip"></div>');
	//$(".menuTip").fadeTo(0,0);
	$(".menuTip").hide();
	$("ul.accordian li.down ul a").hoverIntent(
		function() {
			var position = $(this).position();
			position.top -= 3;
			position.left += 170;
			var path = $(this).attr("href");
			var pathSplit = path.split("/");
			//var thumb = path.substring(path.lastIndexOf("/"), path.indexOf("."));
			var endName = pathSplit[pathSplit.length-1];
			
			var thumb = pathSplit[pathSplit.length-2] + "_" + endName.substring(endName.lastIndexOf("/"), endName.indexOf("."));
			//alert(thumb);
			thumb = "url(/style/images/thumbs/" + thumb + ".png) no-repeat";
			//$(".menuTip").css("top", position.top+"px"); 
			$(".menuTip").css("left", position.left+"px");
			$(".menuTip").css("background", thumb);
			//$(".menuTip").fadeIn(200);
			$(".menuTip").clearQueue();
			if ($(".menuTip").css('opacity') == 0) {
				$(".menuTip").css("top", position.top+"px"); 	
				//$(".menuTip").animate({opacity: 1}, 200);
				$(".menuTip").fadeIn(200);
			} else {
				//$(".menuTip").animate({top: position.top, opacity: 1}, 200);
				$(".menuTip").animate({top: position.top}, 200);
				//$(".menuTip").css("top", position.top+"px"); 	
				$(".menuTip").fadeIn(200);
			}
		},
		function () {
			//$(".menuTip").fadeTo(0, 200);
			//$(".menuTip").clearQueue();
			//$(".menuTip").delay(5000).fadeOut(200);
			//$(".menuTip").delay(500).animate({opacity: 0}, 200);
		}
	);
	$("ul.accordian ul").hoverIntent(
		function() {
			
		},
		function () {
			//$(".menuTip").fadeTo(0, 200);
			$(".menuTip").clearQueue();
			$(".menuTip").fadeOut(200);
			//$(".menuTip").delay(500).animate({opacity: 0}, 200);
		}
	);
	
	/*
	$("ul.accordian").after('<div class="menuTip"></div>');
	$(".menuTip").hide();
	$("ul.accordian li.down ul a").hoverIntent(
		function() {
			var position = $(this).position();
			position.top -= 3;
			position.left += 170;
			var path = $(this).attr("href");
			var pathSplit = path.split("/");
			//var thumb = path.substring(path.lastIndexOf("/"), path.indexOf("."));
			var endName = pathSplit[pathSplit.length-1];
			
			var thumb = pathSplit[pathSplit.length-2] + "_" + endName.substring(endName.lastIndexOf("/"), endName.indexOf("."));
			//alert(thumb);
			thumb = "url(/style/images/thumbs/" + thumb + ".png) no-repeat";
			$(".menuTip").css("top", position.top+"px"); 
			$(".menuTip").css("left", position.left+"px");
			$(".menuTip").css("background", thumb);
			$(".menuTip").fadeIn(200);
		},
		function () {
			$(".menuTip").fadeOut(200);
		}
	);*/
	
	
	//$("ul.newsList li").hide(0).animate({opacity: "show", top: "-75"}, "slow");
	
	/*function showMenuTip() {
		var position = $(this).position();
		position.top -= 3;
		position.left += 170;
		var thumb = $(this).attr("href");
		thumb = thumb.substring(thumb.lastIndexOf("/"), thumb.indexOf("."));
		//alert(thumb);
		thumb = "url(/style/images/thumbs" + thumb + ".png) no-repeat";
		$(".menuTip").css("top", position.top+"px"); 
		$(".menuTip").css("left", position.left+"px");
		$(".menuTip").css("background", thumb);
		if ($(".menuTip").css("opacity") > 0.2) {
			$(".menuTip").fadeIn(0);
		} else {
			$(".menuTip").fadeIn(200);
		}
	}
	
	function hideMenuTip() {
		$(".menuTip").fadeOut(200);
	}
	
	var config = {    
     sensitivity: 1, // number = sensitivity threshold (must be 1 or higher)    
     interval: 200, // number = milliseconds for onMouseOver polling interval    
     over: showMenuTip, // function = onMouseOver callback (REQUIRED)    
     timeout: 3000, // number = milliseconds delay before onMouseOut    
     out: hideMenuTip // function = onMouseOut callback (REQUIRED)    
	};
	
	$("ul.accordian li.down ul a").hoverIntent( config );*/
	
	
	$('#content p.intro').wrapInner('<span/>');
	$('#content blockquote p').wrapInner('<span/>');
	$('#content p.client').wrapInner('<span/>');
	//$('#content li').wrapInner('<span/>');
	
	
	

});