/*!
 * Custom javascript for www.andygock.com.au
 */

$(document).ready(function(){

	/* Set target windows */
	$('a.blank').click(function() {
		this.target = '_blank';
	});
	$('a.top').click(function() {
		this.target = '_top';
	});

	/* Scrolling galleries */
	$('#scrollShow').smoothDivScroll({
		/*
		autoScroll: 'onstart',
		autoScrollDirection: 'right',
		autoScrollStep: 1,
		autoScrollInterval: 15,
		*/
		scrollStep: 10,
		scrollInterval: 10,
		//visibleHotSpots: 'always',
	});
	
	$('#scrollShow').disableSelection(); /* Stop accidental selections of images during scroll */
	
	/* Make hot spots visible, visibleHotSpots during init doesn't work for some reason */
	$('#scrollShow').smoothDivScroll('showHotSpotBackgrounds','2000');
	
	/* CTA buttons */
	$('.cta-content').hide();
	$('.cta-button img').hover(
		function(){this.src='/images/learn_more_down.png';},
		function(){this.src='/images/learn_more_up.png';}
	);
	$('.cta-button').click(function(evt){
		$('.cta-content').slideDown('slow',function(){
			$('html,body').animate({
				scrollTop: $('.cta-content').offset().top
			},'slow');
		});
		evt.preventDefault();
	});
	$('.cta-close a').click(function(evt){
		$('.cta-content').slideUp('slow');
		$('html,body').animate({
			scrollTop: 0
		},'slow');		
		evt.preventDefault();
	});

	/* Set equal columns in #bottom */
	$(function(){
	    var H = 0;
	    $("#bottom div").each(function(i){
	        var h = $("#bottom div").eq(i).height();
	        if(h > H) H = h;
	    });
	    $("#bottom div").height(H);
	});
	
});

/*
$('.scrollableArea img').lazyload({
	effect: 'fadeIn',
	//container: $('.scrollableArea'),
});
*/

/* Heading font replacement script */
Cufon.replace('#main-header #header-left',{ hover: true });
Cufon.replace('#main-header #header-right',{ hover: true });
Cufon.replace('h1, #bottom h2');

/* Disable slections inside smoothdivscroll area */
jQuery.fn.extend({ 
        disableSelection : function() { 
                return this.each(function() { 
                        this.onselectstart = function() { return false; }; 
                        this.unselectable = "on"; 
                        jQuery(this).css('user-select', 'none'); 
                        jQuery(this).css('-o-user-select', 'none'); 
                        jQuery(this).css('-moz-user-select', 'none'); 
                        jQuery(this).css('-khtml-user-select', 'none'); 
                        jQuery(this).css('-webkit-user-select', 'none'); 
                }); 
        } 
}); 


