// Roll over
function lightup(imgName)
{
imgOn=eval(imgName + "on.src");
document[imgName].src= imgOn;
}

function turnoff(imgName)
{
imgOff=eval(imgName + "off.src");
document[imgName].src= imgOff;
}

function checkemail(checkStr)
{
// test if valid email address, must have @ and .
var checkEmail = "@.";
var EmailValid = false;
var EmailAt = false;
var EmailPeriod = false;
var error = "";

for (i = 0;i < checkStr.length;i++)
{
ch = checkStr.charAt(i);

for (j = 0;j < checkEmail.length;j++)
{

if (ch == checkEmail.charAt(j) && ch == "@")
EmailAt = true;

if (ch == checkEmail.charAt(j) && ch == ".")
EmailPeriod = true;

if (EmailAt && EmailPeriod)
break;

if (j == checkEmail.length)
break;
}

// if both the @ and . were in the string
if (EmailAt && EmailPeriod)
{
EmailValid = true
break;
error = "";
}

}

if (!EmailValid)
{
error = " - Email must contain an \"@\" and a \".\"\n";
}

return error;
}

function CheckContact()
{
var alertsay = ""; 

if (document.forms[0].Name.value == "")
{
alertsay += "- You must enter your Contact Name\n";
}

if ((document.forms[0].Tel.value == "") && (document.forms[0].Email.value == "") && (document.forms[0].Address.value == ""))
{
alertsay += "- Please enter at least 1 contact method\n";
}

if (document.forms[0].Email.value != "")
{
alertsay += checkemail(document.forms[0].Email.value);
}

if (alertsay)
{
alert("The following error(s) occurred:\n" + alertsay.substring(alertsay,alertsay.length-1) + "\n\nForm would not be processed");
}

else
{
return true;
}

return false;
}

function window_option(WinW,WinH)
{
var x,y;
x=(screen.width/2-(WinW/2));
y=(screen.height/2-(WinH/2));
option = "height=" + WinH +",width="+ WinW +",left=" + x +",top="+ y;
return option;
}

function LargeImage(ImgName)
{
temp = "";
temp +="<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n";
temp +="<html>\n";
temp +="<head>\n";
temp +="<title>Large Image</title>\n";
temp +="<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n";
temp +="<link href=\"css/style.css\" rel=\"stylesheet\" type=\"text/css\">\n";
temp +="</head>\n\n";

temp +="<body bgcolor=\"#FFFFFF\">\n\n";

temp +="<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n";
temp +="<tr>\n";
temp +="<td align=\"center\"><img src=\"../images/photos/large/" + ImgName +"\" width=\"440\" height=\"280\"></td>\n";
temp +="</tr>\n";
temp +="</table>\n\n";

temp +="</body>\n";
temp +="</html>\n";

option = window_option('460','300');
newwindow = window.open("","", option);
var newwindow = newwindow.document
newwindow.write(temp);
}