function RunSiteScripts()
{
	//INTRO SEQUENCE
	function Stage1()
	{
		setTimeout(function() {
			$("#frame_1").fadeOut("slow", Stage2);
		}, 1500);
	}
	
	function Stage2() 
	{
		setTimeout(function() {
			$("#frame_2").fadeIn("slow", Stage3);
		}, 500);
	}
	function Stage3() 
	{
		setTimeout(function() {
			$("#frame_2").fadeOut("slow", Stage4);
		}, 1500);
	}
	function Stage4() {
		$("body").animate({ backgroundColor: "#ece5d6" }, { queue:true, duration:500, complete:Stage5 });
    }
	function Stage5() {
        $("#topWrapper").fadeIn("slow");
		setTimeout(function() {
			$("#frame_3").fadeIn("slow", Stage6);
		}, 500);
	}
	function Stage6() 
	{
		setTimeout(function() {
			$("#frame_3").fadeOut("slow", ShowGallery);
		}, 5000);
	}
	function ShowGallery()
	{
		//$("#introWrapper").animate({ backgroundColor: "#ece5d6" }, { queue:true, duration:500 }).css("z-index", 1);
        $("#frame_3").css("z-index", 1);
        $("#introWrapper").css("z-index", 1);
        $("#slideShowContainer").fadeIn("slow");
        $("#bottomWrapper").fadeIn("slow");
        $('#slideshow').cycle({timeout:3000, startingSlide:0, next: '#next', prev: '#prev', before: HandleOnBefore});
        //PAUSE SLIDE SHOW
        $('#pause').click(function() { 
            $('#slideshow').cycle('pause'); 
        });
        $('#next').click(function() { 
            $('#slideshow').cycle('resume'); 
        });
        $('#prev').click(function() { 
            $('#slideshow').cycle('resume'); 
        });
	}

	$("#frame_1").fadeIn("slow", Stage1);
}

function HandleOnBefore()
{
    if (this.alt == "kipsbay")
    {
        $("#KipsBay").addClass("On");
        $("#Project14297").removeClass("On");
        $("#RussianDesignShow").removeClass("On");
        $("#Project27846").removeClass("On");
        $("#HamptonDesignerShowhouse").removeClass("On");
    } else if(this.alt == "project14297") {
        $("#KipsBay").removeClass("On");
        $("#Project14297").addClass("On");
        $("#RussianDesignShow").removeClass("On");
        $("#Project27846").removeClass("On");
        $("#HamptonDesignerShowhouse").removeClass("On");
    } else if(this.alt == "russiandesignshow") {
        $("#KipsBay").removeClass("On");
        $("#Project14297").removeClass("On");
        $("#RussianDesignShow").addClass("On");
        $("#Project27846").removeClass("On");
        $("#HamptonDesignerShowhouse").removeClass("On");
    } else if(this.alt == "project27846") {
        $("#KipsBay").removeClass("On");
        $("#Project14297").removeClass("On");
        $("#RussianDesignShow").removeClass("On");
        $("#Project27846").addClass("On");
        $("#HamptonDesignerShowhouse").removeClass("On");
    } else if(this.alt == "hamptondesignershowhouse") {
        $("#KipsBay").removeClass("On");
        $("#Project14297").removeClass("On");
        $("#RussianDesignShow").removeClass("On");
        $("#Project27846").removeClass("On");
        $("#HamptonDesignerShowhouse").addClass("On");
    }
}

function RunSlideShow(startIndex)
{
    $('#slideshow').cycle({timeout:3000, startingSlide:startIndex, next: '#next', prev: '#prev', before: HandleOnBefore});
    //PAUSE SLIDE SHOW
    $('#pause').click(function() { 
        $('#slideshow').cycle('pause'); 
    });
    $('#next').click(function() { 
        $('#slideshow').cycle('resume'); 
    });
    $('#prev').click(function() { 
        $('#slideshow').cycle('resume'); 
    });
}





// About Page 
function AboutNextPage()
{
    $("#aboutPage1").fadeOut("fast", function() {$("#aboutPage2").fadeIn("fast")});
}
function AboutPrevPage()
{
    $("#aboutPage2").fadeOut("fast", function() {$("#aboutPage1").fadeIn("fast")});
}

// Thoughts Page 
function ThoughtsNextPage(pageid)
{
    nextpageid = pageid + 1;
    $("#thoughtsPage" + pageid).fadeOut("fast", function() {$("#thoughtsPage" + nextpageid).fadeIn("fast")});
}
function ThoughtsPrevPage(pageid)
{
    prevpageid = pageid - 1;
    $("#thoughtsPage" + pageid).fadeOut("fast", function() {$("#thoughtsPage" + prevpageid).fadeIn("fast")});
}








function ShowArtJournalSlide(startIndex)
{
    $('#artjournalslideshow').cycle({timeout:0, startingSlide:startIndex, next: '#next', prev: '#prev', before: HandleOnBefore});
    //PAUSE SLIDE SHOW
    $('#pause').click(function() { 
        $('#artjournalslideshow').cycle('pause'); 
    });
    $('#next').click(function() { 
        $('#artjournalslideshow').cycle('resume'); 
    });
    $('#prev').click(function() { 
        $('#artjournalslideshow').cycle('resume'); 
    });
}

// ArtJournalList Page  
function ArtsJournalListNextPage(pageid)
{
    nextpageid = pageid + 1;
    $("#artsJournalListPage" + pageid).fadeOut("fast", function() {$("#artsJournalListPage" + nextpageid).fadeIn("fast")});
}
function ArtsJournalListPrevPage(pageid)
{
    prevpageid = pageid - 1;
    $("#artsJournalListPage" + pageid).fadeOut("fast", function() {$("#artsJournalListPage" + prevpageid).fadeIn("fast")});
}

/*
function ArtJournalNextPage()
{
    $("#artJournalPage1").fadeOut("fast", function() {$("#artJournalPage2").fadeIn("fast")});
}
function ArtJournalPrevPage()
{
    $("#artJournalPage2").fadeOut("fast", function() {$("#artJournalPage1").fadeIn("fast")});
}
*/

// About Page 
function AboutNextPage()
{
    $("#aboutPage1").fadeOut("fast", function() {$("#aboutPage2").fadeIn("fast")});
}
function AboutPrevPage()
{
    $("#aboutPage2").fadeOut("fast", function() {$("#aboutPage1").fadeIn("fast")});
}

// ArtJournal Page 
function ShowArtsJournalListSlide()
{
    $('#artsjournallistslideshow').cycle({timeout:0, startingSlide:0, next: '#next', prev: '#prev', before: HandleOnBefore});
    //PAUSE SLIDE SHOW
    $('#pause').click(function() { 
        $('#artsjournallistslideshow').cycle('pause'); 
    });
    $('#next').click(function() { 
        $('#artsjournallistslideshow').cycle('resume'); 
    });
    $('#prev').click(function() { 
        $('#artsjournallistslideshow').cycle('resume'); 
    });
}


