$(document).ready(function() {

  //main menu
  $('.products, #products_sub_menu').hover(function() {
    $(this).addClass("hover");
    $('#products_sub_menu').show();
  }, function () {
      $('.products').removeClass("hover");
      $('#products_sub_menu').hide();
  });

  $('#products_sub_menu').hover(function() {
    $('.products').addClass("hover");
  });

  $('#products_sub_menu').mouseleave(function(){
    $('.products').removeClass("hover");
  });

  $('.services, #services_sub_menu').hover(function() {
    $(this).addClass("hover");
    $('#services_sub_menu').show();
  }, function () {
      $('.services').removeClass("hover");
      $('#services_sub_menu').hide();
  });

  $('#services_sub_menu').hover(function() {
    $('.services').addClass("hover");
  });

  $('#services_sub_menu').mouseleave(function(){
    $('.services').removeClass("hover");
  });

  //forms
  /* default form values to their titles if nothing is set and make grey */
	$('form').find(':input').each(function() {
		var type = this.type;
		var tag = this.tagName.toLowerCase();
		if (type == 'text' || type == 'password' || tag == 'textarea'){
			if($(this).val() == '' || $(this).val() == $(this).attr('title')){
				$(this).val($(this).attr('title'));
				$(this).css('color', '#CCCCCC');
			}
		}
	});

	/* clear input values on form submit if user has not entered anything */
	$('form').submit(function() {    
		$(this).find(':input').each(function() {
			if($(this).val() == $(this).attr('title')){
				$(this).val('');
			};
		});
	});

	/* Form Input defaults */
	$("form input, form textarea").focus(function(){
		if($(this).val() == $(this).attr("title")){
			$(this).val("");
			$(this).css('color', '#000000');
		}
	});
	$("form input, form textarea").blur(function(){
		if($(this).val() == ""){
			$(this).css('color', '#cccccc');
			$(this).val($(this).attr("title"));

		}
	});

})
