// misc preload
preloaded_imgs = new Array();
preloaded_imgs.push('/images/arrow-left-over.gif', '/images/arrow-right-over.gif');
for( var itr = 0; itr < preloaded_imgs.length; itr++ ) {
	var loc = preloaded_imgs[itr];
	preloaded_imgs[itr] = new Image();
	preloaded_imgs[itr].src = loc;
}
// preload scolling photo sample images
var photo_sample_img_itr = 1;
var photo_sample_img_count = 5;

function sample_scroll(direction) {
	photo_sample_img_itr += direction;
	
	if(photo_sample_img_itr<0)
	{
		photo_sample_img_itr = 0;
		return;
	}
	else if(photo_sample_img_itr>photo_sample_img_count-2)
	{
		photo_sample_img_itr = photo_sample_img_count-2;
		return;
	}
	
	for(i=0; i<photo_sample_img_count; i++)
	{
		document.getElementById('photosample'+(i+1)).style.display = 'none';
	}
	
	document.getElementById('photosample'+(photo_sample_img_itr+1)).style.display = 'inline';
	document.getElementById('photosample'+(photo_sample_img_itr+2)).style.display = 'inline';
	
	if(photo_sample_img_itr==0)
	{
		document.getElementById('photosampleN').style.visibility = 'hidden';
	}
	else if(photo_sample_img_itr==photo_sample_img_count-2)
	{
		document.getElementById('photosampleP').style.visibility = 'hidden';
	}
	else 
	{
		document.getElementById('photosampleN').style.visibility = 'visible';
		document.getElementById('photosampleP').style.visibility = 'visible';
	}
}

function ctf(theText) 
{
	if (theText.value == theText.defaultValue) 
	{
		theText.value = "";
	}
}

function rtf(theText) 
{
	if (theText.value == "") 
	{
		theText.value = theText.defaultValue;
	}
}

function isValidSignUp(the_form)
{
	if(!isValidEmail(the_form.email.value))
	{
		alert('Please enter a valid e-mail address.');
		the_form.email.focus();
		return false;
	}
	return true;
}

function isValidEmail(the_email) 
{
	var emailFilter=/^.+@.+\..{2,3}$/;
	var illegalChars= /[\(\)\<\'\>\,\;\:\\\/\"\[\]]/;
	if (!emailFilter.test(the_email) || the_email.match(illegalChars)) 
	{
		return false;
	}
	return true;
}