function slFileIncluded()
	{
	alert('Yep, it is here');
	}

function NewWindow(mypage, myname, w, h, scroll, size) 
	{
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',toolbar=0,scrollbars='+scroll+',dependent=NO,location=0,status=0,menubar=0,resizable='+size+''
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
	}

// used for forms
function FormToWindow(myform, windowname, w, h, scroll, size)
	{
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',toolbar=0,scrollbars='+scroll+',dependent=YES,location=0,status=YES,menubar=0,resizable='+size+''
	if (! window.focus)return true;
	window.open('', windowname, winprops);
	myform.target=windowname;
	return true;
	}

function noenter(e) 
	{
	var key;

	if(window.event) key = window.event.keyCode;     //IE
	else key = e.which;     //firefox & netscape

	if (key == 13) return false;
	}

function decimalsandenter(e)
	{
	var key;
	if(window.event) key = window.event.keyCode;     //IE
	else key = e.which;     //firefox & netscape
	if (key == 13) return false;	// return
	if (key == 47) return false;	// forward slash
	if (key > 31 && (key < 46 || key > 57)) return false;
	}

function intandenter(e)
	{
	var key;
	if(window.event) key = window.event.keyCode;     //IE
	else key = e.which;     //firefox & netscape
	if (key == 13) return false;	// return
	if (key > 31 && (key < 48 || key > 57)) return false;
	}

function Trim(TRIM_VALUE)
	{
	if(TRIM_VALUE.length < 1)	{ return""; }
	TRIM_VALUE = RTrim(TRIM_VALUE);
	TRIM_VALUE = LTrim(TRIM_VALUE);
	if(TRIM_VALUE=="")
		{ return ""; }
	else
		{ return TRIM_VALUE; }
	} 

function RTrim(VALUE)
	{
	var w_space = String.fromCharCode(32);
	var v_length = VALUE.length;
	var strTemp = "";
	if(v_length < 0) { return ""; }
	var iTemp = v_length -1;

	while(iTemp > -1)
		{
		if(VALUE.charAt(iTemp) != w_space)
			{
			strTemp = VALUE.substring(0,iTemp +1);
			break;
			}
		iTemp = iTemp-1;
		} 
	return strTemp;
	}

function LTrim(VALUE)
	{
	var w_space = String.fromCharCode(32);
	if(v_length < 1) { return ""; }
	var v_length = VALUE.length;
	var strTemp = "";
	var iTemp = 0;

	while(iTemp < v_length)
		{
		if(VALUE.charAt(iTemp) != w_space)
			{
			strTemp = VALUE.substring(iTemp,v_length);
			break;
			}
		iTemp = iTemp + 1;
		} 
	return strTemp;
	}

function TextCheck(obj, description, length)
	{
	if (Trim(obj.value) == "" || obj.value == null)
		{ 
		highlight(obj, length);
		return(" - " + description + "\n"); 
		}
	return('');
	}

function SelectCheck(obj, description, length)
	{
	if (obj.value <= 0)
		{ 
		highlight(obj, length);
		return(" - " + description + "\n"); 
		}
	return('');
	}

// checks that at least one is checked
function RadioCheck(obj, description)
	{
	var multiple_choice = -1;
	for (q=0; q<obj.length; q++)
		{
		if (obj[q].checked==true) { multiple_choice = q; }
		}

	if (multiple_choice < 0)
		{ return(" - " + description + "\n"); }
	return('');
	}

// obj.type == 'textarea'
function TextareaCheck(obj, description, length, height)
	{
	if (Trim(obj.value) == "" || obj.value == null)
		{ 
		highlightTA(obj, length, height);
		return(" - " + description + "\n"); 
		}
	return('');
	}

function emailCheck(obj, description, length)
	{
	var cleanemail = Trim(obj.value);
	if ((cleanemail.indexOf('@') < 0) || ((cleanemail.charAt(cleanemail.length-4) != '.') && (cleanemail.charAt(cleanemail.length-3) != '.')))
		{ 
		highlight(obj, length);
		return(" - " + description + "\n"); 
		}
	return('');
	}

function turn(whichOne, state) 
	{
	if (state == 'on')
		{ document.getElementById(whichOne).style.display = ''; }
	else
		{ document.getElementById(whichOne).style.display = 'none'; }
	}

function highlight(object, length) 
	{ 
	if(object.style.setAttribute) // IE
		{ object.style.setAttribute("cssText", "background-color: #ffff33; width: "+length+"px;"); } 
	else { object.setAttribute("style", "background-color: #ffff33; width: "+length+"px;"); } 
	}

function highlightTA(object, length, height) 
	{ 
	if(object.style.setAttribute) // IE
		{ object.style.setAttribute("cssText", "background-color: #ffff33; width: "+length+"px; height:"+height+"px;"); } 
	else { object.setAttribute("style", "background-color: #ffff33; width: "+length+"px; height:"+height+"px;"); } 
	}

function clean(object, length) 
	{ 
	if(object.style.setAttribute) // IE
		{ object.style.setAttribute("cssText", "background-color: #ffffff; width: "+length+"px;"); } 
	else { object.setAttribute("style", "background-color: #ffffff; width: "+length+"px;"); } 
	}

function cleanTA(object, length, height) 
	{ 
	if(object.style.setAttribute) // IE
		{ object.style.setAttribute("cssText", "background-color: #ffffff; width: "+length+"px; height:"+height+"px;"); } 
	else { object.setAttribute("style", "background-color: #ffffff; width: "+length+"px; height:"+height+"px;"); } 
	}

