<!--

// Called by search screen to make sure required fields are completed
function allowSendPropSearch(myform) {
	var Requireds = new initArray(new Required_Fields("prop_type",3,5,"Property Type"));
	var returnVal = true;
	var msg = "The following Required Fields must be valid before your listing can be submitted:\n\n"
	for (var i =0; i < Requireds.length; i++)
	{
			switch (Requireds[i].type)
			{
			case 0: //Text Field
				if (!len_check(myform.elements[Get_Fieldname(myform, Requireds[i].name)],Requireds[i].max))
					{
					returnVal = false;
					msg = msg + Requireds[i].alternate + "\n";
					}
			break;
			case 1: //Integer Text Field
				if (!int_val_check(myform.elements[Get_Fieldname(myform, Requireds[i].name)],Requireds[i].max))
					{
					returnVal = false;
					msg = msg + Requireds[i].alternate + "\n";
					}
			break;
			case 2: //Floating Point Text Field
				if (!float_val_check(myform.elements[Get_Fieldname(myform, Requireds[i].name)],Requireds[i].max))
					{
					returnVal = false;
					msg = msg + Requireds[i].alternate + "\n";
					}
			case 3: //Check Box
				if (!check_box(myform, Get_Fieldname(myform, Requireds[i].name),Requireds[i].max))
					{
					returnVal = false;
					msg = msg + Requireds[i].alternate + "\n";
					}
			}
	}
	if (returnVal)
	{
		var blnArea = false;
		for(i=myform.AREA.options.length - 1;i>0;i--)
		{
			if (myform.AREA.options[i].selected)
			{
				blnArea = true;
				break;
			}
		}
		if (blnArea)
			myform.AREA.options[0].selected = false;
		return true;
	}
	else
	{
		alert(msg);
		return false;
	}
}

function selectcheck(selector)
{
	if(selector.selectedIndex==0)
		for(count=1;count<selector.options.length;count++)
			selector.options[count].selected=false;
	else
		selector.options[0].selected=false;
}


function Get_Fieldname (myform, fieldname)
{
	for (var i =0; i < myform.elements.length; i++)
		{
		if (fieldname == myform.elements[i].name)
			return i;
		}
	return i;
} // end function


function datecheck(dateitem)
{
	var myDate = validDate(cleandate(dateitem));
	if (myDate == false)
	{
		alert("Invalid Date: " + dateitem.value + "\nPlease enter using this format: mm/dd/yyyy");
		dateitem.value = "";
		event.cancelbubble = true;
		dateitem.focus();
	}
}


function numbercheck(numberitem)
{
	var itemtext;
	itemtext=numberitem.value;
	if(itemtext=="")
		return true;
	if(!isaPosInt(itemtext))
	{
		alert("Enter the number without commas or decimal points.");
		numberitem.value="";
		event.cancelbubble = true;
		numberitem.focus();
		return false;
	}
	else
		return true;
}


function numbercheck(numberitem, theType)
{
	var itemtext;
	itemtext=numberitem.value;
	if(itemtext=="")
		return true;
	if(theType == 1)
	{
		if(!isaPosInt(itemtext))
		{
			alert("Enter the number without commas or decimal points.");
			numberitem.value="";
			event.cancelbubble = true;
			numberitem.focus();
			return false;
		}
		else
			return true;
	}
	else
	{
		if(!isaPosFloat(itemtext))
		{
			alert("You must enter a decimal or whole number in this box.");
			numberitem.value="";
			event.cancelbubble = true;
			numberitem.focus();
			return false;
		}
		else
			return true;
	}
}

function initArray ()
{
this.length = initArray.arguments.length;
for (var i =0; i < this.length; i++)
	{
	this[i] = initArray.arguments[i];
	}
} // end function


function cleandate(crtl)
{
	var strDate = crtl.value
	//alert('strDate.charAt(1)=' + strDate.charAt(1));
	if(strDate.charAt(0) == "0")
		{
		var newDate = '';
		for (var i=1; i <= strDate.length; i++)
			{
			newDate = newDate + strDate.charAt(i);
			//alert('newDate=' + newDate);
			}
		crtl.value = newDate;
		strDate = newDate;
		}
	//alert('strDate=' + strDate);
	return strDate;
}

