
var popup = function(mylink, windowname) {
    if(!window.focus) {
        return true;
    }
    window.open(mylink, null, 'width=600,height=600,scrollbars=yes');
    return false;
};

var onlineBooking = function() {
    var select = $('#online-booking2');
    var options = select.children('option');
    $.each(options, function(i, option) {
        if($(option).is(':selected') && $(option).attr('value') != 'none') {
            popup($(option).attr('value'), 'Online booking');
        }
    });
};

var lightboxes = function() {
    $('.lightbox').fancybox({
        'padding'		: 0,
        'autoScale'		: false,
        'transitionIn'	: 'none',
        'transitionOut'	: 'none',
        'width'		    : 680,
        'height'		: 495,
        'type'			: 'swf',
        'swf'			: {
            'wmode'		: 'transparent',
            'allowfullscreen'	: 'true'
        }
    });
};

var photoLightboxes = function() {
    $('.photo-lightbox').fancybox({
        'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'speedIn'		:	600, 
		'speedOut'		:	200, 
		'overlayShow'	:	true
    });
};

var captify = function() {
    $('img.captify, .a-captify').captify({
		// speed of the mouseover effect
		speedOver: 'fast',
		// speed of the mouseout effect
		speedOut: 'normal',
		// how long to delay the hiding of the caption after mouseout (ms)
		hideDelay: 500,	
		// 'fade', 'slide', 'always-on'
		animation: 'slide',		
		// text/html to be placed at the beginning of every caption
		prefix: '',		
		// opacity of the caption on mouse over
		opacity: '0.7',					
		// the name of the CSS class to apply to the caption box
		className: 'caption-bottom',	
		// position of the caption (top or bottom)
		position: 'bottom',
		// caption span % of the image
		spanWidth: '100%'
    });
    $('.captify-always-on').captify({
		// speed of the mouseover effect
		speedOver: 'fast',
		// speed of the mouseout effect
		speedOut: 'normal',
		// how long to delay the hiding of the caption after mouseout (ms)
		hideDelay: 500,	
		// 'fade', 'slide', 'always-on'
		animation: 'always-on',		
		// text/html to be placed at the beginning of every caption
		prefix: '',		
		// opacity of the caption on mouse over
		opacity: '0.7',					
		// the name of the CSS class to apply to the caption box
		className: 'caption-bottom',	
		// position of the caption (top or bottom)
		position: 'bottom',
		// caption span % of the image
		spanWidth: '100%'
    });
    $('.captify-on-top').captify({
		// speed of the mouseover effect
		speedOver: 'fast',
		// speed of the mouseout effect
		speedOut: 'normal',
		// how long to delay the hiding of the caption after mouseout (ms)
		hideDelay: 500,	
		// 'fade', 'slide', 'always-on'
		animation: 'fade',		
		// text/html to be placed at the beginning of every caption
		prefix: '',		
		// opacity of the caption on mouse over
		opacity: '0.7',					
		// the name of the CSS class to apply to the caption box
		className: 'caption-top',	
		// position of the caption (top or bottom)
		position: 'bottom',
		// caption span % of the image
		spanWidth: '100%'
    });
};

var carousel = function() {
    $('#carousel').coinslider({
        width: 600,
        height: 310,
        spw: 8,
        sph: 6,
        delay: 3000,
        sDelay: 30,
        titleSpeed: 500,
        effect: 'rain',
        navigation: false
    });
};

$(function() {
    lightboxes();
    photoLightboxes();
    captify();
    carousel();
});

