// JavaScript Document
$(document).ready(function(){
	$('#coin-slider').coinslider({ width: 970, height: 404, delay: 4000 });
	
	var img = $('.rotateCompass');
	if(img.length > 0){
		var offset = img.offset();
		function mouse(evt){
			var center_x = (offset.left) + (img.width()/2);
			var center_y = (offset.top) + (img.height()/2);
			var mouse_x = evt.pageX; var mouse_y = evt.pageY;
			var radians = Math.atan2(mouse_x - center_x, mouse_y - center_y);
			var degree = (radians * (180 / Math.PI) * -1) + 90; 
			//img.css('-moz-transform', 'rotate('+degree+'deg)');
			//img.css('-webkit-transform', 'rotate('+degree+'deg)');
			//img.css('-o-transform', 'rotate('+degree+'deg)');
			//img.css('-ms-transform', 'rotate('+degree+'deg)');
			img.rotate(degree);
		}
		$(document).mousemove(mouse);
	}
	
	$('#contactform').validate();
	
	$('#shipform').validate();
	
	$('#reserform').validate();
	
	$( "#arrival" ).datepicker();
	
	$( "#departure" ).datepicker();
	
  	$("a.ajx").fancybox({
		'autoDimensions'  : true,
		'autoScale'       : true,
		'width'           : 'auto',
		'height'          : 'auto',
		'scrolling'       : 'no',
		'padding'         : 0,
		'href'            : $(this).attr('href')
	});

	$("#lf_gallery").click(function(){
		$.fancybox(
			[
				{"title": "Laundry Facilities", "href": "./public/img/ad/lf/lf2.jpg"},
				{"title": "Laundry Facilities", "href": "./public/img/ad/lf/lf1.jpg"},
				{"title": "Laundry Facilities", "href": "./public/img/ad/lf/lf3.jpg"},
				{"title": "Laundry Facilities", "href": "./public/img/ad/lf/lf4.jpg"}			 
			],
			{
				'autoDimensions'  : true,
				'autoScale'       : true,
				'width'           : 'auto',
				'height'          : 'auto',
				'scrolling'       : 'no',
				'padding'         : 0,
				'href'            : $(this).attr('href')
			}
		);
	});
	
	$("#fc_gallery").click(function(){
		$.fancybox(
			[
				{"title": "Fitness Center", "href": "./public/img/ad/fc/fc1.jpg"},
				{"title": "Fitness Center", "href": "./public/img/ad/fc/fc2.jpg"},
				{"title": "Fitness Center", "href": "./public/img/ad/fc/fc3.jpg"},
				{"title": "Fitness Center", "href": "./public/img/ad/fc/fc4.jpg"},
				{"title": "Fitness Center", "href": "./public/img/ad/fc/fc5.jpg"},
				{"title": "Fitness Center", "href": "./public/img/ad/fc/fc6.jpg"},
				{"title": "Fitness Center", "href": "./public/img/ad/fc/fc7.jpg"}			 
			],
			{
				'autoDimensions'  : true,
				'autoScale'       : true,
				'width'           : 'auto',
				'height'          : 'auto',
				'scrolling'       : 'no',
				'padding'         : 0,
				'href'            : $(this).attr('href')
			}
		);
	});
	
	$("#sp_gallery").click(function(){
		$.fancybox(
			[
				{"title": "Swimming Pool & Hot Tub", "href": "./public/img/ad/sp/sp1.jpg"},
				{"title": "Swimming Pool & Hot Tub", "href": "./public/img/ad/sp/sp2.jpg"},
				{"title": "Swimming Pool & Hot Tub", "href": "./public/img/ad/sp/sp3.jpg"}	
			],
			{
				'autoDimensions'  : true,
				'autoScale'       : true,
				'width'           : 'auto',
				'height'          : 'auto',
				'scrolling'       : 'no',
				'padding'         : 0,
				'href'            : $(this).attr('href')
			}
		);
	});
	
	$("#pt_gallery").click(function(){
		$.fancybox(
			[
				{"title": "Pool Table / Ping Pong Table", "href": "./public/img/ad/pt/pt1.jpg"},
				{"title": "Pool Table / Ping Pong Table", "href": "./public/img/ad/pt/pt2.jpg"},
				{"title": "Pool Table / Ping Pong Table", "href": "./public/img/ad/pt/pt3.jpg"},
				{"title": "Pool Table / Ping Pong Table", "href": "./public/img/ad/pt/pt4.jpg"},
				{"title": "Pool Table / Ping Pong Table", "href": "./public/img/ad/pt/pt5.jpg"},
				{"title": "Pool Table / Ping Pong Table", "href": "./public/img/ad/pt/pt6.jpg"},
				{"title": "Pool Table / Ping Pong Table", "href": "./public/img/ad/pt/pt7.jpg"},
				{"title": "Pool Table / Ping Pong Table", "href": "./public/img/ad/pt/pt8.jpg"},
				{"title": "Pool Table / Ping Pong Table", "href": "./public/img/ad/pt/pt9.jpg"},
				{"title": "Pool Table / Ping Pong Table", "href": "./public/img/ad/pt/pt10.jpg"}		
			],
			{
				'autoDimensions'  : true,
				'autoScale'       : true,
				'width'           : 'auto',
				'height'          : 'auto',
				'scrolling'       : 'no',
				'padding'         : 0,
				'href'            : $(this).attr('href')
			}
		);
	});
	
	$("#sw_gallery").click(function(){
		$.fancybox(
			[
				{"title": "Showers", "href": "./public/img/ad/sw/sw1.jpg"},
				{"title": "Showers", "href": "./public/img/ad/sw/sw2.jpg"},
				{"title": "Showers", "href": "./public/img/ad/sw/sw3.jpg"},
				{"title": "Showers", "href": "./public/img/ad/sw/sw4.jpg"},
				{"title": "Showers", "href": "./public/img/ad/sw/sw5.jpg"},
				{"title": "Showers", "href": "./public/img/ad/sw/sw6.jpg"}
			],
			{
				'autoDimensions'  : true,
				'autoScale'       : true,
				'width'           : 'auto',
				'height'          : 'auto',
				'scrolling'       : 'no',
				'padding'         : 0,
				'href'            : $(this).attr('href')
			}
		);
	});
	
	
});

function email(name, domain, withlink){
  var addr = name + '@' + domain;
  if(withlink) {
     document.write('<a class="gold  f12" href="mailto:' + addr + '">' + addr + '</a>');
  } else {
     document.write(addr);
  }
}



