function display_date()
{
	
	var time_element = document.getElementById('timestamp');
	
	var thetime    = new Date();
	var nhours     = thetime.getHours();
	var nmins      = thetime.getMinutes();
	var nsecn      = thetime.getSeconds();
	var nday       = thetime.getDay();
	var nmonth     = thetime.getMonth()+1;
	var ntoday     = thetime.getDate();
	var nyear      = thetime.getYear();
	var AorP;

	AorP   = (nhours>=12) ? "PM" : "AM";
	nhours = nhours>=13 ? nhours-12 : nhours==0 ? 12 : nhours;

	if (nsecn<10) nsecn="0"+nsecn;

	if (nmins<10) nmins="0"+nmins;

	// Day of week
	switch(nday)
	{
		case 0: nday="Sunday";break;
		case 1: nday="Monday";break;
		case 2: nday="Tuesday";break;
		case 3: nday="Wednesday";break;
		case 4: nday="Thursday";break;
		case 5: nday="Friday";break;
		case 6: nday="Saturday";break;
	}

	if (nyear<=99) nyear= "19"+nyear;

	if ((nyear>99) && (nyear<2000)) nyear+=1900;

	// Ordinal suffix of the day
	switch(ntoday)
	{
	case 1:dAppend  = "st";break;
	case 2:dAppend  = "nd";break;
	case 3:dAppend  = "rd";break;
	default:dAppend = "th";break;
	}	
	
	// Month name string
	switch(nmonth)
	{
		case 1: nMonthName  = 'January'; break; 
		case 2: nMonthName  = 'February'; break; 
		case 3: nMonthName  = 'March'; break; 
		case 4: nMonthName  = 'April'; break; 
		case 5: nMonthName  = 'May'; break; 
		case 6: nMonthName  = 'June'; break; 
		case 7: nMonthName  = 'July'; break; 
		case 8: nMonthName  = 'August'; break; 
		case 9: nMonthName  = 'September'; break; 
		case 10: nMonthName = 'October'; break; 
		case 11: nMonthName = 'November'; break; 
		case 12: nMonthName = 'December'; break; 
	}
	// Update the element
	time_element.innerHTML=nday+', '+nMonthName+' '+ntoday+dAppend+', '+nyear+' at '+nhours+':'+nmins+':'+nsecn+' '+AorP;
	// Callback
	setTimeout('display_date()',1000);
}

function SafariSearchMorph(obj,results,domain,placeholder){
	// swap input types to make use of Safari search boxes
	obj.setAttribute('placeholder',(obj.value != '' ? obj.value : placeholder));
	obj.setAttribute('value','');
	obj.setAttribute('autosave',domain);
	obj.setAttribute('results',results);
	obj.setAttribute('class','white');
	obj.type = 'search';
}

// Capitalizes the first character of a string
function cap(obj) {
  if(obj.value) {
    var re = /^(\w)(.+)$/;
    parts = re.exec(obj.value);
    if(parts) obj.value = parts[1].toUpperCase()+parts[2];
  }
}	

// Member access button hover states
function btnTgle( obj ) {
	var source = obj.src;
	var base   = 'images/';
	var parts  = source.split( "/" );
	obj.src    = ( parts[parts.length-1] == 'goButton.gif' ) ? base + 'goButtonHover.gif' : base + 'goButton.gif';
}

// Online bookmark image transitions
function fadeImage( obj,state,f_from,f_to )
{
	var f = f_from||0.5;
	var t = f_to||1.0;
	state == 'on' ? new Effect.Fade( obj, {from:f,to:t} ) : new Effect.Fade( obj,{from:t,to:f} );
}

// Verify login form fields are entered
function vfCnts() {
	var user = $( 'username' );
	var pass = $( 'password' );
	if( user.value == '' || pass.value == '' ) {
		alert( "Make sure to enter both a user name and a password to log in." );
		user.focus();
		return false;
	}
	return true;
}

function checkFiles( objIDNameRef ){
	var obj = $( objIDNameRef );
	if( obj.value == '') {
		alert( "Please select a file to upload!" );
		return false;
	}
	return true;
}
