var isMobile = (typeof(window.orientation) != "undefined");

var setBG = function (intIndex) {
    if (typeof (bgImgs) != "undefined") {
        var key = (isMobile) ? "mobile" : "default";
        if (bgImgs.length > 0) {
            var strImgTmplt = '<img id="{0}" src="{1}"{2}/>';
            var strImgs = "";
            for (var iBg = 0; iBg < bgImgs.length; iBg++) {
                strImgs += strImgTmplt.replace("{0}", "bg_" + iBg).replace("{1}", bgImgs[iBg][key]);
                strImgs = strImgs.replace("{2}", ((iBg == 0) && (bgImgs.length > 1)) ? ' class="opaque" ' : ' ');
            }
            $("#background #background-photo").html($(strImgs));
        }
        if (bgImgs.length > 1) {
            $("#background img.opaque").removeClass("opaque");
        }
        window.setTimeout(function () {
            $("#bg_" + intIndex).addClass("opaque"); 
        }, 100);
    }
};

/* Author: 

*/
$(function () {
    setBG(0);

    if (typeof (window.orientation) != "undefined") 
    {
        window.onload = function () { window.scrollTo(0, 1); }; 
    };

    // Hide all the tooltips
    $("#jquery li").each(function () {
        $("a strong", this).css("opacity", "0");
    });

    $("#jquery li").hover(function () { // Mouse over
        $(this)
			.stop().fadeTo(500, 1)
			.siblings().stop().fadeTo(500, 0.2);

        $("a strong", this)
			.stop()
			.animate({
			    opacity: 1,
			    top: "-10px"
			}, 300);

    }, function () { // Mouse out
        $(this)
			.stop().fadeTo(500, 1)
			.siblings().stop().fadeTo(500, 1);

        $("a strong", this)
			.stop()
			.animate({
			    opacity: 0,
			    top: "-1px"
			}, 300);
    });
});
