
$(document).ready(function() {
	$('.thumb').mouseover(
		function () {
			var prev = $(this).parent().parent().find('.viewer_on');
			var next = $(this).parent().parent().find('.viewer_off');
			
			next.attr('src', 'img/' + $(this).attr('image'));

			prev.removeClass('viewer_on').addClass('viewer_off');
			next.removeClass('viewer_off').addClass('viewer_on');

			prev.stop().animate({opacity:0,},400);
			next.stop().animate({opacity:1,},400);
		});								 

   $('input[type=text], textarea').focus(function() {
      if($(this).val() == $(this).attr('defaultValue')) {
         $(this).val('');
      }
   })
   .blur(function() {
      if($(this).val().length == 0) {
         $(this).val($(this).attr('defaultValue'));
      }
   });
   
   $('#00N30000006FlPK').val('Date:');

	$('.hover').hover(
		function () {
			$(this).children('.more').animate({opacity:1,},400);
		}, 
		function () {
			$(this).children('.more').animate({opacity:0,},400);
		}
	);
	// Expand Panel
	$("#newstoggle .open").click(function(){
		clearSlide();
		$("div#newspanel").slideDown("slow");
	});	
	
	// Collapse Panel
	$("#newstoggle .close").click(function(){
		$("div#newspanel").slideUp("slow");	
	});		
	
	// Switch buttons from "Log In | Register" to "Close Panel" on click
	$("#newstoggle a").click(function () {
		$("#newstoggle a").toggle();
	});		
	
	// Expand Panel
	$("#contacttoggle .open").click(function(){
		clearSlide();
		$("div#contactpanel").slideDown("slow");
		$("#map").gMap({ markers: [{ address: "1601 bayshore dr, bc, canada", html: "The Sunset Bay Yacht Group" }], zoom:14, controls: false, scrollwheel: true, });
	});	
	
	// Collapse Panel
	$("#contacttoggle .close").click(function(){
		$("div#contactpanel").slideUp("slow");	
	});		
	
	// Switch buttons from "Log In | Register" to "Close Panel" on click
	$("#contacttoggle a").click(function () {
		$("#contacttoggle a").toggle();
	});		
	
	
	$(".various").fancybox({
		maxWidth	: 400,
		maxHeight	: 600,
		fitToView	: false,
		width		: '100%',
		height		: '100%',
		autoSize	: false,
		closeClick	: false,
		openEffect	: 'none',
		closeEffect	: 'none'
	});
	$(".newsbox").fancybox({
		maxWidth	: 930,
		maxHeight	: 380,
		fitToView	: false,
		width		: '100%',
		height		: '100%',
		autoSize	: false,
		closeClick	: false,
		openEffect	: 'none',
		closeEffect	: 'none'
	});
});


