$(document).ready(function(){
	
	//get height of main div 
	$height = $("#jsfix-content-main").height()+60;
	//alert($height);
	$("#jsfix-content-left,#jsfix-content-right").height($height);
	$("#jsfix-content-left img,#jsfix-content-right img").height($height);
	
	$wrapcurrenthight = $("#jsfix-content-wrap").height();
	if($height-40 > $wrapcurrenthight)
	$("#jsfix-content-wrap").height($height-40);
	
	$height_main = $("#main").height();
	$("#main-left,#main-right").height($height_main);
	$("#main-left img,#main-right img").height($height_main);

});

(function($){
    $.fn.MySlider = function(interval) {
        var slides;
        var cnt;
        var amount;
        var i;

        function run() {
            // hiding previous image and showing next
            $(slides[i]).fadeOut(1000);
            i++;
            if (i >= amount) i = 0;
            $(slides[i]).fadeIn(1000);

            // updating counter
            cnt.text(i+1+' / '+amount);

            // loop
            setTimeout(run, interval);
        }

        slides = $('#my_slider').children();
        cnt = $('#counter');
        amount = slides.length;
        i=0;

        // updating counter
        cnt.text(i+1+' / '+amount);

        setTimeout(run, interval);
    };
})(jQuery);

// custom initialization
jQuery(window).load(function() {
    $('.smart_gallery').MySlider(3000);
});
