/*
============
    PAGE
============
Created: June 2009
Updated: October 2009


*/
$(document).ready(function(){
	$("#contact").css("display", "none");
	$("#contact").slideUp(0);
	$('#contact_subject').val("");
	AddHeaderStars();
});

function Home()
{
	var Stars = new Array(4)
	Stars[0] = 0;
	Stars[1] = 163;
	Stars[2] = -1;
	Stars[3] = 0;
	Stars[4] = 163;
	Stars[5] = -1;
	Stars[6] = 0;
	Stars[7] = 163;
	var original = $("#stars").html();
	$("#stars").html(original + GetStarsOutput(Stars, 565));
	$("#content").css("height", 287);
}

function AddHeaderStars()
{
	var Stars = new Array(4)
	Stars[0] = 0;
	Stars[1] = 163;
	Stars[2] = -1;
	Stars[3] = 0;
	Stars[4] = 124;
	Stars[5] = -1;
	Stars[6] = 0;
	Stars[7] = 114;
	Stars[8] = -6;
	Stars[9] = 0;
	Stars[10] = 130;
	Stars[11] = -1;
	Stars[12] = 0;
	Stars[13] = 85;
	Stars[14] = -1;
	Stars[15] = 0;
	Stars[16] = 53;
	Stars[17] = -4;
	Stars[18] = 128;
	Stars[19] = 130;
	Stars[20] = -1;
	Stars[21] = 122;
	Stars[22] = 130;
	Stars[23] = -1;
	Stars[24] = 115;
	Stars[25] = 130;
	Stars[26] = -1;
	Stars[27] = 105;
	Stars[28] = 130;
	Stars[29] = -1;
	Stars[30] = 95;
	Stars[31] = 130;
	Stars[32] = -1;
	Stars[33] = 80;
	Stars[34] = 130;
	Stars[35] = -1;
	Stars[36] = 60;
	Stars[37] = 130;
	Stars[38] = -1;
	Stars[39] = 37;
	Stars[40] = 130;
	Stars[41] = -1;
	Stars[42] = 0;
	Stars[43] = 130;
	Stars[44] = -1;
	Stars[45] = 0;
	Stars[46] = 130;
	Stars[47] = -1;
	Stars[48] = 0;
	Stars[49] = 3;
	Stars[50] = 25;
	Stars[51] = 130;
	Stars[52] = -1;
	Stars[53] = 0;
	Stars[54] = 3;
	Stars[55] = 25;
	Stars[56] = 163;
	Stars[57] = -1;
	Stars[58] = 0;
	Stars[59] = 163;
	Stars[60] = -1;
	Stars[61] = 0;
	Stars[62] = 163;
	
	$("#stars").html(GetStarsOutput(Stars, 40));
}

function GetStarsOutput(Stars, top)
{
	var left = 5;
	var line = 0;
	var lastStar=163;
	var count = 0;
	var starsOutput="";
	while (count<Stars.length)
	{
		for (var xStar=Stars[count]; xStar<Stars[count+1]; xStar++)
			starsOutput += "<div style=\"top: " + ((line * 9) + top) + "px; left: " + (left + (xStar * 5)) + "px\">*</div>";
		count=count+2;
		if (Stars[count]<0)
		{
			line=line+(-Stars[count]);
			count++;
		}
	}
	return starsOutput;
}

function OpenContact()
{
	$("#page").fadeTo("fast", 0.5, function() {
		$("#contact").slideDown("medium");	
	});
	return false;
}

function CloseContact()
{
	$("#contact").slideUp("medium", function() {	
		$("#page").fadeTo("fast", 1);
	});
	return false;
}
