// JavaScript Document
var initialPrint = 0;
var initialInteractive = 0;

//Activate Immediately
$(document).ready(function(){
	
	//Hide Content
	$('#web').html('');
	$('#print').html('');
	$('#interactive').html('');
						   
	//Show Web
	$("#web").load("web.htm");
	
	//Show Arrows	
	$("#arrow_left").show();
	$("#arrow_right").show();
	$("#arrow_left").hover(function() {$(this).css( {backgroundPosition:"0px -143px"});},function () {$(this).css( {backgroundPosition:"0px 0px"});});
	$("#arrow_right").hover(function() {$(this).css( {backgroundPosition:"0px -117px"});},function () {$(this).css( {backgroundPosition:"0px 0px"});});
						   
	//Allows Non-Javascript Users to Scroll through choices					   
	$("#work_web").css( {overflow:"hidden"});
	$("#work_print").css( {overflow:"hidden"});
	$("#work_interactive").css( {overflow:"hidden"});
	
	//Randomly picks starting image (favoring those listed first)				
	window.startpoint = Math.floor(Math.random()*8);
	if(startpoint > 2){window.startpoint = Math.floor(Math.random()*8);};
	if(startpoint > 4){window.startpoint = Math.floor(Math.random()*8);};
	
	menuRollovers();
	$("#menu_web").hover(function() {$(this).css( {backgroundPosition:"0px -66px"});},function () {$(this).css( {backgroundPosition:"0px -66px"});});

});

//Work Menu Rollovers
function menuRollovers(){
	$("#menu_web").hover(function() {$(this).css( {backgroundPosition:"0px -33px"});},function () {$(this).css( {backgroundPosition:"0px 0px"});});
	$("#menu_print").hover(function() {$(this).css( {backgroundPosition:"-76px -33px"});},function () {$(this).css( {backgroundPosition:"-76px 0px"});});
	$("#menu_interactive").hover(function() {$(this).css( {backgroundPosition:"-156px -33px"});},function () {$(this).css( {backgroundPosition:"-156px 0px"});});
}

//Work Menu Highlights
function menuHighlight(){
	$("#menu_web").css( {backgroundPosition:"0px 0px"});
	$("#menu_print").css( {backgroundPosition:"-76px 0px"});
	$("#menu_interactive").css( {backgroundPosition:"-156px 0px"});
}

//Reveals Web Work
function showWeb(){
	$("#interactive").hide();
	$("#print").hide();
	$("#web").show();
	$("#work_web").trigger( 'goto', [ 0 ] );
	$("#work_interactive").css("z-index", "40");
	$("#work_print").css("z-index", "40");
	$("#work_web").css("z-index", "50");
	menuHighlight();
	$("#menu_web").css( {backgroundPosition:"0px -66px"});
	menuRollovers();
	$("#menu_web").hover(function() {$(this).css( {backgroundPosition:"0px -66px"});},function () {$(this).css( {backgroundPosition:"0px -66px"});});
}
//Reveals Print Work
function showPrint(){
	if(initialPrint == 0){$("#print").load("print.htm");};
	initialPrint = 1;
	$("#interactive").hide();
	$("#web").hide();
	$("#print").show();
	$("#work_print").trigger( 'goto', [ 0 ] );
	$("#work_interactive").css("z-index", "40");
	$("#work_print").css("z-index", "50");
	$("#work_web").css("z-index", "40");
	menuHighlight();
	$("#menu_print").css( {backgroundPosition:"-76px -66px"});
	menuRollovers();
	$("#menu_print").hover(function() {$(this).css( {backgroundPosition:"-76px -66px"});},function () {$(this).css( {backgroundPosition:"-76px -66px"});});
}
//Reveals Interactive Work
function showInteractive(){
	if(initialInteractive == 0){$("#interactive").load("interactive.htm");};
	initialInteractive = 1;
	$("#print").hide();
	$("#web").hide();
	$("#interactive").show();
	$("#work_interactive").trigger( 'goto', [ 0 ] );
	$("#work_interactive").css("z-index", "50");
	$("#work_print").css("z-index", "40");
	$("#work_web").css("z-index", "40");
	menuHighlight();
	$("#menu_interactive").css( {backgroundPosition:"-156px -66px"});
	menuRollovers();
	$("#menu_interactive").hover(function() {$(this).css( {backgroundPosition:"-156px -66px"});},function () {$(this).css( {backgroundPosition:"-156px -66px"});});
}

//Show Work Menu
function showMenu(){
	document.write('<ul id="work_menu"><li id="menu_web" onclick="showWeb();">web.</li><li id="menu_print" onclick="showPrint();">print.</li><li id="menu_interactive" onclick="showInteractive();">interactive.</li></ul>');
}
	