//onload
$(function() {
    $(document).pngFix();

    // initialize message boxes
    var msgoverlay = { 'background-color': 'black', opacity: 0.5 };
    var defaultDialogSettings = { modal: true, overlay: msgoverlay, resizable: false, draggable: false, height: '80px' };

    $("#contact-dialog").dialog(defaultDialogSettings);
    
    var htmlVersionDialogSettings = { modal: true, overlay: msgoverlay, resizable: false, draggable: false, height: '300px', width: '429px', buttons: { "Ok": function() { $(this).dialog("close"); } } };
    $("#htmlversion-dialog").dialog(htmlVersionDialogSettings);
    
    
    var tmaSpecialSettings = { modal: true, overlay: msgoverlay, resizable: false, draggable: false, height: '593px', width: '989px', position: 'top' };
    $("#tma-special-dialog").dialog(tmaSpecialSettings);

    $("#accordion").accordion({ active: false });

    $(".glasses").mouseover(function() {
        $(this).css("backgroundImage", "url(/html/Content/_img/bg-colors.png)");
        $(this).children(".colors").show();
    });

    $(".glasses").mouseout(function() {
        $(".glasses").css("backgroundImage", "none");
        $(".colors").hide();
    });

    //retailer search - shows label choose country, ...
    $(".change").mouseover(function() {
        var small = $(this).children().get(0);
        $(small).show();
    });

    $(".change").mouseout(function() {
        var small = $(this).children().get(0);
        $(small).hide();
    });

    //shows color info
    $(".color-info").mouseover(function() {
        var small = $(this).children().get(0);
        $(small).show();
    });

    $(".color-info").mouseout(function() {
        var small = $(this).children().get(0);
        $(small).hide();
    });

    $("#lang-select").mouseover(function() {
        $("#d-1").show();
    });

    $("#lang-select").mouseout(function() {
        $("#d-1").hide();
    });

    //flash check
    if (!jQuery.fn.flash.hasFlash()) {
        //alert("no flash");
        $(".dialog").attr("href", "/html/dialog/noflash.action?KeepThis=true&TB_iframe=true&height=300&width=400");
        
        $("#virtual-mirror").attr("href", "/html/dialog/noflash.action?KeepThis=true&TB_iframe=true&height=300&width=400");
        $("#makingof").attr("href", "/html/dialog/noflash.action?KeepThis=true&TB_iframe=true&height=300&width=400");
        //$("#brandvideo").attr("href", "/html/dialog/noflash.action?KeepThis=true&TB_iframe=true&height=300&width=400");
        $("#makeup").attr("href", "/html/dialog/noflash.action?KeepThis=true&TB_iframe=true&height=300&width=400");
        $("#flash-version").attr("href", "/html/dialog/noflash.action?KeepThis=true&TB_iframe=true&height=300&width=400");
        $("#media").attr("href", "/html/dialog/noflash.action?KeepThis=true&TB_iframe=true&height=300&width=400");
        $("#flash-version").addClass("thickbox");
    } else {
        $(".dialog").each(function() {
            var id = $(this).attr("id");
            if (id != '') {
                $(this).attr("href", "/html/dialog/index.action?id=" + id + "&KeepThis=true&TB_iframe=true&height=300&width=400");
            }
        });
    
        $("#virtual-mirror").attr("href", "/html/dialog/virtualMirror.action?KeepThis=true&TB_iframe=true&height=300&width=400");
        $("#makingof").attr("href", "/html/dialog/makingof.action?KeepThis=true&TB_iframe=true&height=300&width=400&show=flash");
        //$("#brandvideo").attr("href", "/html/dialog/brandvideo.action?KeepThis=true&TB_iframe=true&height=300&width=400&show=flash");
        $("#makeup").attr("href", "/html/dialog/makeup.action?KeepThis=true&TB_iframe=true&height=300&width=400&show=flash");
        $("#media").attr("href", "/html/dialog/media.action?KeepThis=true&TB_iframe=true&height=300&width=400&show=flash");
        $("#flash-version").attr("href", "http://www.silhouette.com");
        $("#flash-version").attr("class", "");
    }

});

