function validate_form(thisform)
{
	with (thisform)
	{
		var result = true;
		var emailvalidate = document.getElementById("emailvalidate");
		emailvalidate.innerHTML = "";
	  
		if (thisform.custom.value.length > 0)
		{
			if (validate_email(thisform.custom, emailvalidate, "Not a valid e-mail address!" )==false) result = false;
		}

		if (result)
		{
			MySwapImageRestore();
		}
	
		return result;
	}
}

function changeStyle(id, newValue)
{
	document.getElementById(id).style.display = newValue;
}

function displayDemo()
{
	if (document.getElementById)
	{
		changeStyle('popupDiv', 'inline');
		return false;
	}
	else
	{
		return true;
	}
}

function hideDemo()
{
	changeStyle('popupDiv', 'none');
	return false;
}

function ClearImageBarHighlight(thisObj, webRoot)
{
  thisObj.parentNode.style.backgroundImage = "url('"+webRoot+"images/imagebar.gif')";
}

function SetActiveTile(thisObj, imageNum, webRoot)
{
  thisObj.parentNode.style.backgroundImage = "url('"+webRoot+"images/imagebarlit.gif')";
  
  var imageFile = webRoot+"images/original" + imageNum + ".gif";
  var backgroundImage = "url('" + imageFile + "')";

  document.getElementById("originalImage").src = imageFile;
  document.getElementById("tiledOriginal").style.backgroundImage = backgroundImage;

  imageFile = webRoot+"images/tile" + imageNum + ".gif";
  backgroundImage = "url('" + imageFile + "')";
  
  document.getElementById("seamlessTileImage").src = imageFile;
  document.getElementById("tiledSeamless").style.backgroundImage = backgroundImage;
}


