jQuery(document).ready(function() {

	// home top stage
    $('.mod-stage996 .stgslide').cycle({
		timeout: 1500,
		speed: 1000,
        pagerAnchorBuilder: function(idx, slide) {
            idxNUM = idx + 1;
            return '<div id="stgbtn' + idxNUM + '" class="stgbtnoff">' + idxNUM + '</div>';
        }
    });

    $('.mod-gallery954 ul.gallery_show').galleria({


onImage: function() { // some image effects for demonstration purposes
        },
        onThumb: function(thumb) { // thumbnail effects goes here
        }
    });

    $('.mod-gallery954').prepend("<div class='autoControl'>Pause</div>");
		var active = true;
		var gal = jQuery('.mod-gallery954');
		var ctrl = gal.find('.autoControl')

    $(function() {
        if (active) {
            ctrl.css("background-position", "0 0");
            gal.everyTime('10s', 'slideshow', function() {
                $.galleria.next();
            });
        } if (!active) {
            ctrl.css("background-position", "0 -23px");
        };

        ctrl.css("cursor", "pointer").click(function() {
            if (!active) {
                active = true;
                $.galleria.next();
                ctrl.css("background-position", "0 0").html("Pause");
                gal.everyTime('10s', 'slideshow', function() {
                    $.galleria.next();
                });
            } else if (active) {
                active = !active;
                ctrl.css("background-position", "0 -23px").html("Play");
                gal.stopTime('slideshow');
            }
        });

    });
});
