$(document).ready(function()
{
    ie6 = ($.browser.msie && $.browser.version=='6.0');
    if(ie6)
    {
        document.location.href = 'http://www.ps-studio.info/NOIE6/noie.html';
        /*window.attachEvent('onload', mkwidth);
        window.attachEvent('onresize', mkwidth);

        var minwidth = document.getElementById("container").currentStyle['min-width'].replace('px', '');
        var maxwidth = document.getElementById("container").currentStyle['max-width'].replace('px', '');

        function mkwidth(){
            document.getElementById("container").style.width = document.documentElement.clientWidth < minwidth ? minwidth+"px" : (document.documentElement.clientWidth > maxwidth ? maxwidth+"px" : "100%");
        };*/
    }

    var center_width = $('#center-column').width();
    var redis_logo_margin = parseInt($('.redis-logo').eq(0).css('margin-left'));
    var job_link_unactive = parseInt($('.job-link-unactive').eq(0).css('margin-left'));
    var job_link_active = parseInt($('.job-link-active').eq(0).css('margin-left'));
    var phone = parseInt($('.phone').eq(0).css('margin-left'));
    var email = parseInt($('.email-unactive').eq(0).css('margin-left'));
    var email_a = parseInt($('.email-active').eq(0).css('margin-left'));
    var rediska_size = parseInt($('.presentation img').eq(0).css('width'));
    var jobs_size = parseInt($('.jobs img').eq(0).css('width'));
    var slogan = parseInt($('.slogan').css('width'));
    var slogan_top = parseInt($('.slogan').css('margin-top'));
    var slogan_bottom = parseInt($('.slogan').css('margin-bottom'));
    var services_p_font_size = parseInt($('.services p').css('font-size'));
    var services_p_padding_bottom = parseInt($('.services p').css('padding-bottom'));
    var services_p_left = parseInt($('.services .left p').css('padding-right'));
    var services_p_right = parseInt($('.services .right p').css('padding-left'));
    var logos_top = parseInt($('.logos-company').css('margin-top'));
    var logos_padding_left = parseInt($('.logos-company li').css('padding-left'));
    var logos_padding_right = parseInt($('.logos-company li').css('padding-right'));
    var hor_line_top = parseInt($('.hor-line').css('margin-top'));
    var hor_line_width = parseInt($('.hor-line').css('width'));
    var new_work_top = parseInt($('.new-work').css('margin-top'));
    var new_work_width = parseInt($('.new-work').css('width'));
    var new_work_bottom = parseInt($('.new-work').css('margin-bottom'));
    var pres_bottom_margin = parseInt($('.presentation').css('margin-bottom'));
    var jobs_top_padding = parseInt($('.jobs').css('padding-top'));
    var jobs_bottom_padding = parseInt($('.jobs').css('padding-bottom'));
    var jobs_font_size = parseInt($('.jobs p').css('font-size'));
    var jobs_p_margin_top = parseInt($('.jobs p').css('margin-top'));
    var jobs_p_line = parseInt($('.jobs p').css('line-height'));
    var hor_line_jobs_top = parseInt($('.jobs .hor-line-2').css('margin-top'));
    var hor_line_jobs_width = parseInt($('.jobs .hor-line-2').css('width'));
    var presentation_font_size = parseInt($('.presentation p').css('font-size'));
    var presentation_p_margin_top = parseInt($('.presentation p').css('margin-top'));
    var presentation_p_line = parseInt($('.presentation p').css('line-height'));
    var hor_line_presentation_top = parseInt($('.presentation .hor-line-2').css('margin-top'));
    var hor_line_presentation_width = parseInt($('.presentation .hor-line-2').css('width'));
    var jobs_title_unactive_width = parseInt($('.jobs-title-unactive').css('width'));
    var jobs_title_unactive_height = parseInt($('.jobs-title-unactive').css('height'));
    var jobs_title_unactive_top = parseInt($('.jobs-title-active').css('margin-top'));
    var jobs_title_active_width = parseInt($('.jobs-title-active').css('width'));
    var jobs_title_active_height = parseInt($('.jobs-title-active').css('height'));
    var jobs_title_active_top = parseInt($('.jobs-title-active').css('margin-top'));

    var clock_top_padding = parseInt($('.clock').css('padding-top'));
    var clock_bottom_padding = parseInt($('.clock').css('padding-bottom'));
    var clock_font_size = parseInt($('.clock p').css('font-size'));
    var clock_p_margin_top = parseInt($('.clock p').css('margin-top'));
    var clock_p_line = parseInt($('.clock p').css('line-height'));
    var hor_line_clock_top = parseInt($('.clock .hor-line-2').css('margin-top'));
    var hor_line_clock_width = parseInt($('.clock .hor-line-2').css('width'));
    var clock_size = parseInt($('.clock img').eq(0).css('width'));

    var hor_line3_width = parseInt($('.hor-line-3').css('width'));

    var thread1 = parseInt($('.thread1').css('width'));
    var thread2 = parseInt($('.thread2').css('width'));
    var thread2_top = parseInt($('.thread2').css('top'));
    var thread3 = parseInt($('.clock .thread3').css('width'));
    var thread3_top = parseInt($('.clock .thread3').css('top'));

    $('.redis-logo').css('margin-left', (((((center_width - 600) / 180) * -0.24) + 1) * redis_logo_margin) + 'px');
    $('.job-link-unactive').css('margin-left', (((((center_width - 600) / 180) * -0.16) + 1) * job_link_unactive) + 'px');
    $('.job-link-active').css('margin-left', (((((center_width - 600) / 180) * -0.16) + 1) * job_link_active) + 'px');
    $('.phone').css('margin-left', (((((center_width - 600) / 180) * 14) + 1) * phone) + 'px');
    $('.email-unactive').css('margin-left', (((((center_width - 600) / 180) * 0.37) + 1) * email) + 'px');
    $('.email-active').css('margin-left', (((((center_width - 600) / 180) * 0.37) + 1) * email_a) + 'px');
    $('.presentation img').css('width', (((((center_width - 600) / 180) * 0.3) + 1) * rediska_size) + 'px');
    $('.jobs img').eq(0).css('width', (((((center_width - 600) / 180) * 0.3) + 1) * jobs_size) + 'px');
    $('.slogan').css('width', (((((center_width - 600) / 180) * 0.3) + 1) * slogan) + 'px');
    $('.slogan').css('margin-top', (((((center_width - 600) / 180) * 0.3) + 1) * slogan_top) + 'px');
    $('.slogan').css('margin-bottom', (((((center_width - 600) / 180) * 0.3) + 1) * slogan_bottom) + 'px');
    $('.services p').css('font-size', (((((center_width - 600) / 180) * 0.3) + 1) * services_p_font_size) + 'px');
    $('.services p').css('padding-bottom', (((((center_width - 600) / 180) * 0.5) + 1) * services_p_padding_bottom) + 'px');
    $('.services .left p').css('padding-right', (((((center_width - 600) / 180) * 0.3) + 1) * services_p_left) + 'px');
    $('.services .right p').css('padding-left', (((((center_width - 600) / 180) * 0.3) + 1) * services_p_right) + 'px');
    $('.logos-company').css('margin-top', (((((center_width - 600) / 180) * 0.5) + 1) * logos_top) + 'px');
    $('.logos-company li').css('padding-left', (((((center_width - 600) / 180) * 1.2) + 1) * logos_padding_left) + 'px');
    $('.logos-company li').css('padding-right', (((((center_width - 600) / 180) * 1.2) + 1) * logos_padding_right) + 'px');
    $('.hor-line').css('margin-top', (((((center_width - 600) / 180) * 0.55) + 1) * hor_line_top) + 'px');
    $('.hor-line').css('width', (((((center_width - 600) / 180) * 0.3) + 1) * hor_line_width) + 'px');
    $('.new-work').css('margin-top', (((((center_width - 600) / 180) * 0.55) + 1) * new_work_top) + 'px');
    $('.new-work').css('width', (((((center_width - 600) / 180) * 0.3) + 1) * new_work_width) + 'px');
    $('.new-work').css('margin-bottom', (((((center_width - 600) / 180) * 0.3) + 1) * new_work_bottom) + 'px');
    $('.presentation').css('margin-bottom', (((((center_width - 600) / 360) * 0.41) + 1) * pres_bottom_margin) + 'px');
    $('.jobs').css('padding-top', (((((center_width - 600) / 360) * 1) + 1) * jobs_top_padding) + 'px');
    $('.jobs').css('padding-bottom', (((((center_width - 600) / 180) * 0.3) + 1) * jobs_bottom_padding) + 'px');
    $('.jobs p').css('font-size', (((((center_width - 600) / 360) * 0.6) + 1) * jobs_font_size) + 'px');
    $('.jobs p').css('margin-top', (((((center_width - 600) / 360) * 0.8) + 1) * jobs_p_margin_top) + 'px');
    $('.jobs p').css('line-height', (((((center_width - 600) / 360) * 0.6) + 1) * jobs_p_line) + 'px');
    $('.jobs .hor-line-2').css('margin-top', (((((center_width - 600) / 180) * 0.55) + 1) * hor_line_jobs_top) + 'px');
    $('.jobs .hor-line-2').css('width', (((((center_width - 600) / 180) * 0.3) + 1) * hor_line_jobs_width) + 'px');
    $('.jobs-title-unactive').css('width', (((((center_width - 600) / 180) * 0.3) + 1) * jobs_title_unactive_width) + 'px');
    $('.jobs-title-unactive').css('height', (((((center_width - 600) / 180) * 0.3) + 1) * jobs_title_unactive_height) + 'px');
    $('.jobs-title-unactive').css('margin-top', (((((center_width - 600) / 180) * 0.3) + 1) * jobs_title_unactive_top) + 'px');
    $('.jobs-title-active').css('width', (((((center_width - 600) / 180) * 0.3) + 1) * jobs_title_active_width) + 'px');
    $('.jobs-title-active').css('height', (((((center_width - 600) / 180) * 0.3) + 1) * jobs_title_active_height) + 'px');
    $('.jobs-title-active').css('margin-top', (((((center_width - 600) / 180) * 0.3) + 1) * jobs_title_active_top) + 'px');
    $('.presentation p').css('font-size', (((((center_width - 600) / 360) * 0.6) + 1) * presentation_font_size) + 'px');
    $('.presentation p').css('margin-top', (((((center_width - 600) / 360) * 0.8) + 1) * presentation_p_margin_top) + 'px');
    $('.presentation p').css('line-height', (((((center_width - 600) / 360) * 0.6) + 1) * presentation_p_line) + 'px');
    $('.presentation .hor-line-2').css('margin-top', (((((center_width - 600) / 180) * 0.55) + 1) * hor_line_presentation_top) + 'px');
    $('.presentation .hor-line-2').css('width', (((((center_width - 600) / 180) * 0.3) + 1) * hor_line_presentation_width) + 'px');

    $('.clock').css('padding-top', (((((center_width - 600) / 180) * 0.5) + 1) * clock_top_padding) + 'px');
    $('.clock').css('padding-bottom', (((((center_width - 600) / 360) * 8.2) + 1) * clock_bottom_padding) + 'px');
    $('.clock p').css('font-size', (((((center_width - 600) / 360) * 0.6) + 1) * clock_font_size) + 'px');
    $('.clock p').css('margin-top', (((((center_width - 600) / 360) * 0.8) + 1) * clock_p_margin_top) + 'px');
    $('.clock p').css('line-height', (((((center_width - 600) / 360) * 0.6) + 1) * clock_p_line) + 'px');
    $('.clock .hor-line-2').css('margin-top', (((((center_width - 600) / 180) * 0.55) + 1) * hor_line_clock_top) + 'px');
    $('.clock .hor-line-2').css('width', (((((center_width - 600) / 180) * 0.3) + 1) * hor_line_clock_width) + 'px');
    $('.clock img').eq(0).css('width', (((((center_width - 600) / 180) * 0.3) + 1) * clock_size) + 'px');

    $('.hor-line-3').css('width', (((((center_width - 600) / 180) * 0.3) + 1) * hor_line3_width) + 'px');

    $('.thread1').css('width', (((((center_width - 600) / 180) * 0.3) + 1) * thread1) + 'px');
    $('.thread2').css('width', (((((center_width - 600) / 180) * 0.3) + 1) * thread2) + 'px');
    $('.thread2').css('top', (((((center_width - 600) / 180) * 0.3) + 1) * thread2_top) + 'px');
    $('.clock .thread3').css('width', (((((center_width - 600) / 180) * 0.3) + 1) * thread3) + 'px');
    $('.clock .thread3').css('top', (((((center_width - 600) / 180) * 0) + 1) * thread3_top) + 'px');

    $(window).resize(function()
    {
        var center_width = $('#center-column').width();

        $('.redis-logo').css('margin-left', (((((center_width - 600) / 180) * -0.24) + 1) * redis_logo_margin) + 'px');
        $('.job-link-unactive').css('margin-left', (((((center_width - 600) / 180) * -0.16) + 1) * job_link_unactive) + 'px');
        $('.job-link-active').css('margin-left', (((((center_width - 600) / 180) * -0.16) + 1) * job_link_active) + 'px');
        $('.phone').css('margin-left', (((((center_width - 600) / 180) * 14) + 1) * phone) + 'px');
        $('.email-unactive').css('margin-left', (((((center_width - 600) / 180) * 0.37) + 1) * email) + 'px');
        $('.email-active').css('margin-left', (((((center_width - 600) / 180) * 0.37) + 1) * email_a) + 'px');
        $('.presentation img').css('width', (((((center_width - 600) / 180) * 0.3) + 1) * rediska_size) + 'px');
        $('.jobs img').eq(0).css('width', (((((center_width - 600) / 180) * 0.3) + 1) * jobs_size) + 'px');
        $('.slogan').css('width', (((((center_width - 600) / 180) * 0.3) + 1) * slogan) + 'px');
        $('.slogan').css('margin-top', (((((center_width - 600) / 180) * 0.3) + 1) * slogan_top) + 'px');
        $('.slogan').css('margin-bottom', (((((center_width - 600) / 180) * 0.3) + 1) * slogan_bottom) + 'px');
        $('.services p').css('font-size', (((((center_width - 600) / 180) * 0.3) + 1) * services_p_font_size) + 'px');
        $('.services p').css('padding-bottom', (((((center_width - 600) / 180) * 0.5) + 1) * services_p_padding_bottom) + 'px');
        $('.services .left p').css('padding-right', (((((center_width - 600) / 180) * 0.3) + 1) * services_p_left) + 'px');
        $('.services .right p').css('padding-left', (((((center_width - 600) / 180) * 0.3) + 1) * services_p_right) + 'px');
        $('.logos-company').css('margin-top', (((((center_width - 600) / 180) * 0.5) + 1) * logos_top) + 'px');
        $('.logos-company li').css('padding-left', (((((center_width - 600) / 180) * 1.2) + 1) * logos_padding_left) + 'px');
        $('.logos-company li').css('padding-right', (((((center_width - 600) / 180) * 1.2) + 1) * logos_padding_right) + 'px');
        $('.hor-line').css('margin-top', (((((center_width - 600) / 180) * 0.55) + 1) * hor_line_top) + 'px');
        $('.hor-line').css('width', (((((center_width - 600) / 180) * 0.3) + 1) * hor_line_width) + 'px');
        $('.new-work').css('margin-top', (((((center_width - 600) / 180) * 0.55) + 1) * new_work_top) + 'px');
        $('.new-work').css('width', (((((center_width - 600) / 180) * 0.3) + 1) * new_work_width) + 'px');
        $('.new-work').css('margin-bottom', (((((center_width - 600) / 180) * 0.3) + 1) * new_work_bottom) + 'px');
        $('.presentation').css('margin-bottom', (((((center_width - 600) / 360) * 0.41) + 1) * pres_bottom_margin) + 'px');
        $('.jobs').css('padding-top', (((((center_width - 600) / 360) * 1) + 1) * jobs_top_padding) + 'px');
        $('.jobs').css('padding-bottom', (((((center_width - 600) / 180) * 0.3) + 1) * jobs_bottom_padding) + 'px');
        $('.jobs p').css('font-size', (((((center_width - 600) / 360) * 0.6) + 1) * jobs_font_size) + 'px');
        $('.jobs p').css('margin-top', (((((center_width - 600) / 360) * 0.8) + 1) * jobs_p_margin_top) + 'px');
        $('.jobs p').css('line-height', (((((center_width - 600) / 360) * 0.6) + 1) * jobs_p_line) + 'px');
        $('.jobs .hor-line-2').css('margin-top', (((((center_width - 600) / 180) * 0.55) + 1) * hor_line_jobs_top) + 'px');
        $('.jobs .hor-line-2').css('width', (((((center_width - 600) / 180) * 0.3) + 1) * hor_line_jobs_width) + 'px');
        $('.jobs-title-unactive').css('width', (((((center_width - 600) / 180) * 0.3) + 1) * jobs_title_unactive_width) + 'px');
        $('.jobs-title-unactive').css('height', (((((center_width - 600) / 180) * 0.3) + 1) * jobs_title_unactive_height) + 'px');
        $('.jobs-title-unactive').css('margin-top', (((((center_width - 600) / 180) * 0.3) + 1) * jobs_title_unactive_top) + 'px');
        $('.jobs-title-active').css('width', (((((center_width - 600) / 180) * 0.3) + 1) * jobs_title_active_width) + 'px');
        $('.jobs-title-active').css('height', (((((center_width - 600) / 180) * 0.3) + 1) * jobs_title_active_height) + 'px');
        $('.jobs-title-active').css('margin-top', (((((center_width - 600) / 180) * 0.3) + 1) * jobs_title_active_top) + 'px');
        $('.presentation p').css('font-size', (((((center_width - 600) / 360) * 0.6) + 1) * presentation_font_size) + 'px');
        $('.presentation p').css('margin-top', (((((center_width - 600) / 360) * 0.8) + 1) * presentation_p_margin_top) + 'px');
        $('.presentation p').css('line-height', (((((center_width - 600) / 360) * 0.6) + 1) * presentation_p_line) + 'px');
        $('.presentation .hor-line-2').css('margin-top', (((((center_width - 600) / 180) * 0.55) + 1) * hor_line_presentation_top) + 'px');
        $('.presentation .hor-line-2').css('width', (((((center_width - 600) / 180) * 0.3) + 1) * hor_line_presentation_width) + 'px');

        $('.clock').css('padding-top', (((((center_width - 600) / 180) * 0.5) + 1) * clock_top_padding) + 'px');
        $('.clock').css('padding-bottom', (((((center_width - 600) / 360) * 8.2) + 1) * clock_bottom_padding) + 'px');
        $('.clock p').css('font-size', (((((center_width - 600) / 360) * 0.6) + 1) * clock_font_size) + 'px');
        $('.clock p').css('margin-top', (((((center_width - 600) / 360) * 0.8) + 1) * clock_p_margin_top) + 'px');
        $('.clock p').css('line-height', (((((center_width - 600) / 360) * 0.6) + 1) * clock_p_line) + 'px');
        $('.clock .hor-line-2').css('margin-top', (((((center_width - 600) / 180) * 0.55) + 1) * hor_line_clock_top) + 'px');
        $('.clock .hor-line-2').css('width', (((((center_width - 600) / 180) * 0.3) + 1) * hor_line_clock_width) + 'px');
        $('.clock img').eq(0).css('width', (((((center_width - 600) / 180) * 0.3) + 1) * clock_size) + 'px');

        $('.hor-line-3').css('width', (((((center_width - 600) / 180) * 0.3) + 1) * hor_line3_width) + 'px');

        $('.thread1').css('width', (((((center_width - 600) / 180) * 0.3) + 1) * thread1) + 'px');
        $('.thread2').css('width', (((((center_width - 600) / 180) * 0.3) + 1) * thread2) + 'px');
        $('.thread2').css('top', (((((center_width - 600) / 180) * 0.3) + 1) * thread2_top) + 'px');
        $('.clock .thread3').css('width', (((((center_width - 600) / 180) * 0.3) + 1) * thread3) + 'px');
        $('.clock .thread3').css('top', (((((center_width - 600) / 180) * 0) + 1) * thread3_top) + 'px');
    });

    $('.job-link-unactive').live('mouseenter', function()
    {
        $(this).hide();
        $('.job-link-active').show();
    });
    $('.job-link-active').live('mouseleave', function()
    {
        $(this).hide();
        $('.job-link-unactive').show();
    });

    $('.email-unactive').live('mouseenter', function()
    {
        $(this).hide();
        $('.email-active').show();
    });
    $('.email-active').live('mouseleave', function()
    {
        $(this).hide();
        $('.email-unactive').show();
    });


    $('.jobs-title-unactive').live('mouseenter', function()
    {
        $(this).hide();
        $('.jobs-title-active').show();
    });
    $('.jobs-title-active').live('mouseleave', function()
    {
        $(this).hide();
        $('.jobs-title-unactive').show();
    });

    $("a.in-jobs").click(function () {
        var elementClick = $(this).attr("href");
        var destination = $(elementClick).offset().top;
        if($.browser.safari){
            $('body').animate( { scrollTop: destination }, 1100 );
        }else{
            $('html').animate( { scrollTop: destination }, 1100 );
        }
        return false;
    });

    ie7 = ($.browser.msie && $.browser.version=='7.0');
    if(ie7)
    {
        $('.presentation').click(function()
        {
            document.location.href = ($(this).parent('a').attr('href'));
        });
    }
});
