$(document).ready(function() {	counter = 0;	$('.crai_slider').each(function() {		counter++;		// prelevo parametri		id = $(this).attr('id');		fx = $(this).attr('fx'); // scrollHorz, fade		timeout = $(this).attr('timeout'); // se 0 non automatico				width = $(this).attr('slider-width');		height = $(this).attr('slider-height');				toolbar = $(this).attr('toolbar');				toolbarType = $(this).attr('toolbar-type');		if (toolbarType == undefined) {			toolbarType = '1';		}		toolbarTop = $(this).attr('toolbar-top');		toolbarLeft = $(this).attr('toolbar-left');								minToolbar = $(this).attr('min-toolbar');		minToolbarTop = $(this).attr('min-toolbar-top');		minToolbarLeft = $(this).attr('min-toolbar-left');				if (id == null || id == '') {			id = 'slider_' + counter;		}				$(this).replaceWith(function() {			// creo la toolbar se richiesta (toolbar ha anche posizione x e y)			out = '';			out += '<div id="' + id + '" class="crai_slider" style="width: ' + width + 'px;height:' + height + 'px; overflow: hidden;">';			if (toolbar == 'true') {				switch(toolbarType) {					case '2':						out += '<div id="' + id + '_crai_slider_toolbar" class="crai_slider_toolbar2" style="top: ' + toolbarTop + 'px; left: ' + toolbarLeft + 'px;"></div>';						break;										default:						out += '<div id="' + id + '_crai_slider_toolbar" class="crai_slider_toolbar" style="top: ' + toolbarTop + 'px; left: ' + toolbarLeft + 'px;"></div>';						break;				}			}			if (minToolbar == 'true') {				out += '<div id="' + id + '_crai_slider_min_toolbar" class="crai_slider_toolbar" style="top: ' + minToolbarTop + 'px; left: ' + minToolbarLeft + 'px;"><div id=\"' + id + '_crai_slider_min_toolbar_left\"><span>&lt;</span></div><div id=\"' + id + '_crai_slider_min_toolbar_right\"><span>&gt;</span></div></div>';			}			out += '<div id="' + id + '_crai_slider_slides" class="crai_slider_slides">' + $(this).html() + '</div>';			out += '</div>';			return out;		});						if (toolbar == 'true') {			$('#' + id + '_crai_slider_slides').cycle({				fx: fx,				timeout: timeout,				pager: '#' + id + '_crai_slider_toolbar',				pagerAnchorBuilder: function(idx, slide) { 					return '<div><span>'+(idx+1)+'</span></div>';				}			});		} else if (minToolbar == 'true') {			$('#' + id + '_crai_slider_slides').cycle({				fx: fx,				timeout: timeout,				prev: '#' + id + '_crai_slider_min_toolbar_left',				next: '#' + id + '_crai_slider_min_toolbar_right'			});			$('#' + id + '_crai_slider_min_toolbar_left').click(function() { $('#' + id + '_crai_slider_slides').cycle('prev'); });			$('#' + id + '_crai_slider_min_toolbar_right').click(function() { $('#' + id + '_crai_slider_slides').cycle('next'); });		} else {			$('#' + id + '_crai_slider_slides').cycle({				fx: fx,				timeout: timeout			});		}							/*	$('#pauseBtn').toggle(	function(){		$('#slider').cycle('pause'); 		$(this).css({		background: 'transparent url(images/slide_grande_home/bt_slide_play_26x24.png) no-repeat 10px 0'}		);	},	function(){		$('#slider').cycle('resume'); 		$(this).css({		background: 'transparent url(images/slide_grande_home/bt_slide_pausa_26x24.png) no-repeat 10px 0'}		);	}	);	*/											});});
