function checkFlatwarePieces() {

if (!document.flatware.pieceName.value) {

alert("You did not enter a name for the flatware piece");
document.flatware.pieceName.focus();

return false;

}

}



function checkCustomerService() {

if (!document.CustomerServiceForm.ServiceEmail.value) {

alert("You did not enter an email address");
document.CustomerServiceForm.ServiceEmail.focus();

return false;

}

if (!document.CustomerServiceForm.ConfirmEmail.value) {

alert("You did not confirm your email address");
document.CustomerServiceForm.ConfirmEmail.focus();

return false;

}

if (document.CustomerServiceForm.ServiceEmail.value != document.CustomerServiceForm.ConfirmEmail.value) {

alert("You email address and confirm email address do not match");
document.CustomerServiceForm.ConfirmEmail.focus();

return false;

}

}



function checkContactForm() {

if (!document.contact.firstname.value) {

alert("You did not enter a first name");
document.contact.firstname.focus();

return false;

}

if (!document.contact.lastname.value) {

alert("You did not enter a last name");
document.contact.lastname.focus();

return false;

}

if (!document.contact.email.value) {

alert("You did not enter an email address");
document.contact.email.focus();

return false;

}

if (!document.contact.emailconfirm.value) {

alert("You did not confirm your email address");
document.contact.emailconfirm.focus();

return false;

}

if (document.contact.email.value != document.contact.emailconfirm.value) {

alert("You email address and confirm email address do not match");
document.contact.emailconfirm.focus();

return false;

}

if (!document.contact.description.value) {

alert("You did not enter a description");
document.contact.description.focus();

return false;

}

}



function checkInquiries() {

if (!document.contact.firstname.value) {

alert("You did not enter a first name");
document.contact.firstname.focus();

return false;

}

if (!document.contact.lastname.value) {

alert("You did not enter a last name");
document.contact.lastname.focus();

return false;

}

if (!document.contact.address.value) {

alert("You did not enter an address");
document.contact.address.focus();

return false;

}

if (!document.contact.city.value) {

alert("You did not enter a city");
document.contact.city.focus();

return false;

}

if (!document.contact.zip.value) {

alert("You did not enter a zip code");
document.contact.zip.focus();

return false;

}

if (!document.contact.email.value) {

alert("You did not enter an email address");
document.contact.email.focus();

return false;

}

if (!document.contact.confirmemail.value) {

alert("You did not confirm your email address");
document.contact.confirmemail.focus();

return false;

}

if (document.contact.email.value != document.contact.confirmemail.value) {

alert("You email address and confirm email address do not match");
document.contact.confirmemail.focus();

return false;

}

if (!document.contact.description.value) {

alert("You did not enter a description");
document.contact.description.focus();

return false;

}

}



function checkSellToUs() {

if (!document.contact.firstname.value) {

alert("You did not enter a first name");
document.contact.firstname.focus();

return false;

}

if (!document.contact.lastname.value) {

alert("You did not enter a last name");
document.contact.lastname.focus();

return false;

}

if (!document.contact.email.value) {

alert("You did not enter an email address");
document.contact.email.focus();

return false;

}

if (!document.contact.confirmemail.value) {

alert("You did not confirm your email address");
document.contact.confirmemail.focus();

return false;

}

if (document.contact.email.value != document.contact.confirmemail.value) {

alert("You email address and confirm email address do not match");
document.contact.confirmemail.focus();

return false;

}

if (!document.contact.description.value) {

alert("You did not enter a description");
document.contact.description.focus();

return false;

}

}



function getNewFlatwarePatterns(src) {

window.location.href = src;

}



function getVintageFlatwarePatterns(src) {

window.location.href = src;

}

<!--

function load() {

var load = window.open('http://www.alastaircrawford.com/php_uploads/email_friend.php?id='+document.url,'','scrollbars=no,menubar=no,height=500,width=450,resizable=yes,toolbar=no,location=no,status=yes');

//var load = window.open(document.url,'','scrollbars=no,menubar=no,height=500,width=450,resizable=yes,toolbar=no,location=yes,status=yes');

}

// -->



function validate_login_form ( )
{
    valid = true;

    if ( document.login_form.UserEmail.value == "" )
    {
        alert ( "Please fill in your Email Address." );
        document.login_form.UserEmail.focus();
        valid = false;
       	return valid;
    }
    

    return valid;
    form.submit();
}

function validate_reset_pass ( )
{
    valid = true;

    if ( document.login_form.username.value == "" )
    {
        alert ( "Please fill in your Email Address." );
        document.login_form.username.focus();
        valid = false;
       	return valid;
    }
    if ( document.login_form.password.value == "" )
    {
        alert ( "Please fill in your Password." );
        document.login_form.password.focus();
        valid = false;
        return valid;
    }
    if ((document.login_form.password.value.length < 4) || (document.login_form.password.value.length > 15)) 
    {
	alert ("The password is the wrong length.\n");
	document.login_form.password.focus();
	valid = false;
	return valid;
    }
    if ( document.login_form.password.value != document.login_form.password2.value)
    {
	alert ( "Please make sure both Password fields match" );
	document.login_form.password2.focus();
	valid = false;
	return valid;
    }
    

    return valid;
    form.submit();
}

