function first(){
    $(".active").removeClass('active');
    $(".item_cont").removeClass('active_item_cont');
    $("#item1_cont").addClass('active_item_cont');
    $(".first").parent().addClass('active');
    $(".all").removeClass('app');
    $("#ship").attr('src', 'img/ship.png');
    location.hash = ''; 
}

function second(){
    $(".active").removeClass('active');
    $(".item_cont").removeClass('active_item_cont');
    $("#item2_cont").addClass('active_item_cont');
    $(".second").parent().addClass('active');
    $(".all").removeClass('app');
    $("#ship").attr('src', 'img/ship_big.png');
    location.hash = 'services'; 
}

function third(){
    $(".active").removeClass('active');
    $(".item_cont").removeClass('active_item_cont');
    $("#item3_cont").addClass('active_item_cont');
    $(".third").parent().addClass('active');
    $(".all").addClass('app');
    $("#ship").attr('src', 'img/ship_plant.png');
    location.hash = 'app_form'; 
}

function fourth(){
    $(".active").removeClass('active');
    $(".item_cont").removeClass('active_item_cont');
    $("#item4_cont").addClass('active_item_cont');
    $(".fourth").parent().addClass('active');
    $(".all").removeClass('app');
     $("#ship").attr('src', 'img/bird.png');
    location.hash = 'contact'; 
}

function fifth(){
    $(".active").removeClass('active');
    $(".item_cont").removeClass('active_item_cont');
    $("#item5_cont").addClass('active_item_cont');
    $(".fifth").parent().addClass('active');
    $(".all").removeClass('app');
    $("#ship").attr('src', 'img/barge.png');
    location.hash = 'vacancies'; 
}

$(document).ready(function(){ 
var cont = location.hash;
if ( cont == '#services' || cont == '#app_form' || cont == '#contact' || cont == '#vacancies') {
    location.hash = cont;
    }

if (cont == '') { first(); }
if (cont == '#services') { second(); }
if (cont == '#app_form') { third(); }
if (cont == '#contact') { fourth(); }
if (cont == '#vacancies') { fifth(); }

$(".first").click(function(){
    first();
    return false;
});
$(".second").click(function(){
    second();
    return false;
});
$(".third").click(function(){
    third();
    return false;
});
$(".fourth").click(function(){
    fourth();
    return false;
});
$(".fifth").click(function(){
    fifth();
    return false;
});
});

