var product=0; // false
var application=0; // false
var productImage;
var appImage;
function getURL()
{
var j = 0;
var i = 0;
address = window.location + 0;

	for (i = 0; i < address.length; i++)
	{
		if(address.charAt(i) == "/")
		{
			j++;
		}
	}

	if(j == 5)
	{
		productImage = 'images/products.gif';
		appImage = 'images/applications.gif';
	}
	else if(j == 6)
	{
		productImage = '../images/products.gif';
		appImage = '../images/applications.gif';
	}
}
function nameon(text)
{
document.getElementById('text').innerHTML=text
}
function nameout()
{
document.getElementById('text').innerHTML=" "
}
function moveback(id,image)
{
	if(id == 'products')
	{
		if((product == 0) && (application == 0))
		{
			document.getElementById(id).src=image;
			product = 1;
		}
		else if(product == 1)
		{
			;
		}
		else if(application == 1)
		{
			document.getElementById('applications').src=appImage;
			document.getElementById(id).src=image;
			application = 0;
		}
	}
	else if(id == 'applications')
	{
		if((application == 0) && (product == 0))
		{
			document.getElementById(id).src=image;
			application = 1;
		}
		else if (application == 1)
		{
			;
		}
		else if(product == 1)
		{
			document.getElementById('products').src=productImage;
			document.getElementById(id).src=image;
			product = 0;
		}
	}
	else // id != applications or product
	{
//		alert(id,product,application);

		if((application == 0) && (product == 0))
		{
			document.getElementById(id).src=image;
		}
		else if((id == 'beer1') || (id == 'wine1') || (id == 'solkafloc') || (id == 'alphacel'))
		{
			document.getElementById(id).src=image;
		}
		else
		{
			if(product == 1)
			{
				document.getElementById('products').src=productImage;
				document.getElementById(id).src=image;
				product = 0;
			}
			else(application == 1)
			{
				document.getElementById('applications').src=appImage;
				document.getElementById(id).src=image;
				application = 0;
			}
		}
	}
}
function hideAll()
{
	if(product == 1)
	{
		document.getElementById('products').src=productImage;
		product = 0;
	}
	else if(application == 1)
	{
		document.getElementById('applications').src=appImage;
		application = 0;
	}
hide();
}
function moveover(id,image)
{
document.getElementById(id).src=image;
}
function bgChange(bg)
{
document.body.style.background=bg
}
function change()
{
document.body.style.background='#ffffff';
}
function display(name)
{
hide();
document.getElementById(name).style.visibility="visible";
}
function hide()
{
document.getElementById("menu1").style.visibility="hidden";
document.getElementById("menu2").style.visibility="hidden";
}
function gray_all(id)
{
document.getElementById('filtration').style.filter="gray()";
document.getElementById('cheese').style.filter="gray()";
document.getElementById('food').style.filter="gray()";
document.getElementById('pharm').style.filter="gray()";
document.getElementById('petfood').style.filter="gray()";
document.getElementById('industrial').style.filter="gray()";
document.getElementById(id).style.filter="color()";
}
function color_all()
{
document.getElementById('filtration').style.filter="color()";
document.getElementById('cheese').style.filter="color()";
document.getElementById('food').style.filter="color()";
document.getElementById('pharm').style.filter="color()";
document.getElementById('petfood').style.filter="color()";
document.getElementById('industrial').style.filter="color()";
}
function checkAll()
{
	var my_address = document.contactform.emailaddr.value;
        var pos = my_address.search(/\S+@\S+(\.org|\.net|\.com|\.edu)/);

	if(document.contactform.fname.value == "")
	{
		alert("Need to enter a first name")
		document.contactform.fname.focus();
		return false;
	}
	else if(document.contactform.lname.value == "")
	{
		alert("Need to enter a last name")
		document.contactform.lname.focus();
		return false;
	}
	else if(document.contactform.jobtitle.value == "")
	{
		alert("Need to enter a job title")
		document.contactform.jobtitle.focus();
		return false;
	}
	else if(document.contactform.company.value == "")
	{
		alert("Need to enter a company name")
		document.contactform.company.focus();
		return false;
	}
	else if(document.contactform.emailaddr.value == "")
	{
		alert("Need to enter an email address")
		document.contactform.emailaddr.focus();
		return false;
	}
	else if(pos != 0){
                alert("You must enter a valid email address (" +
                       my_address + ") is not in correct form.");
                document.contactform.emailaddr.focus();
                document.contactform.emailaddr.select();
                return false;
        }
	else
		return true;
}
