<!--
//********************************************************************************
// Description: Global javascript used by all pages, for form validation, page flow
//                              and page display
// 
// Assumptions: None
//               
// Authors:     Brian McGovern
// Assumptions: The form being validated is the only form on page. Update coming soon.
//********************************************************************************
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Define Global Variables
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if ((document.domain == "www.bickfordtheatre.org") || (document.domain.indexOf("bickfordtheatre.org") != -1) ){
//      alert("bickford");
        location.href="http://www.morrismuseum.org/static/bickford/bickford.html";
}else{
        if ( (document.domain != "192.168.100.80") && (document.domain != "192.168.10.103") && (document.domain != "www.morrismuseum.org")){
                location.href = "http://www.morrismuseum.org";
        }
}
// Error Messages  

 
var err0 = "Please enter your Full Name.";
var err1 = "Please enter your First Name.";
var err2 = "Please enter your Last Name.";
var err3 = "Please enter your City.";
var err4 = "Please select a State.";
var err5 = "Please enter a valid User ID.  It is your Email Address.";
var err6 = "Please select a Country.";
var err7 = "Please select a City.";
var err8 = "Please enter a valid e-mail address.";
var err9 = "Please enter your Password.";
var err10 = "Please enter Confirmation Password.";
var err11 = "The password does not match, please re-confirm your password.";
var err12 = "The company web id and company secret code does not match.  Please try again.";
var err13 = "The company secret code you entered is invalid.  Please check the code and try again.";
var err14 = "The User Id and Password entered are invalid.  Please try again.";
var err15 = "There was no match to your search criteria.";
var err16 = "The logo file entered does not exist.  Please check the file path.";
var err17 = "The old password entered is invalid.";
var err18 = "There was a problem in delivering your email.  Please try again.";
var err19 = "Company Web Id is invalid. Please try again.";
var err20 = "The user id entered is being used, please pick a new id.";
var err21 = "Please enter your Comment.";
var err22 = "Please enter a valid Phone Number.";
var err23 = "Please enter your search criteria.";
var err24 = "Please enter your Question.";
var err25 = "Please enter a Subject.";
var err26 = "Please enter a valid Expiration Date.";
var err27 = "Please enter the Article Text.";
var err28 = "Please select a Servicing Division.";
var err29 = "Please enter a Course Name.";
var err30 = "Please enter your Street Address.";
var err31 = "Please enter your Zip Code.";
var err32 = "Please enter a valiod Start Date and End Date.";
var err33 = "Please enter a valid Start Time and End Time.";
var err34 = "Please enter a Location Name.";
var err35 = "Please enter your Postal Code.";
var err36 = "Please select an Industry.";
var err37 = "Please select an Category.";
var err38 = "Please enter an Answer.";
var err39 = "Please enter your Job Title.";
var err40 = "Please enter a New Logo.";
var err41 = "Please enter a Description.";
var err42 = "Please enter a Course Name.";
var err43 = "Please enter a Contact Name.";
var err44 = "Please enter a Contact Phone.";
var err45 = "Please enter a Contact Email Address.";
var err47 = "Please enter a Company.";
var err53 = "The logo file format you entered is invalid. Logos must be in GIF format.";
var err54 = "In order to personalize your home page, you must be a registered user.";
var err55 = "The text you typed is longer then __LENGTH__ characters and has been truncated to fit that length.";
var err57 = "The search field may not contain single quotation mark (').";
var err58 = "Your Password must me at least 4 characters in length.";
var err59 = "Please select a Service Industry.";
var err60 = "A user type must be entered.";
var err61 = "The password clue cannot be blank.";
var err62 = "The format for the zip code for your country must be __FORMAT__";
var err63 = "Please enter a valid Manufacturer Phone Number.";
var err64 = "Please enter a Model Number.";
var err65 = "Please select at least one Equipment Category.";
var err66 = "Please enter an Equipment Model Description.";
var err67 = "Please enter a Manufacturer Name.";
var err68 = "Please select a User.";
var err69 = "Please select a Manufacturer.";
var err71 = "Please select an Equipment Type.";
var err72 = "Please select an Equipment Model.";
var err73 = "Please select an Post Type.";
var err74 = "Please select an Equipment Condition.";
var err75 = "Please enter a valid Asking Price.";
var err76 = "Please select an Available Date.";
var err77 = "Please enter an Equipment Model.";
var err78 = "Please enter an Equipment Detail.";
var err79 = "Please enter a Year Made.";
var err80 = "Please enter a valid Manufacturer Fax Number.";
var err81 = "Please enter a valid Maximum Used Equipment Listing Number. This must be a positive number.";
var err82 = "Please select a Sale Date.";
var err83 = "Please enter a valid Selling Price.";
// Date Errors                                                                  
var err48 =  "The Start Date you entered is invalid. Please try again.";
var err49 =  "The End Date you entered is invalid. Please try again.";
var err50 =  "The End Date cannot be before the Start Date. Please try again.";
var err51 =  "The Date you entered is invalid. Please try again.";
var err52 =  "The Start Date cannot be before the today's date. Please try again.";

