//******************************************************************//
// DROP MENU CONFIGURATION
//******************************************************************//

var isNav = (document.layers);
var isIE  = (document.all);
var isMin = (isIE || isNav);

var menuCurrent  = -1;
var menuStartLoc = 60;
var menuBGcolor  = "lightsteelblue";
var menuBGcolor2 = "#212E6A";
var menuBGcolor3 = "#AEAFAD";

//Unsecure http string
var http = 'http://www.marisafe.com';
var https = 'https://www.marisafe.com';

var arrSections = new Array(
	 new Array("Store",
	                           new Array(new Array("172"),
	                                     new Array("Store Home",http + "/store/default.asp"),
	                                     new Array("Get Saved Cart",http + "/store/retrievecart.asp"),
	                                     new Array("Wish List",http + "/store/viewwishlist.asp")
	                           )
	 		),
	 /*new Array("Services",
	                           new Array(new Array("258"),
	                                     new Array("OnWater Assistance",http + "/services/waterassistance/default.asp"),
	                                     new Array("Float Planning",http + "/services/floatplanning/default.asp"),
	                                     new Array("Maintenance & Repair",http + "/services/boatmaintenance/default.asp"),
	                                     new Array("Safety Equipment Services",http + "/services/equipmentservices/default.asp"),
	                                     new Array("Inspection & Survey",http + "/services/surveyors/default.asp"),
	                                     new Array("Registration & Documentation",http + "/services/licensing/default.asp"),
	                                     new Array("Insurance",http + "/services/insurance/default.asp"),
	                                     new Array("Medical Services",http + "/services/waterassistance/medicalservices.asp"), 
	                                     new Array("Learning Center",http + "/services/learning/default.asp")
	                           )
	 		),
	 new Array("Resources",
	                           new Array(new Array("344"),
	                                    
	                                     new Array("Gear Center",http + "/resources/equipment/default.asp"),
	                                     new Array("Resource Directories",http + "/resources/resourcedirectory.asp"),
										 new Array("Weather Center",http + "/resources/WeatherCenter.asp"),
										 new Array("Review Regulations",http + "/resources/regulations/regulations.asp"),
										 new Array("Articles",http + "/news/articles.asp"),
										 new Array("Anonymous Incident Report",http + "/resources/incident.asp"),
										 new Array("Ask the Experts",http + "/resources/askexperts.asp"),
										 new Array("Boating Dictionary",http + "/resources/boatdictionary.asp"),
										 new Array("Resource FAQs",http + "/resources/faq.asp")										 										 
	                           )
	 		),*/
	 new Array("Membership",
	                           new Array(new Array("258"),
	                                     //new Array("Towing Benefits",http + "/membership/towing.asp"),           
	                                     //new Array("Float Plan Response",http + "/membership/floatresponse.asp"),
	                                     //new Array("Theft Protection Program",http + "/membership/theftprotection.asp"),
	                                     new Array("Savings & Discounts",http + "/membership/savingsdiscounts.asp"),
	                              	     new Array("Join MariGuard<sup>TM</sup> Now!",http + "/store/addmembership.asp")
	                           )
	 		),
	 new Array("MyMariSafe",
	                           new Array(new Array("344"),
	                                     
										 new Array("My Account",https + "/MyMariSafe/account.asp"),
	                                     new Array("My Order History",https + "/MyMariSafe/orderhistory.asp"),
	                                     new Array("My Saved Cart",http + "/store/retrieveCart.asp"),
	                                     new Array("My Wish List",http + "/store/viewWishlist.asp"),
	                                     //new Array("My Boat",https + "/MyMariSafe/boat.asp"),
	                                     //new Array("My Gear",https + "/MyMariSafe/equipment.asp"),
	                                     //new Array("My Float Plan",https + "/MyMariSafe/floatplan/viewfloatplans.asp"),
	                                     new Array("Log Out",http + "/MyMariSafe/LogOut.asp")
	                           )
	 		),
	 new Array("News",
							 new Array(new Array("480"),
	                                     new Array("Ordering",http + "/help/default.asp"),
	                                     new Array("Payment Methods",http + "/help/default.asp"),
	                                     new Array("Privacy & Security",http + "/help/default.asp"),
	                                     new Array("Returns",http + "/help/default.asp"),
	                                     new Array("Saved Cart",http + "/help/default.asp"),
	                                     new Array("Shipping",http + "/help/default.asp"),
	                                     new Array("Using Your Account",http + "/help/default.asp"),
	                                     new Array("Wish List",http + "/help/default.asp")
	                           )
	 		),
	new Array("AboutUs",
							new Array(new Array("516"),
	                            new Array("Company Overview",http + "/aboutus/default.asp"),
	                            new Array("At a Glance",http + "/aboutus/glance.asp"),
	                            new Array("Media Contact Info",http + "/aboutus/media.asp"),
	                            new Array("News Releases",http + "/aboutus/newsrelease.asp"),
	                            new Array("In The News",http + "/aboutus/innews.asp"),
	                            new Array("Awards & Feedback",http + "/aboutus/awards.asp"),
	                            new Array("Management Team",http + "/aboutus/team.asp"),
	                            new Array("Partners/Programs",http + "/aboutus/partners.asp"),
	                            new Array("Customer Care",http + "/aboutus/customercare.asp"),
								new Array("Privacy Policy",http + "/aboutus/privacy.asp"),
	                            new Array("Company Structure",http + "/aboutus/structure.asp"),
	                            new Array("Affiliate Program",http + "/aboutus/affiliate/program.asp")
	                            
	                )
			)
	);
 
 
 
 //******************************************************************//
 // FUNCTIONS THAT DRIVE THE DROP MENU
 //******************************************************************//
 function menuBuild(){
	var strHTML = '';
	
	for (i = 0; i < arrSections.length; i++)
	{
		strHTML += '<div id="'+ arrSections[i][0] +'" style="position:absolute;top:'+ menuStartLoc +'px;left:'+ arrSections[i][1][0][0] +'px;visibility:hidden;z-index:2"><table cellspacing=0 cellpadding=0 bgcolor=' + menuBGcolor + ' border=0><tr><td rowspan='+ arrSections[i][1].length*2 +' width=1 bgcolor="'+ menuBGcolor3 +'"><img src="/img/misc/transparent.gif" width=1 height=1></td><td bgcolor="'+ menuBGcolor3 +'""><img src="/img/misc/transparent.gif" width=1 height=1></td><td rowspan='+ arrSections[i][1].length*2 +' width=1 bgcolor="'+ menuBGcolor3 +'"><img src="/img/misc/transparent.gif" width=1 height=1></td></tr>';

		for (j = 1; j < arrSections[i][1].length; j++)
		{
			var layerID = arrSections[i][0] +'XYZ'+ j;

			strHTML += (isIE) ? '<tr><td id="'+ layerID +'" nowrap>' : '<tr><td nowrap>';
			strHTML += '<font face="Verdana,Arial" size=1><img src="/img/misc/transparent.gif" width=1 height=2><br>&nbsp;&nbsp;<a href='+ arrSections[i][1][j][1] +' onMouseOver="menuBgChange(\''+ layerID +'\',\''+ menuBGcolor2 +'\');" onMouseOut="menuBgChange(\''+ layerID +'\',\''+ menuBGcolor +'\');" target="_top" class="menuLinks">'+ arrSections[i][1][j][0] +'</a>&nbsp;&nbsp;<br><img src="/img/misc/transparent.gif" width=1 height=3></font>';
			strHTML += (isIE) ? '' : '';
			strHTML += '</td></tr>';
			strHTML += '<tr><td height=1 bgcolor="'+ menuBGcolor3 +'"><img src="/img/misc/transparent.gif" width=1 height=1></td></tr>';
		}
		
		strHTML += '</table></div>';
	}
	document.write(strHTML);
}

