﻿	$(document).ready(function(){
	
		function switchTo(i) {
			$('.contactnav a').css('color','#333333').eq(i).css('color','#009999');
			$('#directions div').css('display','none').eq(i).css('display','block');
		}
		
		$('.contactnav a').click(function(event){
		switchTo($('.contactnav a').index(event.target));
		});
		switchTo(0);		
	
	    var path = location.pathname.substring(1).toLowerCase();
    	
	    if(path.search('articles/') > -1){
	        $(".tnav a:eq(5)").addClass("active");
	    }
    	
	    if(path.search('pressreleases/') > -1){
	        $(".tnav a:eq(5)").addClass("active");
	    }
    	
	    if(path.search('our-people/') > -1){
	        $(".tnav a:eq(4)").addClass("active");
	    }
    	
	    if(path.search('sectors/') > -1){
	        $(".tnav a:eq(3)").addClass("active");
	    }
    	
	    if(path.search('services/') > -1){
	        $(".tnav a:eq(2)").addClass("active");
	    }
    	
	    if(path.search('careers/') > -1){
	        $(".tnav a:eq(6)").addClass("active");
	    }
		
	});

	ddaccordion.init({
		headerclass: "expandable", //Shared CSS class name of headers group that are expandable
		contentclass: "sub", //Shared CSS class name of contents group
		revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click" or "mouseover
		collapseprev: true, //Collapse previous content (so only one open at any time)? true/false 
		defaultexpanded: [0], //index of content(s) open by default [index1, index2, etc]. [] denotes no content
		animatedefault: false, //Should contents open by default be animated into view?
		persiststate: false, //persist state of opened contents within browser session?
		toggleclass: ["closedheader", "openheader"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
		togglehtml: ["prefix", "", ""], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
		animatespeed: "normal", //speed of animation: "fast", "normal", or "slow"
		oninit:function(headers, expandedindices){ //custom code to run when headers have initalized
			//do nothing
		},
		onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
			//do nothing
		}
	})

	var helv = {
		src: '/media/helvetneuelight.swf'
	, ratios: [7, 1.32, 11, 1.31, 13, 1.24, 14, 1.25, 19, 1.23, 27, 1.2, 34, 1.19, 42, 1.18, 47, 1.17, 48, 1.18, 69, 1.17, 74, 1.16, 75, 1.17, 1.16]
	};

	sIFR.useStyleCheck = true;
	sIFR.activate(helv);

	sIFR.replace(helv, {
		selector: 'h1.pagetitle'
	, css: [
	  '.sIFR-root { color: #009999; }'
	]
	, wmode: 'transparent'
	});

	sIFR.replace(helv, {
		selector: 'h2'
	, css: [
	  '.sIFR-root {color: #666;  }'
	]
	, wmode: 'transparent'
	});

	sIFR.replace(helv, {
		selector: 'h1.home1'
	, css: [
	  '.sIFR-root {color: #009999;  }'
	]
	, wmode: 'transparent'
	});

	sIFR.replace(helv, {
		selector: 'h1.home2'
	, css: [
	  '.sIFR-root {color: #666;  }'
	]
	, wmode: 'transparent'
	});
	