       
var n  = (document.layers);

function initMouseEvents() {

	document.onmousemove = mouseMove;
	
	var currentPage = window.location.pathname;
	var currentPage = currentPage.substring(currentPage.lastIndexOf('/') + 1);
	
	if(currentPage == "patchnew888.php") {
		document.onmousemove = mouseMovePatches;
	}
	
	if (n) document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE);

}


function mouseMove(e) {
	
	if(!document.all && document.getElementById){  // for Netscape
		testX = e.pageX;		
	} else {  // for IE 
		testX = window.event.x;
	}

			if (document.all){	// for IE
				if(testX > 145 || testX < 8) {				
					if (document.all.Sidebar_monthly){
						showSidebar_monthly(0);					
					}
					if (document.all.Sidebar_lights){
						showSidebar_lights(0);					
					}		
				}
			}		
				
		
			
		if(!document.all && document.getElementById){  // for Netscape & Firefox
			if(document.body.clientWidth > 770) {
				var testXaddSpace = ((document.body.clientWidth - 770) / 2)
				var testXvar1 = 145 + testXaddSpace;
				var testXvar2 = 8 + testXaddSpace;
			} else {
				var testXvar1 = 145;
				var testXvar2 = 8;
			}
			
		if(testX > testXvar1 || testX < testXvar2) {
		
				if (document.getElementById("Sidebar_monthly")){
					   showSidebar_monthly(0);	
				   }
				   if (document.getElementById("Sidebar_lights")){
					   showSidebar_lights(0);	
				   }		   
				}	
	
		}
		
}
  
function showSidebar_monthly(showWhat){

	if(showWhat == 1){
		showLinks = "<div class='ntmsidebarImage'><img src='/images/arrow.gif' class='image' width='3' height='10' alt='-'  /></div><a class='sidebar' title='Monthly Notices To Mariners' href='/document/eng/services/notmar/index'>Monthly Notices To Mariners</a>";
		showLinks += "<br/><span style='margin-left:10px;margin-top:5px;'><a class='sidebar' title='Current Edition' href='/document/eng/services/notmar/index'> - Current Edition</a></span>";
		showLinks += "<br/>&nbsp;&nbsp;&nbsp;<span class='bold small'><a class='sidebar' title='Previous Updates' href='/document/eng/services/notmar/legacy'>Previous Updates</a></span>";
		         showLinks += "<br/>&nbsp;&nbsp;&nbsp;&nbsp;<a class='sidebar' title='Numerical Index' href='/document/eng/services/notmar/numindex'>- Numerical Index</a>";
                showLinks += "<br/>&nbsp;&nbsp;&nbsp;&nbsp;<a class='sidebar' title='Section 1' href='/document/eng/services/notmar/sec1index'>- Section 1</a>";
                showLinks += "<br/>&nbsp;&nbsp;&nbsp;&nbsp;<a class='sidebar' title='Section 2' href='/document/eng/services/notmar/sec2index'>- Section 2</a>";
                showLinks += "<br/>&nbsp;&nbsp;&nbsp;&nbsp;<a class='sidebar' title='Section 3' href='/document/eng/services/notmar/sec3index'>- Section 3</a>";
                showLinks += "<br/>&nbsp;&nbsp;&nbsp;&nbsp;<a class='sidebar' title='Section 4' href='/document/eng/services/notmar/sec4index'>- Section 4</a>";
                showLinks += "<br/>&nbsp;&nbsp;&nbsp;&nbsp;<a class='sidebar' title='Section 5' href='/document/eng/services/notmar/sec5index'>- Section 5</a>";

	} else {
		showLinks = "<div class='ntmsidebarImage'><img src='/images/arrow.gif' class='image' width='3' height='10' alt='-'  /></div><a class='sidebar' title='Monthly Notices To Mariners' href='/document/eng/services/notmar/index'>Monthly Notices To Mariners</a>";			
	}
	
	if (document.all){
	   document.all.Sidebar_monthly.innerHTML = showLinks;
	}
	if(!document.all && document.getElementById){
	   document.getElementById("Sidebar_monthly").innerHTML = showLinks;
	}
 }  				   
			
