jQuery(document).ready(function(){
	
	jQuery('.blank').click(function(){ window.open(this.href);return false });

	jQuery('#bok, .cert-btn').prepend('<em></em>');
	jQuery('#nav ul a').prepend('<span>_ </span>');
	jQuery('#footer span a, #gobtns h3').prepend('<b></b>');	
	jQuery('#nav ul a').hover(
		function(){
			jQuery(this).stop().animate({'color' : '#000'}, 100);
		}, 
		function(){
			jQuery(this).stop().animate({'color' : '#336666'}, 300);	
	});			
	jQuery('#footer span a, #gobtns h3').hover(
		function(){
			jQuery(this).find('b').stop().fadeTo(300, 1);
		}, 
		function(){
			jQuery(this).find('b').stop().fadeTo(600, 0);
	});
	jQuery('#copy').hover(
		function() { jQuery(this).stop().animate({'right': '-30px'}, 900, 'easeOutCirc'); }, 
		function() { jQuery(this).stop().animate({'right': '-184px'}, 600, 'easeInCirc')
	});
	 
	jQuery('#enter-txt a strong').hover(
		function(){	
			jQuery(this).stop().animate({backgroundPosition:"(105px -29px)"}, {duration:600, easing:'easeInOutExpo'})
		}, 
		function(){			
			jQuery(this).stop().animate({backgroundPosition:"(105px 1px)"}, {duration:600, easing:'easeOutCubic'})			
	});
	
	jQuery('.cert-btn').hover(
		function(){
			jQuery(this).find('strong').stop().animate({'color' : '#fff'}, 150);			
			jQuery(this).find('em').stop().fadeTo(150, 1);			
		}, 
		function(){
			jQuery(this).find('strong').stop().animate({'color' : '#005B6B'}, 400);	
			jQuery(this).find('em').stop().fadeTo(400, 0);								
	});	
		
	jQuery('#enter-txt a').hover(
		function(){
			jQuery(this).stop().animate({'color' : '#ae0102'}, 150);			
			jQuery(this).find('em').stop().fadeTo(150, 0);			
		}, 
		function(){
			jQuery(this).stop().animate({'color' : '#fff'}, 400);	
			jQuery(this).find('em').stop().fadeTo(400, 1);								
	});	
	 
    if(jQuery("#sshow").length)
	{		 
	$('#sshow ul').cycle({
		fx: 'fade',
		timeout: 5000,
		speed: 1000
	});
	}
	
	jQuery('#btn-founded').click(function(){ jQuery('#home-box').animate({'left': '-490px'}, 1200, 'easeInOutExpo'); jQuery(this).addClass('active'); jQuery('#btn-events').removeClass('active');	});
	jQuery('#btn-events').click(function(){ jQuery('#home-box').animate({'left': '0px'}, 1200, 'easeInOutExpo'); jQuery(this).addClass('active');	jQuery('#btn-founded').removeClass('active');});
		
	jQuery('#btn-close-video').click(function(){ jQuery('#video').animate({'top': '-100%'}, 1200, 'easeInOutExpo'); jQuery('#btn-video').removeClass('active'); });	
	jQuery('#btn-video').click(function(){ jQuery('#video').animate({'top': '0px'}, 1200, 'easeInOutExpo'); jQuery(this).addClass('active'); });
	
    if(jQuery("#drinks").length)	
	{
	jQuery("a[rel=lbx]").fancybox({
					'transitionIn'		: 'fade',
					'transitionOut'		: 'none',
					'titlePosition' 	: 'over',
					'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
						return '<span id="fancybox-title-over">' + (currentIndex + 1) + ' / ' + currentArray.length;
			}
	});	
	}
    if(jQuery("#content").length)	
	{	
	jQuery("#mcs_container").mCustomScrollbar("vertical",400,"easeOutCirc",1.05,"auto","yes","yes",10);		
	jQuery("#mcs_container2").mCustomScrollbar("vertical",400,"easeOutCirc",1.05,"auto","yes","yes",10);	
	jQuery("#mcs_container3").mCustomScrollbar("vertical",400,"easeOutCirc",1.05,"auto","yes","yes",10);	
			
	$("#ep").fancybox({
		'width'				: 700,
		'height'			: 410,
        'autoScale'     	: false,
        'transitionIn'		: 'fade',
		'scrolling'			: 'no',
		'transitionOut'		: 'fade',
		'type'				: 'iframe'
	});
	}
    if(jQuery("#ccoptin").length)
	{		
	 jQuery("#ccoptin").validate();		
	}
    if(jQuery("#form").length)
	{		
	 jQuery("#form").validate();
	}	
    if(jQuery("#icpsignup2589").length)
	{		
	 jQuery("#icpsignup2589").validate();
	}		
	
	tooltip();
	tooltipL();	
	screenshotPreview();
	checkAge();
	
  // Reset Font Size
  var originalFontSize = $('html').css('font-size');
    $(".resetFont").click(function(){
    $('html').css('font-size', originalFontSize);
  });
  // Increase Font Size
  $(".increaseFont").click(function(){
    var currentFontSize = $('html').css('font-size');
    var currentFontSizeNum = parseFloat(currentFontSize, 10);
    var newFontSize = currentFontSizeNum*1.2;
    $('html').css('font-size', newFontSize);
    return false;
  });
  // Decrease Font Size
  $(".decreaseFont").click(function(){
    var currentFontSize = $('html').css('font-size');
    var currentFontSizeNum = parseFloat(currentFontSize, 10);
    var newFontSize = currentFontSizeNum*0.8;
    $('html').css('font-size', newFontSize);
    return false;
  });
  

function checkAge()
{
	if(jQuery.cookie("of_age") != "true")
	{
		showPopup();
	}
}

function showPopup()
{
    if(jQuery("#nav").length)
	{	
 	   jQuery('body').prepend('<script type="text/javascript">window.location = "http://www.perfect1864vodka.com/"</script>'); 
	}
	jQuery("#bok").click(isOfAge);
	jQuery("#vexit").click(isNotOfAge);
}

function isOfAge(e)
{
	jQuery.cookie("of_age", "true", {expires: 1});
	jQuery('body').prepend('<script type="text/javascript">window.location = "http://www.perfect1864vodka.com/home"</script>'); 	
	e.preventDefault();
	return false;		
}

function isNotOfAge()
{
	jQuery.cookie("of_age", null);
}

/*
		jQuery('#events div:first, #buy .content div:first').css('display' , 'block');

	jQuery('#b2uy h3, #hom2e-btns h3').each(function() {
		var tis = jQuery(this), state = false, answer = tis.next('div').hide().css('height','auto').slideUp();
		tis.click(function() {
		  state = !state;
		  answer.slideToggle(state);
		  tis.toggleClass('active',state);
		});
	
*/
});
