		$(document).ready(function () {
				var tabContainers = $('div.tab-container > div');
				tabContainers.hide().filter(':first').show();

				$('div.tab-container ul.tab-nav a').click(function () {
						tabContainers.hide();
						tabContainers.filter(this.hash).fadeIn();
						$('div.tab-container ul.tab-nav a').removeClass('selected');
						$(this).addClass('selected');
						return false;
				}).filter(':first').click();
		});
		
		
		
	$(document).ready(function(){
		 $("span.popup-holder").mouseover(function(){
				$(this).find("span.popup").show();
			});
		 
			$(this).mouseout(function(){
				$("span.popup").hide();
			});
		});

Cufon.replace('h1');
Cufon.replace('h2');
Cufon.replace('h3');
Cufon.replace('h4');
Cufon.replace('.table-container th');
Cufon.replace('.vh1');
Cufon.replace('.vh2');

$(function() {
$('input[title]').blur(function() {
		if ($(this).val() == '') {
				$(this).addClass('hinting').val($(this).attr('title'));
				$(this).one('focus',
				function() {
						$(this).removeClass('hinting').val('');
				});
		}
}).trigger('blur');

});


$(document).ready(function() {
$('.slideshow').cycle({
		fx: 'fade',
		speed: 600,
		timeout: 9000,
		next: '.label-image',
		cleartypeNoBg: 'false'

});
var flashFile = '/flash/Home/slideshow.swf';
	var flashvars = {};
	var params = {};
	params.wmode = "opaque";
	var attributes = {};
	swfobject.embedSWF(flashFile, "flash-container", "1152", "549", "9.0.0", false, flashvars, params, attributes);
});

$(document).ready(function() {
	$('div.drop-down').click(function() {
			if ($(this).is(".search-on")) return;
			$(this).find("ul").stop(true).show().animate({
					height: 130,
					opacity: 1
			},
			100);
			$(this).addClass("search-on");

	});
	$('div.drop-down').mouseleave(function() {
			var me = $(this);
			if (me.is(":not(.search-on)")) return;

			me.find("ul").stop(true).show().animate({
					height: 0,
					opacity: 1
			},
			100,
			function() {
					me.removeClass("search-on");

			});
	});
	var mailingList = '';
	$('#general').click(function() {
		mailingList = 'MailingList';
		$('.optionSelect').html('Any news');
	});
	
		
	$('#sub').click(function() {
	  var name = $('#full_name').val();
      	  var email = $('#email').val();
          var street = $('#street').val();
          var city = $('#city').val();
          var state = $('#state').val();
          var zip = $('#zip').val();
          var phone = $('#phone').val();
 	  var fax = $('#fax').val();
          var cell = $('#cell').val();
          var wherewine = $('#wherewine').val();
          var restaurants = $('#restaurants').val()
         
		if (email == 'Enter a valid email address' || name == '' || name == 'Enter Your Name' || email == ''){
			$('#hidUpdateSuccess').html("You must select input both name and email address to proceed");
	  	} else {
			with (email) {
		  	  apos=email.indexOf("@");
			  dotpos=email.lastIndexOf(".");
			  if (apos<1||dotpos-apos<2) {
				$('#hidUpdateSuccess').html("You have not entered a valid email address");
				return false;
			  } else {
				$.ajax({
			          url: "/subscribe_newsletter.php",
			          type: "POST",
			          data: {"name":name, "email": email, "street":street, "city":city, "state":state, "zip":zip, "phone":phone, "fax":fax, "cell":cell, "wherewine":wherewine, "restaurants":restaurants, "newsletter_name":'MailingList'},
			          success: function() {
			            $('#subscribe').hide();
						$('#hidError').html("");
						$('#hidUpdateSuccess').html("You have successfully been added to the mailing list. Check your email for news updates from WWHQ.");
						return true;
			          }
			        });
			  }
		  }
	   }
      return false;
    });
	
	$('#Submit').click(function() {
		var name = $('#contact_full_name').val();
		var email = $('#contact_email').val();
		var type = $('#enquiry_type').val();
		var phone = $('#phone').val();
		var message = $('#contact_message').val();
		if (email == '' || name == '' || type == '' || message == ''){
			$('#hidContactSuccess').html("You must select input a name, contact email address, enquiry type and message to proceed");
		} else {
			with (email) {
			  	  apos=email.indexOf("@");
				  dotpos=email.lastIndexOf(".");
				  if (apos<1||dotpos-apos<2) {
					$('#hidContactSuccess').html("You have not entered a valid email address<br>");
					return false;
				  } else {
					$.ajax({
				          url: "/contact_submit.php",
				          type: "POST",
				          data: {"name":name, "email": email, "type":type, "message":message, "phone":phone},
				          success: function() {
				            $('#contact_form').hide();
							$('#hidContactSuccess').html("Your enquiry has been sent. Thank you for contacting WWHQ.");
							return true;
				          }
				        });
				  }
			  }
		}
	});

});



