var bSubmit = false;
function CheckFields()
{
	with (document.comments) //saves a few precious keystrokes..
	{			
		if (Name.value == "") {
				alert("Please enter your name.");
				Name.focus();
				return false;
		}
		if (Comment.value == "") {
				alert("Please enter a comment.");
				Comment.focus();
				return false;
		}

		if (Email.value == "") {
				alert("Please enter an email address.");
				Email.focus();
				return false;
		}
	}
}// End CheckFields()

var HOST = '';

function setCookie (name, value, expires, path, domain, secure) {
	var curCookie = name + "=" + escape(value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : "");
	document.cookie = curCookie;
}

function getCookie (name) {
	var prefix = name + '=';
	var c = document.cookie;
	var nullstring = '';
	var cookieStartIndex = c.indexOf(prefix);
	if (cookieStartIndex == -1)
		return nullstring;
	var cookieEndIndex = c.indexOf(";", cookieStartIndex + prefix.length);
	if (cookieEndIndex == -1)
		cookieEndIndex = c.length;
	return unescape(c.substring(cookieStartIndex + prefix.length, cookieEndIndex));
}

function deleteCookie (name, path, domain) {
	if (getCookie(name))
		document.cookie = name + "=" + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
}

function fixDate (date) {
	var base = new Date(0);
	var skew = base.getTime();
	if (skew > 0)
		date.setTime(date.getTime() - skew);
}

function rememberMe (f) {
	var now = new Date();
	fixDate(now);
	now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000);
	setCookie('comment_name', f.Name.value, now, '', HOST, '');
	setCookie('comment_email', f.Email.value, now, '', HOST, '');
	setCookie('comment_home', f.Homepage.value, now, '', HOST, '');
}

function forgetMe (f) {
	deleteCookie('comment_email', '', HOST);
	deleteCookie('comment_home', '', HOST);
	deleteCookie('comment_name', '', HOST);
	f.Email.value = '';
	f.Name.value = '';
	f.Homepage.value = '';
}

var isDHTML=0;
var isID=0;
var isAll=0;
var isLayers=0;
	
if (document.getElementById) {isID = 1; isDHTML = 1;}
else
{
	if (document.all) {isAll = 1; isDHTML = 1;}
	else {browserVersion=parseInt(navigator.appVersion);
		  if ((navigator.appName.indexOf('Netscape') != -1) && (browserVersion==4)) {isLayers=1; isDHTML=1;}}
}

function toggleLinks(name) {
	if (isID) {	var x = document.getElementById(name).style; }
	else 
	{ if (isAll) { var x = document.all[name].style; } 
		else
		{ if (isLayers) { var x = document.layers[name].style ; }
		}
	}

	if (x.display == 'block') x.display = 'none';
	else x.display = 'block';
}



function setCaretToEnd (element) 
{
 if (element.createTextRange) 
  {
   var elval = element.value;
   var elrng = element.createTextRange();
   elrng.moveStart('character', elval.length);
   elrng.select();
 }
}

