<!-- 
/*
------------------------------------------------------------------------------
File Name: utility_lib.js
Company: pH2 Enterprises
Author: Phillip J. Henslee II <ph2@ph2enterprises.com> ©2002
Purpose: utility functions
Functions: 1
Date Created: January 15, 2002
Last Modified: February 18, 2004
Dependent Files: config.js
File Status: Optional
------------------------------------------------------------------------------
*/

/* 
------------------------------------------------------------------------
Function: loadURL
Purpose: load URL in browser curent window or target window
Arguments: 1
Arg 0: thePage - Name of the file to open
------------------------------------------------------------------------
*/  

function loadURL(){

	var args, tempStr, strURL, strPos, myLen, myStr;
	args = loadURL.arguments;
	tempStr = args[0]
	strPos = tempStr.indexOf(",");
	myLen = tempStr.length;
	
	if (strPos != -1){
		strURL = tempStr.slice(0,strPos)
		myStr =  tempStr.slice(strPos +1 , myLen)
	 }
	 else
	 {
		strURL = tempStr
		myStr  = 'self';
	 }
	
	if ( myStr != -1){
	
		if (myStr == "NEWWINDOW"){
		
	        window.open(strURL);
	        	
	    }else{
	      	
	      	window.parent[myStr].location.href=strURL;
	    }
	 }    	
}

/* 
------------------------------------------------------------------------
Function: goMenu(theMenu)
Purpose: loads selected URL from select menu
Arguments: 1
Arg 0: theMenu  the name of the select menu (this)
------------------------------------------------------------------------
*/ function goMenu(theMenu){

	var strURL = theMenu.options[theMenu.selectedIndex].value
	if (strURL != 'null'){
	loadURL(strURL);
	}
	
}


function openPhoto(photoId,width,height,filename) {

   if (photoWin){
   alert("Window Open!");
   photoWin.close();
   }  
   var winargs = "width=" +width + ",height=" + height +",scrollbars=no,resizable=no,status=0"
   var strURL = "photo.asp?pid=" + photoId + "&width=" + width  +"&height=" + height + "&filename=" + filename
   var photoWin=window.open(strURL,"photo",winargs);
   //photoWin.document.open();
   //photoWin.document.writeln('<html><head><title>' + filename +'</title></head><body background=\"' + baseURL.replace("manage/","") +'images/project/' +photo+"\">");
   //photoWin.document.writeln('</body</html>');
   //photoWin.document.close();
   //photoWin.width= width
   //photoWin.height = height
   //photoWin.resizeTo(width,height)
   photoWin.focus()
  }
  
  
// --------------------  ** Fill County Menu **  ----------------->
function fillOptionBox(selObj)
{
		if (document.form.myCounty){

				if (selObj.options[selObj.selectedIndex].value != 'null')
				{
					//alert(selObj.options[selObj.selectedIndex].value);
					var i = j = 0;
					var newItem;
					var src;
					var srcName = "";

					for (i = 0; i < selObj.length; i++)
					{
						if (selObj.options[i].selected)
						srcName = selObj.options[i].value;
					}

					//alert(srcName);

					src = eval(srcName);

							with (document.form.myCounty)
							{
								options.length = 0;
								for (i = 0; i < src.length; i++)
								{
									newItem = options.length;
									options[newItem] = new Option(src[i]);
									options[newItem].value = src[i+1];
									i++;
								}
								options[0].selected = true;
							}

					if ( navigator.appName == 'Netscape' && !document.getElementById) history.go(0);

				} else {
				
							//alert("Null value reset couny drop down!");
							with (document.form.myCounty)
							{
								options.length = 0;
								newItem = options.length;
								options[newItem] = new Option('All Counties(select state first)');
								options[newItem].value = null;
								options[0].selected = true;
							}
					
					
					
				}
		}
}

//--------------------** Check Menu ** ----------------------------->
function checkMenu(){
if (document.getElementById)
isOkay = true;
var isFirst = '';
if (isOkay == true | isFirst == null){
var isMenu = document.form.State;
if (isMenu.options[isMenu.selectedIndex].value != 'null') {
fillOptionBox(isMenu);
isFirst = true;
}
}
}

//--------------------** Load County Menu ** ----------------------------->
function loadCountyMenu(iCountyId){
if (document.getElementById){
//alert(iCountyId);
var selObj = document.form.State
var selObj2 = document.form.myCounty
//alert(selObj.options.length);

fillOptionBox(selObj);

if(iCountyId != null){
for (i = 0; i < selObj2.options.length -1 ; i++)
{
//alert(selObj2.options[i].value);
if (selObj2.options[i].value == iCountyId){

selObj2.options[i].selected = true;
}

}

}
}
}
// -->