var err56 = "The Expiration Date cannot be before the today's date. Please try again.";

var err70 = "Please select an Available Divison/Location.";

// User Confirmation Messages
var message1 = "The changes made will be published to the site instantly. Do you wish to continue?";
var message2 = "Are you sure you want to delete this item?";
var message3 = "The FAQ will be published to the database instantly? Do you want to continue?";
var message4 = "Did you preview your ad? Continue to publish.?";
var message5 = "Did you preview your logo? Continue to publish.?";
var message6 = "Are you sure you want to logoff?";
var message7 = "The action you clicked will take you out of the administration area of the site.  As a site administrator you can modify a manufacturer's information, add equipment etc.  To do this you will be taken to the Contractor's Marketplace area of the site acting as the manufacturer administrator."
var message8 = "The action you clicked will take you out of the administration area of the site.  As a site administrator you can add or delete users.  To do this you will be taken to the Contractor's Marketplace area of the site and walk through the same process as a user."
var message9 = "The action you clicked will take you out of the administration area of the site.  As a site administrator you can modify a user's used equipment listing.  To do this you will be taken to the Used Equipment area of the site as a site administrator."

// Browser Detection
var ns4 = (document.layers)? true:false
var ie4 = (document.all)? true:false
var AppVer = parseInt(navigator.appVersion);





if (navigator.appVersion.indexOf("Mac") != -1){
        var mac = true;
}else{
    var mac = false;
}




// Rollover Preloading 
var base = "/images/";
if (document.images) {
// Top Nav On
        //preload here
		

}


// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Validation Functions
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


////////////////////////////////////////////////////////////////////////////////////////////////////////
//  Function: IsValidZip(field, format) 
// Arguments: 'field'  -the name of the field in the form to be validated
//			  'format' -the zip input mask from db.  
//				LV-####
//				####
//				A####AAA
//				####-####
//				######
//				#####
//				### ##	
//   Returns: Boolean
// Objective: Dynamically checks the value of the data in 'field' for a correctly formatted zip.
////////////////////////////////////////////////////////////////////////////////////////////////////////
function IsValidZip(field, format){
	var value;
	field.value = field.value.toUpperCase();
	value = field.value;
	if (value.length != format.length){
		err62 = err62.replace(/__FORMAT__/, format);
		alert(err62);
		return false;
	}
	for (i = 0; i < format.length; i++){
		//alert("Format: " + format.charAt(i) + " Value: " + value.charAt(i));
		if (format.charAt(i) != "#"){
			if ((format.charAt(i)) != (value.charAt(i))){
				err62 = err62.replace(/__FORMAT__/, format);
				alert(err62);
				return false;
				break;
			}
		}else{
			//alert("in isNaN");
			if (isNaN(value.charAt(i)) || (value.charAt(i) == " ") ){
				err62 = err62.replace(/__FORMAT__/, format);
				alert(err62);
				return false;
				break;
			}
		}
	}
return true;	
}

