/*  jQUERY CUSTOM FUNCTION 
------------------------------------------------------------------------------------------------------------------------------------------- */
jQuery(document).ready(function($) {
	// Suferfish Menu
	$('ul#menu-top-menu').superfish({
		delay:       350,                            // one second delay on mouseout
		animation:   { height:'show' },              // fade-in and slide-down animation
		speed:       'fast',                         // faster animation speed
		autoArrows:  false,                          // disable generation of arrow mark-up
		disableHI:   true,
		dropShadows: false                           // disable drop shadows
	});
	// Back to top
	$(window).scroll(function() {
		if($(this).scrollTop() != 0) {
			$('.scroll').fadeIn();	
		} else {
			$('.scroll').fadeOut();
		}
	});
	$(".scroll").click(function(){
		var full_url = this.href;
		var parts = full_url.split("#");
		var trgt = parts[1];
		var target_offset = $("#"+trgt).offset();
		var target_top = target_offset.top;
		$('html, body').animate({scrollTop:target_top}, 1000);
	});
	
	// External Links Open in New Windows
	$("a[rel='external']").bind("click.external", function(){
		window.open(this.href);
		return false;
	});
	
	// Slides
	$('#slider').slides({
		preload: true,
		preloadImage: 'wp-content/themes/scfiregrill/images/loading.gif',
		container:'slideshow',
		effect: 'fade',
		crossfade: true,
		fadeSpeed: 650,
		hoverPause:false,
		play:5000,
		pause:1000,
		generateNextPrev: true,
		generatePagination: true
	});
	
	// Lightbox with PrettyPhoto
	$("a[rel^='lightbox']").prettyPhoto({
		animationSpeed:'slow',
		theme:'dark_square', 
		overlay_gallery:false, 
		allow_resize:false, 
		opacity:0.70, 
		show_title:false
	});
	$('#opentable').click(function(){
		var urls = $(this).val();
		if (urls=='#') {
		$('#reserver_url').attr({
			'href' : urls,
			'target' : '_self'
			});
		} else {
		$('#reserver_url').attr({
			'href' : urls,
			'target' : '_blank'
			});
		}
	});
});