// return the value of the radio button that is checked
// return an empty string if none are checked, or
// there are no radio buttons
function getCheckedValue(radioObj) 
	{
	if(!radioObj) return "";
	var radioLength = radioObj.length;

	if(radioLength == undefined)
		{
		if(radioObj.checked)
			{
			return radioObj.value;
			}
		else
			{
			return "";
			}
		}

	for (var i=0; i < radioLength; i++) 
		{
		if(radioObj[i].checked) { return radioObj[i].value; }
		}

	return "";
	}

// set the radio button with the given value as being checked
// do nothing if there are no radio buttons
// if the given value does not exist, all the radio buttons
// are reset to unchecked
function setCheckedValue(radioObj, newValue) 
	{
	if(!radioObj) return;
	var radioLength = radioObj.length;
	if(radioLength == undefined) 
		{
		radioObj.checked = (radioObj.value == newValue.toString());
		return;
		}
	for(var i = 0; i < radioLength; i++) 
		{
		radioObj[i].checked = false;
		if(radioObj[i].value == newValue.toString()) 
			{
			radioObj[i].checked = true;
			}
		}
	}

function alterCharsLeft(formobj,varname,limit)
	{
	var charsleft = limit - formobj.elements[varname].value.length;
	if (charsleft < 0) 
		{	
		formobj.elements[varname].value = formobj.elements[varname].value.substring(0, limit);
		charsleft = limit - formobj.elements[varname].value.length;
		}
	formobj.elements[varname+'_limit'].value = charsleft;
	}

function settozero(formField)
	{
	if (Trim(formField.value) == "" || formField.value == null) formField.value="0";
	}

function jumpBox(formObj, thisObj, nextName, limit)
	{
	if (limit == null) limit=4;
	if (thisObj.value.length >= limit)
		{
		formObj.elements[nextName].focus();
		}
	}


/*
conversion types: feet, yards, miles, sqr mile, sqr yard, sqr foot, acre, hectare
feet=>meters
yards=>meters
miles=>kilometers
sqr mile=>sqr km
sqr yard=>sqr meters
sqr foot=>sqr meters
acre=>sqr meters
hectare=>sqr meters

onkeyup="convertToMetric(this.value,'frontage','feet','imperial');"
*/
function convertToMetric(fromValue,toLocation,conversionType,direction)
	{
	direction = typeof(direction) != 'undefined' ? direction : 'metric'; // default value is 'metric'
	var convertdata = 0;
	var temp1 = '';
	var temp2 = '';
	var new_meters = 0;

	// expects 6'2" or 6' or 24"
	if (conversionType == 'feet')
		{
		//alert('feet');
		if (direction == 'metric')
			{
			for (var i=0; i<fromValue.length; i++) 
				{
				temp1 += fromValue.charAt(i);
				// get feet
				if (fromValue.charAt(i) == "\'")
					{
					temp1 = temp1.substr(0,temp1.length-1);
					convertdata += parseFloat(temp1 *12);
					temp1 = '';
					}
				// get inches
				if (fromValue.charAt(i) == "\"")
					{
					temp1 = temp1.substr(0,temp1.length-1);
					convertdata += parseFloat(temp1);
					}
				}

			new_meters = convertdata/39.37;	// convert data is in inches
			document.PAGEform.elements[toLocation].value = new_meters.toFixed(2);
			}
		else
			{
			temp1 = Math.round(fromValue * 39.37); // whole number
			var Feet = Math.floor(temp1/12); // whole number
			var Inches = temp1%12;
			temp2 = Feet+'\' '+Inches+'\"';
			document.PAGEform.elements[toLocation].value = temp2;
			}
		}

	if (conversionType == 'yards')
		{
		//alert('yards');
		if (direction == 'metric') { new_meters = fromValue*0.9144; }
		else { new_meters = fromValue/0.9144; }
		document.PAGEform.elements[toLocation].value = new_meters.toFixed(2);
		}

	if (conversionType == 'miles')
		{
		// alert('miles');
		if (direction == 'metric') { new_meters = fromValue*1.6093; }
		else {new_meters = fromValue/1.6093;	}
		document.PAGEform.elements[toLocation].value = new_meters.toFixed(2);
		}

	if (conversionType == 'sqr mile')
		{
		//alert('sqr mile');
		if (direction == 'metric') { new_meters = fromValue*2.59; }
		else {new_meters = fromValue/2.59; }
		document.PAGEform.elements[toLocation].value = new_meters.toFixed(2);
		}

	if (conversionType == 'sqr yard')
		{
		//alert('sqr yard');
		if (direction == 'metric') { new_meters = fromValue*0.8361; }
		else {new_meters = fromValue/0.8361; }
		document.PAGEform.elements[toLocation].value = new_meters.toFixed(2);
		}

	if (conversionType == 'sqr foot')
		{
		//alert('sqr foot');
		if (direction == 'metric') { new_meters = fromValue*0.0929; }
		else {new_meters = fromValue/0.0929; }
		document.PAGEform.elements[toLocation].value = new_meters.toFixed(2);
		}

	if (conversionType == 'acre')
		{
		//alert('acre');
		if (direction == 'metric') { new_meters = fromValue*4046.86; }
		else {new_meters = fromValue/4046.86; }
		document.PAGEform.elements[toLocation].value = new_meters.toFixed(2);
		}

	if (conversionType == 'hectare')
		{
		//alert('hectare');
		if (direction == 'metric') { new_meters = fromValue*10000; }
		else {new_meters = fromValue/10000; }
		document.PAGEform.elements[toLocation].value = new_meters.toFixed(2);
		}
	}
