// JavaScript Document
//MJOC MEMA EOC STATUS
//default status level\\//Variable for Status Change
var EOCStatus;

function setStatus(newStatus)
{ 

	var agree = confirm("You\'re about to change the EOC\'s operational status level.\n"
  + "Are you sure you want to do this?"); 
  
 if (agree){
  	document.getElementById('statusImage').src = 'http://www.mema.state.md.us/MEMA/images/content/header/mema_op_status_' + newStatus + '.png';

	EOCStatus = newStatus;

	var statusTxt = "You have changed the operational status level of the EOC at MEMA to status " + newStatus.toUpperCase() + ".\r"
					+ "You have the responsiblity to ensure that you have the authority to change the status of "
					+ "EOC at MEMA.\nSevere criminal penalties and / or violation of the UCMJ, for military personnel, "
					+ "will be imposed\nfor falsing reporting the status of the EOC.\n\nYour information is forwarded to"
					+ "the director and deputy directors of MEMA.\n\n"
					+ document.eocStatus.fname.value + " " + document.eocStatus.lname.value + "\r"
					+ "("+document.eocStatus.areaCd.value+")"+document.eocStatus.phExt.value+"-"+document.eocStatus.phNbr.value + "\r"
					+ document.eocStatus.email.value + "\r"
					+ document.eocStatus.watchType.value + "\r"
					+ document.eocStatus.reason_for_chng.value + "\r"		
					+ "\n\n"
					+ "Before you click on the submit button ensure that you have the authority and responsibility\r"
					+ "to authorize the change of status of the Emergency Operations Center.";

	alert(statusTxt);
	
 } else { 
  return false; 
 }
}

function resetStatus(newStatus){         

  	document.getElementById('statusImage').src = '/MEMA/images/content/header/mema_op_status_' + newStatus + '.png';
		
	EOCStatus = newStatus;
}
//SEND EOC Status Change Data
function sendData(status)
{

	toMail		= "ewhite@mema.state.md.us";
	toSubject 	= "CHANGE OF STATUS OF EOC";
	bodyText 	= document.eocStatus.fname.value.toString() + " " + document.eocStatus.lname.value.toString() + '\r'
				+ "("+ document.eocStatus.areaCd.value.toString()+")" + document.eocStatus.phExt.value.toString() + "-" + document.eocStatus.phNbr.value.toString() + '\r'
				+ document.eocStatus.email.value.toString() + '\r'
				+ document.eocStatus.watchType.value.toString() + '\r'
				+ document.eocStatus.reason_for_chng.value.toString() + '\r'
				+ getStatus();
	
	bodyText = "line1\r\nline2\r\nline3\r\nline4";
	
	alert("mailto:" + toMail +"?subject=" + toSubject + "&body=" + bodyText);	
	location.href="mailto:" + toMail +"?subject=" + toSubject + "&body=" + bodyText;
	
}

//Get the new Status
function getStatus()
{
		if (EOCStatus=='green')
		{
			myStatusTxt = "LEVEL ONE";
		}
		if (EOCStatus=='yellow')
		{
			myStatusTxt = "LEVEL TWO";
		}
		if (EOCStatus=='orange')
		{
			myStatusTxt = "LEVEL THREE";
		}		
		if (EOCStatus=='red')
		{
			myStatusTxt = "LEVEL FOUR";
		}		
		
		return "Status is now set to: " + myStatusTxt + "(" + EOCStatus.toUpperCase() + ")";
}


