var delay_dropdown_show=0
var delay_dropdown_hide=0

//news scroller
jQuery(document).ready(function() {
    jQuery('.jcarousel').jcarousel({
        vertical: true,
        scroll:1,
		easing: "easeInOutQuad"
    });
});
function mycarousel_initCallback(carousel)
{
	var play_slider=$('#play_slider');
	var pause_slider=$('#pause_slider');
	play_slider.hide();
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
		play_slider.show();
		pause_slider.hide();
       carousel.startAuto(0);

    });

    carousel.buttonPrev.bind('click', function() {
		play_slider.show();
		pause_slider.hide();
        carousel.startAuto(0);
    });
   pause_slider.click(function() {
		pause_slider.hide();
		play_slider.show();
        carousel.stopAuto(0);
		return false
    });
   play_slider.click(function() {
		play_slider.hide();
		pause_slider.show();
        carousel.startAuto(1);
		return false;
    });
// Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};


jQuery(document).ready(function() {
   jQuery('#slider_horizontal').jcarousel({
		auto:8,
    	wrap: 'circular',
		scroll:1,
		animation: 600,
        pause: 5000,
		easing: "easeInOutQuad",
		initCallback: mycarousel_initCallback
    });
});


function showlogin() {
    //jQuery(window).load(function() {
        $(".mycmmlogin").show(0);
    //});
}


$(document).ready(function() {
    if ($(".mycmmlogin").length) {
        var winH = $(window).height();
        var winW = $(window).width();
        //Set the popup window to center  
        $(".mycmmlogin").css('top', (winH / 2 - $(".mycmmlogin").height() / 2) - 100);
        $(".mycmmlogin").css('left', winW / 2 - $(".mycmmlogin").width() / 2);
    }


    $('.nav2 li').hover(
		function() { $(this).addClass("dropdown"); $('ul', this).slideDown(delay_dropdown_show); },
		function() { $('ul', this).slideUp(delay_dropdown_hide); $(this).removeClass("dropdown"); }
	);
    //FORSIDE SLIDER
    if ($('.tabs').length) {
        //When page loads...
        var tabcontent = $(".tabcontent");

        tabcontent.hide(); //Hide all content
        $("ul.tabs li:first").addClass("current").show(); //Activate first tab
        $(".tabcontent:first").show(); //Show first tab content

        //On Click Event
        $("ul.tabs li").click(function() {

            $("ul.tabs li").removeClass("current"); //Remove any "active" class
            $(this).addClass("current"); //Add "active" class to selected tab
            tabcontent.hide(); //Hide all tab content

            var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
            if ($.browser.msie)
            { $(activeTab).show(); }
            else
            { $(activeTab).fadeIn(1000); }
            return false;
        });

    }

    $('.slider1').anythingSlider({
        easing: "easeInOutQuad",        // Anything other than "linear" or "swing" requires the easing plugin
        autoPlay: true,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not.
        delay: 8000,                    // How long between slide transitions in AutoPlay mode
        startStopped: false,            // If autoPlay is on, this can force it to start stopped
        animationTime: 1000,             // How long the slide transition takes
        hashTags: true,                 // Should links change the hashtag in the URL?
        buildNavigation: true,          // If true, builds and list of anchor links to link to each slide
        pauseOnHover: false,
        show_nr: true
    });
    if ($(".postcomment").length) {
        $(".postcomment").click(function() {
            if (!$(".postform").is(":visible")) {
                $(".postform").fadeIn(0);
            }
            return false;
        });
        $(".postcomments li.button-cancel a").click(function() {
            if ($(".postform").is(":visible")) {
                $(".postform").fadeOut(0);
            }
            return false;
        });
    }

    if ($(".memberlogin").length) {
        $(".memberlogin a").click(function() {
            $(".mycmmlogin").show(0);
            return false;
        });
    }

    if ($(".mycmmlogin").length) {
        $(".mycmmlogin .title a").click(function() {
            $(".mycmmlogin").hide(0);
            return false;
        });
        $(".mycmmlogin .cancel").click(function() {
            $(".mycmmlogin").hide(0);
            return false;
        });
    }
});

function areyousure() {
    return confirm("Are you sure you want to delete this comment?");
}