function validDate(str) 
{
	var days;
	var seperators = new initArray(0,0);
	var count = 0;
	var month="";
	var day="";
	var year="";
	var theDate="";
	if (str == "" || str == null)
		return true;
	else
	{
		for (var i=0; i < str.length; i++)
		{
			if ((str.charAt(i) < "0" || str.charAt(i) > "9") && (str.charAt(i) != "-" && str.charAt(i) != "/"))
			{
				return false;
			}
			else if (str.charAt(i) == "-" || str.charAt(i) == "/")
			{
				seperators[count] = i;
				count=count+1;
				if (count == 3)
				{
					return false;
				}
			}
		}
		if (count != 2)
		{
			return false;
		}
		for (i=0; i < seperators[0]; i++)
			month = month + str.charAt(i)
		if (month == "08") // fix a strange javascript bug
			month="8";
		else if (month == "09")
			month="9";
		if (parseInt(month) < 1 || parseInt(month) > 12)
			return false;
		
		for (i=seperators[0]+1; i < seperators[1]; i++)
			day = day + str.charAt(i)
		if (day == "08") // fix a strange javascript bug
			day="8";
		else if (day == "09")
			day="9";
		
		for (i=seperators[1]+1; i < str.length; i++)
			year = year + str.charAt(i)
		if (year.length != 4)
			return false;
		if (theYear > 2050 || theYear < 1900)
			return false;
		
		var theMonth = parseInt(month) - 1;
		var theDay = parseInt(day);
		var theYear = parseInt(year);
		
		var myDate = new Date(theYear, theMonth, theDay);
				
		if( (myDate.getFullYear()%4) > 0 )
			days = new initArray(0, 3, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0); //subtract days from 31 for max day of month
		else
			days = new initArray(0, 2, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0); //subtract days from 31 for max day of month

		if (theDay < 1 || theDay > (31 - days[theMonth]))
			return false;
		
		return myDate;
	}
}

function ValidateTime(myElement)
{
	if(myElement.value!='')
		{
		if(myElement.value > 0 && myElement.value < 13 && !isNaN(myElement.value))
			myElement.value = myElement.value + ':00';
		else
			{
			var dtTime = String(myElement.value);
			if(dtTime.indexOf(':')<0)
				{
				if((myElement.value > 12 && myElement.value < 100) || myElement.value < 1 || myElement.value > 1259)
					{
					alert('Time values must be between 1 and 12.');
					myElement.value = '';
					myElement.focus();
					return;
					}
				if(myElement.value >= 100 && myElement.value <= 1259)
					{
					myElement.value = dtTime.substring(0,dtTime.length-2) + ':' + dtTime.substring(dtTime.length-2,dtTime.length);
					return;
					}
				if(isNaN(myElement.value))
					{
					alert('Time values must be numeric.');
					myElement.value = '';
					myElement.focus();
					return;
					}
				}
			else
				{
				if(dtTime.indexOf(':')>3 || dtTime.length>5)
					{
					alert('Please use correct time format.');
					myElement.value = '';
					myElement.focus();
					return;
					}
				else
					{
					var TimePart1 = dtTime.substring(0, dtTime.indexOf(':'));
					var TimePart2 = dtTime.substring(dtTime.indexOf(':')+1, dtTime.length);
					//alert('TimePart1:' + parseInt(TimePart1) + '\n' + 'TimePart2:' + parseInt(TimePart2));
					if(parseInt(TimePart1) < 1 || parseInt(TimePart1) > 12 || isNaN(parseInt(TimePart1)))
						{
						alert('Hour values must be numeric.');
						myElement.value = '';
						myElement.focus();
						return;
						}
					if(parseInt(TimePart2) < 0 || parseInt(TimePart2) > 59 || isNaN(parseInt(TimePart2)))
						{
						alert('Minute values must be numeric.');
						myElement.value = '';
						myElement.focus();
						return;
						}
					if(parseInt(TimePart2) == 0)
						{
						myElement.value = TimePart1 + ':00';
						}
					}
				}
			}
		}
}

function rangeChk(val1, val2)
{
	//if ((parseInt(val1) > parseInt(val2)) && parseInt(val2) != 0)
	if (parseInt(val1) > parseInt(val2))
	{
		return false;
	}
	return true;
}

function Required_Fields (name,type,max,alternate)
{
	this.name = name;
	this.type = type;
	this.max = max;
	this.alternate = alternate;
} // end function

function Required_Load_Fields (name,elemRef,type,max,alternate)
{
	this.name = name;
	this.elemRef = elemRef;
	this.type = type;
	this.max = max;
	this.alternate = alternate;
} // end function

function Feature_Load_Fields (name,elemRef,type,max,max_checked,alternate)
{
	this.name = name;
	this.elemRef = elemRef;
	this.type = type;
	this.max = max;
	this.max_checked = max_checked;
	this.alternate = alternate;
} // end function

function lupdate(myform, item,max,fieldname) {
   myform.Listorupdate.value=1;
   var returnVal1 = len_check(item,max,fieldname);
}

function lupdate2(myform, item,max,fieldname) {
   myform.Listorupdate.value=1;
   var returnVal1 = len_check2(item,max,fieldname);
}

function isaPosInt(str) 
{
   if (str == "" || str == null)
	return false;
   else
	{
	for (var i=0; i < str.length; i++)
		{
		if (str.charAt(i) < "0" || str.charAt(i) > "9")
			return false;
		}	
	return (parseInt(str) >= 0)
	}
   return true;
}

