// termini scrollbar
$(window).load(function() {
	mCustomScrollbars();
});
		
		function mCustomScrollbars(){
			/* 
			malihu custom scrollbar function parameters: 
			1) scroll type (values: "vertical" or "horizontal")
			2) scroll easing amount (0 for no easing) 
			3) scroll easing type 
			4) extra bottom scrolling space for vertical scroll type only (minimum value: 1)
			5) scrollbar height/width adjustment (values: "auto" or "fixed")
			6) mouse-wheel support (values: "yes" or "no")
			7) scrolling via buttons support (values: "yes" or "no")
			8) buttons scrolling speed (values: 1-20, 1 being the slowest)
			*/
			$("#mcs_container").mCustomScrollbar("horizontal",500,"easeOutCirc",1,"fixed","yes","yes",20);
			$("#mcs_container_0").mCustomScrollbar("horizontal",500,"easeOutCirc",1,"fixed","yes","yes",20);
			$("#mcs_container_1").mCustomScrollbar("horizontal",500,"easeOutCirc",1,"fixed","yes","yes",20);
			$("#mcs_container_2").mCustomScrollbar("horizontal",500,"easeOutCirc",1,"fixed","yes","yes",20);
			$("#mcs_container_3").mCustomScrollbar("horizontal",500,"easeOutCirc",1,"fixed","yes","yes",20);
			$("#mcs_container_4").mCustomScrollbar("horizontal",500,"easeOutCirc",1,"fixed","yes","yes",20);
			$("#mcs_container_5").mCustomScrollbar("horizontal",500,"easeOutCirc",1,"fixed","yes","yes",20);
			$("#mcs_container_6").mCustomScrollbar("horizontal",500,"easeOutCirc",1,"fixed","yes","yes",20);
			$("#mcs_container_7").mCustomScrollbar("horizontal",500,"easeOutCirc",1,"fixed","yes","yes",20);
			$("#mcs_container_8").mCustomScrollbar("horizontal",500,"easeOutCirc",1,"fixed","yes","yes",20);
			$("#mcs_container_9").mCustomScrollbar("horizontal",500,"easeOutCirc",1,"fixed","yes","yes",20);
		}
		
		/* function to fix the -10000 pixel limit of jquery.animate */
		$.fx.prototype.cur = function(){
				if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) {
					return this.elem[ this.prop ];
				}
				var r = parseFloat( jQuery.css( this.elem, this.prop ) );
				return typeof r == 'undefined' ? 0 : r;
		}
		
		/* function to load new content dynamically */
		function LoadNewContent(id,file){
			$("#"+id+" .customScrollBox .content").load(file,function(){
				mCustomScrollbars();
	});
}

// Pretraga TABS
function mycarousel_initCallback(carousel)
{
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};

$(document).ready(function() {
		//tabs
		$( "#tabs" ).tabs({ fx:  {opacity:'toggle', duration:'fast'} });
		//carousel
		jQuery('#carousel').jcarousel({scroll:1, auto :3, wrap : 'circular', initCallback: mycarousel_initCallback, callback: function(){}});
		// toggle
		$('.more-btn').toggle(
    function() { 
        $(this).text("Povratak na sažet program putovanja");
        $('.more-toggle').toggle("normal");
				$(this).addClass("back");
    },
    function() { 
        $(this).text("Pogledajte ceo program putovanja");
        $('.more-toggle').toggle("normal");
				$(this).removeClass("back");
    }
		);
		// toggle grad
		var btngradid;
		$('.more-btn-grad').toggle(
		function() {
			var btngradid = $(this).attr("id");
			$(this).text("Pogledajte sve aranžmane za ovaj grad");
			$('.more-toggle-grad'+btngradid).toggle("normal");
			$(this).removeClass("back");
			mCustomScrollbars();
		},
		function() {
			$(this).text("Zatvorite aranžmane za ovaj grad");
			var btngradid = $(this).attr("id");
			$('.more-toggle-grad'+btngradid).toggle("normal");
			$(this).addClass("back");
			mCustomScrollbars();
			
		}
);
}); 
//Custom select box
$(document).ready(function(){
	$('#accomodationType').customStyle();
});

//Custom select box aranzman
$(document).ready(function(){
	$('#arangementType').customStyle();
});
 
//Custom select box
$(document).ready(function(){
	$('#accomodationType0').customStyle();
});

//Custom select box
$(document).ready(function(){
	$('#accomodationType1').customStyle();
});

//Custom select box
$(document).ready(function(){
	$('#accomodationType2').customStyle();
});

//Custom select box
$(document).ready(function(){
	$('#accomodationType3').customStyle();
});


