//**********************************************************************************************************************
/**
* COMPANY: Zipline Interactive
* EMAIL: infon@gozipline.com
* PHONE: 509-321-2849
* DESCRIPTION: This document contains programming required for the website templates.  Requires the jQuery library.
*/
//***********************************************************************************************************************


//***********************************************************************************************************************
//ON DOCUMENT READY FUNCTIONS
//***********************************************************************************************************************
$(function() {
	
	if($('.js_height_fix > div').width() < 700)
	{
		$('.js_height_fix > div').height($('.js_height_fix').height());
	}
	$('.js_height_fix2_child').height($('.js_height_fix2').height());

	$('#email').bind('blur', function(){
		if($(this).val() == '') {
			$(this).val('Your Email');
		}
	});
	$('#email').bind('focus', function(){
		if($(this).val() == 'Your Email') {
			$(this).val('');
		}
	});
	/*********EMAIL ALERT************/
	$('.close_alert').click(function() {
		$('.valid_email_alert_con').css('display','none');
		$('.backdrop').css('display','none');
	});
	
	
	/*********WINE POPUPS************/
	
	$('.js_popup1').hover(function() {
		$('.wine_month_popup').show(0);
	},
	function() {
		$('.wine_month_popup').hide(0);
		}
	);
	$('.js_popup2').hover(function() {
		$('.wine_discount_popup').show(0);
	},
	function() {
		$('.wine_discount_popup').hide(0);
		});
		
	/**
	 * Order Now Code
	 */
	$('a[href="#ordernow"]').click(function() {
		$('.wine_month_overlay').show();
		$('.wine_of_month').show();
		$('#interest').val($('.title_of_post').text());
	});
	
	$('.wine_month_overlay').click(function() {
		$('.wine_month_overlay').hide();
		$('.wine_of_month').hide();
	})
	
	$('.wine_close').click(function() {
		$('.wine_month_overlay').hide();
		$('.wine_of_month').hide();
	})
	
	$(window).keypress(function(e) {
		//alert(e.charCode);
		var code = e.keyCode;
		if (code == 0) {
			code = e.charCode;
		}
		
		if (code == 27 && $('.wine_of_month').css('display') == 'block') {
			$('.wine_month_overlay').hide();
			$('.wine_of_month').hide();
		}
	});
});
