/* Functions included in this listing:


***********************************************************************/

// JavaScript function header template
/* -------------------------------------------------------------------------------------------------
Function:
Description:
Author:
Last Modfied Date:
Last Modfied By:
Arguments:
Returns:
Notes:
-------------------------------------------------------------------------------------------------- */



// ---------------------------------------------------------------------
// Submit HTML form_id to passed target_page
function submit_form(form_id,target_page)
	{ var frm = document.getElementById(form_id); frm.action = target_page; frm.submit(); }
/* -------------------------------------------------------------------------------------------------
Function:			ShowPopupWindow
Description:		Displays Popup windows w/user passed title, message, size and font.
Author:				Alex Clarke
Last Modfied Date:	02/24/09
Last Modfied By: 	John Palmer
Arguments:
Returns:
Notes:				JP - Added iFontSize arg to allow user to set specific message text size and strBGColor
					to allow user control of background color
-------------------------------------------------------------------------------------------------- */
function ShowPopupWindow(strText,strTitle,iLeft,iTop,iHeight,iWidth,bPersist,iFontSize,strBGColor) {
	var strParams = "left=" + iLeft + ",top=" + iTop + ",";
	var w;
	strParams = strParams + "menubar=no,resizable=no,height=" + iHeight + ",width=" + iWidth + ",";
	strParams = strParams + "status=no,toolbar=no,scrollbars=yes";
	w = window.open("",'popup',strParams);
	if (strBGColor)
  		strHTML = "<body bgColor=" + strBGColor;
	else
  		strHTML = "<body bgColor=#EFEFEF";
	if (bPersist) strHTML += " onBlur=setTimeout('self.focus()',100)";
	strHTML += ">";
	strHTML += "<span style='font-family:Arial, Helvetica, sans-serif; font-size:9pt;'>";
	strHTML += "<b>" + strTitle + "</b><br>";
	strHTML += "</span>";
	if (iFontSize) 
		strHTML += "<span style='font-family:Arial, Helvetica, sans-serif; font-size:" + iFontSize + "px;'>";
	else
		strHTML += "<span style='font-family:Arial, Helvetica, sans-serif; font-size:10px;'>";
	strHTML += strText;
	strHTML += "</span>";
	strHTML += "<form id=fm><p><input style='width:120px;font-size:10px;height:20px;' type=button value='Close this Window' onclick='window.close()'></p>";
	strHTML += "</form>";
	strHTML += "</body>";
	w.document.open();
	w.document.write(strHTML);
	w.document.close();
	w.focus();
	return true;
}
// ---------------------------------------------------------------------
function ShowFWISTPopupWindow(strText,strTitle,iLeft,iTop,iHeight,iWidth,bPersist) {
	var strParams = "left=" + iLeft + ",top=" + iTop + ",";
	var w;
	var buttstyle = "width:120px;font-size:10px;height:20px;";
	strParams = strParams + "menubar=no,resizable=no,height=" + iHeight + ",width=" + iWidth + ",";
	strParams = strParams + "status=yes,toolbar=no,scrollbars=yes";
	w = window.open("",'popup',strParams);
  strHTML = "<body bgColor=#EFEFEF";
	if (bPersist) strHTML += " onBlur=setTimeout('self.focus()',100)";
	strHTML += ">";
	strHTML += "<span style='font-family:Arial, Helvetica, sans-serif; font-size:9pt;'>";
	strHTML += "<b>" + strTitle + "</b><br>";
	strHTML += "</span>";
	strHTML += "<span style='font-family:Arial, Helvetica, sans-serif; font-size:10px;'>";
	strHTML += strText;
	strHTML += "</span>";
	strHTML += "<form id=fm><p>";
	strHTML += "<input id=closer style='"+buttstyle+"' type=submit value='Close this Window' onclick='window.close()'>&nbsp;&nbsp;";
	strHTML += "<input style='"+buttstyle+"' type=button value='Prints this Graph' onclick='window.print();'>";
	strHTML += "</p></form>";
	strHTML += "</body>";
	w.document.open();
	w.document.write(strHTML);
	w.document.close();
	return true;
}
// ---------------------------------------------------------------------
function LaunchIMF(url, width, height) {
  var features = "directories=0,fullscreen=0,left=0,location=0,menubar=0,"
               + "resizable=1,scrollbars=1,status=1,titlebar=1,toolbar=0,top=0,"
               + "width=" + width + ","
               + "height=" + height;
  var imfWindow = window.open(url, "imfWindow", features);
  imfWindow.focus();
}
/* -------------------------------------------------------------------------------------------------
Function: OpenSelectedLink
Description: Opens a document or URL from the current selection in a list
Author: Alex Clarke
Last Modfied Date: 12/12/08
Last Modfied Author: Alex Clarke
Arguments: 
	strListID: string - ID of the list to query
	bNewWindow: boolean - whether or not to open a new window
Returns: None
Notes: loads 'not found' page if list selection cannot be determined
------------------------------------------------------------------------------------------------- */
function OpenSelectedLink(strListID,bNewWindow)
{
	var strSelection="";
	strList = document.getElementById(strListID);
	strSelection = strList.options[strList.selectedIndex].value;	
	if (strSelection == "")	strSelection = "/linknotfound.php"
	if (bNewWindow)	window.open(strSelection);
	else self.location = strSelection;
	return true;
}
// ---------------------------------------------------------------------
function ChangeLabel (label_title,label_text)
{
	var lbls = document.getElementsByTagName("LABEL");
	for (var i = 0; i < lbls.length; i++) { 
		if (label_title == lbls[i].title) {
			//alert("Found is " + lbls[i].name);
			//alert("Label Text is " + lbls[i].firstChild.nodeValue);
			lbls[i].firstChild.nodeValue = label_text;
			lbls[i].style.paddingLeft = "8px";			
			return true;
		}
	}
	//alert(label_title + " Not Found");
	return false;
}
// ---------------------------------------------------------------------
function ShowMapZoneInfo(strZone)
{
	var strParams = "left=200,top=200,";
	var w;

	strParams = strParams + "menubar=no,resizable=no,height=200,width=200,";
	strParams = strParams + "status=no,toolbar=no,scrollbars=yes";
	w = window.open("/content/aicc/zoneinfo/" + strZone + ".mht",'popup',strParams);
	strHTML += "<form id=fm><p><input style='width:120px;font-size:10px;height:20px;' type=button value='Close this Window' onclick='window.close()'></p>";
	strHTML += "</form>";
	w.document.open();
	w.document.write(strHTML);
	w.document.close();
	w.focus();
	return true;
}

