function FrontPage_Form1_Validator(theForm)
{

  if (theForm.first_name.value == "")
  {
    alert("Please enter a value for the \"First Name\" field.");
    theForm.first_name.focus();
    return (false);
  }

  if (theForm.first_name.value.length < 2)
  {
    alert("Please enter at least 2 characters in the \"First Name\" field.");
    theForm.first_name.focus();
    return (false);
  }

  if (theForm.last_name.value == "")
  {
    alert("Please enter a value for the \"Last Name\" field.");
    theForm.last_name.focus();
    return (false);
  }

  if (theForm.last_name.value.length < 2)
  {
    alert("Please enter at least 2 characters in the \"Last Name\" field.");
    theForm.last_name.focus();
    return (false);
  }

  if (theForm.email_addr.value == "")
  {
    alert("Please enter a value for the \"Email Address\" field.");
    theForm.email_addr.focus();
    return (false);
  }

  if (theForm.email_addr.value.length < 4)
  {
    alert("Please enter at least 4 characters in the \"Email Address\" field.");
    theForm.email_addr.focus();
    return (false);
  }

  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ0123456789-.~-_@";
  var checkStr = theForm.email_addr.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Please enter only letter, digit and \".~-_@ \" characters in the \"Email Address\" field.");
    theForm.email_addr.focus();
    return (false);
  }

  if (theForm.c_phone.value == "")
  {
    alert("Please enter a value for the \"Phone Number\" field.");
    theForm.c_phone.focus();
    return (false);
  }

  var checkOK = "0123456789--";
  var checkStr = theForm.c_phone.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Please enter only digit and \"-\" characters in the \"Phone Number\" field.");
    theForm.c_phone.focus();
    return (false);
  }

  if (theForm.comments.value == "")
  {
    alert("Please enter a value for the \"Comments\" field.");
    theForm.comments.focus();
    return (false);
  }
  return (true);
}

var currentImage = 0;
var totalImages = 8;
var viewSize = 4;

function moveToPrevious() 
{
	if (currentImage > 0) 
	{
		new Effect.Move('photos_in', { 
			x: 231, 
			y: 0, 
			duration: .7, 
			afterFinish: function(e) { 
				currentImage--;
			}, 
			transition: Effect.Transitions.sinoidal, 
			queue: { 
				position: 'end', 
				scope: 'global', 
				limit: 1 
			}
		});
	}
}

function moveToNext()
{
	if(currentImage < totalImages-viewSize)
	{
		
		new Effect.Move('photos_in', { 
			x: -231, 
			y: 0, 
			duration: .7, 
			afterFinish: function(e) { 
				currentImage++;
			}, 
			transition: Effect.Transitions.sinoidal, 		
			queue: { 
				position: 'end', 
				scope: 'global', 
				limit: 1 
			}
		});
	}
}

Array.prototype.shuffle = function (){ 
	for(var rnd, tmp, i=this.length; i; rnd=parseInt(Math.random()*i), tmp=this[--i], this[i]=this[rnd], this[rnd]=tmp);
};

function onAppear(first_image, second_image){		
	//document.getElementById('output').innerHTML += first_image +' '+ second_image +'<hr>';
	
	//swap the images so that the one that has been faded in is in the outer div
	//and the next one to be faded in is waiting in the invisible inner div...
	document.getElementById("bg_container").style.background = 'url('+first_image+') no-repeat top center';
	document.getElementById("bg_container-appear").style.display = 'none';
	document.getElementById("bg_container-appear").style.background = 'url('+second_image+') no-repeat top center';				
}

function Appear(pic_one_id, pic_two_id){
	
	var one_id, two_id;
	new Effect.Appear('bg_container-appear');
	
	one_id = pic_two_id;
			
	if(pic_two_id == pics_array.length-1)
		two_id = 0;
	else
		two_id = pic_two_id+1;
			
	pic_one = pics_array[one_id];
	pic_two = pics_array[two_id];
	
	setTimeout("onAppear('"+pic_one.src+"', '"+pic_two.src+"')", 3000);
	setTimeout("Appear("+one_id+", "+two_id+")", 4000);		
}
