///////////////////////////////////////
//Browser Detection - style sheet output
///////////////////////////////////////

var browser_platform = navigator.appName;
var browser_version = parseFloat(navigator.appVersion);
var hardware_platform = navigator.platform;

if(browser_platform == "Microsoft Internet Explorer" && browser_version >= 3.0) {
	//document.write('<link rel=stylesheets type="text/css" href="./expstyle.css">');
	document.write("<META http-equiv='Page-Enter' content='blendTrans(Duration=0.2)'>");
	document.write("<META http-equiv='Page-Exit' content='blendTrans(Duration=0.2)'>");	
}
else if (browser_platform == "Netscape" && browser_version >= 3.0) {
	//document.write('<link rel=stylesheets type="text/css" href="../netstyle.css">');
}
else {
	//document.write('<link rel=stylesheets type="text/css" href="./expstyle.css">');	
}

///////////////////////////////////////
//DOM Detection
///////////////////////////////////////
var dom_compatability;

if(document.getElementById) {
	dom_compatability = "w3c";
}
else if(document.all) {
	dom_compatability = "IE";
}
else if(document.layers) {
	dom_compatability = "Netscape";
}

///////////////////////////////////////
//Image Preload Detection
///////////////////////////////////////
var image_preload;

if(document.images) {
	image_preload = "true";
}
else {
	image_preload = "false";
}


///////////////////////////////////////
//Roll Function
///////////////////////////////////////
function roll(img, index1, index2) {
	if(image_preload == "true") {
		document.images[img].src = image_array[index1][index2].src;
	}
}

///////////////////////////////////////
//Get Image Source Function
///////////////////////////////////////
function getSource(index1,index2) {
	return image_array[index1][index2].src
}


///////////////////////////////////////
//Menu Functions
///////////////////////////////////////

menuColor="#697EBB";
menuColorOn="#ABBDE0";
fontColorOn="#ffffff";
fontColorOff="#ffffff";
lineColor="#ffffff";

sep = "<img src=./spacer.gif height=1 width=1>";

function displayMenu(menuid) {
	var obj;

	if(dom_compatability == "w3c") {
		obj = document.getElementById(menuid);
		obj.style.visibility = 'visible';
	}
	else if(dom_compatability == "IE") {
		obj = document.all[menuid];
		obj.style.visibility = 'visible';
	}
	else if(dom_compatability == "Netscape") {
		obj = document.layers[menuid];
		obj.visibility = 'show';
	}
}

function hideMenu(menuid) {
	var obj;

	if(dom_compatability == "w3c") {
		obj = document.getElementById(menuid);
		obj.style.visibility = 'hidden';
	}
	else if(dom_compatability == "IE") {
		obj = document.all[menuid];
		obj.style.visibility = 'hidden';
	}
	else if(dom_compatability == "Netscape") {
		obj = document.layers[menuid];
		obj.visibility = 'hide';
	}
}

function dOver(menuid) {
	var obj;

	if(dom_compatability == "w3c") {
		obj = document.getElementById(menuid);
		obj.style.backgroundColor = menuColorOn;
		obj.style.color = fontColorOn;
	}
	else if(dom_compatability == "IE") {
		obj = document.all[menuid];
		obj.style.backgroundColor = menuColorOn;
		obj.style.color = fontColorOn;
	}
	else{return;}
}

function dOut(menuid) {
	var obj;

	if(dom_compatability == "w3c") {
		obj = document.getElementById(menuid);
		obj.style.backgroundColor = menuColor;
		obj.style.color = fontColorOff;
	}
	else if(dom_compatability == "IE") {
		obj = document.all[menuid];
		obj.style.backgroundColor = menuColor;
		obj.style.color = fontColorOff;
	}
	else{return;}
}

function mOver() {
	var args, m;
	args = mOver.arguments;
	m = eval(args[0]);
	m.bgColor = menuColorOn;
}

function mOut() {
	var args, m;
	args = mOut.arguments;
	m = eval(args[0]);
	m.bgColor = menuColor;
}

function loadUrl(url) {
	window.location = url;
}


///////////////////////////////////////
//Div Stuff
///////////////////////////////////////

var xID = 0;

