/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 * By: Olziibat
 * Date: 2011.04.29
 * Mail: olziinaa@gmail.com
 */
$(document).ready(function() {

    //IMAGE LOADER
    jQuery('.imgload').preloadImages({
        showSpeed: 2000,   // length of fade-in animation, 500 is default
        easing: 'easeOutQuad'   // optional easing, if you don't have any easing scripts - delete this option
    });

    // GENERAL SLIDER
    $('.slider').cycle({
        fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
        delay: 10000,
        random: 1,
        easing: 'easeInOutExpo',
        updateActivePagerLink:function(){
            return true;
        }
    });

    $(function() {
        $('#slider').after('<div id="jcycle-pager" class="jcycle-pager">').cycle({
            pager:  '#jcycle-pager',
            before: function() {
                if (window.console) console.log(this.src);
            }
        });
    });

    // BANNER SLIDER
    $('.multi-ads-slider').cycle({
        fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
        delay: 10000,
        random: 1,
        easing: 'easeInOutExpo',
        updateActivePagerLink:function(){
            return true;
        }
    });
    $(function() {
        $('.multi-ads-slider').after('<div id="jcycle-pager1" class="jcycle-pager1">').cycle({
            pager:  '#jcycle-pager1',
            before: function() {
                if (window.console) console.log(this.src);
            }
        });
    });

    // TABS
    $( "#tabs" ).tabs({
        click: function() {
            Cufon.refresh();
        },
        hide: function() {
            Cufon.refresh();
        },
        show: function() {
            Cufon.refresh();
        }/*,
        fx: {
            opacity: 'toggle',
            duration: 100
        }*/
    });

    // COMPANY TICKER
    $('.company-ticker').vTicker({
        speed: 500,
        pause: 10000,
        showItems: 1,
        animation: 'fade',
        mousePause: true,
        height: 70,
        direction: 'up'
    });

    // INCUBATOR COMPANY
    var
    speed = 500,  // animation speed
    $wall = $('.bottom-info').find('.companyiud')
    ;

    $wall.masonry({
        columnWidth: 620,
        // only apply masonry layout to visible elements
        itemSelector: '.company:not(.invis)',
        animate: true,
        animationOptions: {
            duration: speed,
            queue: false
        }
    });

    $('#filtering-nav a').click(function(){
        var colorClass = '.' + $(this).attr('class');

        if(colorClass=='.all') {
            // show all hidden boxes
            $wall.children('.invis')
            .toggleClass('invis').fadeIn(speed);
        } else {
            // hide visible boxes
            $wall.children().not(colorClass).not('.invis')
            .toggleClass('invis').fadeOut(speed);
            // show hidden boxes
            $wall.children(colorClass+'.invis')
            .toggleClass('invis').fadeIn(speed);
        }
        $wall.masonry();

        return false;
    });

    //CLIENT LOGOS
    $(".client-logos").each(function(){
        var btns=jQuery('<div class="fp-pager"></div>');
        var nextBtn=jQuery('<a class="next" href="#"><span><img src="http://www.themeton.com/itpark/wp-content/themes/itpark/images/next.png" alt=""/></span></a>');
        var prevBtn=jQuery('<a class="prev" href="#"><span><img src="http://www.themeton.com/itpark/wp-content/themes/itpark/images/prev.png" alt=""/></span></a>');
        btns.append(prevBtn);
        btns.append(nextBtn);
        jQuery(this).after(btns);
        jQuery(this).carouFredSel({            
            items: {
                visible: 4,
                minimum: 4,
                width:140
            },
            scroll: {
                mousewheel: true
            },
            auto: {
                easing: "easeInOutExpo",
                duration: 1000
            },
            prev : {
                button	: prevBtn,
                key		: "left"
            },
            next : {
                button	: nextBtn,
                key		: "right"
            }
        });
    });
	
	//Toggle
	jQuery(".toggle_title").toggle(
		function(){
			jQuery(this).addClass('toggle_active');
			jQuery(this).siblings('.toggle_content').slideDown("fast");
		},
		function(){
			jQuery(this).removeClass('toggle_active');
			jQuery(this).siblings('.toggle_content').slideUp("fast");
		}
	);
})
Cufon.replace('h1, h2, h3, h4, h5, h6, ul.menu li a, .ui-tabs-nav a, h1.title, a.prev span, a.next span, .dropcap', {
    fontFamily: 'monfnt9',
    hover: true
});