// ---------------------------------------------------------------------
function ShowZoneInfo(strZone)
{
	var strTitle;
	switch (strZone) {
		case "Fairbanks": 
			strTitle = "Fairbanks Area Forestry Information";
			strText = "Fairbanks Area Office<br>";
			strText += "3700 Airport Way<br>";
			strText += "Fairbanks, Alaska 99709-4699<br>";
			strText += "(907) 451-2600, fax: (907) 458-6895<br>";
			strText += "Burn Permit: (907) 451-2626<br>";
			strText += "Fireline: (907) 451-2626<br>";
			strText += "<em><strong>Marc Lee, Area Forester</strong></em>";
			break;
		case "Tok": 
			strTitle = "Tok Area Forestry Information";
			strText = "Tok Area Office<br>";
			strText += "Box 10<br>";
			strText += "Tok, Alaska 99780<br>";
			strText += "(Mile 123 Glenn Hwy.)<br>";
			strText += "(907) 883-5134, fax: (907) 883-5135<br>";
			strText += "Fireline: (907) 883-5657<br>";
			strText += "<em><strong>Jeff Hermanns, Area Forester</strong></em>";
			break;
		case "Delta": 
			strTitle = "Delta Area Forestry Information";
			strText = "Delta Area Office<br>";
			strText += "P.O. Box 1149<br>";
			strText += "Delta Junction, Alaska 99737<br>";
			strText += "(Mi. 267.5 Richardson Hwy.)<br>";
			strText += "(907) 895-4225, fax: (907) 895-4934<br>";
			strText += "Fireline: (907) 895-4227<br>";
			strText += "<em><strong>Al Edgren, Area Forester</strong></em>";
			break;			
		case "Valdez": 
			strTitle = "Valdez/Copper River Area Forestry Information";
			strText = "Valdez/Copper River Area Office<br>";
			strText += "P.O. Box 185<br>";
			strText += "Glennallen, Alaska 99588<br>";
			strText += "(Mi. 110 Richardson Hwy.)<br>";
			strText += "(907) 822-5534, fax: (907) 822-8600<br>";
			strText += "Fireline: (907) 822-5533<br>";
			strText += "<em><strong>Gary Mullen, Fire Management Officer</strong></em>";
			break;			
		case "Matsu": 
			strTitle = "Mat-su/Southwest Area Forestry Information";
			strText = "Mat-su District Office<br>";
			strText += "101 Airport Road<br>";
			strText += "Palmer, Alaska 99645<br>";
			strText += "(907) 761-6300, fax: (907) 761-6319<br>";
			strText += "Burn Permit: (907) 761-6338<br>";
			strText += "Fireline: (907) 761-6311<br>";
			strText += "<em><strong>Ken Bullman, Area Forester</strong></em>";
			break;
		case "Chugach": 
			strTitle = "Chugach National Forest<br>USDA Forest Service - Region 10";
			strText = "3301 C St.<br>";
			strText += "Anchorage, Alaska 99503<br>";
			strText += "(907) 743-9500<br><br>";
			strText += "<a target=_lblank href=http://www.fs.fed.us/r10/chugach>CNF Home Page</a>";
			break;
		case "Tongass": 
			strTitle = "Tongass National Forest<br>USDA Forest Service - Region 10";
			strText = "Federal Building<br>";
			strText += "648 Mission St.<br>";
			strText += "Ketchikan, Alaska 99901<br>";
			strText += "(907) 225-3101<br><br>";
			strText += "<a target=_lblank href=http://www.fs.fed.us/r10/tongass>TNF Home Page</a>";
			break;
		case "Kenai": 
			strTitle = "Kenai-Kodiak Area Forestry Information";
			strText = "Kenai-Kodiak Area Office<br>";
			strText += "42499 Sterling Highway<br>";
			strText += "Soldotna, Alaska 99669<br>";
			strText += "(Mi. 92.5 Sterling Hwy.)<br>";			
			strText += "(907) 260-4200, fax: (907) 260-4205<br>";
			strText += "Burn Permit: (907) 260-4269<br>";
			strText += "Fireline: (907) 260-4273<br>";
			strText += "<em><strong>Jim Peterson, Area Forester</strong></em>";
			break;
		case "Southwest": 
			strTitle = "Southwest District Forestry Information";
			strText = "Southwest District Office<br>";
			strText += "Box 130<br>";
			strText += "McGrath, Alaska 99627<br>";
			strText += "(907) 524-3010, fax: (907) 524-3932<br>";
			strText += "Fireline: (907) 524-3366<br>";
			strText += "<em><strong>Ray Kraemer, Fire Management Officer</strong></em>";
			break;			
		case "Galena":
				strTitle = "Galena Fire Management Zone Information";
				strText = "Office Location: Galena, AK<br><br>";
				strText += "Marlene Eno-Hendren, Fire Management Officer<br>";
				strText += "Phone: (907) 656-1222, fax: (907) 656-1702<br>";
			break;
		case "Upper Yukon":
			strTitle = "Upper Yukon Fire Management Zone Information";
			strText = "Office Location: Ft. Wainwright, AK<br><br>";
			strText += "Steve Theisen, Fire Management Officer<br>";
			strText += "Phone 1-800-237-3652, fax: (907) 356-5556<br>";
			break;
		case "Tanana":
			strTitle = "Tanana Fire Management Zone Information";
			strText = "Office Location: Ft. Wainwright, AK<br><br>";
			strText += "Dave Jandt, Fire Management Officer<br>";
			strText += "Phone 1-800-237-3652, fax: (907) 356-5556<br>";
			break;
		case "Military":
			strTitle = "Military Fire Management Zone Information";
			strText = "Office Location: Ft. Wainwright, AK<br><br>";
			strText += "Tamala Defries, Fire Management Officer<br>";
			strText += "Phone 1-800-237-3652, fax: (907) 356-5556<br>";
			break;
		case "Haines":
			strTitle = "Northern Southeast Area Office";
			strText = "P.O. Box 263 (Gateway Building)<br>";
			strText += "Haines, AK 99827<br>";
			strText += "(907) 766-2120 / fax: (907) 766-3225<br>";
			strText += "<em><strong>Roy Josephson, Area Forester</em></strong><br>";
			break;
	}
//	strText += "<br><em>(clicking a link may close this window)</em>";
	ShowPopupWindow(strText,strTitle,200,200,190,300,true);
return true;
}
//**************************************************************************
function GoToDir(strFile)
{
	//alert(strFile);
	document.doclist.srcdir.value=strFile;
	//alert(document.doclist.passwd.value);
	//alert(document.doclist.srcdir.value);
	document.doclist.submit();
	return true;
}
/***************************** End of JavaScript functions*********************/


