// JavaScript Document
function CGRCmail(value) {
	//var category=contact.category.options[value].value;
	var cat1 = document.getElementById("category").options[document.getElementById("category").selectedIndex].value;
	
	if (cat1=="Coast Guard Recruiting" || cat1=="Jobs" || cat1=="Now Hiring" || cat1=="Recruiting") { 
		window.location.href="https://cgrats.uscg.mil/cgInformation.asp?mid=3254";}
	else if (cat1=="Direct Access") {
		window.location.href="http://www.uscg.mil/ppc/ccb/";}
	else if (cat1=="Human Resources" || cat1=="Personnel and Records") {
		window.location.href="http://www.uscg.mil/hr/faqs.asp";}
	else if (cat1=="Marine Safety Feedback") {
		window.location.href="http://homeport.uscg.mil/maritimesurvey";}
	else if (cat1=="Licensing Information" || cat1=="Merchant Mariners"){
		window.location.href="http://www.uscg.mil/nmc/contact_iasknmc.asp";}
	else if (cat1=="Rules of the Road (NavRules)") {
		window.location.href="http://www.navcen.uscg.gov/index.php?pageName=navRulesMain";}
	else if (cat1=="NAVCEN Website"){
		window.location.href="http://www.navcen.uscg.gov/?pageName=contactUs";}
}
	
function addemail(theForm){
	var category=theForm.category.options[theForm.category.selectedIndex].value;
	
	if (category=="Acquisitions"){
		theForm.To.value="william.d.sansone@uscg.mil";}
	else if (category=="Auxiliary"){
		theForm.To.value="Wayne.Spivak@uscg.mil";}
	else if (category=="Aids to navigation and GPS"){
		theForm.To.value="JPhilip.J.Balem@uscg.mil";}
	else if (category=="AMVER"){
		theForm.To.value="AMVERTeam@uscg.mil";}
	else if (category=="CHRIS Manual/Website"){
		//theForm.To.value="hazmat@comdt.uscg.mil;Alan.L.Schneider@uscg.mil"
		theForm.To.value="HQS-PF-fldr-CG-533CGPreparedness@uscg.mil";}
	else if (category=="Coast Guard Academy"){
		theForm.To.value="cgaweb@dcseg.uscga.edu";}
	else if (category=="Coast Guard Magazine"){
		theForm.To.value="cgmag@uscg.mil";}
	else if (category=="CGVI"){
		theForm.To.value="cgvi@uscg.mil";}	 
	else if (category=="Commercial Vessel Inspection"){
		theForm.To.value="HQS-PF-fldr-G-PCV@uscg.mil";}
	else if (category=="Direct Access") {
		window.location.href="http://www.uscg.mil/ppc/ccb/";
		return false;}
	else if (category=="Environmental Protection"){
		theForm.To.value="HQS-PF-fldr-CG-533@uscg.mil";}
	else if (category=="History and Lighthouses"){
		theForm.To.value="scott.t.price@uscg.mil";}
	else if (category=="Homeport"){
		theForm.To.value="OSC-CustomerSupport@uscg.mil";}
	else if (category=="Human Resources"){
		window.location.href="http://www.uscg.mil/hr/faqs.asp";
		return false;}
	else if (category=="Jobs"){
		window.location.href="https://cgrats.uscg.mil/cgInformation.asp?mid=3254";
		return false;}
	else if (category=="Licensing Information"){
		window.location.href="http://www.uscg.mil/nmc/contact_iasknmc.asp";
		return false;}
	else if (category=="Marine Safety Survey"){
		window.location.href="http://homeport.uscg.mil/maritimesurvey";
		return false;}
	else if (category=="Merchant Mariners"){
		window.location.href="http://www.uscg.mil/nmc/contact_iasknmc.asp";
		return false;}
	else if (category=="NAVCEN Website"){
		//theForm.To.value="Webmasternavcen@uscg.mil;Michael.J.Baca@uscg.mil";}
		window.location.href="http://www.navcen.uscg.gov/";
		return false;}
	else if (category=="Now Hiring"){
		theForm.To.value="CGR-DG-CGRC-WEBMASTER@uscg.mil";}
	else if (category=="Personnel and Records"){
		window.location.href="http://www.uscg.mil/hr/faqs.asp";
		return false;}
	else if (category=="Personnel Locator"){
		theForm.To.value="ARL-PF-CGPCCGLocator@uscg.mil";}
	else if (category=="Port Security"){
		theForm.To.value="HQS-PF-fldr-G-PCP@uscg.mil";}
	else if (category=="Public Affairs, News and Images"){
		theForm.To.value="public-inquiry@comdt.uscg.mil";}
	else if (category=="Recreational Boating Safety"){
		theForm.To.value="HQS-PF-fldr-CG-5422@uscg.mil";}
	else if (category=="Recruiting"){
		window.location.href="https://cgrats.uscg.mil/cgInformation.asp?mid=3254";
		return false;} 
	else if (category=="Rules of the Road (NavRules)"){
		window.location.href="http://www.navcen.uscg.gov/mwv/navrules/navrules.htm";
		return false;}
		 //theForm.To.value="cgnav@uscg.mil";}
	else if (category=="Search and Rescue"){
		theForm.To.value="Willie.M.Foster@uscg.mil";}
	else if (category=="TWIC Questions"){
		theForm.To.value="hqs-twic-hq@uscg.mil";}
	else if (category=="VADM Card Report"){
		theForm.To.value="radm_watson@uscg.mil";}
	else if (category=="Vessel Documentation"){
		theForm.To.value="nvdc.w.webmaster@uscg.mil";}
	else if (category=="Website Feedback"){
		theForm.To.value="Joe.M.Fernandez@uscg.mil;Monika.E.Foster@uscg.mil";
		theForm.CC.value="Daniel.Lee@uscg.mil";
	}
	
	// Required fields
	if (theForm.From.value==""){
		alert("Please specify your email address.");
		theForm.From.focus();
		return false;} 
	if (category=="Select a category"){
		alert("Please choose a category for your email.")
		theForm.category.focus();
		return false;}
	if (theForm.Message.value==""){
		alert("Please include a question or comment.")
		theForm.Message.focus();
		return false;}
		
	// Get URL of previous page
	 if(document.referrer)
	 	document.getElementById('referrer').value = document.referrer;
	
	return true;
}
