// -------------------------------------------------------------------

// Open a sizable window with a parsed image name.
function OpenImagesizableWindow(thisWindowTitle, thisImage, thisWindowWidth, thisWindowHeight)
{		
         var thisWindowTitle = "Aaron Taylor & Associates";
	thisWindowWidth = thisWindowWidth + 20;
	thisWindowHeight = thisWindowHeight + 40;
	
	newWindow=window.open('','newWindow','width='+thisWindowWidth+',height='+thisWindowHeight+',scrollbars=yes, resizable, left=20,top=20');
	newWindow.document.open();
	newWindow.document.write("<html>");
	newWindow.document.write("<head>");
	newWindow.document.write("<title>"+thisWindowTitle+"</title>");
	newWindow.document.write('<LINK rel=stylesheet type="text/css" href="Stylesheets/clientStyles.css" title="style">');
	newWindow.document.write("</head>");
	newWindow.document.write("<body topmargin='10' leftmargin='10' rightmargin='10'>");
	newWindow.document.write("<center><img src='"+thisImage+"'><center><br>");
	newWindow.document.write('<center><a href="#" onclick="JavaScript:window.print();">[Print Photo]</a> &nbsp;&nbsp; <a href="#" onclick="JavaScript:window.close()">[Close Photo]</a></center>');
	newWindow.document.write("</body>");
	newWindow.document.write("</html>");
	newWindow.document.close();
	newWindow.focus();
}

// -------------------------------------------------------------------

// Check for a valid email address.
function IsEmailAddr(email)
{
  var result = false
  var theStr = new String(email)
  var index = theStr.indexOf("@");
  if (index > 0)
  {
    var pindex = theStr.indexOf(".",index);
    if ((pindex > index+1) && (theStr.length > pindex+1))
	result = true;
  }
  return result;
}

// -------------------------------------------------------------------

// Check all required fields have been entered on the Contact Us Form.
function ValidateContact() 
{
	  if (theContactForm("Full Name").value == "")
	    {
	    alert("Please enter your Name");
	    theContactForm("Full Name").focus();
	    return (false);
	    }

	  if (theContactForm("Email").value == "")
	    {
	    alert("Please enter your Email Address");
	    theContactForm("Email").focus();
	    return (false);
	    }
		
	  if (!IsEmailAddr(theContactForm("Email").value))
	    {
	    alert("Please enter a complete Email Address i.e. yourname@yourdomain.com");
	    theContactForm("Email").focus();
	    return (false);
	    }

	  if (theContactForm.Comments.value == "")
	    {
	    alert("Please enter your Comments");
	    theContactForm.Comments.focus();
	    return (false);
	    }

           else
             {
             alert("Thank you - your request will now be submitted.");
             return (true);
             }
}  

// -------------------------------------------------------------------
