$(function() {
	$('#slideshow').cycle({ fx: 'fade', timeout: 10000, speed: 500 });
	
	$("#contact-info").click(function(){
		urlstart = "jVumbacco";
		location.href="mailto:" + urlstart + "@comcast.net";
	});
	
	$('#txtPhone').mask('(999) 999-9999');
	$('#emailform label').each(function(i) {
		if ($(this).next('input').length > 0) {
			$(this).next('input').val($(this).text());
			var a = $(this).next('input').val();
			$(this).next('input').focus(function() {
				$(this).filter(function() {
					return $(this).val() == '' || $(this).val() == a;
				}).val('').addClass('focus');
			}).blur(function() {
				$(this).filter(function() {
					return $(this).val() == '';
				}).val(a).removeClass('focus');
			});
		} else {
			$(this).next('textarea').val($(this).text());
			var b = $(this).next('textarea').val();
			$(this).next('textarea').focus(function() {
				$(this).filter(function() {
					return $(this).val() == '' || $(this).val() == b;
				}).val('').addClass('focus');
			}).blur(function() {
				$(this).filter(function() {
					return $(this).val() == '';
				}).val(b).removeClass('focus');
			});
		}
	}).remove();
	
	$("#btnSend").click(function(){
		if($("#txtName").val() == "Full Name"){ $("#txtName").addClass("error"); }else{ $("#txtName").removeClass("error"); }
		if($("#txtEmail").val() == "Email Address"){ $("#txtEmail").addClass("error"); }else{ $("#txtEmail").removeClass("error"); }
		if(!(($("#txtEmail").val().indexOf(".") > 2) && ($("#txtEmail").val().indexOf("@") > 0))){ $("#txtEmail").addClass("error"); }else{ $("#txtName").removeClass("error"); }
		if($("#txtPhone").val() == "Phone Number"){ $("#txtPhone").addClass("error"); }else{ $("#txtPhone").removeClass("error"); }
		if($(".text").hasClass("error")){ return (false); }
	});
});
