$('html').addClass('js');

$().ready(function() {

	// Panel Slider
	$('#coda-slider-1').codaSlider({
		dynamicArrows: false,
		dynamicTabs: false,
		autoHeight: false
		});
	
	// Panel Slider - Bottom Navigation
	$(".coda-nav").jCarouselLite({
		btnNext: ".scrollright",
		btnPrev: ".scrollleft",
		visible: 4,
		speed: 1000,
		easing: 'easeInOutExpo',
		circular: false,
		btnGo:	[".1", ".2", ".3", ".4", ".5", ".6", ".7", ".8"],
    	beforeStart: function(b) {
        	if ( !$('.coda-nav .1 a').hasClass('current') ) {
				$("#skip").hide();
				}
			if ( !$('.coda-nav .last a').hasClass('current') ) {
				$("#return").hide();
				}
    		},
    	afterEnd: function(b) {
        	if ( $('.coda-nav .1 a').hasClass('current') ) {
				$("#skip").show();
				}
			if ( $('.coda-nav .last a').hasClass('current') ) {
				$("#return").show();
				}
    		}
		});
		
		
	$(".coda-nav ul li:last").width(868); // Extends length of last item to four panels wide
	$(".coda-nav li a").removeClass('current'); // Removes highlight on first item, while start panel is displaying
	

	// Hide tab panels when clicking on bottom navigation
	$(".coda-nav a, .solution-nav a").click(function () {
		$("#productSelector-Tabs li").removeClass('select');
		// $(".coda-nav li").show();
		$(".coda-nav a").removeClass("highlight");
		});
		
	// Highlight relevant bottom navigation items when viewing tabs
	$("#productSelector-Tabs li").click(function () {
		$("#productSelector-Tabs li:not(this)").removeClass('select');
		$(this).addClass('select');
		$(".coda-nav li a").removeClass('current');
		$(".start-Panel").hide();
		$(".arrow a, .arrow-pointer").css("visibility","hidden");
		});
	$(".coda-nav li").click(function () {
		$(".arrow a, .arrow-pointer").css("visibility","visible");
		$(".start-Panel").fadeOut(500);
		});
	$(".tabOHS").click(function () {
		$(".coda-nav li:not(.filterOHS) a").removeClass('current');
		$(".filterOHS a").addClass('current');
		$("#solutionOverlay").hide();
		});
	$(".tabContract").click(function () {
		$(".coda-nav li:not(.filterContract) a").removeClass('current');
		$(".filterContract a").addClass('current');
		$("#solutionOverlay").hide();
		});
	$(".tabPortfolio").click(function () {
		$(".coda-nav li:not(.filterPortfolio) a").removeClass('current');
		$(".filterPortfolio a").addClass('current');
		$("#solutionOverlay").hide();
		});
	$(".tabSolutions").click(function () {
		$(".coda-nav a, .solution-nav li").removeClass('current');
		});
	
	// Disables arrow navigation while animations are playing to avoid queueing
	var myTimer = {};
	$(".arrow a").click(function () {
		$(".arrow a").css("visibility","hidden");
		myTimer = $.timer(1000,function(){
			$(".arrow a").css("visibility","visible");
		});
		});	





// --------------------------------------------------------------------
// Solution Advisor

		
	// Enables styling of drop down menu on Solution Advisor	
	$('.sectorSelect').selectbox({
		onChangeCallback: myFunction
		});
	
			
	// Display suggestions based on selected field in Solution Advisor    
	// Workshield = 1  /  Healthshield = 2  /  Contrac = 3  /  Rastrac = 4  /  Loantrac = 5  /  Leasetrac = 6

	function myFunction(args)
		{
		$("#solutionOverlay").show();
		$(".solution-nav li").hide();
		$("#solutionOverlay").removeClass();
		var Industry = (args.selectedVal)
		
		if (Industry == "selectitem"){
			$("#solutionOverlay").hide();
			$(".solutiontitle").hide();
			$(".solutionadvice").html("");
			}
		else if (Industry == "Agri Business"){
			$("#solutionOverlay").addClass('twoproducts');
			$(".solutiontitle, .solution-nav .1, .solution-nav .3").show();
			$(".solutionadvice").html("For the Agri Business industry, Workshield &amp; Contrac are designed to cater for your needs.");
			}
		else if (Industry == "Finance"){
			$("#solutionOverlay").addClass('threeproducts');
			$(".solutiontitle, .solution-nav .1, .solution-nav .3, .solution-nav .5").show();
			$(".solutionadvice").html("For Banking &amp; Finance industries, Workshield, Contrac &amp; Loantrac are designed to cater for your needs.");
			}
		else if (Industry == "Construction"){
			$("#solutionOverlay").addClass('twoproducts');
			$(".solutiontitle, .solution-nav .1, .solution-nav .3").show();
			$(".solutionadvice").html("For the Construction industry, Workshield &amp; Contrac are designed to cater for your needs.");
			}
		else if (Industry == "Defence"){
			$("#solutionOverlay").addClass('threeproducts');
			$(".solutiontitle, .solution-nav .1, .solution-nav .3, .solution-nav .6").show();
			$(".solutionadvice").html("For Defence industries, Workshield, Contrac &amp; Leasetrac are designed to cater for your needs.");
			}
		else if (Industry == "Education"){
			$("#solutionOverlay").addClass('threeproducts');
			$(".solutiontitle, .solution-nav .1, .solution-nav .3, .solution-nav .6").show();
			$(".solutionadvice").html("For the Education industry, Workshield, Contrac &amp; Leasetrac are designed to cater for your needs.");
			}
		else if (Industry == "Engineering"){
			$("#solutionOverlay").addClass('twoproducts');
			$(".solutiontitle, .solution-nav .1, .solution-nav .3").show();
			$(".solutionadvice").html("For Engineering industries, Workshield &amp; Contrac are designed to cater for your needs.");
			}
		else if (Industry == "Government"){
			$("#solutionOverlay").addClass('threeproducts');
			$(".solutiontitle, .solution-nav .1, .solution-nav .3, .solution-nav .6").show();
			$(".solutionadvice").html("For Government industries, Workshield, Contrac &amp; Leasetrac are designed to cater for your needs.");
			}
		else if (Industry == "Health"){
			$("#solutionOverlay").addClass('threeproducts');
			$(".solutiontitle, .solution-nav .1, .solution-nav .3, .solution-nav .2").show();
			$(".solutionadvice").html("For Health &amp; Aged Care industries, Workshield, Healthshield &amp; Contrac are designed to cater for your needs.");
			}
		else if (Industry == "Media"){
			$("#solutionOverlay").addClass('twoproducts');
			$(".solutiontitle, .solution-nav .1, .solution-nav .3").show();
			$(".solutionadvice").html("For the Media industry, Workshield &amp; Contrac are designed to cater for your needs.");
			}
		else if (Industry == "Manufacturing"){
			$("#solutionOverlay").addClass('twoproducts');
			$(".solutiontitle, .solution-nav .1, .solution-nav .3").show();
			$(".solutionadvice").html("For the Manufacturing industry, Workshield &amp; Contrac are designed to cater for your needs.");
			}
		else if (Industry == "Mining"){
			$("#solutionOverlay").addClass('twoproducts');
			$(".solutiontitle, .solution-nav .1, .solution-nav .3").show();
			$(".solutionadvice").html("For the Mining industry, Workshield &amp; Contrac are designed to cater for your needs.");
			}
		else if (Industry == "Property Management"){
			$("#solutionOverlay").addClass('threeproducts');
			$(".solutiontitle, .solution-nav .1, .solution-nav .3, .solution-nav .6").show();
			$(".solutionadvice").html("For the Property Management industry, Workshield, Contrac &amp; Leasetrac are designed to cater for your needs.");
			}
		else if (Industry == "Property Development"){
			$("#solutionOverlay").addClass('threeproducts');
			$(".solutiontitle, .solution-nav .1, .solution-nav .3, .solution-nav .4").show();
			$(".solutionadvice").html("For the Property Development industry, Workshield, Contrac &amp; Rastrac are designed to cater for your needs.");
			}
		else if (Industry == "Resources"){
			$("#solutionOverlay").addClass('threeproducts');
			$(".solutiontitle, .solution-nav .1, .solution-nav .3, .solution-nav .6").show();
			$(".solutionadvice").html("For the Resources industry, Workshield, Contrac &amp; Leasetrac are designed to cater for your needs.");
			}
		else if (Industry == "Retail"){
			$("#solutionOverlay").addClass('threeproducts');
			$(".solutiontitle, .solution-nav .1, .solution-nav .3, .solution-nav .6").show();
			$(".solutionadvice").html("For the Retail industry, Workshield, Contrac &amp; Leasetrac are designed to cater for your needs.");
			}
		else if (Industry == "Services"){
			$("#solutionOverlay").addClass('twoproducts');
			$(".solutiontitle, .solution-nav .1, .solution-nav .3").show();
			$(".solutionadvice").html("For the Services industry, Workshield &amp; Contrac are designed to cater for your needs.");
			}
		else if (Industry == "Transport"){
			$("#solutionOverlay").addClass('twoproducts');
			$(".solutiontitle, .solution-nav .1, .solution-nav .3").show();
			$(".solutionadvice").html("For Transport industries, Workshield &amp; Contrac are designed to cater for your needs.");
			}
		else if (Industry == "Other"){
			$("#solutionOverlay").addClass('twoproducts');
			$(".solutiontitle, .solution-nav .1, .solution-nav .3").show();
			$(".solutionadvice").html("For other industries, Workshield &amp; Contrac are designed to cater for your needs.");
			}
		else {
			$(".coda-nav li").hide();}
			}
			
	// Solution Advisor Slider	
		$(".solution-nav li").click(function () {
			$(".solution-nav li:not(this)").removeClass('current');
			$(this).addClass('current');
			});
});


