function ie6() {
    var Sys = {};
    var ua = navigator.userAgent.toLowerCase();
    var s;
    (s = ua.match(/msie ([\d.]+)/)) ? Sys.ie = s[1] :
    (s = ua.match(/firefox\/([\d.]+)/)) ? Sys.firefox = s[1] :
    (s = ua.match(/chrome\/([\d.]+)/)) ? Sys.chrome = s[1] :
    (s = ua.match(/opera.([\d.]+)/)) ? Sys.opera = s[1] :
    (s = ua.match(/version\/([\d.]+).*safari/)) ? Sys.safari = s[1] : 0;

    if (Sys.ie == 6.0) {
        return true;
    }
    else {
        return false;
    }
}

function doResize() {
    var h = ((document.documentElement.clientHeight < 570) ? "570" : document.documentElement.clientHeight) + "px";
    var w = ((document.documentElement.clientWidth < 431) ? "431" : document.documentElement.clientWidth) + "px";
    $("#total").css({"height" : h, "width" : w});
    $("#nav").css({"height" : h});
}

function loadclear() {
    var newimg = new Image();
    newimg.src = "images/background.jpg";
    if (!ie6()) {
        newimg.onload = function(){
            $("#total").css({"background-image" : "url(" + newimg.src + ")"});
            $("#total").show("slow");
        }
    }
    else {
        $("#total").css({"background-image" : "url(" + newimg.src + ")"});
        $("#total").show("slow");
    }
}

window.onresize = function() {
    if (ie6()) {
        doResize();
    }
}

$(function(){
    if (ie6()) {
        doResize();
    }
    loadclear();

    $(".navlink").mouseover(function(){
        var thisimg = "#" + $(this).attr("id") + " img";
        var arrid = "#" + $(this).attr("id") + "arr";
        var newtop;
        if(arrid == "#blogarr") newtop = 81;
        else
        if(arrid == "#worksarr") newtop = 159;
        else
        if(arrid == "#albumarr") newtop = 241;
        else
        if(arrid == "#aboutarr") newtop = 332;
        var newsrc = "images/Nav_" + $(this).attr("id") + "_O.gif";
        $(thisimg).attr({src: newsrc});
        $(arrid).animate({"top" : newtop}, 300);
    });
    $(".navlink").mouseout(function(){
        var thisimg = "#" + $(this).attr("id") + " img";
        var arrid = "#" + $(this).attr("id") + "arr";
        var newsrc = "images/blank.gif";
        var newtop;
        if(arrid == "#blogarr") newtop = 80;
        else
        if(arrid == "#worksarr") newtop = 155;
        else
        if(arrid == "#albumarr") newtop = 240;
        else
        if(arrid == "#aboutarr") newtop = 330;

        $(thisimg).attr({src: newsrc});
        $(arrid).animate({"top" : newtop + 50}, 100);
        $(arrid).animate({"top" : -25}, 300);
    });

    $("#BigLogo img").mouseover(function(){
        $(this).attr("src", "images/X2StudioBigLogo.gif");
    });
    $("#BigLogo img").mouseout(function(){
        $(this).attr("src", "images/blank.gif");
    });

    $("#url").mouseover(function(){
        var newtop = 535;
        var newleft = 170;
        $(this).animate({"top" : newtop + 1, "left" : newleft + 1}, 50);
        $(this).animate({"top" : newtop + 1, "left" : newleft - 1}, 50);
        $(this).animate({"top" : newtop - 1, "left" : newleft - 1}, 50);
        $(this).animate({"top" : newtop - 1, "left" : newleft + 1}, 50);
        $(this).animate({"top" : newtop, "left" : newleft}, 50);
    });
});

$(function(){
    $(".inside").css("display", "block");
});

$(function(){
    $(".close").click(function(){
        $(".inside").css("display", "none");
    });
});