function showSidebar_lights(showWhat){

	if(showWhat == 1){
		showLinks = "<div class='ntmsidebarImage'><img src='/images/arrow.gif' class='image' width='3' height='10' alt='-'  /></div><a class='sidebar' title='Lists of Lights, Buoys, and Fog Signal' href='/document/eng/services/list/index'>Lists of Lights, Buoys, and Fog Signals</a>";
		showLinks += "<br>&nbsp;&nbsp;<a class='sidebar' title='Newfoundland and &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Labrador' href='/document/eng/services/list/newfoundland-2009'>- Newfoundland and &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Labrador</a>";
		showLinks += "<br>&nbsp;&nbsp;<a class='sidebar' title='Atlantic Coast' href='/document/eng/services/list/atlantic-coast-2009'>- Atlantic Coast</a>";
		showLinks += "<br>&nbsp;&nbsp;<a class='sidebar' title='Inland Waters' href='/document/eng/services/list/inland-waters-2009'>- Inland Waters</a>";
		showLinks += "<br>&nbsp;&nbsp;<a class='sidebar' title='Pacific Coast' href='/document/eng/services/list/pacific-coast'>- Pacific Coast</a>";
	} else {
		showLinks = "<div class='ntmsidebarImage'><img src='/images/arrow.gif' class='image' width='3' height='10' alt='-'  /></div><a class='sidebar' title='Lists of Lights, Buoys, and Fog Signals' href='/document/eng/services/list/index'>Lists of Lights, Buoys, and Fog Signals</a>";			
	}
			
	if (document.all){
	   document.all.Sidebar_lights.innerHTML = showLinks;
	}
	if(!document.all && document.getElementById){
	   document.getElementById("Sidebar_lights").innerHTML = showLinks;
	}
}  

