<HTML>
<HEAD>
<SCRIPT LANGUAGE= "JavaScript">
<!--
// Use this function to retrieve a cookie.
function getCookie(name){
var cname = name + "=";
var dc = document.cookie;
if (dc.length > 0) {
begin = dc.indexOf(cname);
if (begin != -1) {
begin += cname.length;
end = dc.indexOf(";", begin);
if (end == -1) end = dc.length;
return unescape(dc.substring(begin, end));
}
}
return null;
}
// Use this function to save a cookie.
function setCookie(name, value, expires) {
document.cookie = name + "=" + escape(value) + "; path=/" +
((expires == null) ? "" : "; expires=" + expires.toGMTString());
}
// Use this function to delete a cookie.
function delCookie(name) {
document.cookie = name + "=; expires=Thu, 01-Jan-70 00:00:01 GMT" + "; path=/";
}
// Function to display welcome message if new visitor.
function showWelc() {
if (getCookie(cookieName) == null ||
getCookie(cookieName) == "welcome") {
setCookie(cookieName, "welcome", exp);
document.write(theMessage);
}
else {
setCookie(cookieName, "nowelcome", exp);
}
}
// Function to toggle welcome message.
function toggleWelc() {
if (getCookie(cookieName) == "welcome") setCookie(cookieName, "nowelcome", exp);
else setCookie(cookieName, "welcome", exp);
}
// Function to display a form that allows welcome message to be toggled.
function showForm() {
if (getCookie(cookieName) == null ||
getCookie(cookieName) == "welcome") {
document.write('<FORM><INPUT TYPE = "CHECKBOX" onClick = "toggleWelc()">');
document.write('Don\'t show this welcome message again.</FORM>');
}
}
var exp = new Date();
exp.setTime(exp.getTime() + (24 * 60 * 60 * 1000 * 365));
var cookieName = '_welcome';
// Your welcome message:
var theMessage = 'Since this this is your first time here...';
// -->
</SCRIPT>
</HEAD>
<BODY BGCOLOR = "#FFFFFF">
<SCRIPT LANGUAGE = "JavaScript">
<!--
// Place this where you want the welcome message to be displayed.
showWelc();
//-->
</SCRIPT>
<SCRIPT LANGUAGE = "JavaScript">
<!--
// Place this where you want the welcome message "toggle form" to be displayed.
showForm();
// -->
</SCRIPT>
</BODY>
</html>