function startFlash() {
    if (swfobject.hasFlashPlayerVersion("9.0.0") && $('.NoLogo').length == 0) {
        swfobject.embedSWF('/Triple-S/key8.swf', 'flash_placeholder', 1000, 600, '9.0.0', '', {}, {wmode: 'transparent'});
    } else {
        startJS();
    }
}

function startJS() {
    /*$('#flash').animate({'backgroundColor': 255}, 500, '', function() {*/
        $('#flash').css('display', 'none');
        $('#container').fadeIn();
        $('#corporateMenu li a').css('width', '199px');
        $('#corporateMenu').css('width', '800px').css('left', '200px').fadeIn();
        $('#home .col').hover(function() {
            $(this).addClass('hover');
        }, function() {
            $(this).removeClass('hover');
        });
        $('#home .col .logo').click(function() {
            selectCol(this.parentNode);
        });
        $('#home .col .MenuItemTitleSSSTraining a').click(function() { selectCol(document.getElementById('col2')); return false; });
        $('#home .col .MenuItemTitleSSSConcierge a').click(function() { selectCol(document.getElementById('col3')); return false; });
        $('#home .col .MenuItemTitleSSSEvents a').click(function() { selectCol(document.getElementById('col4')); return false; });
        $('#home .col .MenuItemTitleSSSLAM a').click(function() { selectCol(document.getElementById('col5')); return false; });
        $('#newsletterhome a').click(function() {
            $('#newsletterhomeform').fadeIn(1000);
        });
        startDetailJS();
    /*});*/
}

function selectCol(col) {
    switch (col.id) {
        case 'col2': $('.Triple').css('display', 'block'); $('body').addClass('Triple'); break;
        case 'col3': $('.Concierge').css('display', 'block'); $('body').addClass('Concierge'); break;
        case 'col4': $('.Events').css('display', 'block'); $('body').addClass('Events'); break;
        case 'col5': $('.LAM').css('display', 'block'); $('body').addClass('LAM'); break;
    }
    $('#home .col, #home #coltext').removeClass('hover').each(function() {
        if (this !== col) $(this).fadeOut(); });
    $('.stock', col).animate({marginTop: '10px'}, 1500);
    window.setTimeout(function() {
        $('#home').fadeOut();
    }, 1000);
    $('#corporateMenu li a').animate({width: '171px'}, 1200);
    $('#corporateMenu').animate({left: '310px', width: '690px'}, 1300);
    $('.crown').animate({top: $(document).height() - 45 + 'px', width: '50px', height: '25px', left: '5px'}, 1500);
}

function startDetailJS() {
    $('.body').css('margin-left', '310px');
    $('.col:not(#home .col)').css('position', 'absolute').css('top', $(this).scrollTop() + "px");
    $(window).scroll(function() {
        $('.news').css('bottom', 10 - $(this).scrollTop() + "px");
        $('#corporateMenu').css('bottom', 0 - $(this).scrollTop() + "px");
        $('#newsletterhome').css('bottom', 0 - $(this).scrollTop() + "px");
        $('#newsletterhomeform').css('bottom', 60 - $(this).scrollTop() + "px");
        $('.col:not(#home .col)').css('position', 'absolute').css('top', $(this).scrollTop() + "px");
    });
    $('.news img').hoverIntent({interval: 20, timeout: 1000, over: function() { buttonIn(); }, out: function() { buttonOut(); }});
    $('#sectionMenu').hoverIntent({interval: 20, timeout: 1000, over: function() { logosIn(); }, out: function() { logosOut(); }});
    $('#newslink').fancybox({'frameWidth': 600});
}

var isInButton = false;
var isInMenu = false;
var isInLogos = false;

function buttonIn() {
}
function menuIn() { isInMenu = true; }
function logosIn() { isInLogos = true; }

function buttonOut() { isInButton = false; mouseOut(); }
function menuOut() { isInMenu = false; mouseOut(); }
function logosOut() { isInLogos = false; mouseOut(); }
function mouseOut() {
}

function showNews(html) {
    $('#newsdata').html('<div class="fancynews">' + html + '</div>');
    $('#newslink').click();
}

function cancelNewsletter() {
    $('.col .stock').slideDown();
    $('.ReceiveNewsletter').slideUp();
    $('#newsletterhomeform').fadeOut(500);
}