<!-- 
/*
------------------------------------------------------------------------------
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: January 27, 2002
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(photo,width,height) {
	var winargs = "width=" +width + ",height=" + height +",scrollbars=no,resizable=no,status=0"
  // alert(winargs);
    var prevWnd=window.open("","Photo",winargs);
   prevWnd.document.open();
   prevWnd.document.writeln('<html><title>House Photo</title><body background=\"images/listings/'+photo+"\">");
   prevWnd.document.writeln('</body</html>');
   prevWnd.document.close();
  }

function openSitePhoto(photo,width,height) {
	var winargs = "width=" +width + ",height=" + height +",scrollbars=no,resizable=no,status=0"
  // alert(winargs);
    var prevWnd=window.open("","Photo",winargs);
   prevWnd.document.open();
   prevWnd.document.writeln('<html><title>Site Plans</title><body background=\"images/'+photo+"\">");
   prevWnd.document.writeln('</body</html>');
   prevWnd.document.close();
  }

// --------------------  ** Form Validaton **  ----------------->

function checkrequired(which) {
var pass=true;
if (document.images) {
for (i=0;i<which.length;i++) {
var tempobj=which.elements[i];
if (tempobj.name.substring(0,8)=="required") {
if (((tempobj.type=="text"||tempobj.type=="textarea")&&
tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&
tempobj.selectedIndex==0)) {
pass=false;
break;
         }
      }
   }
}
if (!pass) {
shortFieldName=tempobj.name.substring(8,30).toUpperCase();
alert("Please enter valid data for the "+shortFieldName+" field!");
return false;
}
else
return true;

}


// -->









