$(function() {
	$('.rollover').hover(function() {
		var currentImg = $(this).attr('src');
		$(this).attr('src', $(this).attr('hover'));
		$(this).attr('hover', currentImg);
	}, function() {
		var currentImg = $(this).attr('src');
		$(this).attr('src', $(this).attr('hover'));
		$(this).attr('hover', currentImg);
	});
});

var image = '';
function bkgndImage(page,secpage) {
	if (page=='aboutus') {
		if (secpage == 'bios')
			image = cycleImgs[1];
		else
			image = cycleImgs[0];
	}
	else if (page=='1')
		image = cycleImgs[2];
	else if (page=='2')
		image = cycleImgs[6]; // 'images/aboutusbackground.jpg';
	else if (page=='3')
		image = cycleImgs[7]; // 'images/clientsbackground.jpg';
	else if (page=='4')
		image = cycleImgs[8]; // 'images/awardsbackground.jpg';
	else if (page=='clients')
		image = cycleImgs[3];
	else if (page=='awards')
		image = cycleImgs[4];
	else if (page=='visionbook')
		image = cycleImgs[5];
	$.backstretch(image, {speed: 200});
	$('.homesidemenu').fadeIn(300);
	$('.homesidetitles').fadeIn(300);
	$('#content').fadeIn(300);
}

function showtitle () {
	alert(projectTitles[0]);
}


var currentImg;
function showtitle (indx) {
	currentImg = $('#tst1').html();
	$('#tst1').html(projectTitles[indx]);
}
function showprev () {
		$('#tst1').html(currentImg);
}


function validate_email(field,alerttxt) {
	with (field) {
		apos=value.indexOf("@");
		dotpos=value.lastIndexOf(".");
		if (apos<1||dotpos-apos<2) {
			alert(alerttxt);return false;
		}
		else {
			return true;
		}
	}
}

$(function() {
	$(".submit_btn").click(function() {

		var lastname = $("input#lastname").val();
		if (lastname == "") {
			$("input#lastname").focus();
			alert("Please fill out your last name");
			return false;
		}

		var street = $("input#street").val();
		if (street == "") {
			$("input#street").focus();
			alert("Please fill out your street address");
			return false;
		}

		var city = $("input#city").val();
		if (city == "") {
			$("input#city").focus();
			alert("Please fill out your city");
			return false;
		}

		var state = $("input#state").val();
		if (state == "") {
			$("input#state").focus();
			alert("Please fill out your state");
			return false;
		}

		var phonenum = $("input#phonenum").val();
		if (phonenum == "") {
			$("input#phonenum").focus();
			alert("Please fill out your phone number");
			return false;
		}

		document.contact.submit();

	});
});

$(function() {
	$(".submit_btn2").click(function() {

		var lastname2 = $("input#lastname2").val();
		if (lastname2 == "") {
			$("input#lastname2").focus();
			alert("Please fill out your last name");
			return false;
		}

		var phonenum2 = $("input#phonenum2").val();
		if (phonenum2 == "") {
			$("input#phonenum2").focus();
			alert("Please fill out your phone number");
			return false;
		}

		document.contactvb.submit();

	});
});