////////////////////////////////////////////////////////////////////////////////////////////////////////
//  Function: IsValidPhone() 
// Arguments: dial_code, phone1, phone2, phone3
//   Returns: Boolean
// Objective: Checks the value of the data in phone1, phone2, phone3 for a positive number based on dial_code
////////////////////////////////////////////////////////////////////////////////////////////////////////
function IsValidPhone(dial_code, phone1, phone2, phone3){
	var format = "";
	if (document.forms[0][dial_code].value != ""){
		if ((document.forms[0][dial_code].value == 1) || (document.forms[0][dial_code].value == "-")){
			//alert("In US");
			//alert(document.forms[0][phone1].value.length);
			//alert(document.forms[0][phone2].value.length);
			//alert(document.forms[0][phone3].value.length);
			if ((document.forms[0][phone1].value.length < 3) || (document.forms[0][phone2].value.length < 3) || (document.forms[0][phone3].value.length < 4)){
				//alert("lenght");
				return false;
			}
		}
	}
	// no country code for this country in DB or its a "+" country code either way  just check that its not letters
	if (!IsBlank(phone1) || !IsBlank(phone2) || !IsBlank(phone3)){
		return false;
	}
	if ( (!IsPosNumber(phone1)) || (!IsPosNumber(phone2)) || (!IsPosNumber(phone3))){
		return false;
	}
	return true;
}
	
////////////////////////////////////////////////////////////////////////////////////////////////////////
//  Function: Validate_IsPosNumber() 
// Arguments: 'field'  -the name of the field in the form to be validated
//   Returns: Boolean
// Objective: Checks the value of the data in 'field' for a positive number.
////////////////////////////////////////////////////////////////////////////////////////////////////////
function IsPosNumber(field){
var the_length = (field.value.length - 1);
        for(i=0; i<=the_length; i++){
                if ((field.value.charAt(i) == "-") || (field.value.charAt(i) == " ")){
                        return false;
                        break;
                }
        }
        if (isNaN(field.value)){
                return false;
        }
        return true;
}


function IsValidExpDate(field){
	var split = field.split("/");
	//alert(split.length);
 
	if (split.length == 2){
		//alert("right size");
		if (((split[0] >= 1) && (split[0] <= 31)) && ((split[1] > 2003) && (split[1] < 2030))){
			return true;
		}else{
			return false;
		}
	}else{
		return false;
	}	 
	 
}
	
	
                
////////////////////////////////////////////////////////////////////////////////////////////////////////
//  Function: IsPosDate() 
// Arguments: 'field'  - a variable 
//   Returns: Boolean
// Objective: Used by functions on variables, check that 'field' is a number. 
////////////////////////////////////////////////////////////////////////////////////////////////////////
function IsPosDate(field){
        if (isNaN(field)){
                return false;
        }else{
                if (field == ""){
                        return false;
                }else{
                        return true;
                }
        }
}
   

