/* MAILING LIST SIGN UP FORM */

$(document).ready(function() {
 
	var triggers = $(".modalInput, .modalInputFoot").overlay({
	 
		// some mask tweaks suitable for modal dialogs
		mask: { color: '#006EFF', loadSpeed: 400, opacity: 0.25 },

		closeOnClick: true,

		closeOnEsc: true,
		
		top: '10%'
		
	});
	 
	$("#prompt form").submit(function(e) {
	 
		// close the overlay
		triggers.eq(1).overlay().close();
	 
		// get user input
		var input = $("input", this).val();
	 
		// do something with the answer
		triggers.eq(1).html(input);
	 
		// do not submit the form
		return e.preventDefault();
	});
 
});

/* PRIVATE HIRE PAGE ENQUIRY FORM */

$(document).ready(function() {
 
	var triggers = $(".hireEnquiryBttn").overlay({
	 
		// some mask tweaks suitable for modal dialogs
		mask: { color: '#006EFF', loadSpeed: 400, opacity: 0.25 },

		closeOnClick: true,

		closeOnEsc: true,
		
		top: '10%',
	
		fixed: false
	
	});

	$("#enq").submit(function(e) {
	 
		// close the overlay
		triggers.eq(1).overlay().close();
	 
		// get user input
		var input = $("input", this).val();
	 
		// do something with the answer
		triggers.eq(1).html(input);
	 
		// do not submit the form
		return e.preventDefault();
	});
 
});

/* BROADCAST PHOTO GALLERY */

$(document).ready(function() {
	
	Galleria.loadTheme('http://www.cable-london.com/themes/site_themes/cableLondon/js/galleria/themes/classic/galleria.classic.min.js');
	
    $('.photogallery').galleria({
        width:650,
        height:454,
		imageCrop: true,
		imageMargin: 0,
		showInfo: false,
		thumbCrop: true,
		transition: 'slide'
    });
});

/* PRIVATE HIRE PAGE IMG SLIDE SHOW */

$(document).ready(function() {
    $('#hireSlides').nivoSlider({
        effect:'fade', //Specify sets like: 'fold,fade,sliceDown'
        slices:15,
        animSpeed:800, //Slide transition speed
        pauseTime:4000,
        startSlide:0, //Set starting Slide (0 index)
        directionNav:true, //Next & Prev
        directionNavHide:true, //Only show on hover
        controlNav:true, //1,2,3...
        controlNavThumbs:false, //Use thumbnails for Control Nav
        controlNavThumbsFromRel:false, //Use image rel for thumbs
        controlNavThumbsSearch: '.jpg', //Replace this with...
        controlNavThumbsReplace: '_thumb.jpg', //...this in thumb Image src
        keyboardNav:false, //Use left & right arrows
        pauseOnHover:true, //Stop animation while hovering
        manualAdvance:false, //Force manual transitions
        captionOpacity:0.7, //Universal caption opacity
        beforeChange: function(){},
        afterChange: function(){},
        slideshowEnd: function(){}, //Triggers after all slides have been shown
        lastSlide: function(){}, //Triggers when last slide is shown
        afterLoad: function(){} //Triggers when slider has loaded
    });
});

/* SCROLL TO ANCHOR TAG */

$(document).ready(function(){
    $('a[href*=#]').click(function() {
    if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
        && location.hostname == this.hostname) {
            var $target = $(this.hash);
            $target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
            if ($target.length) {
                var targetOffset = $target.offset().top;
                $('html,body').animate({scrollTop: targetOffset}, 1500, 'easeInOutExpo');
                return false;
            }
        }
    });
});
