jQuery(function($) {
    $.ajaxSetup({
        cache: true
    });
    var ajaxLoad = '<div class="loading"><img src="images/loading.gif" alt="loading..." /></div>';
    $("ul#tab-pendapat li a").click(function() {
        var itm = $("ul#tab-pendapat li a");
        itm.removeClass("selected");
        $(this).addClass("selected");
        var loadPendapat = $(this).attr("href");
        $("#tab-pendapat-content").html(ajaxLoad).load(loadPendapat).fadeIn('slow');
        return false;
    }).eq(0).addClass("selected");
    
    $("#block-blog h2 a").click(function() {
        var loadBlog = $(this).attr("href");
        $("#blog-content").html(ajaxLoad).load(loadBlog).fadeIn('slow');
        return false;
    });

  	   $('.fokus .items a').click(function() {
        var itm = $(".fokus .items a");
        var itmIndex = itm.index(this) + 1;
        var total = itm.length;
        itm.removeClass("active");
        $(this).addClass("active");
        $(".fokus .index-item").text(itmIndex + ' DARI ' + total);
        var loadFokus = $(this).attr("href");
        $("#ajax-fokus").html(ajaxLoad).load(loadFokus).fadeIn('slow');
        return false;
    }).eq(0).click();
    
    $('.infografis .items a').click(function() {
        var itm = $(".infografis .items a");
        var itmIndex = itm.index(this) + 1;
        var total = itm.length;
        itm.removeClass("active");
        $(this).addClass("active");
        $(".infografis .index-item").text(itmIndex + ' DARI ' + total);
        var loadInfo = $(this).attr("href");
        $("#ajax-infografis").html(ajaxLoad).load(loadInfo).fadeIn('slow');
        return false;
    }).eq(0).click();

    $('.fotoslide .items a').click(function() {
        var itm = $(".fotoslide .items a");
        var itmIndex = itm.index(this) + 1;
        var total = itm.length;
        itm.removeClass("active");
        $(this).addClass("active");
        $(".fotoslide .index-item").text(itmIndex + ' DARI ' + total);
        var loadFoto = $(this).attr("href");
        $("#ajax-fotoslide").html(ajaxLoad).load(loadFoto).fadeIn('slow');
        return false;
    }).eq(0).click();
	
	$('.videoslide .items a').click(function() {
        var itm = $(".videoslide .items a");
        var itmIndex = itm.index(this) + 1;
        var total = itm.length;
        itm.removeClass("active");
        $(this).addClass("active");
        $(".videoslide .index-item").text(itmIndex + ' DARI ' + total);
        var loadFoto = $(this).attr("href");
        $("#ajax-videoslide").html(ajaxLoad).load(loadFoto).fadeIn('slow');
        return false;
    }).eq(0).click();

    var darkApi = $(".scrollinset").scrollable({
        api: true
    });
    var cleanApi = $(".scrollable").scrollable({
        size: 4
    });
	
	$('.videonext').removeClass("disabled");

});

featuredcontentglider.init({
	gliderid: "canadaprovinces", //ID of main glider container
	contentclass: "glidecontent", //Shared CSS class name of each glider content
	togglerid: "p-select", //ID of toggler container
	remotecontent: "", //Get gliding contents from external file on server? "filename" or "" to disable
	selected: 0, //Default selected content index (0=1st)
	persiststate: false, //Remember last content shown within browser session (true/false)?
	speed: 1000, //Glide animation duration (in milliseconds)
	direction: "downup", //set direction of glide: "updown", "downup", "leftright", or "rightleft"
	autorotate: true, //Auto rotate contents (true/false)?
	autorotateconfig: [15000, 5] //if auto rotate enabled, set [milliseconds_btw_rotations, cycles_before_stopping]
})
