


function Check()

{
if (document.form2.your_name.value == '') {
var agree=alert("You must enter your name");
document.form2.your_name.focus();
	return false;
}
if (document.form2.your_email.value == '') {
var agree=alert("You must enter an email address");
document.form2.your_email.focus();
	return false;
}
if (document.form2.message.value == '') {
var agree=alert("You must enter a message");
document.form2.message.focus();
	return false;
}
if (-1 == document.form2.your_email.value.indexOf("@")) 
{alert("You must enter a valid email address.");
document.form2.your_email.focus();
return false;
} 
if (document.form2.your_email.value.length == (document.form2.your_email.value.indexOf("@")+1) ) 
{alert("You must enter a valid email address.");
document.form2.your_email.focus();
return false;
} 
else { return true; }
}


// Extract the value from the cookie at the given offset.

function GetValue( Offset )
{
var End = document.cookie.indexOf (";", Offset);
if( End == -1 )
End = document.cookie.length;

// Return the portion of the cookie beginning with the offset
// and ending with the ";".

return unescape( document.cookie.substring( Offset, End) );
}

function GetCookie( Name )
{
var Len = Name.length;

// Look at each substring that's the same length as the cookie name
// for a match.  If found, look up the value and return it.

var i = 0;
while( i < document.cookie.length )
{
var j = i + Len + 1;
if( document.cookie.substring( i, j) == (Name + "=") )
return GetValue( j );
i = document.cookie.indexOf( " ", i ) + 1;
if( i == 0)
break;
}
var a = "";
return a;
}

// Create or change a cookie given its name and value.  The name and value
// are required, but the expiration date isn't.  Note that if you don't specify
// an expiration date, the cookie only exists for the current session.

function SetCookie( Name, Value, Expire )
{
document.cookie = Name + "=" + escape( Value ) + ";expires=" + Expire;
}

// Write all the cookies for the form1 form.

function WriteCookies()
{
//  var Expire = "Friday,25-Feb-2000 12:00:00 GMT";
var Expire = "$cookie_expiration_date";

with( document.form1 )
{
SetCookie( "email", email.value, Expire );
SetCookie( "password", pw.value, Expire );
}
}

// Load the form with the values in the cookie

function GetCookies()
{
with( document.form1 )
{
email.value = GetCookie( "email" );
pw.value = GetCookie( "password" );
auth_remember_login.value = GetCookie( "remember_login" );

if ( auth_remember_login.value == "on" ) { 
auth_remember_login.checked = true; }

}
}

function FixCookieDate (date) {
var base = new Date(0);
var skew = base.getTime(); // dawn of (Unix) time - should be 0
if (skew > 0)  // Except on the Mac - ahead of its time
date.setTime (date.getTime() - skew);
}

var expdate = new Date ();
FixCookieDate (expdate); // Correct for Mac date bug - call only once for given Date object!
expdate.setTime (expdate.getTime() + (24 * 60 * 60 * 1000 * 365)); // 365 days from now 

function IsValid()
{
blnValid = true;

with( document.form1 )
{
if( email.value == "" )
{
window.alert( "Please enter your Email Address" );
blnValid = false;
document.form1.email.focus();
}
if( pw.value == "" )
{
window.alert( "Please enter your Password" );
blnValid = false;
document.form1.pw.focus();
}


var Email = email.value;
var Password = pw.value;

if (auth_remember_login.checked) {
var Remember_login = "on";
}

}
if( blnValid )

if (Remember_login == "on") {
document.cookie = "email=" + Email + ";expires=" + expdate.toGMTString() + ";";
document.cookie = "password=" + Password + ";expires=" + expdate.toGMTString() + ";";
document.cookie = "remember_login=" + Remember_login + ";expires=" + expdate.toGMTString() + ";";
}

if (Remember_login != "on") {
var Expires = "-1";
document.cookie = "email=" + Email + ";expires=" + Expires + ";";
document.cookie = "password=" + Password + ";expires=" + Expires + ";";
document.cookie = "remember_login=" + Remember_login + ";expires=" + Expires + ";";
}

return blnValid;
}
