(function($) {
    $.extend($.expr[':'], {
        startsWith: function(a, b, match) {
            return $(a).text().indexOf(match[3]) === 0;
        }
    });
    Drupal.behaviors.searchForm = {
        attach: function(context, settings) {
            cForm('#search-block-form .form-text', 'Search');

        }
    };
    Drupal.behaviors.initAniMenu = {
        attach: function(context, settings) {
            $('#main-menu ul li.expanded ul').hover(function() {
                $(this).parent().addClass("on");
                $(this).prev().addClass("over");
            },
            function() {
                $(this).parent().removeClass("on");
                $(this).prev().removeClass("over");
            });
            $('#main-menu ul li.expanded a').hover(function() {
                $(this).parent().addClass("on");
            },
            function() {
                $(this).parent().removeClass("on");
            });
        }
    };
    Drupal.behaviors.initTabs = {
        attach: function(context, settings) {
            $('ul.tabs li:first').addClass('active');
            $('.toggled:not(:first)').hide();
            $('.tabs-wrapper ul.tabs li').live('click',
            function() {
                $('.tabs-wrapper ul.tabs li').not(this).removeClass('active');
                $(this).addClass('active');
                $('.toggled').filter(':visible').hide();
                var activeTab = $(this).find('a').attr('href');
                $(activeTab + '.toggled').fadeIn('slow').show();
                return false;
            });
        }
    };
    Drupal.behaviors.seeHL = {
        attach: function(context, settings) {
            var frameID = $('#block-views-slidenode-block-1 .attachment .view-content');
            var trig = $('.jcarousel-skin-hl li a');
            $(trig).bind('click',
            function() {
                $(trig).removeClass('selected');
                $(this).addClass('selected');
                $(frameID).children().stop().fadeOut('fast');
                $(frameID).removeClass('loading').addClass('loading');
                $('#block-views-slidenode-block-1 .attachment').fadeIn('slow');
                return false;
            });
        }
    };
    Drupal.behaviors.overHl = {
        attach: function(context, settings) {
            $('.view-slidenode .attachment, .gallery-frame', context).hover(function() {
                $(".panel-overlay", this).stop().animate({
                    bottom: '0px'
                },
                300);
            },
            function() {
                $(".panel-overlay", this).stop().animate({
                    bottom: '-140px'
                },
                600);
            });
        }
    };
    Drupal.behaviors.viewsSelect = {
        attach: function(context, settings) {
            $(".views-exposed-widget select:not(.view-arsip .views-exposed-widget select)", context).change(function() {
                this.form.submit();
            });
        }
    };
    Drupal.behaviors.initPopup = {
        attach: function(context, settings) {
            $('.popup, .feed-icon').live('click',
            function() {
                var url = $(this).attr('href');
                window.open(url, 'external');
                return false;
            });
        }
    };
	function scrollHead() {
    $("html, body").animate({
        scrollTop: 0
    },
    "slow");
	}
	
	function cForm(selector,defvalue){if($.trim($(selector).val())==""){$(selector).val(defvalue);}
	$(selector).focus(function(){if($(selector).val()==defvalue){$(selector).val("");}});$(selector).blur(function(){if($.trim($(selector).val())==""){$(selector).val(defvalue);}});}
	
})(jQuery);
;

