var test_flag = 0;
var amount = 0;
var interval_once_flag = 0;
var test_div_direction = "x";
var f1 = 0;
var timestep_once_flag = 0

xMousePos = 0; // Horizontal position of the mouse on the screen
yMousePos = 0; // Vertical position of the mouse on the screen
xMousePosMax = 0; // Width of the page
yMousePosMax = 0; // Height of the page

var viewportwidth;
var viewportheight;

/*
var gifHome = new Image(26,24);
gifHome.src = "background.gif";
var gifHome2 = new Image(26,24);
gifHome2.src = "background_top.gif";

function changeImg(cImg,ref)
{
	document.images[cImg].src = ref.src;
}
*/

//document.captureEvents(Event.MOUSEMOVE);
//document.onmousemove = captureMousePosition;

var game_screenshot_showing = 5;

// object to move - controls
//var moving_div = "div__large_screenshot_controls__2";
var testing_object_visibility = "hidden";
//

/*
function highlight_button()
{
	var obj__nav_menu = document.getElementById("nav-menu");
	
	obj__nav_menu.style.background = "background_top.gif";
}
*/
  
/* 
function open_tut_menu()
{
	var obj__black_box = document.getElementById("black_box");

	if (obj__black_box.style.visibility == "hidden")
	{
		var obj = document.getElementById("div__tutorials_box");
		obj.style.visibility = "visible"
	}
	
	var obj__portfolio_box = document.getElementById("div__portfolio_box");
	obj__portfolio_box.style.visibility = "hidden"
	
}
*/

/*
function open_portfolio_menu()
{
	var obj__portfolio_box = document.getElementById("div__portfolio_box");
	obj__portfolio_box.style.visibility = "visible";
	
	var obj = document.getElementById("div__tutorials_box");
	obj.style.visibility = "hidden"
	
}
*/


function close_tutorial_menu()
{
	//if (test_flag == 0)
	//{
		var obj = document.getElementById("div__tutorials_box");
		obj.style.visibility = "hidden";
		
		var obj__portfolio_box = document.getElementById("div__portfolio_box");
		obj__portfolio_box.style.visibility = "hidden";

		
		//test_flag = 1;
	//}
}


function show_large_screenshot_1()
{
	var obj__large_screenshot = document.getElementById("div__large_screenshot");
	var obj__large_screenshot_controls = document.getElementById("div__large_screenshot_controls");
	obj__large_screenshot.style.visibility = "visible";
	obj__large_screenshot_controls.style.visibility = "visible";
	var obj__black_box = document.getElementById("black_box");
	obj__black_box.style.visibility = "visible";
	var obj__large_screenshots_white_box = document.getElementById("div__large_screenshots_white_box");
	obj__large_screenshots_white_box.visibility = "visible";
	
	document.getElementById('div__large_screenshot').innerHTML = "<img src=./game_screenshot_1.png></img>";
	game_screenshot_showing = 1;
}

function show_large_screenshot_2()
{
	var obj__large_screenshot = document.getElementById("div__large_screenshot");
	var obj__large_screenshot_controls = document.getElementById("div__large_screenshot_controls");
	obj__large_screenshot.style.visibility = "visible";
	obj__large_screenshot_controls.style.visibility = "visible";
	var obj__black_box = document.getElementById("black_box");
	obj__black_box.style.visibility = "visible";
	var obj__large_screenshots_white_box = document.getElementById("div__large_screenshots_white_box");
	obj__large_screenshots_white_box.visibility = "visible";


	
	document.getElementById('div__large_screenshot').innerHTML = "<img src=./game_screenshot_2.png></img>";
	game_screenshot_showing = 2;
}

function show_large_screenshot_3()
{
	var obj__large_screenshot = document.getElementById("div__large_screenshot");
	var obj__large_screenshot_controls = document.getElementById("div__large_screenshot_controls");
	obj__large_screenshot.style.visibility = "visible";
	obj__large_screenshot_controls.style.visibility = "visible";
	var obj__black_box = document.getElementById("black_box");
	obj__black_box.style.visibility = "visible";
	var obj__large_screenshots_white_box = document.getElementById("div__large_screenshots_white_box");
	obj__large_screenshots_white_box.visibility = "visible";


	
	document.getElementById('div__large_screenshot').innerHTML = "<img src=./game_screenshot_3.png></img>";
	game_screenshot_showing = 3;
}

