$(document).ready(function(){

	var myDate = new Date();
    $("#time").html(myDate.format('l F j, Y')); 	
	var a = $.cookie('welcome');
	
	if(a!="true"){
		$("#pop1").css("display","block");
	}
	else{
		$("#white1").css("display","none");
	    $("#white2").css("display","none");
	}
	
	var onMouseOutOpacity = 0.3;
	// Initialize Galleriffic Gallery
	$('#gallery').galleriffic('#thumbs-min', {
		delay:                  9000,
		imageContainerSel:      '#slideshow',
		controlsContainerSel:   '#controls',
		captionContainerSel:    '#caption',
		autoStart:               true,
		onTransitionOut:        function(callback) {
						$('#caption').slideUp(1000);
						$('#slideshow').fadeTo(1500, 0.1, callback);
		},
		onTransitionIn:         function() {
						$('#slideshow').fadeTo(2000, 1.0);
						setTimeout("$('#caption').slideDown(1000);",2000);
		},
		onChange:               function(prevIndex, nextIndex) {
						$('#thumbs-min ul li a').children('img')
							.fadeTo('fast', onMouseOutOpacity)
							.eq(nextIndex).fadeTo('fast', 1.0);

		},
		preloadAhead:           -1
	});
		
		$("a").click(function(){
			this.blur;
	    });
        
});
	
function swap(){
	        $.cookie('welcome', 'true', { expires: 1 });
			setTimeout("$('#pop2').fadeOut(1000)",2000);
			$("#pop1").fadeOut(1000);
			$("#pop2").css("display","block");
			setTimeout("$('#white1').fadeOut(1000)",3000);
			setTimeout("$('#white2').fadeOut(1000)",3000);
		
}

window.onload = init;

function init(){
	var a = $.cookie('welcome');
	if(a!="true") setTimeout("swap();",2000);
}
