﻿// Get an element on the page by ID.
// Return null if the ID is not found.
function GetElement(id)
{
	var e = null;
	if (document.getElementById)
	{
		e = document.getElementById(id);
	}
	else if (document.all)
	{
		e = eval("window." + id);
	}
	else if (document.layers)
	{
		e = document.layers[id];
	}
	return e;
}

// Hide an element.
function HideElement(id)
{
	if (document.getElementById)
	{
		// This is the way the standards work.
		document.getElementById(id).style.display = "none";
	}
	else if (document.all)
	{
		// This is the way old MS IE versions work.
		document.all[id].style.display = "none";
	}
	else if (document.layers)
	{
		// This is the way NN4 works.
		document.layers[id].display = "none";
	}
}

// Show an element.
function ShowElement(id)
{
	if (document.getElementById)
	{
		// This is the way the standards work.
		document.getElementById(id).style.display = "block";
	}
	else if (document.all)
	{
		// This is the way old MS IE versions work.
		document.all[id].style.display = "block";
	}
	else if (document.layers)
	{
		// This is the way NN4 works.
		document.layers[id].display = "block";
	}
}


function ValidateEmail(str) 
{
	var pattern  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;

	if (pattern.test(str))
	{
		return true;
	}
	else 
	{
		return false;
	}
}