function show_large_screenshot_4()
{
	var obj__large_screenshot = document.getElementById("div__large_screenshot");
	var obj__large_screenshot_controls = document.getElementById("div__large_screenshot_controls");
	obj__large_screenshot.style.visibility = "visible";
	obj__large_screenshot_controls.style.visibility = "visible";
	var obj__black_box = document.getElementById("black_box");
	obj__black_box.style.visibility = "visible";
	var obj__large_screenshots_white_box = document.getElementById("div__large_screenshots_white_box");
	obj__large_screenshots_white_box.visibility = "visible";


	
	document.getElementById('div__large_screenshot').innerHTML = "<img src=./game_screenshot_4.png></img>";
	game_screenshot_showing = 4;
}

function close_large_screenshots()
{
	var obj__large_screenshot = document.getElementById("div__large_screenshot");
	var obj__large_screenshot_controls = document.getElementById("div__large_screenshot_controls");
	obj__large_screenshot.style.visibility = "hidden";
	obj__large_screenshot_controls.style.visibility = "hidden";
	
	var obj__black_box = document.getElementById("black_box");
	obj__black_box.style.visibility = "hidden";
	
	var obj__large_screenshots_white_box = document.getElementById("div__large_screenshots_white_box");
	obj__large_screenshots_white_box.visibility = "hidden";
		
	document.getElementById('div__large_screenshot').innerHTML = "<img src=./game_screenshot_1.gif></img>";
	game_screenshot_showing = 1;
}


function _set()
{
	amount = document.frm1.txt1.value;
	var obj__selected = document.getElementById(moving_div);
	if (test_div_direction == "y")
	{
		obj__selected.style.top = amount + "px";
	}
	if (test_div_direction == "x")
	{
		obj__selected.style.left = amount + "px";
	}

	//alert(document.frm1.txt1.value);
}


function count_up()
{
	document.frm1.txt1.value++;
	/*
	var obj__selected = document.getElementById(moving_div);
	
	if (test_div_direction == "y")
	{
		obj__selected.style.top = document.frm1.txt1.value + "px";
	}
	if (test_div_direction == "x")
	{
		obj__selected.style.left = document.frm1.txt1.value + "px";
	}
	*/
}
function count_down()
{
	document.frm1.txt1.value--;
	/*
	var obj__selected = document.getElementById(moving_div);
	
	if (test_div_direction == "y")
	{
		obj__selected.style.top = document.frm1.txt1.value + "px";
	}
	if (test_div_direction == "x")
	{
		obj__selected.style.left = document.frm1.txt1.value + "px";
	}
	*/
}


function set_x()
{
	test_div_direction = "x";
}
function set_y()
{
	test_div_direction = "y";
}





function cycle_large_screenshot_back()
{
	//var game_screenshot_showing = 2;
	//alert(game_screenshot_showing);
	
	if (game_screenshot_showing == 2)
	{
		document.getElementById('div__large_screenshot').innerHTML = "<img src=./game_screenshot_1.png></img>";
		game_screenshot_showing = 1;
	}
	if (game_screenshot_showing == 3)
	{
		document.getElementById('div__large_screenshot').innerHTML = "<img src=./game_screenshot_2.png></img>";
		game_screenshot_showing = 2;
	}
	if (game_screenshot_showing == 4)
	{
		document.getElementById('div__large_screenshot').innerHTML = "<img src=./game_screenshot_3.png></img>";
		game_screenshot_showing = 3;
	}
}

