//Cufon
Cufon.replace('#header p.quickContact', { fontFamily: 'HelveticaNeue' , hover: false, textShadow: '#0d1c5e -1px 1px 2px' });
Cufon.replace('.mainContent h1', { fontFamily: 'HelveticaNeue' , hover: false });
Cufon.replace('.mainContent h2', { fontFamily: 'HelveticaNeue' , hover: false });
Cufon.replace('.mainContent h3', { fontFamily: 'HelveticaNeue' , hover: false });
Cufon.replace('.mainContent h4', { fontFamily: 'HelveticaNeue' , hover: false });
Cufon.replace('.aside h3', { fontFamily: 'HelveticaNeue' , hover: false });
Cufon.replace('a.button', { fontFamily: 'HelveticaNeue' , hover: true, textShadow: '#666666 -1px 1px 2px' });
Cufon.replace('#footer h4', { fontFamily: 'HelveticaNeue' , hover: false });

$(document).ready(function(){

	$.urlParam = function(name){
		var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href);
		if (!results) { return 0; }
		return results[1] || 0;
	}
	
	if (jQuery('#header ul.menu').length>0) {
		//Dropdowns 
	    $(window).unload(function(){
			$('#header ul.menu').hideSuperfishUl();
		});
		$('#header ul.menu').superfish({
			delay: 0,
			animation: {opacity:'show',height:'show'},
			speed: 'normal',
			autoArrows: false,
			dropShadows: false
		});
	}
	
	if (jQuery('.homeBanner').length>0) {
		//Home Banner Cycle
		$('.homeBanner').cycle({ 
			fx: 'fade', 
			timeout: 8000,
			speed: 500,
			pager: '.homeBannerPagination'
		});
	}
	
	if (jQuery('.tabContainer').length>0) {
		//Outdoor Offsite Carousel
		$("#tboOffsite").jCarouselLite({
			btnNext: "#tboOffsiteNext",
			btnPrev: "#tboOffsitePrevious",
			visible: 3,
			circular: 0
		});
		//Outdoor Conference Carousel
		$("#tboConf").jCarouselLite({
			btnNext: "#tboConfNext",
			btnPrev: "#tboConfPrevious",
			visible: 3,
			circular: 0
		});
		//Hide OCC Next Temp
		$("#tboConfNext").hide();
		
		//Indoor Conference Carousel
		$("#tbiConf").jCarouselLite({
			btnNext: "#tbiConfNext",
			btnPrev: "#tbiConfPrevious",
			visible: 3,
			circular: 0
		});

		//Tabs
		$(".tabContainer").hide(); //Hide all content
		$("ul.tabs li:first a").addClass("selected").show(); //Activate first tab
		$(".tabContainer:first").show(); //Show first tab content

		//On Click Event
		$("ul.tabs li a").click(function() {
			$("ul.tabs li a").removeClass("selected"); //Remove any "active" class
			$(this).addClass("selected"); //Add "active" class to selected tab
			$(".tabContainer").hide(); //Hide all tab content
			var activeTab = $(this).attr("href"); //Find the href attribute value to identify the active tab + content
			$(activeTab).show(); //Fade in the active ID content
			return false;
		});
	}
	
	if (jQuery('.eventsContainer').length>0) {
		//Events Carousel
		$("#esEvents").jCarouselLite({
			btnNext: "#esEventsNext",
			btnPrev: "#esEventsPrevious",
			visible: 3,
			circular: 0
		});
	}	
	
	if (jQuery('#asideCycle').length>0) {
		//Home Aside Cycle
		$('#asideCycle').cycle({ 
			fx: 'scrollHorz',
			prev: '.cyclePrevious',
			next: '.cycleNext',			
			timeout: 8000,
			speed: 500,
			pager: '.cyclePagination'
		});
	}
	
	if (jQuery('.slideShowContainer').length>0) {
		//Slide Show Cycle
		$('.slideShowInner').cycle({ 
			fx: 'scrollHorz',
			prev: '.slideShowPrev',
			next: '.slideShowNext',			
			timeout: 8000,
			speed: 500
		});
	}	
	
	if (jQuery('.activityCycle').length>0) {
		//Activity Slide Show Cycle
		$('.activityCycle').cycle({ 
			fx: 'scrollHorz',
			prev: '.activityPrevious',
			next: '.activityNext',			
			timeout: 8000,
			speed: 500
		});
	}		
	
	if (jQuery('#youtubeLink').length>0) {
		//You Tube Fancybox
		$("a#youtubeLink").fancybox({
			'hideOnContentClick': false,
			'hideOnOverlayClick': false,
			'transitionIn': 'elastic',
			'transitionOut': 'elastic',
			'speedIn': 600, 
			'speedOut':	200, 
			'overlayShow':	true,
			'overlayOpacity': 0.9,
			'overlayColor': '#15162e'
		});
	}
	
	if (jQuery('#quoteForm').length>0) {
		//Form validate
		$("#quoteForm").validate({
			rules: {
				name: "required",
				organisation: "required",
				phone: "required",
				email: {
					required: true,
					email: true
				}
			},
			messages: {
				name: "Please enter your name",
				organisation: "Please enter your organisation",
				phone: "Please enter your work phone number",				
				email: "Please enter a valid email address"
			}
		});			
	}
	
	if (jQuery('.activity').length>0) {
		//Hide activities, Show linked activity
		$(".activity").hide(); //Hide all content

		var activityVal = $.urlParam('activity');
		var activityElement = "#" + activityVal;
		if (activityVal == 0) {
			$("#selectActivity").show();		
			
		} else {
			$(activityElement).show();
			$('html, body').animate({scrollTop: $("#tabsElement").offset().top}, 1000);
		}

		//On Click Event team building
		$("div.tabCarousel ul li a").click(function() {
			$(".activity").hide(); //Hide all tab content
			var activeTab = $(this).attr("href"); //Find the href attribute value to identify the active tab + content
			$(activeTab).fadeIn(); //Fade in the active ID content
			$('html, body').animate({scrollTop: $("#tabsElement").offset().top}, 1000);
			return false;
		});
		
		//On Click Events evening
		$("div#esEvents ul li a").click(function() {
			$(".activity").hide(); //Hide all tab content
			var activeTab = $(this).attr("href"); //Find the href attribute value to identify the active tab + content
			$(activeTab).fadeIn(); //Fade in the active ID content
			$('html, body').animate({scrollTop: $("#tabsElement").offset().top}, 1000);
			return false;
		});		
	}	
		
});		
