$(document).ready(function() {
	$('#expando').animate({'opacity' : '1'}, 1000);
	
	
	
	$('.fancybox').fancybox({
		'onComplete' : function() {
			$('img').mousedown(function(e) {
			e.preventDefault();
			return false;
		});
	},
		'transitionIn' : 'elastic',
		'transitionOut' : 'elastic',
		'overlayColor' : '#000000',
		'overlayOpacity' : '0.8',
		'titleShow' : true,
		 'titlePosition': 'inside',
		 'autoScale' : false
	});
	
	$('.openfancybox').click(function() {
	
		$('#firstimg').trigger('click');
		return false;
	})
	
	
	function countChecked() {
	
	var n = $("input:checked").length;
	$('#upcoming-wrapper li').removeClass('displayed_cats');
	
	
      	$('input:checked').each(function() {
			
			$val = $(this).val();
			
			$('#upcoming-wrapper li[rel~=' + $val + ']').addClass('displayed_cats');
			//$('.upcoming li').not('[rel~=' + $val + ']').removeClass('displayed_cats').addClass('hidden_restaurants');
			
			//$('.displayed_cats').show();
			//$('.hidden_restaurants').hide();
			//$('.upcoming li').show().not('[rel~=' + $val + ']').hide();
		
		});
		
		$('#upcoming-wrapper li').show().not('.displayed_cats').hide();
	  
    }
    countChecked();
    $('input:checkbox').click(countChecked);
	$count = 1;
	$('#my-meta-box-2 tr').each(function(key, value) {
		if(value == 3 || value == 4) {
			$(this).remove();
		}
	});
	
	$('.upload-file form').each(function(key, value) {
		$count = value;
	});
	
	$form = $('.upload-file').html();

	

	$('.upload-another').click(function(e) {
		if($('.add-fields').length <= 2) {
		$('.upload-file').append($form);
		$('.upload-another').remove();
		e.preventDefault();
		return false;
	}
	});
	
	$('.datepicker').datepicker();
	
	
	
	// var timer = setInterval( changeBackground, 6000);
	// $count = 1;
	// 
	// function changeBackground() {
	// 	if($count > 4) {
	// 		$count = 1;
	// 	}
	// 	
	// 	$image = $('#expando').attr('src');
	// 	
	// 	$('#expando').hide();
	// 	
	// 	$newimage = $image.substring(0, $image.length - 6) + '0' + $count + '.jpg';
	// 	
	// 	
	// 	
	// 	$('#expando').attr('src', $newimage).fadeIn(1500);
	// 	$count++;
	// }
	// 
	
	
	$(function () {
            var tabContainers = $('div.tabs > div');
            tabContainers.hide().filter(':first').show();

            $('div.tabs ul.tabNavigation a').click(function () {
                    tabContainers.hide();
                    tabContainers.filter(this.hash).show();
                    $('div.tabs ul.tabNavigation a').removeClass('selected');
                    $(this).addClass('selected');
					/*Cufon.replace('.tabNavigation li a', { hover:true, fontFamily: 'FranklinGothicDemi' });
					Cufon.now();*/
                    return false;
            }).filter(':first').click();
    });
	
	$('.cart-area').hover(function() {
		$('.price').css({'border-bottom' : '1px solid #c4c4c4' });
	}, function() {
		$('.price').css({'border' : 'none' });
	});
	


		/*$('.image-load img').hide();

		count = 0;//initialize
		int=0;//Internet Explorer Fix
		if($('.image-load img').length > 0) {
			$(window).bind("load", function() {//The load event will only fire if the entire page or document is fully loaded

				var int = setInterval("preload(count)",300);//500 is the fade in speed in milliseconds
			});
		}*/


	
});
//Cufon.replace('#home-posts h2', { hover:true, fontFamily: 'FranklinGothicDemi' });

function preload(count) {

 var images = $('.image-load img').length;//count the number of images on the page

 if (count >= images) {// Loop the images
 clearInterval(int);//When it reaches the last image the loop ends
 }
 	$('.image-load img:hidden').eq(0).fadeIn(500);//fades in the hidden images one by one
 count++;//add 1 to the count
}
jQuery(document).ready(function(){
    jQuery(document).bind("contextmenu",function(e){
    	  //alert('\u00a9 Bass Museum of Art. All rights reserved.');
        //return false;
    });
});
$(document).ready(function() {

	/*	$('img').mousedown(function(e) {
			e.preventDefault();
			return false;
		});*/
		
});

//var deluxeOpened = false;
//var deluxe_;

//$(document).ready(function() {
  // deluxe nav
  
//  $('li.deluxe').hover(function() {
	
//    $('.panel-menu div').hide();
//    var deluxe = $(this);
//    deluxe_ = deluxe;
//    $('li.deluxe').removeClass('on');
//    if(!deluxeOpened){
//	  // Opening for the first time
//	  timerId = setTimeout ("deluxeOpenFirst()", 300);	
//    } else {
//	  // Opening for the second time and after
//	  clearTimeout (timerId);
//	  clearTimeout (timerId2);
//      deluxeOpened = true;
//      $('.panel-menu').hide();
//      deluxe.children('.panel-menu').show();
//      $('.panel-menu div').show();
//      deluxe.addClass('on');
//    }
//  }, function() {
//	// Nav item rollout
//	clearTimeout (timerId);
//	timerId2 = setTimeout ("deluxeClose()", 400);
//  });
//});
//function deluxeOpenFirst () {
//  var deluxe = deluxe_;
//  deluxeOpened = true;
//  deluxe.addClass('on');
 // $('#menu-overlay').css('z-index', '1').show();
 // deluxe.children('.panel-menu').slideDown("slow",function(){
 //   if (!deluxeOpened) {
  //    $('.panel-menu').hide();
 //   } else {
 //     $('.panel-menu div').show();
 //   }

 //   $('#menu-overlay').hover(function() {
  //    $(this).hide();
 //     deluxeOpened = false;
 //     $('li.deluxe').removeClass('on');
 //     $('.panel-menu').hide();
   //   $(this).unbind();
   // }, function() {
    //});
  //});
//}

//function deluxeClose () {
    //$('#menu-overlay').hide();
    //deluxeOpened = false;
    //$('li.deluxe').removeClass('on');
    //$('.panel-menu').hide();
  //  $('#menu-overlay').unbind();
//}