function isaPosFloat(str) 
{
   var onepoint = false;	
   if (str == "" || str == null)
	return false;
   else
	{
	for (var i=0; i < str.length; i++)
		{
		if ((str.charAt(i) < "0" || str.charAt(i) > "9") && str.charAt(i) != ".")
			return false;
		else if(str.charAt(i) == ".")
			{
			if (!onepoint) // check to see if we already detected a decimal point
			{				
				onepoint=true;
				var pointRef = i;
			}
			else
				return false;
			}
		}	
	if (onepoint) // check to see if we already detected a decimal point
	{
		if (str.substring(pointRef,str.length).length > 3) 
			str = str.substring(0,pointRef + 3) //make sure we only have 2 digits to the right of the decimal
	}
	return (parseFloat(str) >= 0)
	}
}

function int_val_check(item,max,fieldname) {
   var returnVal = false;
   if (!isaPosInt(item.value))
	{
	if (item.value.length < 1 )
		item.focus();
	}
   else if (parseInt(item.value) > max) 
	{
	item.value="";
	item.focus();
	}
   else
	returnVal = true;
   return returnVal;
}

function float_val_check(item,max,fieldname) {
   var returnVal = false;
   if (!isaPosFloat(item.value))
	{
	item.focus();
	if (item.value.length < 1 )
		{
		item.focus();
		}
	}
   else if (parseFloat(item.value) > max) 
	{
	item.value="";
	item.focus();
	}
   else
	returnVal = true;
   return returnVal;
}

function int_val_check2(item,max,fieldname) {
   var returnVal = false;
   if (!isaPosInt(item.value))
	{
	alert(fieldname + " is NOT a Valid Number");
	item.focus();
	}
   else if (parseInt(item.value) > max) 
	{
	alert(fieldname + " is TOO large! It Cannot exceed " + max + ".");
	//item.value="";
	item.focus();
	}
   else
	returnVal = true;
   return returnVal;
}


function float_val_check2(item,max,fieldname) {
   var returnVal = false;
   if (!isaPosFloat(item.value))
	{
	alert(fieldname + " is NOT a Valid Floating Point Number");
	item.focus();
	}
   else if (parseFloat(item.value) > max) 
	{
	alert(fieldname + " is TOO large! It Cannot exceed " + max + ".");
	item.value="";
	item.focus();
	}
   else
	returnVal = true;
   return returnVal;
}

function len_check(item,max,fieldname) {
   var returnVal = false;
   if (item.value.length < 1 )
	{
	item.focus();
	}
   else if (item.value.length > max )
	{
	//item.value="";
	item.focus();
	}
   else
	returnVal = true;
   return returnVal;
}

function len_check2(item,max,fieldname) {
   var returnVal = false;
   if (item.value.length > max )
	{
	alert(fieldname + " is TOO LONG! Cannot exceed " + max + " characters.");
	//item.value="";
	item.focus();
	}
   else
	returnVal = true;
   return returnVal;
}

function rad_check(item,max,fieldname) {
   var returnVal = false;
   return returnVal;
}

function check_box(myform, start, max) {
	var returnVal = false;
	for (var x=start;x<(start+max);x++)
	{
		if (myform.elements[x].checked)
			returnVal = true;
	}
   return returnVal;
}

function list_box(myform, ref) {
	var returnVal = false;
	try
	{
		var index = myform.elements[ref].selectedIndex;
		if (index < 0)
			index = 0;
		if(myform.elements[ref].options[index].value != "")
			return true;
	}
	catch(e)
	{
	}
	return returnVal;
}

function CompareRange(crtl1, crtl2)
{
	if (Trim(crtl1.value) != '' && Trim(crtl2.value) != '')
		if(!rangeChk(crtl1.value, crtl2.value))
			{
			alert('Maximum Value needs to be greater than Minimum Value.');
			event.bubblecancel = true;
			crtl2.focus();
			}
}

function compareDates(date1, date2, fieldname)
{
var returnVal = "valid";
var myDate1 = validDate(date1);
var myDate2 = validDate(date2);

if ((myDate1 && myDate2) && (myDate1 > myDate2))
	returnVal = fieldname;
else if ((!myDate1 && myDate2) || ((myDate1 && !myDate2) && date2 != ""))
	returnVal = fieldname;
return returnVal;
}

function specdatecheckSocal(item, todaysDate, months)
{
	var theMonthsDiff = 0;
	if(validDate(item.value))
	{
		theMonthsDiff = (parseInt(Date.parse(item.value)) - parseInt(Date.parse(todaysDate))) / (1000 * 60 * 60 * 24 * (366 / 12))
//		alert("theMonthsDiff:  "+theMonthsDiff);
		if (months < 0)
		{
//			alert(parseInt(Date.parse(item.value)) - parseInt(Date.parse(todaysDate)))
//			alert("theMonthsDiff:  "+theMonthsDiff);
//			if(theMonthsDiff > months && theMonthsDiff <= 0.02)
			if(theMonthsDiff > months && theMonthsDiff <= 0.0000001)
				return true;
			else
			{
				alert(" This " + item.name + " cannot be greater than " + (parseInt(todaysDate.getMonth()) + 1) + "/" + todaysDate.getDate() + "/" + todaysDate.getFullYear() + ".")
				return false;
			}
		}
		else if (months == 0)
		{
			if(theMonthsDiff >= -0.02 && Date.parse(item.value) <= new Date())
				return true;
			else
			{
				alert("This " + item.name + " cannot be less than " + (parseInt(todaysDate.getMonth()) + 1) + "/" + todaysDate.getDate() + "/" + todaysDate.getFullYear() + ".")
				return false;
			}
		}
		else
		{
			if(theMonthsDiff >= -0.02 && theMonthsDiff <= months)
				return true;
			else
			{
				alert("This " + item.name + " cannot be less than " + (parseInt(todaysDate.getMonth()) + 1) + "/" + todaysDate.getDate() + "/" + todaysDate.getFullYear() + ".")
				return false;
			}
		}
	}
	else
		alert("Invalid Date=" + item.value + "\nPlease enter using this format: mm/dd/yyyy");
		item.value = "";
		item.focus();
		item.select();
	return false;
}

