﻿//this function is to clear the value data on the search box in the mast when a user clicks on it
//author: mary-chris hirsch
//created: 7/17/08

function ClearInput(value, id){ // This calls our function ClearInput, and the two variables we will need for it to function the original value and the id.
    var input = document.getElementById(id); // Gets the input field based on its id.

    if(value == input.value){ // If the default value is equal to the current value.
    input.value = ''; // Empty It.
    }else{ // Else the value is not equal to the current input field value.
    input.value = input.value; // Leave it the same.
    } // End Else.
    } // Close Function.

// Date function

var months = new Array(12);
months[0] = "January";
months[1] = "February";
months[2] = "March";
months[3] = "April";
months[4] = "May";
months[5] = "June";
months[6] = "July";
months[7] = "August";
months[8] = "September";
months[9] = "October";
months[10] = "November";
months[11] = "December";

var weekDays = new Array(7);
weekDays[0] = "Sunday";
weekDays[1] = "Monday";
weekDays[2] = "Tuesday";
weekDays[3] = "Wednesday";
weekDays[4] = "Thursday";
weekDays[5] = "Friday";
weekDays[6] = "Saturday";

var dteBase = new Date();
var monthName = months[dteBase.getMonth()];
var weekDay = weekDays[dteBase.getDay()];
var date = dteBase.getDate();
var year = dteBase.getYear();

if (year < 2000) year = year + 1900; // Y2K Fix, Isaac Powell http://onyx.idbsu.edu/~ipowell

var formatDate = weekDay + ', ' + monthName + ' ' + date + ', ' + year;

function getFormattedDate() {
    return formatDate;
}

// This function gets the current year, and applies it to the copyright
// Last modified 1/24/07

function copyrightDate() {
	// Test for the browsers' interpretation of the DOM
	if (!document.getElementById) return false;
	if (!document.getElementById("sitetools")) return false;
	// Create <p> element to display the text and year
	var copyright = document.createElement("p");
	copyright.setAttribute("id","copyright");
	// Write in the HTML and the year from the date function
	copyright.innerHTML = "Copyright &copy;" + " " + year;
	var tools = document.getElementById("sitetools");
	// Test for the gateway via the Real Cities logo (if not found, append to the sitetools <div>)
	if (document.getElementById("real-city")) {
		var realcities = document.getElementById("real-city");
		tools.insertBefore(copyright,realcities);
	} else {
		tools.appendChild(copyright);
	}
}

//Change the text value for Rent Search

function changeTheVal() 
{  
 // Make sure browser supports getElementById   
 if(!document.getElementById ) return;  
 // Find the input by it's id  
 var inputObj = document.getElementById("location");  
 if( inputObj ) 
 { 
 if ( inputObj.value=="City & State or Zip Code" )
 {inputObj.value = ""; }
  // Update the value  
   
 } 
}

//Change the text value for Job Search
function changeTheValJob() {
    // Make sure browser supports getElementById   
    if (!document.getElementById) return;
    // Find the input by it's id  
    var inputObj = document.getElementById("kAndEntire");
    if (inputObj) {
        if (inputObj.value == "Enter a search term")
        { inputObj.value = ""; }
        // Update the value  

    }
}
