$(document).ready(function() {
	
	$("#menu li ul").hide(); 

	$("#menu li").hover(
        function () {
		$(this).children("ul").show();
        },function(){
		$(this).children("ul").hide();
	});//hover

});// document ready
$(document).ready(function() {
    $('.slideshow').cycle({ 
		fx: 'fade', speed: '1000', timeout: '6000' // choose your transition type, ex: fade, scrollUp, shuffle, etc...
	});
	 $('.slideshow2').cycle({ 
		fx: 'fade', speed: '500', timeout: '4000', autostop: 1 // choose your transition type, ex: fade, scrollUp, shuffle, etc...
	});
	
	$('.default-value').each(function() {
 	   var default_value = this.value;
 	   $(this).css('color', '#666'); // this could be in the style sheet instead
 	   $(this).focus(function() {
       	 if(this.value == default_value) {
          	  this.value = '';
           	 $(this).css('color', '#333');
      	  }
   	 });
   	 
    $(this).blur(function() {
      if(this.value == '') {
            $(this).css('color', '#666');
            this.value = default_value;
            }
    });
});
$('#bSubmit').click(function () {
		errorMsg = "";

		if ($('#yourname').val() == "" || $('#yourname').val() == "Name")
		{
			errorMsg += "Name is a required field\n";
		}

		if ($('#email').val() == "" || $('#email').val() == "E-Mail")
		{
			errorMsg += "E-Mail is a required field\n";
		}

		if ($('#phone').val() == "" || $('#phone').val() == "Phone")
		{
			errorMsg += "Phone is a required field\n";
		}

		if ($('#url').val() == "" || $('#url').val() == "Website URL")
		{
			errorMsg += "Website URL is a required field\n";
		}

		if (errorMsg == "")
		{
			return true;
		}

		alert(errorMsg);
		return false;
	});

});
 
$(function() {
	$("#phone").keyup(function() {
		var curchr = this.value.length;
		var curval = $(this).val();
		if (curchr == 3) {
			$("#phone").val("(" + curval + ")" + "-");
		} else if (curchr == 9) {
			$("#phone").val(curval + "-");
		}
	});
	$("#phone").numeric();
});
