//Accordion Slide Banner
$(function() {
                $('#accordion > li').hover(
                    function () {
                        var $this = $(this);
                        $this.stop().animate({'width':'563px'},500);
                        $('.heading',$this).stop(true,true).fadeOut();
                        $('.bgDescription',$this).stop(true,true).slideDown(500);
                        $('.description',$this).stop(true,true).fadeIn();
                    },
                    function () {
                        var $this = $(this);
                        $this.stop().animate({'width':'115px'},500);
                        $('.heading',$this).stop(true,true).fadeIn();
                        $('.description',$this).stop(true,true).fadeOut(500);
                        $('.bgDescription',$this).stop(true,true).slideUp(700);
                    }
                );
            });



//Fancy Box pop-up
$(document).ready(function() {       
        $('a[rel=booking-form]').fancybox({
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'titlePosition' 	: 'over',
				'scrolling' 		: 'yes',
				'width'				: 750,
				'height'			: 900,
				'autoScale' 		: 'false',
				'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
				}
			});
});

$(document).ready(function() {       
        $("a[rel=example_group]").fancybox({
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'titlePosition' 	: 'over',
				'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
					return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
				}
			});
});

$(document).ready(function() {       
        $('a[rel=exchange]').fancybox({
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'titlePosition' 	: 'over',
				'scrolling' 		: 'no',
				'width'				: 500,
				'height'			: 250,
				'autoScale' 		: 'false',
				'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
				}
			});
});




//Grid Nav
$(function() {
				$('#tj_container').gridnav({
					type	: {
						mode		: 'disperse', 	// use def | fade | seqfade | updown | sequpdown | showhide | disperse | rows
						speed		: 500,			// for fade, seqfade, updown, sequpdown, showhide, disperse, rows
						easing		: '',			// for fade, seqfade, updown, sequpdown, showhide, disperse, rows	
						factor		: '',			// for seqfade, sequpdown, rows
						reverse		: ''			// for sequpdown
			}
	});
});



//Captcha
$(function() { 

	 // refresh captcha
	 $('img#refresh').click(function() {  
			
			change_captcha();
	 });
	 
	 function change_captcha()
	 {
	 	document.getElementById('captcha').src="http://www.spailahi.co.za/get_captcha.php?rnd=" + Math.random();
	 }
	
});






// Smooth Scroll
$(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}, 600);
 
                return false;
 
            }
 
        }
 
    });
 
});








// Images fade animation
$(function(){
	$(".fadeload").hover(function(){
		$(this).stop().animate({opacity: "0.5"}, 350);
	},
	function(){
		$(this).stop().animate({opacity: "1"}, 125);
	});
});


// Go Top button animation
$(function(){
	$("#gotop a").hover(function(){
		$(this).stop().animate({top: "-10px" , height: "30px"}, {duration:125 , easing : "easeInCubic"});
	},
	function(){
		$(this).stop().animate({top: "0px" , height: "20px"}, {duration:600 , easing : "easeOutBounce"});
	});
});




// Tooltip
    $(function(){
    $( '#demo-tip-darkgray, #demo-tip-red, #demo-tip-green, #demo-tip-blue, #demo-tip-facebook, #demo-tip-mail, #demo-tip-download, #demo-tip-twitter' ).poshytip({
				className: 'tip-darkgray',
				bgImageFrameSize: 11,
				offsetX: -25
			});
	});
	
	
	
//Cufon replace
$(function(){
		   
		Cufon.replace('.description h2, .heading, .description a, .read-more a, .menu > li > a',{ hover: true, fontFamily: 'Arrus BT' });		
		Cufon.replace('h4, h3, #submain .grid-3-submain-font, .content-holder h2, .content-holder-contact h2, .content-holder-full h2, .content-holder-search h2, .grid-3-sidebar h3',{ hover: true, fontFamily: 'Arrus BT' });
		Cufon.replace('.grid-3-submain-italic',{ hover: true, fontFamily: 'Journal' });
		Cufon.replace('.description p',{ hover: true, fontFamily: 'Myriad Pro' });

});	






//BreadCrumbs
$(function() {
	jQuery("#breadCrumb").jBreadCrumb();
});





	
