	//-- below goes .js
		function submitPage(strAction, formName)
		{

			if (formName == 'homeFinder')
			{
				if (strAction == 'stateChange')
				{
					
					document.HomeFinder.takeAction.value = 'stateChange';
					setCookieValue('sStateId', document.HomeFinder.countySearch_state.options[document.HomeFinder.countySearch_state.selectedIndex].value);
					setCookieValue('sMinPrice', document.HomeFinder.minprice.value);
					setCookieValue('sMaxPrice', document.HomeFinder.maxprice.value);

				}
		
				if (strAction == 'countyChange')
				{
					document.HomeFinder.takeAction.value = 'countyChange';

					setCookieValue('sMinPrice', document.HomeFinder.minprice.value);
					setCookieValue('sMaxPrice', document.HomeFinder.maxprice.value);
					setCookieValue('sCountyId', document.HomeFinder.countySearch_county.options[document.HomeFinder.countySearch_county.selectedIndex].value);
				}
	
				document.HomeFinder.submit();
			}

			if (formName == 'extendedSearch')
			{
				if (strAction == 'stateChange')
				{
					
					document.extendedSearch.takeAction.value = 'stateChange';
					setCookieValue('sStateId', document.extendedSearch.countySearch_state.options[document.extendedSearch.countySearch_state.selectedIndex].value);
					setCookieValue('sMinPrice', document.extendedSearch.minprice.value);
					setCookieValue('sMaxPrice', document.extendedSearch.maxprice.value);

				}
		
				if (strAction == 'countyChange')
				{
					document.extendedSearch.takeAction.value = 'countyChange';

					setCookieValue('sMinPrice', document.extendedSearch.minprice.value);
					setCookieValue('sMaxPrice', document.extendedSearch.maxprice.value);
					setCookieValue('sCountyId', document.extendedSearch.countySearch_county.options[document.extendedSearch.countySearch_county.selectedIndex].value);
				}
	
				document.extendedSearch.submit();
			}

			
			if (formName == 'radsub')
			{
				if (strAction == 'stateChange')
				{
					document.radsub.takeAction.value = 'stateChange';
					setCookieValue('sRadius', document.radsub.miles.options[document.radsub.miles.selectedIndex].value)
					setCookieValue('sStreet', document.radsub.streetaddress.value)
					setCookieValue('sCityName', document.radsub.addresscity.value)					
					setCookieValue('sStateId', document.radsub.addressState.options[document.radsub.addressState.selectedIndex].value);
				}

				document.radsub.submit();
			}


			if (formName == 'exactsub')
			{
				if (strAction == 'stateChange')
				{
				
					document.exactsub.takeAction.value = 'stateChange';
					setCookieValue('sStreet', document.exactsub.exactaddress.value)
					setCookieValue('sCityName', document.exactsub.exactcity.value)
					setCookieValue('sStateId', document.exactsub.exactstate.options[document.exactsub.exactstate.selectedIndex].value);
				}
				
				document.exactsub.submit();
			}

						
		}	
	
		function forceOpenLevel(level)
		{
			var pageTarget
			
			pageTarget = 'level_pop.asp#Level' + level

			window.open(pageTarget, 'cc', 'scrollbars=yes,HEIGHT=401,WIDTH=466')
		
		}
		
		
		function openLevelWin() 
		{
			if (getCookieValue('level_displayed') != 'yes')
			{
				//open the window to be viewed.
				window.open('level_pop.asp', 'cc', 'scrollbars=yes,HEIGHT=401,WIDTH=466')
				setCookieValue('level_displayed', 'yes')
			}
			else
			{
				return false;
			}

		}
		
		
		function cleanCookiesExtendedCrit()
		{
			setCookieValue('sMinPrice', "");
			setCookieValue('sMaxPrice', "");
			setCookieValue('sMinBeds', "");
			setCookieValue('sMinBaths', "");
		
		}
				
		
		function runCountySearch(fromQuick)
		{
			if(fromQuick == 1)
			{
				cleanCookiesExtendedCrit();

				setCookieValue('sMinPrice', document.HomeFinder.minprice.value);
				setCookieValue('sMaxPrice', document.HomeFinder.maxprice.value);
			}

			
			if(document.HF.displayChoice.value == 'yes')
			{
				if(document.HF.searchEhomeOnly[1].checked == true)
				{
					document.HomeFinder.searchOnly.value = "true"
				}
				else
				{
					document.HomeFinder.searchOnly.value = "false"
				}
			}


			setCookieValue('sStateId', document.HomeFinder.countySearch_state.options[document.HomeFinder.countySearch_state.selectedIndex].value);
			setCookieValue('sCountyId', document.HomeFinder.countySearch_county.options[document.HomeFinder.countySearch_county.selectedIndex].value);
			setCookieValue('searchType', 1)

			
			document.HomeFinder.takeAction.value = 'submitArea';
			
			document.HomeFinder.submit();
		}



		function runCountySearch2(fromQuick)
		{
			if(fromQuick == 1)
			{
				cleanCookiesExtendedCrit();

				setCookieValue('sMinPrice', document.extendedSearch.minprice.value);
				setCookieValue('sMaxPrice', document.extendedSearch.maxprice.value);
			}

			
			if(document.HF.displayChoice.value == 'yes')
			{
				if(document.HF.searchEhomeOnly[1].checked == true)
				{
					document.extendedSearch.searchOnly.value = "true"
				}
				else
				{
					document.extendedSearch.searchOnly.value = "false"
				}
			}


			
			setCookieValue('sStateId', document.extendedSearch.countySearch_state.options[document.extendedSearch.countySearch_state.selectedIndex].value);
			setCookieValue('sCountyId', document.extendedSearch.countySearch_county.options[document.extendedSearch.countySearch_county.selectedIndex].value);
			setCookieValue('searchType', 1)

			
			document.extendedSearch.takeAction.value = 'submitArea';
			
			document.extendedSearch.submit();
		}
		
		
		
		
		function runRadiusSearch(fromQuick)
		{
			if(fromQuick == 1)
			{
				cleanCookiesExtendedCrit();
				
			}

			if(document.HF.displayChoice.value == 'yes')
			{
				if(document.HF.searchEhomeOnly[1].checked == true)
				{
					document.radsub.searchOnly.value = "true"
				}
				else
				{
					document.radsub.searchOnly.value = "false"
				}
			}
				
			//store cookie values
			setCookieValue('sRadius', document.radsub.miles.options[document.radsub.miles.selectedIndex].value)
			setCookieValue('sStreet', document.radsub.streetaddress.value)
			setCookieValue('sCityName', document.radsub.addresscity.value)

			
			setCookieValue('sStateId', document.radsub.addressState.options[document.radsub.addressState.selectedIndex].value)
			setCookieValue('searchType', 2)

			document.radsub.takeAction.value = 'submit'
			document.radsub.submit();

		}
		
		
		
		
		function runExactSearch(fromQuick)
		{
			if(fromQuick == 1)
			{
				cleanCookiesExtendedCrit();
				
			}
			
			if(document.HF.displayChoice.value == 'yes')
			{
				if(document.HF.searchEhomeOnly[1].checked == true)
				{
					document.exactsub.searchOnly.value = "true"
				}
				else
				{
					document.exactsub.searchOnly.value = "false"
				}					
			}	
			setCookieValue('sStreet', document.exactsub.exactaddress.value)
			setCookieValue('sCityName', document.exactsub.exactcity.value)
			setCookieValue('sStateId', document.exactsub.exactstate.options[document.exactsub.exactstate.selectedIndex].value);
			setCookieValue('searchType', 3)
			
			document.exactsub.takeAction.value = 'submit'
			document.exactsub.submit();
		}


		function runMlsNumberSearch(fromQuick)
		{
			if(fromQuick == 1)
			{
				cleanCookiesExtendedCrit();

			}

			if(document.HF.displayChoice.value == 'yes')
			{
				if(document.HF.searchEhomeOnly[1].checked == true)
				{
					document.mlssub.searchOnly.value = "true"
				}
				else
				{
					document.mlssub.searchOnly.value = "false"
				}				
			}
							
			setCookieValue('sMlsNumber', document.mlssub.mlsnumber.value)
			setCookieValue('searchType', 4)
			
			document.mlssub.takeAction.value = 'submit'
			document.mlssub.submit();
			
		}


		function runZipCodeSearch(fromQuick)
		{
			if(fromQuick == 1)
			{
				cleanCookiesExtendedCrit();
			}

			if(document.HF.displayChoice.value == 'yes')
			{
				if(document.HF.searchEhomeOnly[1].checked == true)
				{
					document.zipsub.searchOnly.value = "true"
				}
				else
				{
					document.zipsub.searchOnly.value = "false"
				}				
			}			

			setCookieValue('sZip', document.zipsub.zip.value)
			setCookieValue('searchType', 5)
			
			document.zipsub.takeAction.value = 'submit'
			document.zipsub.submit();
		}




		function setCookieValue(name, value)
		{
			var search_cookie;
			var today_date = new Date();
			var exp_date = new Date(today_date.getYear() + 1, today_date.getMonth(), today_date.getDate());

			//create and drop the cookie - set to expire in 1 year.
			search_cookie = name + '=' + escape(value) + ';expires=' + exp_date.toGMTString();
			document.cookie = search_cookie
		
		}

		
		function getCookieValue(name)
		{
			  // Declare variables.
			  var firstChar,lastChar;

			  // Get the entire cookie string.
			  var theBigCookie = document.cookie;


			  // Grab just this cookie from theBigCookie string.

			  // Find the start of the 'name'.
			  firstChar = theBigCookie.indexOf(name);


			  // If it exists,
				if(firstChar != -1)
				{
				    // skip 'name' and '='.
					firstChar += name.length + 1;

					// Find the end of the value string (i.e. the next';').
					lastChar = theBigCookie.indexOf(';', firstChar);


					if(lastChar == -1) lastChar = theBigCookie.length;

					// Return the value.

					return theBigCookie.substring(firstChar, lastChar);

				} 
				else
				{
					// If there was no cookie, return false.
					return false;
				}
		}
						

		function ValidateInteger(strValue)
		{
		  strValue=TrimLeadingZeros(strValue);
		  strValue=stripCharsNotInBag(strValue, "1234567890")
		  		 
		  //build RegExp object with pattern
		  var objReg=new RegExp("^\\d+$","g");
		  if (!objReg.exec(strValue))
			 return -1;
		  else
			 return strValue;
		    
		}

		
		function ValidateCurrency(strValue)
		{
		  strValue=TrimLeadingZeros(strValue);
		  strValue=stripCharsNotInBag(strValue, "1234567890")
		  strValue=AddEndingZeros(strValue,2);
		  
		  //build RegExp object with pattern ####.##
		  var objReg=new RegExp("^\\d+\\.(\\d{2})$","g");
			
		  if (!objReg.exec(strValue))
		    return -1;
		  else
		  {
			//strValue = stripCharsNotInBag(strValue, "1234567890")
		    return strValue;
		  }
		}
				

		function stripCharsNotInBag (s, bag)

		{   var i;
		    var returnString = "";

		    // Search through string's characters one by one.
		    // If character is in bag, append to returnString.

		    for (i = 0; i < s.length; i++)
		    {   
		        // Check that current character isn't whitespace.
		        var c = s.charAt(i);
		        if (bag.indexOf(c) != -1) returnString += c;
		    }

		    return returnString;
		}


		function reformat (s)

		{   var arg;
		    var sPos = 0;
		    var resultString = "";

		    for (var i = 1; i < reformat.arguments.length; i++) {
		       arg = reformat.arguments[i];
		       if (i % 2 == 1) resultString += arg;
		       else {
		           resultString += s.substring(sPos, sPos + arg);
		           sPos += arg;
		       }
		    }
		    return resultString;
		}


				
		function TrimLeadingZeros(strIn)
		{
		  var strBuild="";
		  if (IsBlank(strIn))
		  {
		    strIn="";
		    return;
		  }
		  for (var i=0; i<strIn.length; i++)
		  {
		    var strTemp=strIn.charAt(i);
		    if (strTemp!="0")
		    {
		      strBuild=strIn.substring(i);
		      break;
		    }  
		  }
		  return strBuild; 
		}	
		
		
		function AddEndingZeros(strIn,intDecimal)
		{
		  var strTemp=strIn.split(".");
		  var zero="0000000000";
		  if (strTemp[0]==strIn)
		    strTemp[1]=zero.substring(0,intDecimal);
		  else if (strTemp[1].length<intDecimal)
		    strTemp[1]=strTemp[1]+zero.substring(0,(intDecimal-strTemp[1].length));
		  return strIn=strTemp[0]+"."+strTemp[1];
		}	
		
						
		function IsBlank(strIn)
		{
		  if (strIn==null) return false;
		  for (var i=0; i<strIn.length;i++)
		  {
		    var strTemp=strIn.charAt(i);
		    if ((strTemp!=' ')&&(strTemp!='/n')&&(strTemp!='/t')) return false;
		  }
		  return true;
		}