// JavaScript Document
function initNav() {
	$("#our-work-li").hover(function() {	//On hover...
		$(this).css("color", "#9fd8d2");
		$(this).find('nav').show();
}, function() { //On hover out...
		$(this).css("color", "#fff").stop();
		$(this).find('nav').hide();
	});
		//$("#our-approach-li").hover(function() {	//On hover...
		//$(this).css("color", "#9fd8d2");
		//$(this).find('nav').show();
//}, function() { //On hover out...
		//$(this).css("color", "#fff").stop();
		//$(this).find('nav').hide();
	//});
		$("#about-sw-li").hover(function() {	//On hover...
		$(this).css("color", "#9fd8d2");
		$(this).find('nav').show();
}, function() { //On hover out...
		$(this).css("color", "#fff").stop();
		$(this).find('nav').hide();
	});
		$("#contact-li").hover(function() {	//On hover...
		$(this).css("color", "#9fd8d2");
		$(this).find('nav').show();
}, function() { //On hover out...
		$(this).css("color", "#fff").stop();
		$(this).find('nav').hide();
	});
}
function firstLastPrincipal() {
$('#greg_chapman').css({'padding-left' : '0'});
$('#margie_traylor').css({'padding-right' : '0', 'border-right' : '0'});
}
function thankYou() {
	$('#thankyou').show();
}
function launchModal() {
	//When you click on a link with class of poplight and the href starts with a # 
$('a.poplight[href^=#]').click(function() {
    var popID = $(this).attr('rel'); //Get Popup Name
    var popURL = $(this).attr('href'); //Get Popup href to define size

    //Pull Query & Variables from href URL
    var query= popURL.split('?');
    var dim= query[1].split('&');
    var popWidth = dim[0].split('=')[1]; //Gets the first query string value

    //Fade in the Popup and add close button
    $('#' + popID).fadeIn().css({ 'width': Number( popWidth ) }).prepend('<a href="#" class="close avenir-light">x</a>');

    //Define margin for center alignment (vertical   horizontal) - we add 80px to the height/width to accomodate for the padding  and border width defined in the css
    var popMargTop = ($('#' + popID).height() + 80) / 2;
    var popMargLeft = ($('#' + popID).width() + 80) / 2;

    //Apply Margin to Popup
    $('#' + popID).css({
        'margin-top' : -popMargTop,
        'margin-left' : -popMargLeft
    });

    //Fade in Background
    $('body').append('<div id="fade"></div>'); //Add the fade layer to bottom of the body tag.
    $('#fade').css({'filter' : 'alpha(opacity=75)'}).fadeIn(); //Fade in the fade layer - .css({'filter' : 'alpha(opacity=80)'}) is used to fix the IE Bug on fading transparencies 

    return false;
});

//Close Popups and Fade Layer
$('a.close, #fade').live('click', function() { //When clicking on the close or fade layer...
    $('#fade , .popup_block').fadeOut(function() {
        $('#fade, a.close').remove();  //fade them both out
    });
    return false;
});
}

function serviceAccordion() {
//Set default open/close settings
//$(".acc_container").hide(); //Hide/close all containers
//$('.acc_trigger:first').addClass('active').next().show(); //Add "active" class to first trigger, then show/open the immediate next container

//On Click
//$('.acc_trigger').click(function(){
	//if( $(this).next().is(':hidden') ) { //If immediate next container is closed...
		//$('.acc_trigger').removeClass('active').next().slideUp(); //Remove all "active" state and slide up the immediate next container
		//$(this).toggleClass('active').next().slideDown(); //Add "active" state to clicked trigger and slide down the immediate next container
	//}
	//return false; //Prevent the browser jump to the link anchor
//});
$("span.open").show();
$("span.close").hide();
$(".acc_container").hide();

$("#online_marketing .acc_trigger").click(function() {
    $("#online_marketing .acc_container").slideToggle('fast');
    $("#online_marketing .close").toggle();
    $("#online_marketing .open").toggle();
	 $(this).toggleClass("active");
    return false;
});



$("#mobile_marketing .acc_trigger").click(function() {
    $("#mobile_marketing .acc_container").slideToggle('fast');
    $("#mobile_marketing .close").toggle();
    $("#mobile_marketing .open").toggle();
	 $(this).toggleClass("active");
    return false;
});

$("#social_media .acc_trigger").click(function() {
    $("#social_media .acc_container").slideToggle('fast');
    $("#social_media .close").toggle();
    $("#social_media .open").toggle();
	 $(this).toggleClass("active");
    return false;
});


$("#technical_services .acc_trigger").click(function() {
    $("#technical_services .acc_container").slideToggle('fast');
    $("#technical_services .close").toggle();
    $("#technical_services .open").toggle();
	 $(this).toggleClass("active");
    return false;
});
 

$("#content_creative .acc_trigger").click(function() {
    $("#content_creative .acc_container").slideToggle('fast');
    $("#content_creative .close").toggle();
    $("#content_creative .open").toggle();
	 $(this).toggleClass("active");
    return false;
});

}

function showJobs() {
//When page loads...
	$(".job-listing").hide(); //Hide all content
	$(".job-listing:first").addClass('active').show();
	$("ul.jobs li:first").addClass('active');

	//On Click Event
	$("ul.jobs li").click(function() {

		$("ul.jobs li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".job-listing").hide(); //Hide all tab content

		var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active ID content
		return false;
	});
												 
}
function removeAbout() {
	$('.about-year').each(function(){
		$(this).text($(this).text().replace(/About/, ''))
		});
}
function initTimeline() {
$(".year").hide();
$(".timeline-wrapper li").click(function() {
    $("label").removeClass("grow");
    $(this).find("label").addClass("grow");
    $(".year").fadeOut();
    $(".timeline-wrapper ul li").removeClass("active");
    $(this).addClass("active");
    $(this).find("div").fadeIn();
return false;
});
    
}