function showSidebar(){

	var currentPage = window.location.pathname;
	var currentPage = currentPage.substring(currentPage.lastIndexOf('/') + 1);

	if(currentPage == "mycharts-eng.php") {
		var show_Sidebar = "<div class='ntmsidebarheader' onMouseOver='showSidebar_monthly(0)'><h2 class='nav'><a class='white' href='/document/eng/index'>Notices To Mariners</a></h2></div>\n" +
			"<div id='Sidebar_monthly' class='ntmsidebarheaderitem'><div class='ntmsidebarImage'><img src='/images/arrow.gif' class='image' width='3' height='10' alt='-'  /></div><a class='sidebar' href='/document/eng/services/notmar/index'>Monthly Notices To Mariners</a></div>\n" +
            "<div class='ntmsidebarheaderitem'><a class='sidebar' title='' href='/document/eng/services/annual/default-eng'>Annual Notices To Mariners 2011</a></div>\n" +
            "<div class='ntmsidebarheaderitem'><a class='sidebar' title='' href='/document/eng/services/t-p-eng/index-eng'>Summary of Temporary and Preliminary Notices 2011</a></div>\n" +
			"<div id='Sidebar_lights' class='ntmsidebarheaderitem'><a class='sidebar' href='/document/eng/services/list/index'>Lists of Lights, Buoys, and Fog Signals</a></div><br />\n" +
			"<div class='ntmsidebarheader'><h2 class='nav'><a class='menulink' title='' href=''>Online Services</a></h2></div>\n" +
			"<div class='ntmsidebarheaderitem'><a class='sidebar' title='Search - Notices to Mariners' href='/search/notmar-eng.php'>Search - Notices to Mariners</a></div>\n" +
			"<div class='ntmsidebarheaderitem'><a class='sidebar' title='Create User Profile' href='/search/mycharts-eng.php?czoxOToibnRtPXN0ZXBfb25lJmxhbmc9ZSI7'>Create User Profile</a></div>\n" +
			"<div class='ntmsidebarheaderitem'><a class='sidebar' title='View Chart Patches' href='/patches/patches-eng.php'>View Chart Patches</a></div><br />\n" +
			"<div class='ntmsidebarheader'><h2 class='nav'>Subscribe to email notification services</h2></div><div style='margin:10px;'></div>\n" +
			"<div class='ntmsidebarheaderitem'><a class='sidebar' title='Receive chart updates FREE' href='/search/mycharts-eng.php?czoxOToibnRtPXN0ZXBfb25lJmxhbmc9ZSI7'>Receive chart updates FREE</a></div>\n" +
			"<div class='ntmsidebarheaderitem'><a class='sidebar' title='Receive complete monthly Notice to Mariners editions FREE' href='/subscribe/'>Receive complete monthly Notice to Mariners editions FREE</a></div><br />\n" +

			"<div class='ntmsidebarheader'><h2 class='nav'><a class='white' title='Registered Users' href='/search/mycharts-eng.php'>Registered Users</a></h2></div>\n" +
			"<div class='ntmsidebarheaderitem'><a class='sidebar' title='Sign in to your Notmar Profile' href='/search/mycharts-eng.php'>Sign in to your Notmar Profile</a></div>\n" +
			"<div class='ntmsidebarheaderitem'><a class='sidebar' title='Unsubscribe from chart updates' href='/search/mycharts-eng.php?czoxMDoibnRtPXJlbW92ZSI7'>Unsubscribe from chart updates</a></div>\n"  +
"<div class='ntmsidebarheaderitem'><a class='sidebar' title='Unsubscribe from complete monthly Notices to Mariners editions' href='/subscribe/unsubscribe.php'>Unsubscribe from complete monthly Notices to Mariners editions</a></div>\n"  +
			"<div class='ntmsidebarheaderitem'><a class='sidebar' title='NOTMAR Privacy Statement' href='/document/eng/services/notmar/privacy_statement_e'>NOTMAR Privacy Statement</a></div>\n" ;
	} else {
		var show_Sidebar = "<div class='ntmsidebarheader' onMouseOver='showSidebar_monthly(0)'><h2 class='nav'><a class='menulink' href='/document/eng/index'>Notices To Mariners</a></h2></div>\n" +
	
			"<div id='Sidebar_monthly' class='ntmsidebarheaderitem'><div class='ntmsidebarImage'><img src='/images/arrow.gif' class='image' width='3' height='10' alt='-'  /></div>" +
			"<a class='sidebar' href='/document/eng/services/notmar/index'>Monthly Notices To Mariners</a></div>\n" +
			"<div><span style='margin-left:10px;margin-top:5px;'><a class='sidebar' title='Current Edition' href='/document/eng/services/notmar/index'> - Current Edition</a></span></div>" +
			"<div><span style='margin-left:10px;margin-top:5px;'><a class='sidebar' title='Previous Updates' href='/document/eng/services/notmar/legacy'> - Previous Editions</a></span></div>\n" +
	
            "<div class='ntmsidebarheaderitem'><div class='ntmsidebarImage'><img src='/images/arrow.gif' class='image' width='3' height='10' alt='-'  /></div><a class='sidebar' title='Annual Notices To Mariners 2010' href='/document/eng/services/annual/default-eng'>Annual Notices To Mariners 2011</a></div>\n" +
            "<div class='ntmsidebarheaderitem'><div class='ntmsidebarImage'><img src='/images/arrow.gif' class='image' width='3' height='10' alt='-'  /></div><a class='sidebar' title='Summary of Temporary and Preliminary Notices 2010' href='/document/eng/services/t-p-eng/index-eng'>Summary of Temporary and Preliminary Notices 2011</a></div>\n" +
			"<div id='Sidebar_lights' class='ntmsidebarheaderitem'><div class='ntmsidebarImage'><img src='/images/arrow.gif' class='image' width='3' height='10' alt='-'  /></div><a class='sidebar' href='/document/eng/services/list/index'>Lists of Lights, Buoys, and Fog Signals</a></div><br />\n" +
			"<div class='ntmsidebarheader'><h2 class='nav'><a class='menulink' href=''>Online Services</a></h2></div>\n" +
			"<div class='ntmsidebarheaderitem'><div class='ntmsidebarImage'><img src='/images/arrow.gif' class='image' width='3' height='10' alt='-'  /></div><a class='sidebar' title='Search - Notices to Mariners' href='/search/notmar-eng.php'>Search - Notices to Mariners</a></div>\n" +
			"<div class='ntmsidebarheaderitem'><div class='ntmsidebarImage'><img src='/images/arrow.gif' class='image' width='3' height='10' alt='-'  /></div><a class='sidebar' title='View Chart Patche' href='/patches/patches-eng.php'>View Chart Patches</a></div><br />\n" +
			"<div class='ntmsidebarheader'><h2 class='nav'>Subscribe to email notification services</h2></div><div style='margin:10px;'></div>\n" +
			"<div class='ntmsidebarheaderitem'><div class='ntmsidebarImage'><img src='/images/arrow.gif' class='image' width='3' height='10' alt='-'  /></div><a class='sidebar' title='Receive chart updates FREE' href='/search/mycharts-eng.php?czoxOToibnRtPXN0ZXBfb25lJmxhbmc9ZSI7'>Receive chart updates FREE</a></div>\n" +
			"<div class='ntmsidebarheaderitem'><div class='ntmsidebarImage'><img src='/images/arrow.gif' class='image' width='3' height='10' alt='-'  /></div><a class='sidebar' title='Receive complete monthly Notice to Mariners editions FREE' href='/subscribe/'>Receive complete monthly Notice to Mariners editions FREE</a></div><br />\n" +
			"<div class='ntmsidebarheader'><h2 class='nav'><a class='menulink' title='Registered Users' href='/search/mycharts-eng.php'>Registered Users</a></h2></div>\n" +
			
			"<div class='ntmsidebarheaderitem'><div class='ntmsidebarImage'><img src='/images/arrow.gif' class='image' width='3' height='10' alt='-'  /></div><a class='sidebar' title='Sign in to your Notmar Profile' href='/search/mycharts-eng.php'>Sign in to your Notmar Profile</a></div>\n" +
			
"<div class='ntmsidebarheaderitem'><div class='ntmsidebarImage'><img src='/images/arrow.gif' class='image' width='3' height='10' alt='-'  /></div><a class='sidebar' title='Unsubscribe from chart updates' href='/search/mycharts-eng.php?czoxMDoibnRtPXJlbW92ZSI7'>Unsubscribe from chart updates</a></div>\n"  +
			
			"<div class='ntmsidebarheaderitem'><div class='ntmsidebarImage'><img src='/images/arrow.gif' class='image' width='3' height='10' alt='-'  /></div><a class='sidebar' title='Unsubscribe from complete monthly Notices to Mariners edition' href='/subscribe/unsubscribe.php'>Unsubscribe from complete monthly Notices to Mariners editions</a></div>"  +

			"<div class='ntmsidebarheaderitem'><div class='ntmsidebarImage'><img src='/images/arrow.gif' class='image' width='3' height='10' alt='-'  /></div><a class='sidebar' title='NOTMAR Privacy Statement' href='/document/eng/services/notmar/privacy-statement-eng'>NOTMAR Privacy Statement</a></div><div></div>"  ;
	}	
	if (document.all){
		try {
	   document.all.ntmsidebar.innerHTML = show_Sidebar;
		} catch(exception) {
			
		}
	}
	if(!document.all && document.getElementById){
	   document.getElementById("ntmsidebar").innerHTML = show_Sidebar;
	}						
}
