function clearText(thefield){
if (thefield.defaultValue==thefield.value)
thefield.value = ""
}

function restoreText(thefield){
if (thefield.value=="")
thefield.value = thefield.defaultValue
} 

function show(object,val) {
	document.getElementById(object).style.visibility = val;
}

function setwhere(object,val) {
	document.getElementById(object).style.width = val+"px";
}

function slideo(so_object,so_change) {
	if (document.getElementById(so_object).style.visibility != 'visible') {
		document.getElementById(so_object).style.visibility = 'visible';
		so_duration = 300;
		so_fps = 60;
		so_frms = so_fps * (so_duration/1000);
		so_cycles = so_duration/so_frms;
		so_move = so_change/so_frms;
						
		for (so_i=0; so_i<=so_frms; so_i++) {
			so_when = so_i*so_cycles;
			setTimeout("setwhere('"+so_object+"','"+(so_move*so_i)+"');",so_when);
			setTimeout("show('"+so_object+"','visible');",so_when);
		}
    }
}

function slidec(sc_object) {
	if (document.getElementById(sc_object).style.visibility != 'hidden') {	
		haystack = document.getElementById(sc_object).style.width;
		needle = haystack.indexOf('p');
		sc_change = haystack.substring(0, needle);
		sc_duration = 50;
		sc_fps = 60;
		sc_frms = sc_fps * (sc_duration/1000);
		sc_cycles = sc_duration/sc_frms;
		sc_move = sc_change/sc_frms;
		sc_thisframe = sc_frms;
		
		for (sc_i=0; sc_i<=sc_frms; sc_i++) {
			sc_when = sc_i*sc_cycles;
			setTimeout("setwhere('"+sc_object+"','"+(sc_move*sc_thisframe)+"');",sc_when);
			sc_thisframe--;
		}
		setTimeout("show('"+sc_object+"','hidden');",sc_when);
	}
}

function validateContact(object) {
	returnAddr=object.return_addr.value;
	returnName=object.return_name.value;
	message=object.message.value;
	var alertMsg = '';
	
	if (returnAddr=='' || returnAddr.substring(0, 4)=='Ente') {
		alertMsg = '\n\tE-Mail Address';
	}
	if (returnName=='' || returnName.substring(0, 4)=='Ente') {
		alertMsg = alertMsg+'\n\tYour Name';
	}
	if (message=='' || message.substring(0, 4)=='Ente') {
		alertMsg = alertMsg+'\n\tYour Message';
	}
	if (alertMsg.length > 1) {
		alert('These required fields were not completed:\n'+alertMsg+'\n\nPlease try again.');
		return false;
	} else {
		object.submit();
	}
}

function validateFriend(object) {
	returnAddr=object.return_addr.value;
	returnName=object.return_name.value;
	friendAddr=object.friend_addr.value;
	friendName=object.friend_name.value;
	var alertMsg = '';
	
	if (returnAddr=='' || returnAddr.substring(0, 4)=='Ente') {
		alertMsg = '\n\tE-Mail Address';
	}
	if (returnName=='' || returnName.substring(0, 4)=='Ente') {
		alertMsg = alertMsg+'\n\tYour Name';
	}
	if (friendAddr=='' || friendAddr.substring(0, 4)=='Ente') {
		alertMsg = '\n\tFriend\'s E-Mail Address';
	}
	if (friendName=='' || friendName.substring(0, 4)=='Ente') {
		alertMsg = alertMsg+'\n\tFriend\'s Name';
	}

	if (alertMsg.length > 1) {
		alert('These required fields were not completed:\n'+alertMsg+'\n\nPlease try again.');
		return false;
	} else {
		object.submit();
	}
}