function cycle_large_screenshot_forward()
{	
	if (game_screenshot_showing == 3)
	{
		document.getElementById('div__large_screenshot').innerHTML = "<img src=./game_screenshot_4.png></img>";
		game_screenshot_showing = 4;
	}
	if (game_screenshot_showing == 2)
	{
		document.getElementById('div__large_screenshot').innerHTML = "<img src=./game_screenshot_3.png></img>";
		game_screenshot_showing = 3;
	}
	if (game_screenshot_showing == 1)
	{
		document.getElementById('div__large_screenshot').innerHTML = "<img src=./game_screenshot_2.png></img>";
		game_screenshot_showing = 2;
	}
}

function change_thumb_1_border_blue()
{
	var obj__thumbnail = document.getElementById("flash_work_thumbnail_1");
	obj__thumbnail.style.borderColor = "#939393";	
}
function change_thumb_2_border_blue()
{
	var obj__thumbnail = document.getElementById("flash_work_thumbnail_2");
	obj__thumbnail.style.borderColor = "#939393";	
}
function change_thumb_3_border_blue()
{
	var obj__thumbnail = document.getElementById("flash_work_thumbnail_3");
	obj__thumbnail.style.borderColor = "#939393";	
}
function change_thumb_4_border_blue()
{
	var obj__thumbnail = document.getElementById("flash_work_thumbnail_4");
	obj__thumbnail.style.borderColor = "#939393";	
}


function change_thumb_1_border_white()
{
	var obj__thumbnail = document.getElementById("flash_work_thumbnail_1");
	obj__thumbnail.style.borderColor = "#ffffff";	
}
function change_thumb_2_border_white()
{
	var obj__thumbnail = document.getElementById("flash_work_thumbnail_2");
	obj__thumbnail.style.borderColor = "#ffffff";	
}
function change_thumb_3_border_white()
{
	var obj__thumbnail = document.getElementById("flash_work_thumbnail_3");
	obj__thumbnail.style.borderColor = "#ffffff";	
}
function change_thumb_4_border_white()
{
	var obj__thumbnail = document.getElementById("flash_work_thumbnail_4");
	obj__thumbnail.style.borderColor = "#ffffff";	
}


function run_once_function()
{
	var obj__label__amount = document.getElementById("label__amount");
	obj__label__amount.style.visibility = testing_object_visibility;
	
	var obj__button__set = document.getElementById("button__set");
	obj__button__set.style.visibility = testing_object_visibility;
	
	var obj__button__up = document.getElementById("button__up");
	obj__button__up.style.visibility = testing_object_visibility;
	
	var obj__button__down = document.getElementById("button__down");
	obj__button__down.style.visibility = testing_object_visibility;
}


/*
function captureMousePosition(e)
{
	xMousePos = e.pageX;
    yMousePos = e.pageY;
    xMousePosMax = window.innerWidth+window.pageXOffset;
    yMousePosMax = window.innerHeight+window.pageYOffset;
	
	document.frm1.txt1.value = (xMousePos*2)-500;
	document.frm2.txt2.value = (yMousePos*2)-500;
}
*/

setInterval ( "doSomething()", 100 );

function doSomething ( )
{
	if (timestep_once_flag == 0)
	{
		var obj__black_box = document.getElementById("black_box");
		obj__black_box.style.visibility = "hidden";

	
		 if (window.innerHeight && window.scrollMaxY) {// Firefox
		yWithScroll = window.innerHeight + window.scrollMaxY;
		xWithScroll = window.innerWidth + window.scrollMaxX;
		} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
			yWithScroll = document.body.scrollHeight;
			xWithScroll = document.body.scrollWidth;
		} else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
			yWithScroll = document.body.offsetHeight;
			xWithScroll = document.body.offsetWidth;
	  	}
		arrayPageSizeWithScroll = new Array(xWithScroll,yWithScroll);
		//alert( 'The height is ' + yWithScroll + ' and the width is ' + xWithScroll );
		//return arrayPageSizeWithScroll;
		
		timestep_once_flag = 1;
	}
		
	var obj__black_box = document.getElementById("black_box");
	obj__black_box.style.width = (xWithScroll+600) + "px";
	obj__black_box.style.height = yWithScroll + "px";
}


