/* form validation and document ready script */

$(document).ready(function(){

	
	
	$("a[rel='set1']").colorbox({opacity:0.92});
	$("a[rel='set2']").colorbox({opacity:0.92});
	$("a[rel='set3']").colorbox({opacity:0.92});
	$("a[rel='set4']").colorbox({opacity:0.92});
	$("a[rel='set5']").colorbox({opacity:0.92});
	$("a[rel='set6']").colorbox({opacity:0.92});
	$("a[rel='set7']").colorbox({opacity:0.92});
	$("a[rel='set8']").colorbox({opacity:0.92});
	$("a[rel='set9']").colorbox({opacity:0.92});
	$("a[rel='set10']").colorbox({opacity:0.92});
	$("#name").focus();
});

function validateField(inField)	// returns true if invalid
{
	if(inField.value=="" || inField.value==null)
	{
		return true;
	}
	else return false;
}

function validateForm()
{
	var field1 = document.getElementById('name');
	var field2 = document.getElementById('email');
	var field3 = document.getElementById('message');
	
	if(validateField(field1))
	{
		field1.style.background = 'yellow'; 
	}
	if(validateField(field2))
	{
		field2.style.background = 'yellow'; 
	}
	if(validateField(field3))
	{
		field3.style.background = 'yellow'; 
	}
	
	if(validateField(field1)||validateField(field2)||validateField(field3))	//if error
	{	
			
			alert("Please complete the highlighted fields.");
			return false;
	}
	else
	{
		return true;
	}
}
