﻿    $(document).ready(function() {
        $(".media").css("left", screen.width / 2 - 475 + "px");
        $("#paintbucket").css("left", screen.width / 2 + 300 + "px");
        //$("#nav").css("left", screen.width / 2 + 100 + "px");
        $("#paintbrushes").css("left", screen.width / 2 - 500 + "px");
        $("#media").css("left", screen.width / 2 - 300 + "px");
        $("#logotext").css("left", screen.width / 2 - 435 + "px");
        $("#nav").css("left", screen.width / 2 - 390 + "px");
        $(".bigquote").css("left", screen.width / 2 - 300 + "px");
        $("#bigPicShell").css("left", screen.width / 2 - 375 + "px");
        $("#heading").css("left", screen.width / 2 - 350 + "px");
        $("#media1").fadeIn("fast");
        $("#quote1").show();

        picTimer=setInterval("showPic('next')", 7000);
        quoteTimer=setInterval("showQuote('next')", 5000);
    });
    
    //var itemCount=// set in picRotator;
    var mediacount;
    var itemNum = 1;
    var itemNumb = 1;
    $("#media1").show();

    function showPic(action) {

        for (var x = 1; x <= itemCount; x++) {
            $("#media" + x).hide();
        }
        if (action == 'next') {
            itemNum = itemNum + 1;
            if (itemNum == itemCount + 1) {
                itemNum = 1;
            }
            // alert(itemNum);
            //$("#media" + itemNum).show("scale");
            $("#media" + itemNum).show("scale");

            $("#itemcount").html(itemCount);
            $("#itemnum").html(itemNum);

        }

        if (action == 'previous') {
            itemNum = itemNum - 1;
            if (itemNum == 0) {
                itemNum = itemCount;
            }
            $("#media" + itemNum).fadeIn("fast");
        }

    }

    //var itemCount=// set in picRotator;
    var quoteCount = 5;
    var quoteNum = 1;
    var quoteNumb = 1;
    $("#quote1").show();

    function showQuote(action) {

        for (var x = 1; x <= quoteCount; x++) {
            $("#quote" + x).hide();
        }
        if (action == 'next') {
            quoteNum = quoteNum + 1;
            if (quoteNum == quoteCount + 1) {
                quoteNum = 1;
            }
            $("#quote" + quoteNum).show("clip");

        }

        if (action == 'previous') {
            quoteNum = quoteNum - 1;
            if (quoteNum == 0) {
                quoteNum = quoteCount;
            }
            $("#quote" + quoteNum).show();
        }

    }

    function showBigQuote(x) {
        $("#bg").show();
        opacity("bg", 0, 85, 1000);
        //$("#bigquote" + x).fadeIn();
        $("#bigquote" + x).show("blind");


        clearInterval(picTimer);
        clearInterval(quoteTimer);
    }

    function closeBigQuote(x) {
        $("#bg").hide();
        $("#bigquote" + x).fadeOut();

        picTimer = setInterval("showPic('next')", 7000);
        quoteTimer = setInterval("showQuote('next')", 10000);

    }


    function showBigPic(x) {

        //alert(x);
        $("#bigPic").attr("src","gallery/large/" + x);
        $("#bigPicShell").fadeIn();
        $("#bg").show();

        //opacity("bg", 0, 85, 1000);
        //$("#bigquote" + x).fadeIn();
        
        $("#bigPicShell" + x).show("size");

    }

    function closeBigPic(x) {
        $("#bg").hide();
        //$("#bigPicShell" + x).hide("scale");
        $("#bigPicShell").fadeOut();


    }

    function advanceGallery(action) {

        for (var x = 1; x <= galleryCount; x++) {
            $("#gallery" + x).hide();
        }
        if (action == 'next') {
            itemNum = itemNum + 1;
            if (itemNum == galleryCount + 1) {
                itemNum = 1;
            }
            //$("#gallery" + itemNum).fadeIn();
            $("#gallery" + itemNum).show("drop", { direction: 'right' },500);

            //$("#itemcount").html(galleryCount);
            //$("#itemnum").html(itemNum);


        }

        if (action == 'previous') {
            itemNum = itemNum - 1;
            if (itemNum == 0) {
                itemNum = galleryCount;
            }
            //$("#gallery" + itemNum).fadeIn("fast");
            $("#gallery" + itemNum).show("drop",{direction:'left'},300);

        }

    }
    