function makeDiv(a,b,c,d) {

	var divID = a;
	var index = b;
	var divLeft = c;
	var divTop = d;
	
	if(browser_platform == "Netscape" && browser_version >= 6.0) {
		DivObj = "<div id=\"" + divID + "\" style=\"position:absolute; width:125px; z-index:2;top:"+divTop + "px; left: " + divLeft + "; background-color: #697EBB; border:1 solid #697EBB; visibility: hidden;\" onMouseover=\"displaymenu(\'" + divID +"\');\" onMouseout=\"hideMenu(\'" + divID + "\');\">";
			
		DivObj += "<div id=\"spacer\" style=\"position:relative; height:3px; width:125px; z-index:0; left: 0; font-size:1\"></div>";

			for(i=0;i<6;i++) {
				if(menu[index][i][0]!=null) {
					DivObj += "<div id=\"bar\" style=\"position:relative; height:1; width:125px; z-index:3; left: 0; background-color:" + lineColor+ ";\">" + sep +"</div>";
				
					DivObj += "<div id=\"x" + xID + "\" style=\"position:relative; background-color:" + menuColor +"; height:15px; width:125px; z-index:3; left: 1;color:" + fontColorOff + "; cursor:POINTER; font-family: myriad,arial,helvetica,sans-serif; font-size: 10px; font-weight: normal; line-height: 14px; text-decoration: none;\" onMouseover=\"dOver(\'x" + xID + "\');\" onMouseout=\"dOut(\'x" + xID + "\');\" onClick=\"loadUrl('"+menu[index][i][1]+"')\">&nbsp;"+menu[index][i][0] + "&nbsp;</div>";

					xID = xID + 1;
				}
			}

		DivObj += "<div id=\"spacer\" style=\"position:relative; height:5px; width:125px; z-index:3; left:0; line-height: 10px; font-size:1;\"></div></div>";

		document.write(DivObj);
	}
	else {
		DivObj = "<div id=\"" + divID + "\" style=\"position:absolute; width:125px; z-index:2; top:" + divTop +"px; left: " + divLeft + "; background-color: #697EBB; border:1 solid #697EBB; visibility: hidden;\" onMouseover=\"displayMenu(\'" + divID + "\');\" onMouseout = \"hideMenu(\'" + divID + "\');\">";

		DivObj+= "<div id=\"spacer\" style=\"position:relative; height:1px; width:125px; z-index:0; left:0; font-size:1;\"></div>";

			for(i=0; i<6; i++) {
				if(menu[index][i][0]!=null) {
					DivObj += "<div id=\"bar\" style=\"position:relative; height:1; width:125px; z-index:3; left:0; background-color:" + lineColor + ";\">" + sep + "</div>";
				
					DivObj += "<div id=\"x" + xID + "\" style=\"position:relative; background-color:" + menuColor +"; height:15px; width:125px; z-index:3; left:0; color:" + fontColorOff + "; cursor:POINTER; font-family: myriad,arial,helvetica,sans-serif; font-size: 10px; font-weight: normal; line-height: 14px; text-decoration: none;\" onMouseover=\"dOver(\'x" + xID + "\');\" onMouseout=\"dOut(\'x" + xID + "\');\" onCLick=\"loadUrl('"+menu[index][i][1]+"')\">&nbsp;"+menu[index][i][0] +"&nbsp;</div>";
				
						xID = xID +1;
				}
			}

		DivObj += "<div id=\"spacer\" style=\"position:relative; height:4px; width:125px; z-index:0; left:0 line-height: 10px; font-size:1;\"></div></div>";

		document.write(DivObj);
	}
}


///////////////////////////////////////
//Layer Stuff
///////////////////////////////////////

function makeLayer(a,b,c,d) {
	
	var nestID = 0;
	var layerID = a;
	var index = b;
	var left = c;
	var top = d;


	if(hardware_platform.indexOf("Win") < 0) {
		increment = 16;
	}
	else {
		increment = 15;
	}

	DivObj = "<layer id =\"" + layerID + "\" Z-INDEX=1 BGCOLOR=\"" + "#697EBB" + "\" WIDTH=125 HEIGHT=4 LEFT=" + left + " TOP=" + top + " VISIBILITY=HIDE onmouseover=\"displayMenu(\'" + layerID + "\');\" onmouseout=\"hideMenu(\'" + layerID + "\');\">";
	
	var nTop = 3
	
		for(i=0; i<6; i++) {
			if(menu[index][i][0]!=null) {
				//DivObj += "<layer id=\"line2\" BGCOLOR=\"" + lineColor + "\" WIDTH=125 HEIGHT=1 Z-INDEX=4 LEFT=1 TOP=" + nTop + ">" + sep + "</layer>";

				DivObj += "<layer id=\"x" + nestID + "\" Z-INDEX=3 BGCOLOR=\"" + menuColor + "\" HEIGHT=16 WIDTH=125 LEFT=1 TOP=" + nTop + " onmouseover=\"mOver('document.layers[\\'" + layerID + "\\'].document.layers[\\'x" + nestID + "\\']')\" onmouseout=\"mOut('document.layers[\\'" + layerID + "\\'].document.layers[\\'x" + nestID + "\\']')\" onClick=\"loadUrl('" + menu[index][i][1] + "')\"><a href=javascript:loadUrl('"+menu[index][i][1]+"')><font face=myriad,helvetica,arial,sans-serif size=1 color=" + fontColorOff + ">" + menu[index][i][0];

				DivObj += "</font></a></layer>";
				nestID += 1;
				nTop = nTop + increment + 1;
			}
		}

		DivObj += "<layer id=\"line2\" BGCOLOR=\"" + lineColor + "\" WIDTH=125 HEIGHT=1 Z-INDEX=2 TOP=" + nTop + ">" + sep + "</layer>";

		DivObj += "<layer id=\"lineEnd\" BGCOLOR=\"" + "#697EBB" + "\" WIDTH=125 HEIGHT=4 Z-INDEX=4 TOP=" + nTop + "></layer></layer>";

		document.write(DivObj);

}


