/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
jQuery(document).ready(function() {
    jQuery('.preload').preloadImages({
        showSpeed: 2000,   // length of fade-in animation, 500 is default
        easing: 'easeInOutQuint'   // optional easing, if you don't have any easing scripts - delete this option
    });
    jQuery(".tabblock" ).each(function(){
        jQuery(this).tabs({
            fxFade: true,
            fxSpeed: 'fast',
            fx: {                
                opacity: 'toggle',
                duration: 'fast'
            }
        });
    });
    jQuery('.jcycle').cycle({
        fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
        delay: 1000,
        random: 1,
        easing: 'easeInOutExpo',
        prev:    '.prev',
        next:    '.next'
    });
    // JCYCLE PAGER FUNCTION
    jQuery(function() {
        $('.jcycle').after('<div id="jcycle-pager" class="jcycle-pager">').cycle({
            pager:  '#jcycle-pager',
            before: function() {
                if (window.console) console.log(this.src);
            }
        });
    });

	jQuery("a[rel^='prettyPhoto']").prettyPhoto({deeplinking:false});
	
	
    jQuery(".tabblock" ).each(function(){
        jQuery(this).tabs({
			event: "mouseover",
            fxFade: true,
            fxSpeed: 'fast',
            fx: {
                opacity: 'toggle',
                duration: 'fast'
            }
        });
    });
    jQuery(".tabszz" ).each(function(){
        jQuery(this).tabs({
			event: "mouseover",
            fxFade: true,
            fxSpeed: 'fast',
            fx: {
                opacity: 'toggle',
                duration: 'fast'
            }
        });
    });
	
	
	var theInt = null;
		var $crosslink, $navthumb;
		var curclicked = 0;
		
		theInterval = function(cur){
			clearInterval(theInt);
			
			if( typeof cur != 'undefined' )
				curclicked = cur;
			
			$crosslink.removeClass("active-thumb");
			$navthumb.eq(curclicked).parent().addClass("active-thumb");
				jQuery(".stripNav ul li a").eq(curclicked).trigger('click');
			
			theInt = setInterval(function(){
				$crosslink.removeClass("active-thumb");
				$navthumb.eq(curclicked).parent().addClass("active-thumb");
				jQuery(".stripNav ul li a").eq(curclicked).trigger('click');
				curclicked++;
				if( 6 == curclicked )
					curclicked = 0;
				
			}, 3000);
		};
		
		jQuery(function(){
			
			jQuery("#main-photo-slider").codaSlider();
			
			$navthumb = jQuery(".nav-thumb");
			$crosslink = jQuery(".cross-link");
			
			$navthumb
			.click(function() {
				var $this = $(this);
				theInterval($this.parent().attr('href').slice(1) - 1);
				return false;
			});
			
			theInterval();
		});
})

ddsmoothmenu.init({
    mainmenuid: "smoothmenu1", //menu DIV id
    orientation: 'h', //Horizontal or vertical menu: Set to "h" or "v"
    classname: 'ddsmoothmenu', //class added to menu's outer DIV
    //customtheme: ["#1c5a80", "#18374a"],
    contentsource: "markup" //"markup" or ["container_id", "path_to_menu_file"]
})

Cufon.replace('ul.menu-list li a, h1, h2, h3, #secondnavmenu', {
    fontFamily: 'AGFuturaMon',
    hover: true
});


