/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
Cufon.replace('h1, h2, h3, h4, h5, .event-day, .event-month, .ddsmoothmenu ul li a, .for-page span',{
    fontFamily: 'AGAvantGardeMon',
    hover: true
});

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"]
});

jQuery(document).ready(function() {
    jQuery("label.overlabel").overlabel();
    jQuery('.jcycle').after('<div id="jcycle-pager" class="jcycle-pager">').cycle({
        pager:  '#jcycle-pager',
        fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
        delay: 1000,
        random: 1,
        easing: 'easeInOutExpo'
    });
    jQuery('.preload').preloadImages({
        showSpeed: 1000,   // length of fade-in animation, 500 is default
        easing: 'easeOutQuad'   // optional easing, if you don't have any easing scripts - delete this option
    });
    jQuery('#portfolio-list').filterable();
		
	jQuery('.tabs').each(function(tabid){
        var tabTitles=jQuery(this).children('h3').remove();
        var myTab=tabid;
        jQuery(this).children().each(function(index){
            jQuery(this).attr('id', 'tab-'+myTab+'-'+index);
        });        
        var tabTitleContainer=jQuery('<ul class="'+jQuery(this).attr('rel')+'"></ul>');
        tabTitles.each(function(index){
            jQuery(this).children('a').attr('href', '#tab-'+myTab+'-'+index);
            tabTitleContainer.append(jQuery('<li></li>').append(jQuery(this)));
        });
        jQuery(this).prepend(tabTitleContainer);
        
        //jQuery(this).append(titles);
    });
		/*jQuery('.tabs').tabs({
	load:function(){
		
	}
    });*/

    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");
    }
);
    // PRETTY PHOTO FUNCTIONS
    //jQuery(".zoom").prettyPhoto();
    jQuery(".zoom:first a[rel^='prettyPhoto']").prettyPhoto({
        animationSpeed:'slow',
        theme:'light_square',
        slideshow:2000,
        autoplay_slideshow: false
    });
    jQuery(".zoom:gt(0) a[rel^='prettyPhoto']").prettyPhoto({
        animationSpeed:'fast',
        slideshow:10000
    });
	// Initialize Galleria
    /*jQuery('#galleria').galleria();*/
    //  IMAGE PRELOADER
    jQuery('.preload').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
    });

    jQuery('.slider').cycle({
        fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
            delay: 1000,
            random: 1,
            easing: 'easeInOutExpo'
    });

    // TWEET JS FUNCTION
    jQuery(".tweet").tweet({
        username: tweet_user,
        join_text: "auto",
        avatar_size: 0,
        count: 20,
        auto_join_text_default: "бичсэн,",
        auto_join_text_ed: "we",
        auto_join_text_ing: "we were",
        auto_join_text_reply: "хариулсан",
        auto_join_text_url: "we were checking out",
        loading_text: "Твиттрээс мэдээллүүдийг цуглуулж байна ..."
    }).ajaxStop(function(){
        jQuery('.tweet').vTicker({
            speed: 500,
            pause: 5000,
            showItems: 1,
            animation: 'fade',
            mousePause: true,
            height: 10,
            direction: 'up'
        });
        
    });

    // OVER LABEL FUNCTION
    jQuery("label.overlabel").overlabel();
    // ADDED FORM VALIDATION STYLE
    jQuery("input[type='text']:not(.noStyle), input[type='password']:not(.noStyle)").each(function(){
        //jQuery(this).addClass('textInput');
        });
    // Focus and blur style changing
    jQuery('.textInput').blur( function() {
        jQuery(this).removeClass('inputFocus');
    }).focus( function() {
        jQuery(this).addClass('inputFocus');
    });

    // SOCIAL ICONS HOVER EFFECT
    jQuery("ul.head-social li").hoverIntent(
        function () {
            jQuery(this).animate({
                opacity:1
            }, 100, 'swing');
        },
        function () {
            jQuery(this).animate({
                opacity:.5
            }, 500, 'swing');
        }
        );

	// TOOL TIP FUNCTION
    if (jQuery.browser.msie && parseInt(jQuery.browser.version, 10) < 7) {
    // IE 6 sucks so the effect doesn't work at all and that's why we skip it here
    // we coluld do something different for IE 6 in this area if we wanted
    }
    else {
        jQuery(function(){			
            jQuery(".tool-tip").tipTip();
        });
    };
});
