       
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(testX > 125 || testX < 8) {
		
		if (document.all){	// for IE
			if (document.all.Sidebar_monthly){
				showSidebar_monthly(0);					
			}
			if (document.all.Sidebar_lights){
				showSidebar_lights(0);					
			}		
		}		
		
		if(!document.all && document.getElementById){  // for Netscape
		   if (document.getElementById("Sidebar_monthly")){
			   showSidebar_monthly(0);	
		   }
		   if (document.getElementById("Sidebar_lights")){
			   showSidebar_lights(0);	
		   }		   
		}		

	}
*/

			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' href='/document/eng/services/notmar/index'>Monthly Notices To Mariners</a>";
		showLinks += "<br>&nbsp;&nbsp;<a class='sidebar' href='/document/eng/services/notmar/index'> - Current Edition</a>";
		showLinks += "<br>&nbsp;&nbsp;<a class='sidebar' href='/document/eng/services/notmar/legacy'> - Previous Updates</a>";
	} else {
		showLinks = "<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' onMouseOver='showSidebar_monthly(1);'>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' href='/document/eng/services/list/index'>Lists of Lights, Buoys, and Fog Signals</a>";
		showLinks += "<br>&nbsp;&nbsp;<a class='sidebar' href='/document/eng/services/list/newfoundland-2009'>- Newfoundland and &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Labrador</a>";
		showLinks += "<br>&nbsp;&nbsp;<a class='sidebar' href='/document/eng/services/list/atlantic-coast-2009'>- Atlantic Coast</a>";
		showLinks += "<br>&nbsp;&nbsp;<a class='sidebar' href='/document/eng/services/list/inland-waters-2009'>- Inland Waters</a>";
		showLinks += "<br>&nbsp;&nbsp;<a class='sidebar' href='/document/eng/services/list/pacific-coast-2007'>- Pacific Coast</a>";
	} else {
		showLinks = "<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' onMouseOver='showSidebar_lights(1)' >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(){
	
	//alert (document.location.href );
	
	var currentPage = window.location.pathname;
	var currentPage = currentPage.substring(currentPage.lastIndexOf('/') + 1);
	//alert(currentPage);

	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' onMouseOver='showSidebar_monthly(1)'>Monthly Notices To Mariners</a></div>\n" +
            "<div class='ntmsidebarheaderitem'><a class='sidebar urgent' href='/document/eng/services/notmar/Loran-C-eng' onMouseOver='showSidebar_monthly(0)'><u>UPDATE AUGUST 3, 2010 NOTICE - Termination of the Loran-C Service</u></a></div>\n" +
            "<div class='ntmsidebarheaderitem'><a class='sidebar' href='/document/eng/services/2010-annual/index' onMouseOver='showSidebar_monthly(0)'>Annual Notices To Mariners 2010</a></div>\n" +
            "<div class='ntmsidebarheaderitem' onMouseOver='showSidebar_lights(0)'><a class='sidebar' href='/document/eng/services/t-p-2010-eng/index-eng'>Summary of Temporary and Preliminary Notices 2010</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' onMouseOver='showSidebar_lights(1)'>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'><a class='sidebar' href='/search/notmar-eng.php'>Search - Notices to Mariners</a></div>\n" +
			"<div class='ntmsidebarheaderitem'><a class='sidebar' href='/search/mycharts-eng.php?czoxOToibnRtPXN0ZXBfb25lJmxhbmc9ZSI7'>Create User Profile</a></div>\n" +
			"<div class='ntmsidebarheaderitem'><a class='sidebar' 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' href='/search/mycharts-eng.php?czoxOToibnRtPXN0ZXBfb25lJmxhbmc9ZSI7'>Receive chart updates FREE</a></div>\n" +
			"<div class='ntmsidebarheaderitem'><a class='sidebar' href='/subscribe/'>Receive complete monthly Notice to Mariners editions FREE</a></div><br />\n" +

			"<div class='ntmsidebarheader'><h2 class='nav'><a class='white' href='/search/mycharts-eng.php'>Registered Users</a></h2></div>\n" +
			"<div class='ntmsidebarheaderitem'><a class='sidebar' href='/search/mycharts-eng.php'>Sign in to your Notmar Profile</a></div>\n" +
			"<div class='ntmsidebarheaderitem'><a class='sidebar' href='/search/mycharts-eng.php?czoxMDoibnRtPXJlbW92ZSI7'>Unsubscribe from chart updates</a></div>\n"  +
"<div class='ntmsidebarheaderitem'><a class='sidebar' href='/subscribe/unsubscribe.php'>Unsubscribe from complete monthly Notices to Mariners editions</a></div>\n"  +
			"<div class='ntmsidebarheaderitem'><a class='sidebar' 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='menulink' href='/document/eng/services/notmar/index' onMouseOver='showSidebar_monthly(1)'>Monthly Notices To Mariners</a></div>\n" +
            "<div class='ntmsidebarheaderitem'><a class='sidebar urgent' href='/document/eng/services/notmar/Loran-C-eng' onMouseOver='showSidebar_monthly(0)'><u>UPDATE AUGUST 3, 2010 NOTICE - Termination of the Loran-C Service</u></a></div>\n" +
            "<div class='ntmsidebarheaderitem'><a class='sidebar' href='/document/eng/services/2010-annual/index' onMouseOver='showSidebar_monthly(0)'>Annual Notices To Mariners 2010</a></div>\n" +
            "<div class='ntmsidebarheaderitem' onMouseOver='showSidebar_lights(0)'><a class='sidebar' href='/document/eng/services/t-p-2010-eng/index-eng'>Summary of Temporary and Preliminary Notices 2010</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' onMouseOver='showSidebar_lights(1)'>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'><a class='sidebar' href='/search/notmar-eng.php'>Search - Notices to Mariners</a></div>\n" +
			"<div class='ntmsidebarheaderitem'><a class='sidebar' 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' href='/search/mycharts-eng.php?czoxOToibnRtPXN0ZXBfb25lJmxhbmc9ZSI7'>Receive chart updates FREE</a></div>\n" +
			"<div class='ntmsidebarheaderitem'><a class='sidebar' href='/subscribe/'>Receive complete monthly Notice to Mariners editions FREE</a></div><br />\n" +
			"<div class='ntmsidebarheader'><h2 class='nav'><a class='menulink' href='/search/mycharts-eng.php'>Registered Users</a></h2></div>\n" +
			
			"<div class='ntmsidebarheaderitem'><a class='sidebar' href='/search/mycharts-eng.php'>Sign in to your Notmar Profile</a></div>\n" +
			
"<div class='ntmsidebarheaderitem'><a class='sidebar' href='/search/mycharts-eng.php?czoxMDoibnRtPXJlbW92ZSI7'>Unsubscribe from chart updates</a></div>\n"  +
			
			"<div class='ntmsidebarheaderitem'><a class='sidebar' href='/subscribe/unsubscribe.php'>Unsubscribe from complete monthly Notices to Mariners editions</a></div>"  +

			"<div class='ntmsidebarheaderitem'><a class='sidebar' href='/document/eng/services/notmar/privacy-statement-eng'>NOTMAR Privacy Statement</a></div><div></div>"  ;
	}
	
	
	if (document.all){
	   document.all.ntmsidebar.innerHTML = show_Sidebar;
	}
	if(!document.all && document.getElementById){
	   document.getElementById("ntmsidebar").innerHTML = show_Sidebar;
	}					
					
	
}