function specdatecheck(item, todaysDate, months)
{
	var theMonthsDiff = 0;
	if(validDate(item.value))
	{


		theMonthsDiff = (parseInt(Date.parse(item.value)) - parseInt(Date.parse(todaysDate))) / (1000 * 60 * 60 * 24 * (3666 / 1))
		if (months < 0)
		{
			if(theMonthsDiff > months && theMonthsDiff <= 0.02)
				return true;
			else
			{
				alert("This " + item.name + " cannot be greater than " + (parseInt(todaysDate.getMonth()) + 1) + "/" + todaysDate.getDate() + "/" + todaysDate.getYear() + " or less than " + months + " months in the past. Please correct.")
				return false;
			}
		}
		else if (months == 0)
		{
			if(theMonthsDiff >= -0.02 && Date.parse(item.value) <= new Date())
				return true;
			else
			{
				alert("This " + item.name + " cannot be less than " + (parseInt(todaysDate.getMonth()) + 1) + "/" + todaysDate.getDate() + "/" + todaysDate.getYear() + " or greater than " + months + " months in the future. Please correct.")
				return false;
			}
		}
		else
		{
			if(theMonthsDiff >= -0.02 && theMonthsDiff <= months)
				return true;
			else
			{
				alert("This " + item.name + " cannot be less than " + (parseInt(todaysDate.getMonth()) + 1) + "/" + todaysDate.getDate() + "/" + todaysDate.getYear() + " or greater than " + months + " months in the future. Please correct.")
				return false;
			}
		}
	}
	else
		alert("Invalid Date=" + item.value + "\nPlease enter using this format: mm/dd/yyyy");
		item.value = "";
		item.focus();
		item.select();
	return false;
}

function specdatecheckdays(item, todaysDate, days)
{
	var theDaysDiff = 0;
	if(validDate(item.value))
	{


		//alert(item + ':' + parseInt(Date.parse(item.value)));
		//alert(todaysDate + ':' + parseInt(Date.parse(todaysDate)));
		//alert((parseInt(Date.parse(item.value)) - parseInt(Date.parse(todaysDate))));
		theDaysDiff = (parseInt(Date.parse(item.value)) - parseInt(Date.parse(todaysDate))) / 100000
		theDaysDiff = theDaysDiff/864;
		//alert('theDaysDiff=' + theDaysDiff);
		if (days < 0)
		{
			if(theDaysDiff >= days && theDaysDiff <= 0.02)
				return true;
			else
			{
				alert("This " + item.name + " cannot be greater than today's date or less than " + days + " days in the past. Please correct.")
				return false;
			}
		}
		else if (days == 0)
		{
			if(theDaysDiff >= -0.02 && Date.parse(item.value) <= new Date())
				return true;
			else
			{
				alert("This " + item.name + " cannot be less than today's date or greater than " + days + " days in the future. Please correct.")
				return false;
			}
		}
		else
		{
			if(theDaysDiff >= -0.02 && theDaysDiff <= days)
				return true;
			else
			{
				alert("This " + item.name + " cannot be less than today's date or greater than " + days + " days in the future. Please correct.")
				return false;
			}
		}
	}
	else
		alert("Invalid Date=" + item.value + "\nPlease enter using this format: mm/dd/yyyy");
		item.value = "";
		item.focus();
		item.select();
	return false;
}

function ClearForm(myform)
{
	for(i=0;i<myform.elements.length;i++)
	{
		if(myform.elements[i].type == "text")
			myform.elements[i].value = "";
		// following were added by Rob Overman on 6.20.2000
		// these allow the clearing of more than just text inputs
		if(myform.elements[i].type == "checkbox")
			myform.elements[i].checked = false;
		if(myform.elements[i].type == "checkbox" && myform.elements[i].value == 'All' && myform.elements[i].name == 'STATUS')
			myform.elements[i].checked = true;
		if(myform.elements[i].type == "select-one")
			myform.elements[i].selectedIndex = 0;
		if(myform.elements[i].type == "select-multiple")
			myform.elements[i].selectedIndex = 0;
	}
}