jQuery(function($){
				
   var title = $('meta[name=Title]').attr("content");
	if( title  == "Home" ) {
	  $.supersized({ slideshow: 1,autoplay:1,
		start_slide             :   1,			// Start slide (0 is random)
		transition              :   6, 	min_width:   0,	min_height	:   0, vertical_center  :   1,	horizontal_center  :   1, fit_always:	0,	fit_portrait:   1,	fit_landscape:   0,	
		slide_links	:	'false',thumb_links				:	1,	thumbnail_navigation    :   0, slide_interval: 3000,	slides 	:  	[
											{image : 'img/yacht.jpg', title : 'The Sunset Bay Yacht Group', thumb : '', url : ''},
											{image : 'img/contact.jpg', title : 'The Corporate Yacht', thumb : '', url : ''},
											{image : 'img/wedding.jpg', title : 'The Wedding Yacht', thumb : '', url : ''},  
											{image : 'img/wine.jpg', title : 'The Wedding Yacht', thumb : '', url : ''}
									]
	  });
	}
	else if( title == "Services" ) {
	  $.supersized({ slideshow: 1,autoplay:0,
		start_slide             :   1,			// Start slide (0 is random)
		transition              :   6, 	min_width:   0,	min_height	:   0, vertical_center  :   1,	horizontal_center  :   1, fit_always:	0,	fit_portrait:   1,	fit_landscape:   0,	
		slide_links	:	'false',thumb_links				:	1,	thumbnail_navigation    :   0,	slides 	:  	[ 
											{image : 'img/vancouver4.jpg', title : 'The Wine Yacht', thumb : '', url : ''}	
									]
	  });
	}
	else if( title == "Yacht" ) {
	  $.supersized({ slideshow: 1,autoplay:0,
		start_slide             :   1,			// Start slide (0 is random)
		transition              :   6, 	min_width:   0,	min_height	:   0, vertical_center  :   1,	horizontal_center  :   1, fit_always:	0,	fit_portrait:   1,	fit_landscape:   0,	
		slide_links	:	'false',thumb_links				:	1,	thumbnail_navigation    :   0,	slides 	:  	[  
											{image : 'img/02.jpg', title : 'The Wine Yacht', thumb : '', url : ''}	
									]
	  });
	}
	else if( title == "Cuisine" ) {
	  $.supersized({ slideshow: 1,autoplay:0,
		start_slide             :   1,			// Start slide (0 is random)
		transition              :   6, 	min_width:   0,	min_height	:   0, vertical_center  :   1,	horizontal_center  :   1, fit_always:	0,	fit_portrait:   1,	fit_landscape:   0,	
		slide_links	:	'false',thumb_links				:	1,	thumbnail_navigation    :   0,	slides 	:  	[  
											{image : 'img/34.jpg', title : 'The Wine Yacht', thumb : '', url : ''}	
									]
	  });
	}
	else if( title == "Contact" ) {
	  $.supersized({ slideshow: 1,autoplay:0,
		start_slide             :   1,			// Start slide (0 is random)
		transition              :   6, 	min_width:   0,	min_height	:   0, vertical_center  :   1,	horizontal_center  :   1, fit_always:	0,	fit_portrait:   1,	fit_landscape:   0,	
		slide_links	:	'false',thumb_links				:	1,	thumbnail_navigation    :   0,	slides 	:  	[
											{image : 'img/20.jpg', title : 'The Wine Yacht', thumb : '', url : ''}	
									]
	  });
	}
	else if( title == "News" ) {
	  $.supersized({ slideshow: 1,autoplay:0,
		start_slide             :   1,			// Start slide (0 is random)
		transition              :   6, 	min_width:   0,	min_height	:   0, vertical_center  :   1,	horizontal_center  :   1, fit_always:	0,	fit_portrait:   1,	fit_landscape:   0,	
		slide_links	:	'false',thumb_links				:	1,	thumbnail_navigation    :   0,	slides 	:  	[
											{image : '../img/home.jpg', title : 'The Wine Yacht', thumb : '', url : ''}	
									]
	  });
	}
	else {
	  $.supersized({ slideshow: 1,autoplay:0,
		start_slide             :   1,			// Start slide (0 is random)
		transition              :   6, 	min_width:   0,	min_height	:   0, vertical_center  :   1,	horizontal_center  :   1, fit_always:	0,	fit_portrait:   1,	fit_landscape:   0,	
		slide_links	:	'false',thumb_links				:	1,	thumbnail_navigation    :   0,	slides 	:  	[ 
											{image : 'img/home.jpg', title : 'The Wine Yacht', thumb : '', url : ''}	
									]
	  });
	}

}); 
function clearPanel() {
		$("div#contactpanel").slideUp("slow");	
		$("div#newspanel").slideUp("slow");	
}

function clearSlide() {
	$('.currentSlide').stop().animate({
	  opacity: 0,
	  /*top: '-=50',*/
	}, 1000, function() {
	  // Animation complete.
	}).removeClass('currentSlide');
}

function goCorporate() {
  if(vars.current_slide != 1 && !vars.in_animation) {
	api.goTo(2);
	clearPanel();
	$('.currentSlide').animate({
	  opacity: 0,
	  /*top: '-=50',*/
	}, 1000, function() {
	  // Animation complete.
	}).removeClass('currentSlide');
	/*
	$('#corporate').addClass('currentSlide').animate({
	  opacity: 1,
	  top: '+=50',
	}, 1000, function() {
	  // Animation complete.
	});
	*/
	$('#corporate').addClass('currentSlide').animate({
	  opacity: 1,
	}, 1000, function() {
	  // Animation complete.
	});
  }
}
function goWedding() {
  if(vars.current_slide != 2 && !vars.in_animation) {
	api.goTo(3);
	clearPanel();
	$('.currentSlide').animate({
	  opacity: 0,
	  /*top: '-=50',*/
	}, 1000, function() {
	  // Animation complete.
	}).removeClass('currentSlide');
	/*
	$('#wedding').addClass('currentSlide').animate({
	  opacity: 1,
	  top: '+=50',
	}, 1000, function() {
	  // Animation complete.
	});
	*/
	$('#wedding').addClass('currentSlide').animate({
	  opacity: 1,
	}, 1000, function() {
	  // Animation complete.
	});
  }
}
function goWine() {
  if(vars.current_slide != 3 && !vars.in_animation) {
	api.goTo(4);
	clearPanel();
	$('.currentSlide').animate({
	  opacity: 0,/*
	  top: '-=50',*/
	}, 1000, function() {
	  // Animation complete.
	}).removeClass('currentSlide');
	/*
	$('#wine').addClass('currentSlide').animate({
	  opacity: 1,
	  top: '+=50',
	}, 1000, function() {
	  // Animation complete.
	});
	*/
	$('#wine').addClass('currentSlide').animate({
	  opacity: 1,
	}, 1000, function() {
	  // Animation complete.
	});
  }
}
function goService() {

}
function goYacht() {
	
}
function goCuisine() {
		api.goTo(7);
}
function goContact() {
		api.goTo(8);
}