////////////////////////////////////////////////////////////////////////////////////////////////////////
//  Function: IsBlank() 
// Arguments: 'field'  - the name of the html form field 
//   Returns: Boolean
// Objective: Checks the field (Textbox, Textarea) for whitespace and blank
////////////////////////////////////////////////////////////////////////////////////////////////////////        
function IsBlank(field){
//alert("isblank");
var the_length;
var whitespace;
        if (field.value == ""){
                return false;
        }else{
                the_length = (field.value.length - 1);
                for(i=0; i<=the_length; i++){
                        if (field.value.charAt(i) == " "){
                                whitespace = 1;
                        }else{
                                whitespace = 0;
                                break;
                        }
                }
                if (whitespace == 1){
                        return false;
                }
        }
        return true;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////
//  Function: IsChecked() 
// Arguments: 'field'  - the name of the html form field 
//   Returns: Boolean
// Objective: Checks the field set (Checkbox, Radio) for one or more selections
////////////////////////////////////////////////////////////////////////////////////////////////////////        
function IsChecked(field){
var the_length = (field.length - 1);
var ischecked = 0;
        for (i=0; i<=the_length; i++){
                if (field[i].checked){
                        ischecked = 1;  
                        break;
                }
        }
        if (ischecked == 0){
                return false;
        }else{
                return true;
        }
}

////////////////////////////////////////////////////////////////////////////////////////////////////////
//  Function: IsSingleChecked() 
// Arguments: 'field'  - the name of the html form field 
//   Returns: Boolean
// Objective: Checks the field set (Checkbox, Radio) for one or more selections
////////////////////////////////////////////////////////////////////////////////////////////////////////        
function IsSingleChecked(field){
        if (!field.checked){
                return false;
        }else{
                return true;
        }
}


////////////////////////////////////////////////////////////////////////////////////////////////////////
//  Function: IsEmail() 
// Arguments: 'field'  - the name of the html form field 
//   Returns: Boolean
// Objective: Checks the field (Text) an email address containing '@' and '.'
////////////////////////////////////////////////////////////////////////////////////////////////////////        
function IsEmail(field){
var the_length;
        if (field.value == ""){
                return false;
        }else{
                if ((field.value.indexOf("@") > -1 ) && (field.value.indexOf(".") > -1 )){
                        return true;
                }else{
                        return false;
                }
        }
        return true;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////
//  Function: IsSelected() 
// Arguments: 'field' - the name of the html form field,  
//                        'multiple'  - Boolean variable defining if that select box allows multiple selections
//   Returns: Boolean
// Objective: 1. If multiple == true checks that ANY of the options are selected
//                        2. If multiple == false checks that an option other than the first one is selected. The 
//                               first option has text like "Please select an option".
////////////////////////////////////////////////////////////////////////////////////////////////////////        
function IsSelected(field, multiple){
        if (multiple){
                if (field.options.selectedIndex >= 0){
                        return true;
                }else{  
                        return false;
                }
        }else{
                if (field.options.selectedIndex > 0){
                        return true;
                }else{  
                        return false;
                }
        }
        return true;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////
//  Function: NumSelect() 
// Arguments: 'field' - the name of the html form field,
//   Returns: integer
// Objective: Returns the number of options in the selection list.
////////////////////////////////////////////////////////////////////////////////////////////////////////        
function NumSelect(field) {
        return field.length
}

////////////////////////////////////////////////////////////////////////////////////////////////////////
//  Function: IsPasswordValid() 
// Arguments: 'newpass', 'newpassconfirm' - names of html form fields
//   Returns: Boolean
// Objective: Checks that the newpass == newpassconfirm  (put in your password 2x to confirm) and that 
//                        Password is at least 8 chars.
////////////////////////////////////////////////////////////////////////////////////////////////////////        
function IsPasswordValid(newpass, newpassconfirm){
		//alert("In IsPasswordValid");
        if (document.forms[0][newpass].value.length < 4) {      
                alert(err58);
                return false;
		}
        if (document.forms[0][newpass].value != document.forms[0][newpassconfirm].value){
   	    	alert(err11);
       	    return false;
		}
return true;
}


////////////////////////////////////////////////////////////////////////////////////////////////////////
//   function: GetItemForKey
//parameters : in_Array, in_Key
//    return: a_NameValuePairs
//    purpose: Returns an array of arrays
////////////////////////////////////////////////////////////////////////////////////////////////////////
function GetItemsForKey(in_Array, in_Key){
	var a_NameValuePairs = new Array();
	var j = 0;
	for (var i=0; i<in_Array.length; i++){
		var unsplit_item = in_Array[i].split("::");
		if (in_Key == unsplit_item[0]){
			a_NameValuePairs[j] = unsplit_item[1].split("||");
			j++;
		}
	}
	return a_NameValuePairs;
}


////////////////////////////////////////////////////////////////////////////////////////////////////////
//  Function: Gather_Checkbox_Input() 
// Arguments: 'to_field'  -the name of the field (select) in the form to be moved
//			  'from_field'  - the name of the field (text) in the html form
//			  'delim' - delimiter
//   Returns: -
// Objective: Takes all the options in from_field checkbox and moves them to to_field, in the following format
//			  valuedelimvalue
////////////////////////////////////////////////////////////////////////////////////////////////////////
function Gather_Checkbox_Input(from_field, to_field, delim){
	document.forms[0].elements[to_field].value = "";
	var the_length = (document.forms[0].elements[from_field].length - 1); 
	if (the_length > -1) {
		for (i=0; i<=the_length; i++){
			if (document.forms[0].elements[from_field][i].checked){
				if (document.forms[0].elements[to_field].value == ""){
					document.forms[0].elements[to_field].value = document.forms[0].elements[from_field][i].value;
				}else{
					document.forms[0].elements[to_field].value = ((document.forms[0].elements[to_field].value) + delim + (document.forms[0].elements[from_field][i].value));
				}
			}
		}
	}
	//alert(document.forms[0].elements[to_field].value);
}
// END


////////////////////////////////////////////////////////////////////////////////////////////////////////
//  Function: Gather_Input() 
// Arguments: 'to_field'  -the name of the field (select) in the form to be moved
//			  'from_field'  - the name of the field (text) in the html form
//   Returns: -
// Objective: Takes all the options in from_field and moves them to to_field, in the following format
//			  name::value;
////////////////////////////////////////////////////////////////////////////////////////////////////////
function Gather_Input(from_field, to_field, delim){
	document.forms[0].elements[from_field].value = "";
	var the_length = (document.forms[0].elements[from_field].options.length - 1); 
	if (the_length > -1) {
		//alert("test");
		for (i=0; i<=the_length; i++){
			if (document.forms[0].elements[to_field].value == ""){
				document.forms[0].elements[to_field].value = document.forms[0].elements[from_field].options[i].value;
			}else{
				document.forms[0].elements[to_field].value = ((document.forms[0].elements[to_field].value) + delim + (document.forms[0].elements[from_field].options[i].value));
			}
		}
	}
	//alert(document.forms[0].elements[to_field].value);
}
// END


////////////////////////////////////////////////////////////////////////////////////////////////////////
//  Function: Limit_Input() 
// Arguments: 'field' - names of html form fields
//                        'limit' - numeral variable holding the max length of text area
//   Returns: Boolean
// Objective: Trims the field (Textarea) to the amount of characters in 'limit'.  Done to avoid 
//                        database field limit errors
////////////////////////////////////////////////////////////////////////////////////////////////////////        
function Limit_Input(field,limit){
        if (field.value.length > limit ) {
                field.value = field.value.substring(0,limit);
                err55 = err55.replace(/__LENGTH__/, limit);
                alert(err55);
        }
}

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Page Flow Functions
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

////////////////////////////////////////////////////////////////////////////////////////////////////////
//  Function: Page_Submit() 
// Arguments: none
//   Returns: Page Submission
// Objective: Each page has a Validate_Page function within it, if that returns true, the page is 
//                        submitted
////////////////////////////////////////////////////////////////////////////////////////////////////////        
function Page_Submit(){
        if (Validate_Page()){
                document.forms[0].submit();
        }
}

////////////////////////////////////////////////////////////////////////////////////////////////////////
//  Function: Page_Cancel() 
// Arguments: none
//   Returns: page goes back 1 history
// Objective: performs the function of the browser back button
////////////////////////////////////////////////////////////////////////////////////////////////////////        
function Page_Cancel(){
        history.back(-1);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////
//  Function: Confirm_Action() 
// Arguments: 'message' - The message to be displayed in confirm box.
//			  'dest'    - Target url
//   Returns: -
// Objective: Displays a warning message that the user has to accept in order for the action to occur
////////////////////////////////////////////////////////////////////////////////////////////////////////        
function Confirm_Action(message, dest){
	if (confirm(message)){
		window.location.href=dest;
	}
}

////////////////////////////////////////////////////////////////////////////////////////////////////////
//  Function: Confirm_Action() 
// Arguments: 'message' - The message to be displayed in confirm box.
//			  'dest'    - Target url
//   Returns: -
// Objective: Displays a warning message that the user has to accept in order for the action to occur
////////////////////////////////////////////////////////////////////////////////////////////////////////        
function Confirm_Delete(message, action){
	if (confirm(message)){
		document.forms[0].action = action;
		document.forms[0].submit();
	}
}

 

////////////////////////////////////////////////////////////////////////////////////////////////////////
//  Function: Close_Popup() 
// Arguments: none
//   Returns: closes a window
// Objective: Simple window closer fucntion
////////////////////////////////////////////////////////////////////////////////////////////////////////        
function Close_Popup(){ 
        window.close();
        window.opener.focus();
}

////////////////////////////////////////////////////////////////////////////////////////////////////////
//  Function: Go_There() 
// Arguments: 'dest' - string url
//   Returns: links to a new page
// Objective: Used primarily for drop down navigation, where urls are the values of the drop down options.
//                        Takes window to page defined in 'dest'. Called by onChange.
////////////////////////////////////////////////////////////////////////////////////////////////////////        
function Go_There(dest) {
                window.location.href = dest;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////
//  Function: Pop_Up() 
// Arguments: 'destination' - string url
//                        'width', 'height'  - dimensions of window to be opened
//   Returns: opens 'destination' in new window
// Objective: Opens a new window to url == 'destination' with dimensions desired
////////////////////////////////////////////////////////////////////////////////////////////////////////        
function Pop_Up(destination, width, height)   {
        var pop = window.open(destination,"newWindow","scroll=auto,status=no,width=" + width+ ",height=" + height + ",scrollbars=auto,copyhistory=no");
}


	function popup(href){
		wnum = 0;
	if(href.length > 0){
		wnum++;
		window.open(href, "window"+wnum, 

"toolbar=no,location=no,directories=no,resizable=yes,status=no,menubar=no,scrollbars=yes,height=450,width=600");
		}
	}
 
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Page Display functions
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

////////////////////////////////////////////////////////////////////////////////////////////////////////
//  Function: imgOn() 
// Arguments: 'imgName' - string value of the img tag
//   Returns: -
// Objective: swaps the src of 'imgName' with preloaded 'imgName' + 'on' .src
////////////////////////////////////////////////////////////////////////////////////////////////////////        
function imgOn(imgName, color) {
        if (document.images) {
				//alert(imgName + "--" + color);
				//var name = eval(color  + "_img_off.src");
				//alert(document[imgName].src);
				//document[imgName].onerror();
				//alert(eval(imgName + "_" + color + "_img_on.src"));
				if (document[imgName]){
	                document[imgName].src = eval(imgName + "_" + color + "_img_on.src");
				}
        }
}

////////////////////////////////////////////////////////////////////////////////////////////////////////
//  Function: imgOff() 
// Arguments: 'imgName' - string value of the img tag
//   Returns: -
// Objective: swaps the src of 'imgName' with preloaded 'imgName' + 'off' .src
////////////////////////////////////////////////////////////////////////////////////////////////////////        
function imgOff(imgName) {
		//alert ("in image off");
        if (document.images) {
				document[imgName].src = eval("product_" + imgName + "_img_off.src");
        }
}



////////////////////////////////////////////////////////////////////////////////////////////////////////
//  Function: WriteDate() 
// Arguments: none
//   Returns: Document.write (Date)
// Objective: determines current date based on client clock and prints out date on html page
////////////////////////////////////////////////////////////////////////////////////////////////////////        
function WriteDate() {
var today=new Date();

if(today.getDay() == 0){
        document.write("Sunday");}
if(today.getDay() == 1){
        document.write("Monday");}
if(today.getDay() == 2){
        document.write("Tuesday");}
if(today.getDay() == 3){
        document.write("Wednesday");}
if(today.getDay() == 4){
        document.write("Thursday");}
if(today.getDay() == 5){
        document.write("Friday");}
if(today.getDay() == 6){
        document.write("Saturday");}
document.write (", ");
if(today.getMonth() == 0){
        document.write("January");}
if(today.getMonth() == 1){
        document.write("February");}
if(today.getMonth() == 2){
        document.write("March");}
if(today.getMonth() == 3){
        document.write("April");}
if(today.getMonth() == 4){
        document.write("May");}
if(today.getMonth() == 5){
        document.write("June");}
if(today.getMonth() == 6){
        document.write("July");}
if(today.getMonth() == 7){
        document.write("August");}
if(today.getMonth() == 8){
        document.write("September");}
if(today.getMonth() == 9){
        document.write("October");}
if(today.getMonth() == 10){
        document.write("November");}
if(today.getMonth() == 11){
        document.write("December");}
document.write (" ");
document.write (today.getDate());
var y = today.getYear();
if ( y < 1000 ) y += 1900;
document.write (", " + y + " at ");

var tmp = today.getHours();
var hr = (tmp <= 12) ? tmp : (tmp-12);
hr = ( hr < 10 ) ? "0" + hr : hr;
var sym = (tmp < 12) ? " a.m." : " p.m.";
if (hr == "00"){hr=12;}

var TodayMinutes = (( today.getMinutes() < 10) ? "0" : "" ) + today.getMinutes();
var TodaySeconds = (( today.getSeconds() < 10) ? "0" : "" ) + today.getSeconds();
document.write(hr + ":" + TodayMinutes + " " + sym);
}
// ADDED BY MRC


/*
function IsValidShowDate(field){

	var split = field.split("/");
	var showtime = mktime(0,0,0,split[0],,split[1],split[2]);
	//alert(split.length);
 	var thedate = new Date( );
 
 
 if(thedate < showtime){
 return true;
 }else{
 return false;}
}
*/


// END 
////////////////////////////////////////////////////////////////////////////////////////////////////////
//-->