//NORIS wants the Property Category List to be set to "Residential" when form is cleared.
// RJO - 04/04/2001
function ClearForm2(myform)
{
	for(i=0;i<myform.elements.length;i++)
	{
		if(myform.elements[i].type == "text")
			myform.elements[i].value = "";
		// following were added by Rob Overman on 6.20.2000
		// these allow the clearing of more than just text inputs
		if(myform.elements[i].type == "checkbox")
			myform.elements[i].checked = false;
		if(myform.elements[i].type == "checkbox" && myform.elements[i].value == 'All' && myform.elements[i].name == 'STATUS')
			myform.elements[i].checked = true;
		if(myform.elements[i].type == "select-one" && myform.elements[i].name == 'PROP_TYPE')
			myform.elements[i].selectedIndex = 1;
		else
		{
			if(myform.elements[i].type == "select-one")
				myform.elements[i].selectedIndex = 0;
		}
		if(myform.elements[i].type == "select-multiple")
			myform.elements[i].selectedIndex = 0;
	}
}

function CheckLength(myform, item, maxLength, msg)
{
	if(item.value.length > maxLength)
	{
		alert("Cannot exceed " + maxLength + " characters for " + msg + ".\nYou have entered " + item.value.length + " characters. Please adjust your text.");
		item.focus();
		return false
	}
return true
}

function CheckEmail(item)
{
	if (item.length > 0)
	{
	i=item.indexOf("@");
	j=item.indexOf(".",i);
	k=item.indexOf(",");
	kk=item.indexOf(" ");
	jj=item.lastIndexOf(".") + 1;
	len=item.length;

		if ((i > 0) && (j > (i + 1)) && (k == -1) && (kk == -1) && ((len - jj) >= 2) && ((len - jj) <= 3)) 
			return true;
		else
			return false;
	}
	else
		return false;
}

function inArray(theArray, theString)
{
	if(theArray == null)
		return false;
	for(var i=0;i<theArray.length;i++)
	{
		if(Trim(theArray[i]) == Trim(theString))
			return true;
	}
	return false;
}

function WhereInArray(theArray, theString)
{
	if(theArray == null)
		return -1;
	for(var i=0;i<theArray.length;i++)
	{
		//alert(Trim(theArray[i]) + ' : ' + Trim(theString));
		if(Trim(theArray[i]) == Trim(theString))
			return i;
	}
	return -1;
}

function RTrim(strToTrim)
{
	var intRef = 0;
	for(var i=strToTrim.length - 1;i>=0;i--)
	{
		if(strToTrim.charAt(i) == " ")
			intRef = i;
		else
			break;
	}
	if(intRef > 0)
		return strToTrim.substring(0, intRef - 1)
	else
		return strToTrim;
}

function LTrim(strToTrim)
{
	var intRef = 10000;
	for(var i=0;i<strToTrim.length;i++)
	{
		if(strToTrim.charAt(i) == " ")
			intRef = i;
		else
			break;
	}
	if(intRef < 10000)
		return strToTrim.substring(intRef + 1, strToTrim.length)
	else
		return strToTrim;
}

function Trim(strToTrim)
{
	return RTrim(LTrim(strToTrim));
}
function CheckLength2(item, maxLength)//for onkeydown in text box to protect them from themselves
{
	window.status = (item.value.length + 1) + " characters used out of " + maxLength + " characters available for field:  " + item.name
	if(item.value.length > maxLength)
	{
		item.value = item.value.slice(0,maxLength-1)
		alert("You have reached the maximum length of " + maxLength + " characters.");
		item.focus();
		return false
	}
return true
}
function PXLPrompt(txtprompt, txtvalue,formfield){
	var newpromptwindow = window.showModalDialog("http://"+document.domain + "/promptreplace.asp?txtprompt="+ txtprompt + '&txtvalue='+txtvalue+ '&formfield='+formfield,window,"toolbar:0;location:0;directories:0;status:0;menubar:0;scroll:0;resizable:0;dialogWidth:600px;dialogHeight:200px")
	for (var i =0; i < document.promptfields.elements.length; i++)
		{
		if (formfield == document.promptfields.elements[i].name)
			return document.promptfields.elements[i].value;
		}
//		if (formfield == "area"){
//			return document.promptfields.area.value;
//		}
//		if (formfield == "l_ag1_id"){
//			return document.promptfields.l_ag1_id.value;
//		}
//		if (formfield == "l_off_id"){
//			return document.promptfields.l_off_id.value;
//		}
} 