function validate_form ( )
{
    valid = true;

	if ( document.contact_form.UserFName.value == "" )
	{
		alert ( "Please fill in your First Name." );
		document.contact_form.UserFName.focus();
		valid = false;
		return valid;
	}
	if ( document.contact_form.UserLName.value == "" )
	{
		alert ( "Please fill in your Last Name." );
		document.contact_form.UserLName.focus();
		valid = false;
		return valid;
	}
	if ( document.contact_form.UserEmail.value == "" )
	{
		alert ( "Please fill in your Email Address." );
		document.contact_form.UserEmail.focus();
		valid = false;
		return valid;
	}
	
	var checkEmail = "@.";
	var checkStr = document.contact_form.UserEmail.value;
	var EmailValid = false;
	var EmailAt = false;
	var EmailPeriod = false;
		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;
				}	
		}
		if (!EmailValid)
		{
			alert("The Email Address must contain an \"@\" and a \".\".");
			document.contact_form.UserEmail.focus();
			valid = false;
			return valid;
		}
		
	
	    return valid;
	    form.submit();
}

function validate_email_form ( )
	{
	    valid = true;
	
		if ( document.email_form.UserEmail.value == "" )
		{
			alert ( "Please fill in your Email Address." );
			document.email_form.UserEmail.focus();
			valid = false;
			return valid;
		}
		if ( document.email_form.FriendEmail.value == "" )
		{
			alert ( "Please fill in the email address of whom you wish to send this message." );
			document.email_form.FriendEmail.focus();
			valid = false;
			return valid;
		}
	
		var checkEmail = "@.";
		var checkStr = document.email_form.FriendEmail.value;
		var EmailValid = false;
		var EmailAt = false;
		var EmailPeriod = false;
			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;
					}	
			}
			if (!EmailValid)
			{
				alert("The Email Address must contain an \"@\" and a \".\".");
				document.email_form.FriendEmail.focus();
				valid = false;
				return valid;
			}
	
	
	    return valid;
	    form.submit();
}



function validate_product_form ( )
{
    valid = true;

    if ( document.addProduct_form.prodGroupId.value == "" )
    {
        alert ( "Please select a Product Group." );
        document.addProduct_form.prodGroupId.focus();
        valid = false;
       	return valid;
    }
    if ( document.addProduct_form.prodCategoryId.value == "" )
    {
        alert ( "Please select a Product Category." );
        document.addProduct_form.prodCategoryId.focus();
        valid = false;
        return valid;
    }
    if ( document.addProduct_form.prodName.value == "" )
    {
        alert ( "Please fill in the Product Name." );
        document.addProduct_form.prodName.focus();
        valid = false;
        return valid;
    }
    
    return valid;
    form.submit();
}

function validate_editproduct_form ( )
{
    valid = true;

    if ( document.editProduct_form.prodGroupId.value == "" )
    {
        alert ( "Please select a Product Group." );
        document.editProduct_form.prodGroupId.focus();
        valid = false;
       	return valid;
    }
    if ( document.editProduct_form.prodNameId.value == "" )
	{
	    alert ( "Please select a Product." );
	    document.editProduct_form.prodNameId.focus();
	    valid = false;
           return valid;
    }
    if ( document.editProduct_form.prodCategoryId.value == "" )
    {
        alert ( "Please select a Product Category." );
        document.editProduct_form.prodCategoryId.focus();
        valid = false;
        return valid;
    }
    if ( document.editProduct_form.prodName.value == "" )
    {
        alert ( "Please fill in the Product Name." );
        document.editProduct_form.prodName.focus();
        valid = false;
        return valid;
    }
    
    return valid;
    form.submit();
}

function validate_delete_product_form ( )
{
    valid = true;

    if ( document.deleteProduct_form.prodNameSelect.value == "" )
    {
        alert ( "Please select a Product for deletion." );
        document.deleteProduct_form.prodNameSelect.focus();
        valid = false;
       	return valid;
    }

   answer = confirm("Are you sure you want to delete this product?");
   
   	if (answer !=0)    
   	{     
	    return valid;
	    form.submit();
   	} else {
	    valid = false;
	    return valid;
   	}
}

function validate_hallmark_form ( )
{
    valid = true;

    if ( document.addHallmark_form.prodHallmark.value == "" )
    {
        alert ( "Please enter a Hallmark." );
        document.addHallmark_form.prodHallmark.focus();
        valid = false;
       	return valid;
    }

    
    return valid;
    form.submit();
}

function validate_designer_form ( )
{
    valid = true;

    if ( document.addDesigner_form.prodDesignerName.value == "" )
    {
        alert ( "Please enter a Designer." );
        document.addDesigner_form.prodDesignerName.focus();
        valid = false;
       	return valid;
    }

    
    return valid;
    form.submit();
}
