// JavaScript Document

function ShowDropPanel(pnl, btn) {
	menu=document.getElementById(pnl);
	icon=document.getElementById(btn);
	imageBase=externallinksargs.imagebase;
	if ((menu.style.display == "") && (icon.src.search(/plus/i) != -1)) {
		menu.style.display = "none";
	}
	if (menu.style.display=="none") {
		menu.style.display="block";
		icon.src=imageBase + "/minus_9x15.gif";
	}
	else {
		menu.style.display="none";
		icon.src=imageBase + "/plus_9x15.gif";
	}
}

function bookmarkPage() {
	var url = window.location.href;
	var title = document.title;
	if (window.sidebar) { // for Firefox
		window.sidebar.addPanel(title,url,"");
	} else if (document.all) { // for IE
		window.external.AddFavorite(url,title);
	} else {
		alert("To bookmark this page, please close this box and press Ctrl-D.  Thank you!");
	}
}

function mailLink(mailanchor) {
	mailanchor.href = "mailto:?subject=" + document.title + "&body=" + window.location.href;
	return true;
}

function dropDownNav(url) {
	if ( ( (url.search(/http:/i) != -1) || (url.search(/https:/i) != -1) ) && ( (url.search(/marad.dot.gov/i) == -1) && (url.search(/ad.dot.gov/i) == -1) ) ) {
		var redirecttext = "Thank you for visiting the Maritime Administration website.<p>" + 
		"You will be transfered in 10 seconds to:<p>" + 
		unescape(url) + "<p>" +
		"<input type='button' value='Cancel' onclick='closedialog();'>" +
		"<input type='button' value='Continue' onclick='window.open(\"" + url + "\",\"new_window\");closedialog();'><p>" +
		"Please be aware that when you exit our web sites, the privacy policy stated on our web sites may not be the same as that on other web sites. " +
		"In addition, The Departement of Transportation (DOT) cannot attest to the accuracy of information provided by linked sites. " +
		"Linking to a web site does not constitute an endorsement by DOT or any of its employees of the sponsors of the site or the products presented on the site."; 		
				
		document.getElementById("externallink-window").innerHTML = redirecttext;
		document.getElementById("externallink-background").style.display = "block";
		document.getElementById("externallink-window").style.display = "block";
		
		if (window.ActiveXObject) {
			document.getElementById("externallink-iframe").style.display = "block";
		} 
			
		var left = window.ActiveXObject ? document.documentElement.scrollLeft : 0;
		var top = window.ActiveXObject ? document.documentElement.scrollTop : 0;
		
		document.getElementById("externallink-window").style.left = Math.max((left + (externallinks.getwindowwidth() - document.getElementById("externallink-window").offsetWidth) / 2), 0) + "px";
		document.getElementById("externallink-window").style.top = Math.max((top + (externallinks.getwindowheight() - document.getElementById("externallink-window").offsetHeight) / 2), 0) + "px";
		
		this.timeout = window.setTimeout("window.open('" + url + "','new_window');closedialog();", 10000);

	} else {
		window.location=url;
	}
}

function closedialog() {
		window.clearTimeout(this.timeout);
		
		document.getElementById("externallink-background").style.display = "none";
		document.getElementById("externallink-window").style.display = "none";
		
		if (window.ActiveXObject) {
			document.getElementById("externallink-iframe").style.display = "none";
		}
		
		if (window.detachEvent) {
			window.detachEvent("onresize", externallinks.positiondialog);
		} else if (window.removeEventListener) {
			window.removeEventListener("resize", externallinks.positiondialog, false);
		} else {
			window.onresize = null; 
		}
}

function MM_findObj(n, d) { //v4.01
	var p,i,x;
	if(!d) d=document;
	if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document;
		n=n.substring(0,p);
	}
	if(!(x=d[n])&&d.all) x=d.all[n];
	for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n);
	return x;
}

function MM_preloadImages() { //v3.0
	var d=document;
	if(d.images) {
		if(!d.MM_p) d.MM_p=new Array();
		var i,j=d.MM_p.length,a=MM_preloadImages.arguments;
		for(i=0; i<a.length; i++) {
			if (a[i].indexOf("#")!=0) {
				d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];
			}
		}
	}
}

function MM_swapImgRestore() { //v3.0
	var i,x,a=document.MM_sr;
	for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

//
//function MM_jumpMenu(targ,selObj,restore) { //v3.0
//	eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
//	if (restore) selObj.selectedIndex=0;
//}
//

function MM_swapImage() { //v3.0
	var i,j=0,x,a=MM_swapImage.arguments;
	document.MM_sr=new Array;
	for(i=0;i<(a.length-2);i+=3) {
		if ((x=MM_findObj(a[i]))!=null) {
			document.MM_sr[j++]=x;
			if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];
		}
	}
}

function setStatus(text) {
	window.status=text;
	return true;
}
