// JavaScript Document// JavaScript Document

$(document).ready(function(){
						   
	// STOP IE6 FLICKER
	if ($.browser.msie && $.browser.version.substr(0,1)<7) { 
	
		document.execCommand('BackgroundImageCache', false, true);
		//$('.Logo').attr('src','Image/LogoIE6.gif')
	};
	
	
	
	$('input[title!=""]').hint();
	$('textarea[title!=""]').hint();
	
/*var windowWidth = $(window).width(); //retrieve current window width
	var windowHeight = $(window).height(); //retrieve current window height
	var documentWidth = $(document).width(); //retrieve current document width
	var documentHeight = $(document).height(); //retrieve current document height
	var vScrollPosition = $(document).scrollTop(); //retrieve the document scroll ToP position
	var hScrollPosition = $(document).scrollLeft(); //retrieve the document scroll Left position


function onm_window_parameters(){ //called on viewer reload, screen resize or scroll

    windowWidth = $(window).width(); //retrieve current window width
    windowHeight = $(window).height(); //retrieve current window height
    documentWidth = $(document).width(); //retrieve current document width
    documentHeight = $(document).height(); //retrieve current document height
    vScrollPosition = $(document).scrollTop(); //retrieve the document scroll ToP position
    hScrollPosition = $(document).scrollLeft(); //retrieve the document scroll Left position

};*/
	
	/*calc = $(window).scrollLeft()+$(window).width() - 273 ;
	  
	$('.Pear ').animate({ left: calc +"px" },{queue: false, duration: 0});
	 
	
	
	$(window).scroll(function(){
							  
	  //console.log($(window).scrollLeft()+$(window).width() +"px");
	  
	  calc = $(window).scrollLeft()+$(window).width() - 273 ;
	  
	  $('.Pear ').animate({ left: calc +"px" },{queue: false, duration: 0});
	  
	});
	
	
	$(window).resize(function() {
							  
	  //console.log($(window).width() +"px");
	  
	  calc = $(window).width() - 273 ;
	  
	  $('.Pear ').animate({ left: calc +"px" },{queue: false, duration: 0});
	  
	});*/

	
	///////////////////////
	
	
	
	
	
	$('#AgeCheckButton').click( function () {
										  
			if ( isNaN($(".AgeYear").val()) || isNaN($(".AgeMonth").val()) || isNaN($(".AgeDay").val()) ) {
				//console.log('ailo')
				DateFormat();
				return false;						  
			}
			var DateToPass = $('.AgeYear').val() +'.'+ $('.AgeMonth').val() +'.'+ $('.AgeDay').val();
			//console.log (DateToPass);
			
			var dob = Date.parse( DateToPass );
			//console.log (dob);
			
			var Birthday = dob.addYears(18);
			var DateToday = Date.today();	
			var DateTodayEight = Date.today().addYears(-18);
			//console.log ('Today - 18  = ' + DateTodayEight);
			//console.log ('Birthday plus 18 = ' +Birthday);
			//console.log ('Today is = ' + DateToday);
			
			
			
			
			
				if (  Date.today().compareTo(Birthday) == -1 )	{
					
					//$('.Message').html('Go away under 18');
					//console.log($(this).text("Under 18"));
					
					ageCheck();
					return false;
	
				} else {
					
					//$('.Message').html('Hello Over 18');				
					$('#AgeCheck').submit();
					
					return true;
	
					//console.log($(this).text(" Over 18"));
				}
			
			//console.log ( Date.today().compareTo(Birthday) );
			
	});
	
	///////////////////////
			  
	ageCheck = function() {

		Shadowbox.open({
			content:    'NoEntry.htm',
			player:     "iframe",
			title:      "Age Verification",
			height:     100,
			width:      450
		});

	};

	DateFormat = function() {

    
		Shadowbox.open({
			content:    'NoEntryDateError.htm',
			player:     "iframe",
			title:      "Please Check",
			height:     100,
			width:      450
		});

	};
	
	
});


// JavaScript Document

/**
* @author Remy Sharp
* @url http://remysharp.com/2007/01/25/jquery-tutorial-text-box-hints/
*/

(function ($) {
	$.fn.hint = function (blurClass) {	
	
	
		if (!blurClass) { 
			blurClass = 'blur';
		}			
		return this.each(function () {	
								   		   
			// get jQuery version of 'this'
			var $input = $(this),				
			// capture the rest of the variable to allow for reuse
			title = $input.attr('title'),		
			$form = $(this.form),
			$win = $(window);
			//console.log('title=' + title);
			$(this).val('');
			function remove() {
				if( $(this).val() == title) {
					$(this).val('');
				};				
				$input.addClass(blurClass);				
			}	
			
			// only apply logic if the element has the attribute
			if (title) {
			
				// on blur, set value to title attr if text is blank
				$input.blur(function () {
					$input.removeClass(blurClass);					
					if( $(this).val() == '') {						
						$(this).val(title);					
					}					
				}).focus(remove).blur(); // now change all inputs to title			
			};
		});
	};
})(jQuery);