//function PXLPrompt(txtprompt, txtvalue){
//	var formEle = null; 
//	formEle = document.createElement("<form name='promptreplace'>"); 
//	document.appendChild(formEle); 
//	var dummyEle = null 
//	dummyEle = document.createElement("<input name='newvalue'>"); 
//	dummyEle.type = "hidden"; 
//	dummyEle.name = "newvalue"; 
//	//dummyEle.value = "TEST";
//	formEle.appendChild(dummyEle); 
//	var newpromptwindow = window.showModalDialog("http://"+document.domain + "/promptreplace.asp?txtprompt="+ txtprompt + '&txtvalue='+txtvalue,window,"toolbar:0;location:0;directories:0;status:0;menubar:0;scroll:0;resizable:0;dialogWidth:600px;dialogHeight:200px")
////	if (document.promptreplace.newvalue.value > ""){
//		return document.promptreplace.newvalue.value;
////	}else{
////		history.go(0)
////	}
//} 
//in noris we prompt more than once, this is cheezy, but it's easy.
function PXLPrompt2(txtprompt, txtvalue){
	var formEle = null; 
	formEle = document.createElement("<form name='promptreplace2'>"); 
	document.appendChild(formEle); 
	var dummyEle = null 
	dummyEle = document.createElement("<input name='newvalue2'>"); 
	dummyEle.type = "hidden"; 
	dummyEle.name = "newvalue2"; 
	//dummyEle.value = "TEST";
	formEle.appendChild(dummyEle); 
	var newpromptwindow = window.showModalDialog("http://"+document.domain + "/promptreplace2.asp?txtprompt="+ txtprompt + '&txtvalue='+txtvalue,window,"toolbar:0;location:0;directories:0;status:0;menubar:0;scroll:0;resizable:0;dialogWidth:600px;dialogHeight:200px")
//	alert (document.promptreplace2.newvalue2.value);
//	return document.promptreplace2.newvalue2.value;
//	if (document.promptreplace2.newvalue2.value > ""){
		return document.promptreplace2.newvalue2.value;
//	}else{
//		history.go(0)
//	}

} 
//in noris we prompt more than once, this is cheezy, but it's easy.
function PXLPrompt3(txtprompt, txtvalue){
	var formEle = null; 
	formEle = document.createElement("<form name='promptreplace3'>"); 
	document.appendChild(formEle); 
	var dummyEle = null 
	dummyEle = document.createElement("<input name='newvalue3'>"); 
	dummyEle.type = "hidden"; 
	dummyEle.name = "newvalue3"; 
	//dummyEle.value = "TEST";
	formEle.appendChild(dummyEle); 
	var newpromptwindow = window.showModalDialog("http://"+document.domain + "/promptreplace3.asp?txtprompt="+ txtprompt + '&txtvalue='+txtvalue,window,"toolbar:0;location:0;directories:0;status:0;menubar:0;scroll:0;resizable:0;dialogWidth:600px;dialogHeight:200px")
//	alert (document.promptreplace2.newvalue2.value);
//	return document.promptreplace3.newvalue3.value;
//	if (document.promptreplace3.newvalue3.value > ""){
		return document.promptreplace3.newvalue3.value;
//	}else{
//		history.go(0)
//	}

} 
function NoHtml(what){
	var checkit = what.value.toUpperCase();
	var nono = false
	if (checkit.indexOf("<FONT") > -1 || checkit.indexOf("<B>") > -1 || checkit.indexOf("/FONT") > -1|| checkit.indexOf("</B") > -1||checkit.indexOf("HREF") > -1 ||checkit.indexOf("<A")> -1||checkit.indexOf("<I")> -1){
		nono = true
	}
//uncomment lines below to actually stop them from using html
	if (nono){
		alert ("You may not use HTML formatting in listings")
		what.focus()
		what.select()
	}else{
		findnasties2(what);
	}
}
function validYear(val)
{
	if(isaPosInt(val))
		if(parseInt(val) > 1900 && parseInt(val) < 2100)
			return true;
	return false;
}
//general mail
function CheckLength2(item, maxLength)//for onkeydown in text box to protect them from themselves
{
	window.status = (item.value.length + 1) + " characters used out of " + maxLength + " characters available for field:  " + item.name
	if(item.value.length > maxLength)
	{
		item.value = item.value.slice(0,maxLength-1)
		alert("You have reached the maximum length of " + maxLength + " characters.");
		item.focus();
		return false
	}
return true
}
function findnasties(instuff){
	var checkit = instuff.value;
	var badstuff = false;
	for (var i=0; i <= checkit.length; i++){
		if (badstuff == false){
		if (checkit.charCodeAt(i) < 032 || checkit.charCodeAt(i) > 122){
			badstuff = true
			if (checkit.charCodeAt(i) == 10 ||checkit.charCodeAt(i) == 13||checkit.charCodeAt(i) == 09){
			alert ('You have entered a carriage return or tab character, this is an invalid character for this field. Please change it.');
			}else{
			alert ('You have entered "'+checkit.charAt(i) + '" this is an invalid character for this field. Please change it.');
			}
	}	}}
	if (badstuff){
		instuff.focus();
	}
}
function findnasties2(instuff){
	var checkit = instuff.value;
	var badstuff = false;
	for (var i=0; i <= checkit.length; i++){
		//if (badstuff == false){
		//alert(checkit.charCodeAt(i));
		if (checkit.charCodeAt(i) < 032 || checkit.charCodeAt(i) > 122 || checkit.charCodeAt(i) == 34){
			if (checkit.charCodeAt(i) != 10 &&checkit.charCodeAt(i) != 13){
				badstuff = true
				//alert(checkit.charCodeAt(i) + " " + i+ " " +checkit.charAt(i));
				switch (checkit.charCodeAt(i)){
				case 8211: //dash
					checkit = checkit.replace(checkit.charAt(i),"-");
				break;
				case 189: //1/2	
					checkit = checkit.replace(checkit.charAt(i),"1/2");
				break;
				case 8216: //left '
					checkit = checkit.replace(checkit.charAt(i), "'");
				break;
				case 8217: //right '
					checkit = checkit.replace(checkit.charAt(i),"'");
				break;
				case 8220: //left "
					checkit = checkit.replace(checkit.charAt(i),"'");
				break;
				case 8221: //right "
					checkit = checkit.replace(checkit.charAt(i),"'");
				break;
				case 224: 
				case 225:
				case 226:
				case 227:
				case 229:
				case 230:
					checkit = checkit.replace(checkit.charAt(i),"a");
				break;
				case 232:
				case 233:
				case 234:
				case 235:
					checkit = checkit.replace(checkit.charAt(i),"e");
				break;
				case 241:
					checkit = checkit.replace(checkit.charAt(i),"n");
				break;

				default:
					checkit = checkit.replace(checkit.charAt(i), " ")
	}	}	}	}
	if (badstuff){
		instuff.value = checkit
		alert ("Invalid characters have been found.   They have been replaced with valid characters where possible.\nThey have been replaced with a space where a suitable replacement could not be found.\nPlease review these changes before saving")
		instuff.focus();
	}
}
function findnasties3(instuff){//only difference is this returns a true-false rather than focusing on the field
	var checkit = instuff.value;
	var badstuff = false;
	for (var i=0; i <= checkit.length; i++){
		//if (badstuff == false){
		//alert(checkit.charCodeAt(i));
		if (checkit.charCodeAt(i) < 032 || checkit.charCodeAt(i) > 122 || checkit.charCodeAt(i) == 34){
			if (checkit.charCodeAt(i) != 10 &&checkit.charCodeAt(i) != 13){
				badstuff = true
				//alert (checkit.charCodeAt(i) + " " + checkit.charAt(i))
				switch (checkit.charCodeAt(i)){
				case 8211: //dash
					checkit = checkit.replace(checkit.charAt(i),"-");
				break;
				case 189: //1/2	
					checkit = checkit.replace(checkit.charAt(i),"1/2");
				break;
				case 8216: //left '
					checkit = checkit.replace(checkit.charAt(i), "'");
				break;
				case 8217: //right '
					checkit = checkit.replace(checkit.charAt(i),"'");
				break;
				case 8220: //left "
					checkit = checkit.replace(checkit.charAt(i),"'");
				break;
				case 8221: //right "
					checkit = checkit.replace(checkit.charAt(i),"'");
				break;
				case 224: 
				case 225:
				case 226:
				case 227:
				case 229:
				case 230:
					checkit = checkit.replace(checkit.charAt(i),"a");
				break;
				case 232:
				case 233:
				case 234:
				case 235:
					checkit = checkit.replace(checkit.charAt(i),"e");
				break;
				case 241:
					checkit = checkit.replace(checkit.charAt(i),"n");
				break;
				
				default:
					checkit = checkit.replace(checkit.charAt(i), " ")
	}	}	}	}
	if (badstuff){
		instuff.value = checkit
		alert ("Invalid characters have been found:   They have been replaced with valid characters where possible.\nThey have been replaced with a space where a suitable replacement could not be found.\nPlease review these changes before saving.")
	}
	return badstuff;
}
function findnasties4(instuff){//returns a true-false is not based on a form field
	var checkit = instuff;
	var badstuff = false;
	for (var i=0; i <= checkit.length; i++){
		//if (badstuff == false){
		//alert(checkit.charCodeAt(i));
		if (checkit.charCodeAt(i) < 032 || checkit.charCodeAt(i) > 122 || checkit.charCodeAt(i) == 34){
			if (checkit.charCodeAt(i) != 10 &&checkit.charCodeAt(i) != 13){
				badstuff = true
				switch (checkit.charCodeAt(i)){
				case 8211: //dash
					checkit = checkit.replace(checkit.charAt(i),"-");
				break;
				case 189: //1/2	
					checkit = checkit.replace(checkit.charAt(i),"1/2");
				break;
				case 8216: //left '
					checkit = checkit.replace(checkit.charAt(i), "'");
				break;
				case 8217: //right '
					checkit = checkit.replace(checkit.charAt(i),"'");
				break;
				case 8220: //left "
					checkit = checkit.replace(checkit.charAt(i),"'");
				break;
				case 8221: //right "
					checkit = checkit.replace(checkit.charAt(i),"'");
				break;
				case 224: 
				case 225:
				case 226:
				case 227:
				case 229:
				case 230:
					checkit = checkit.replace(checkit.charAt(i),"a");
				break;
				case 232:
				case 233:
				case 234:
				case 235:
					checkit = checkit.replace(checkit.charAt(i),"e");
				break;
				case 241:
					checkit = checkit.replace(checkit.charAt(i),"n");
				break;

				default:
					checkit = checkit.replace(checkit.charAt(i), " ")
	}	}	}	}
	if (badstuff){
		instuff.value = checkit
		alert ("Invalid characters have been found.   They have been replaced with valid characters where possible.\nThey have been replaced with a space where a suitable replacement could not be found.\nPlease review these changes before saving.")
	}
	return badstuff;
}
// added Re/X date functions.
function Editdate(field){
	var inputStr = field.value;
//	alert(field.type)
	if (inputStr != ""){
		while (inputStr.indexOf("-") != -1){
			inputStr = inputStr.replace("-","/")
		}
		var delim1 = inputStr.indexOf("/");
		var delim2 = inputStr.lastIndexOf("/");
	if (delim1 != -1 && delim1 == delim2){
		alert("The date entered is not in an acceptable format. \n\n" + "You can enter dates in the following formats:\n" + "mmddyyyy, mm/dd/yyyy, or mm-dd-yyyy.");
		field.value = "";
		if (field.type != "hidden")
		field.focus();
		return false;
	}
	if (delim1 != -1){
		var mm = parseInt(inputStr.substring(0,delim1),10);
		var dd = parseInt(inputStr.substring(delim1 + 1,delim2),10);
		var yyyy = parseInt(inputStr.substring(delim2 + 1, inputStr.length),10);
	}else{
		var mm = parseInt(inputStr.substring(0,2),10);
		var dd = parseInt(inputStr.substring(2,4),10);
		var yyyy = parseInt(inputStr.substring(4,inputStr.length),10);
	}
	if (isNaN(mm) || isNaN(dd) || isNaN(yyyy)){
		alert("The date entered is not in an acceptable format. \n\n" + "You can enter dates in the following formats:\n" + "mmddyyyy, mm/dd/yyyy, or mm-dd-yyyy.");
		field.value = "";
		if (field.type != "hidden")
		field.focus();
		return false;
	}
	if (mm < 1 || mm > 12){
		alert("Months must be between 01 and 12");
		field.value = "";
		if (field.type != "hidden")
		field.focus();
		return false;
	}
	if (dd < 1 || dd > 31){
		alert ("Days must be a min. of 01 and a max. of 31 \n" + "(depending on month and year).");
		field.value = "";
		if (field.type != "hidden")
		field.focus();
		return false;
	}
	var today = new Date()
	if (yyyy < 100){
		var fourdy = 0;
		var thisYear = today.getFullYear();
		fourdy = thisYear + 50 - yyyy;
		century = parseInt(fourdy / 100);
		fourdy = (century * 100) + yyyy;
		yyyy = fourdy;
	}else{
		if (yyyy > 9999){
			alert ("Year must be in 'yy' or 'yyyy' format.");
			field.value = "";
			if (field.type != "hidden")
			field.focus();
			return false;
		}else{
			if (yyyy > 100 && yyyy < 1000){
				alert ("Year must be in 'yy' or 'yyyy' format.");
				field.value = "";
				if (field.type != "hidden")
				field.focus();
				return false;
	}}}
	if (yyyy < 1753){
		alert ("Year must be after 1753.");
//				field.value = "";
				if (field.type != "hidden")
				field.focus();
				return false;
	}
	if (!checkMonthLength(mm,dd)){
		field.value = "";
		if (field.type != "hidden")
		field.focus();
		return false;
	}
	if (mm == 2){
		if (!checkLeapMonth(mm,dd,yyyy)){
			field.value = "";
			if (field.type != "hidden")
			field.focus();
			return false;
	}}	
	if (mm.length < 2){
		mm = "0" + mm}
	if (dd.length < 2){ dd = "0" + dd}
	field.value = mm + "/" + dd + "/" + yyyy
	if (yyyy > 2078){
			alert ("Year must be before 2079.");
//			field.value = "";
			if(field.type != "hidden")
			field.focus();
			return false;
	}
	return true;
}}
function checkMonthLength(mm,dd){
	var months = new Array("","January","February","March","April","May","June","July","August","September","October","November","December")
	if ((mm == 4 || mm == 6 || mm == 9 || mm == 11) && dd > 30){
		alert(months[mm] + " has only 30 days.")
		return false
	}else if (dd > 31 && mm != 2){
		alert(months[mm] + " has only 31 days.")
		return false
	}
	return true
}
function checkLeapMonth(mm,dd,yyyy){
	if (yyyy % 4 > 0 && dd >28){
		alert("February of " + yyyy + " has only 28 days.")
		return false
	}else if ((yyyy % 100 == 0) && (yyyy % 400 > 0) && dd > 28){
		alert("February of " + yyyy + " has only 28 days.")
		return false
	}else if (dd > 29){	
		alert("February of " + yyyy + " has only 29 days.")
		return false
	}
	return true
}
function replaceReturns(instuff){
	var checkit = instuff.value;
	for (var i=0; i <= checkit.length; i++){
		if (checkit.charCodeAt(i) == 10){
			checkit = checkit.replace(checkit.charAt(i),"");
		}
		 if(checkit.charCodeAt(i) == 13)
			checkit = checkit.replace(checkit.charAt(i),"<br>");
	}
	instuff.value = checkit
}
//-->