/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
Cufon.replace('h1, h2, h3, h4, h5, .dropcap, .ddsmoothmenu > ul > li > a, .slider-item a, .teaser-text, a.teaser-button, .article-meta span, .article-rm, .day, .month, .year, .read-all, .article-bottom-list li a', {
    fontFamily: 'MonFnt12',
    hover: true
});
Cufon.replace('.site-name p, .site-name h6', {
    fontFamily: 'Arial',
    hover: true
});
function mixxer(){purl=document.location.href;window.open('http://www.mixx.mn/submit/story?pageurl='+encodeURIComponent(purl));return false;}
jQuery(document).ready(function() {
var ictpa_mail_colonized;
jQuery('#ictpa_mail_share').live('submit',function(){
		var data=jQuery(this).serialize();
		ictpa_mail_colonized=jQuery(this);
		
		ictpa_mail_colonized.find('.mail_form_ajax_loader').show();
		jQuery.post('http://ictpa.gov.mn/new/?'+data, undefined, function(response) {
            //document.write(response);
			ictpa_mail_colonized.html(response);
        });
		return false;
	});

jQuery('#menu-top_menu >li:last').css('background-color','#01aefd');
jQuery('.social_facebook').socialbutton('facebook_share',{
text: '',
button: ''
});
jQuery('.social_twitter').socialbutton('twitter',{
text: 'Twitter'
});
jQuery('.social_share').each(function(){
	jQuery(this).parent().hover(function(){
		jQuery(this).children('.social_share').css('display','block');
	},
	function(){
		jQuery(this).children('.social_share').css('display','none');
	}
	);
});
jQuery('.article-image-slide').each(function(index){
        jQuery(this).before('<ul class="ar-pager nav'+index+'">').cycle({
            fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
            easing: 'easeInOutExpo',
            delay: 10,
            speed: 500,
            pager:  '.nav'+index,
            // callback fn that creates a thumbnail to use as pager anchor
            pagerAnchorBuilder: function(idx, slide) {
                return '<li><a href="#">*</a></li>';
            }
        });
    });
    // JQUERY SPOTLIGHT FUNTION
    jQuery('.spotlight').bind('mouseover', function () {
        jQuery(this).spotlight({
            exitEvent: 'mouseover',
            speed: 100
        });
    });
	// Tabs
	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('.accordion').accordion();
    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");
    }
);
	// 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',
			updateActivePagerLink:function(){
				alert('ss');
				return true;
			}
    });

    // TWEET JS FUNCTION
    jQuery(".tweet").tweet({
        username: "ictpa_mn",
        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: 20,
            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(){
        //$(this).addClass('textInput');
        });
    // Focus and blur style changing
    jQuery('.textInput').blur( function() {
        $(this).removeClass('inputFocus');
    }).focus( function() {
        $(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');
        }
        );

    // PRETTY PHOTO FUNCTIONS
    //$(".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
    });
	

})

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



