$(function() {
	// initialize scrollable banners area
	$.easing.custom = function (x, t, b, c, d) {
	    var s = 1.70158;
	    if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
	    return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
	}

	if ($("div.scrollable").length > 0)
		$("div.scrollable").scrollable({
			item: "div",
			size: 1,
			easing: "custom",
			speed: 700,
			onBeforeSeek: function(e, pag) {
				//var pag = this.getPageIndex();
				var currentItem = ""; var alt = ""; var img = ""; var url = ""; var txt= "";

				if (pag>0)
	            	currentItem = $("div.scrollable").find("img:eq(" + pag + ")");
	            	alt = currentItem.attr("alt");
					if (alt!=""){
						url = "http://www.oktal.ro/banner/" + alt;
						currentItem.attr("src", url);
						currentItem.attr("alt", "");
					}
			}


		}).circular().navigator(".navi").autoscroll({autoplay: true, autopause:true, interval:10000});

	// initialize scrollable mare
	$("div.scrollable2").scrollable({
        item: "div",
		size: 5,
		onSeek: function() {
			var pag = this.getPageIndex();
			var currentItem = ""; var alt = ""; var img = ""; var url = ""; var txt= "";

			if (pag>0)
				for (i=(pag*5); i<(pag*5+5); i++){
                    currentItem = $("div.scrollable2").find("img:eq(" + i + ")");
                    alt = currentItem.attr("alt");
					if (alt!=""){
						url = "http://www.oktal.ro/foto/100x100/" + alt;
						currentItem.attr("src", url);
						currentItem.attr("alt", "");
					}
				}
			}
	});



})