function menuBgChange(obj,color){
	document.all[obj].style.background = color;
}

function menuToggle(obj){
	if (obj == null)
	{
		if (menuCurrent != -1) menuHide(menuCurrent);
		menuCurrent = -1;
	}
	else if (menuCurrent != obj)
	{
		if (menuCurrent != -1) menuHide(menuCurrent);
		menuCurrent = obj;	
		menuShow(menuCurrent);
	}
}

function menuHide(obj){
	document.all[obj].style.visibility = 'hidden';
	
	//here we turn off all the top navigation images
	//i am doing this one by one and i am sure there
	//is a better way of doing this.. but works anyway
}
function menuShow(obj){
	document.all[obj].style.visibility = 'visible';
}

function menuCheck(e){
	if (menuCurrent != -1)
	{

			var cX       = event.clientX + document.body.scrollLeft;
			var cY       = event.clientY + document.body.scrollTop;		
			var obj      = document.all[menuCurrent];
			var ptLeft   = obj.style.pixelLeft - 3;
			var ptRight  = ptLeft + obj.scrollWidth + 5;
			var ptBottom = obj.style.pixelTop + obj.scrollHeight + 3;

		if ((cY < menuStartLoc-17) || (cY > ptBottom) || (cX < ptLeft) || (cX > ptRight))
		{
			menuHide(menuCurrent);
			menuCurrent = -1;
		}
	}
}

function menuResize() {if (browserWidth != window.innerWidth || browserHeight != window.innerHeight) document.location.href = document.location.href;}

if (isIE){
	document.write('<style> a.menuLinks { font-family:Verdana,Helvetica,Arial; color:212884; text-decoration:none; font-size:');
	document.write('9px');	
	document.write(' } a:hover.menuLinks { color:ffffff; text-decoration:none } </style>');	
	document.onmousemove = menuCheck;
}