//////////////////////////////////////////////////////////////////////////////////////
//OUTPUT CODE
//////////////////////////////////////////////////////////////////////////////////////


///////////////////////////////////////
//Menu Entries
///////////////////////////////////////

menu = new Array();
for(i=0; i<6; i++) {
	menu[i] = new Array(6);
	for(k=0; k<6; k++) {
		menu[i][k] = new Array(2);
	}
}


//These arrays only define the submenus for those menus
//which have drop-downs.
menu[0][0][0] = "MASTER CLASS";
menu[0][0][1] = "masterclass.asp";
menu[0][1][0] = "GOALKEEPING";
menu[0][1][1] = "goalkeeping.asp";


menu[1][0][0] = "ABOUT DIRECTOR";
menu[1][0][1] = "aboutthedirector.asp";
menu[1][1][0] = "DIRECTORS NOTE";
menu[1][1][1] = "directorsnote.asp";


menu[2][0][0] = "ENROLLMENT INFO";
menu[2][0][1] = "enrollmentinformation.asp";
menu[2][1][0] = "2006 APPLICATION";
menu[2][1][1] = "2004campapplication.asp";
menu[2][2][0] = "FAQ";
menu[2][2][1] = "faq.asp";


menu[3][0][0] = "Client Forms";
menu[3][0][1] = "../tools/tools.html";
menu[3][1][0] = "Long term Care";
menu[3][1][1] = "../tools/quote.html";
menu[3][2][0] = "Life Insurance";
menu[3][2][1] = "../tools/lifeinsurance.html";

//menu[4][0][0] = "Extras";
//menu[4][0][1] = "../resources/resources.html";
//menu[4][1][0] = "Links";
//menu[4][1][1] = "../resources/links.html";
//menu[4][2][0] = "Articles";
//menu[4][2][1] = "../resources/articles.html";

///////////////////////////////////////
//Image Pre-load
///////////////////////////////////////


if(image_preload == "true") {
	
	var num_tuples = 9;
	var tuple_size = 2;

	image_text_roots = new Array(num_tuples);
	image_text_roots[0] = "../menu/financial";
	image_text_roots[1] = "../menu/about";
	image_text_roots[2] = "../menu/account";
	image_text_roots[3] = "../menu/tools";
	image_text_roots[4] = "../menu/resources";
	image_text_roots[5] = "../menu/home";
	image_text_roots[6] = "../pictures/uppercircle";
	image_text_roots[7] = "../pictures/leftcircle";
	image_text_roots[8] = "../pictures/rightcircle";

	var image_type = "gif"
	
	image_array = new Array(num_tuples);
	for(i=0; i<num_tuples; i++) {
		image_array[i] = new Array(tuple_size);
		
		for(k=0; k<tuple_size; k++) {
			image_array[i][k] = new Image;
			image_array[i][k].src = image_text_roots[i] + k + "." + image_type;
		}
	} 
}

///////////////////////////////////////
//Draw Menus
///////////////////////////////////////

if(dom_compatability == "w3c" || dom_compatability == "IE") {
	makeDiv('financial',0,272,122);
	makeDiv('about',1,0,122);
	makeDiv('account',2,553,122);
	makeDiv('tools',3,346,102);
	makeDiv('resources',4,404,121);
}
else if(dom_compatability == "Netscape") {	
	makeLayer('financial',0,272,121);
	makeLayer('about',1,0,121);
	makeLayer('account',2,593,121);
	makeLayer('tools',3,346,121);
	makeLayer('resources',4,404,121);
}

////////////////////////////////////
//VERIFY FORM
//////////////////////////////////

function verifyEmail(form) 
{
	checkEmail = form.Email.value;
	checkName = form.Firstname.value;
	checkLast = form.Lastname.value;
	checkPassword = form.Password.value;
	checkPassword1 = form.Password1.value;
	checkBox = form.Disclaimer.checked;
	
	 if (checkName=="")
			{
				alert("Please enter your First Name");
				return false;
			}
	
		 if (checkLast=="")
			{
				alert("Please enter your Last Name.");
				return false;
			}

	if ((checkEmail.indexOf('@') < 0) || ((checkEmail.charAt(checkEmail.length-4) != '.') && (checkEmail.charAt(checkEmail.length-3) != '.')))
			{
			alert("You have entered an invalid email address. Please try again.");
			return false;
			}
		
		
		 if (checkPassword=="")
			{
				alert("Please enter your Password.");
				return false;
			}
		

	
	 if (checkBox==false)
			{
				alert("You must agree to the disclaimer before signing up.");
				return false;
			}
			
	 if (checkPassword!=checkPassword1)
				{
					alert("Your Passwords didn't match. Please try again.");
					return false;
				}

	
	return true;
}

function disclaimerwindow(disc)
				{
				var disclaimer=window.open(disc,"disc","scrollbars=yes,width=450,height=445");
				disclaimer.moveTo(5,5);
				careeropener.focus();

				}



