$(document).ready(function(){

    // Main Nav
    $('#nav li').hover(function() {
        $(this).children('.drop-down:hidden').fadeIn(300);
        $(this).children('a:first').addClass('sel');
    },
    function() {
        $(this).children('.drop-down:visible').fadeOut(50);
        $(this).children('a:first').removeClass('sel');
    });

    // Track input field replace
    $('.tracking-search label').labelOver('over-apply');

    // Colorbox for videos
    $("#dot-movie").colorbox({iframe:true, innerWidth:640, innerHeight:384});

	$(".contact").colorbox({inline:true, innerWidth:500, href:"#contact-me-form"});

    // Colorbox for services
    $("#flowchart").colorbox({
        innerWidth:957,
        innerHeight:542
    });

    // Services navigation
    $('a[service]').click(function() {
        var service_key = $(this).attr('service');

        $('.service-details').hide();
        $('ul.services').find('li.active').removeClass('active');
        $('ul.services').find('a[service=' + service_key + ']').closest('li').addClass('active');
        $('#' + service_key).show();
    });

	$('a.close').click(function() {
        $('.service-details').hide();
        $('ul.services').find('li.active').removeClass('active');
		return false;
    });

    // Navigate to anchor on load
    var url = document.location.toString();
    if(url.match('#'))
    {
        var service_type = url.split('#')[1];
        if($('a[service=' + service_type + ']').length > 0)
        {
            $('a[service=' + service_type + ']').click();
        }
    }
});
