﻿$(document).ready(function() {
    initSlide();
    initShowContentPage();
    initChangeNav();
    $('#slideshow').cycle();
    $(document).pngFix();
    $('.legal').click(function() {
        window.open('legal.html');
        return false;
    });    
});

function initChangeNav() {
    $('div#nav ul li a').click(function() {
    $('div#nav').find('a').css('color', '#999');
        $(this).css('color', '#fff');
    });
}

function initSlide() {
    var windowWidth = $(window).width();
    var spaceToSides = windowWidth - 800;
    var actualPosition = spaceToSides / 2;

    $('#main').css('width', windowWidth + 'px');
}

function initShowContentPage() {
    $('a.home').click(function() {
        $('#content').find('div:visible,div:animated').hide();
        $('#Home').fadeIn(3000);      
    });
    $('a.sourcing').click(function() {
        $('#content').find('div:visible,div:animated').hide();
        $('#Sourcing').fadeIn(3000);  
    });
    $('a.importation').click(function() {
        $('#content').find('div:visible,div:animated').hide();
        $('#Importation').fadeIn(3000);        
    });
    $('a.procurement').click(function() {
        $('#content').find('div:visible,div:animated').hide();
        $('#Procurement').fadeIn(3000);      
    });
    $('a.kitting').click(function() {
        $('#content').find('div:visible,div:animated').hide();
        $('#Kitting').fadeIn(3000);        
    });
    $('a.kittingassembly').click(function() {
        $('#content').find('div:visible,div:animated').hide();
        $('#KittingAssembly').fadeIn(3000);
        $('#KittingAssembly div').fadeIn(3000);
    });
    $('a.quality').click(function() {
        $('#content').find('div:visible,div:animated').hide();
        $('#Quality').fadeIn(3000);      
    });
    $('a.whyuseactive').click(function() {
        $('#content').find('div:visible,div:animated').hide();
        $('#WhyUseActive').fadeIn(3000);      
    });
    $('a.contact').click(function() {
        $('#content').find('div:visible,div:animated').hide();
        $('#Contact').fadeIn(3000);
        $('#Contact div').fadeIn(3000);
    });
    $('a.customercare').click(function() {
        $('#content').find('div:visible,div:animated').hide();
        $('#CustomerCare').fadeIn(3000);
        $('#CustomerCare div').fadeIn(3000);
    });
    $('a.computerspares').click(function() {
        $('#content').find('div:visible,div:animated').hide();
        $('#ComputerSpares').fadeIn(3000);
        $('#ComputerSpares div').fadeIn(3000);
    });
}