  //ÊÀÐÓÑÅËÜÊÀ
	//êîëè÷åñòâî èçîáðàæåíèé â äèàôèëüìå
	//cnt_carusel_img=5;
	//øèðèíû ñòðåëîê íàâèãàöèè
	//width_arrow=30;
	//íîìåð àëüáîìà (ïî óìîë÷àíèþ -  ïîñëåäíèå äîáàâëåíèÿ
	//album: "lastup"
;(function($) {
	$.fn.carusel = function(o) {
		o = $.extend({
        cnt_carusel_img: 6,
        width_arrow: 30,
		album: "lastup"
    }, o || {});
	return this.each(function() {  
		//al_1(o.width_arrow,o.cnt_carusel_img);
    $('.next').click(function() {  scroller('next',o.album,o.cnt_carusel_img,o.width_arrow);	});
	$('.prev').click(function() {  scroller('prev',o.album,o.cnt_carusel_img,o.width_arrow);	});
	$("a.zoom2").fancybox({'zoomSpeedIn'		:	500,'zoomSpeedOut'		:	500});
 ;});

}
})(jQuery);
function al_1(width_arrow,cnt_carusel_img){
 //var correct_ie_w = 0;
 if ($.browser.msie) {
 var w=($('#scr-cont').parent().width()-2*width_arrow)/cnt_carusel_img;
 $('#scr-cont').width(cnt_carusel_img*w-2);
	 }
 //$("#scr").css("left",-w+"px");
//<<< ñîçäàíèå òåíåé ó ìèíèèçîáðàæåíèé êàðóñåëüêè
 // var len=$(".thumb-c").length;
 // for (var i=0; i<len ;i++){
 // var el_i = $(".thumb-c:eq("+i+")")[0]; var inner=el_i.innerHTML;var img=$(el_i).find('img'); var zoom2=img[0].src.replace('thumb_',''); var width=img.width()+14; var zoom2_top=(120-img.height())/2-9; var zoom2_right=(w-width)/2; $(el_i).replaceWith('<span class="thumb-c" style="width:'+w+'px;left:0px;"><DIV style="WIDTH: '+width+'px; margin:0 auto;margin-top:'+zoom2_top+'px" class=wrap1>'+'<DIV class=wrap2>'+'<DIV class=wrap3>'+'<DIV class=wrap4><a href="'+zoom2+'" class="zoom2" style="top:'+zoom2_top+'px; right:'+zoom2_right+'px;" title="'+img[0].title+'">+</a> '+inner+'</DIV></DIV></DIV></DIV></span>'); $(".wrap4 a").css({padding:"0px",margin:"0px"});
 // }
//ñîçäàíèå òåíåé ó ìèíèèçîáðàæåíèé  êàðóñåëüêè>>>		
}
///////////////////////////////////////////////////////////////////////////////////////////////////////
function scroller(orient,album,cnt_carusel_img,width_arrow) {
	$("#scr .thumb-c:first-child").stop();
	var w=($('#scr-cont').parent().width()-2*width_arrow)/cnt_carusel_img;
	cnt_carusel_img+=1;
	if (orient=='prev'){
	var pid=parseInt($("#scr .thumb-c:eq(1)")[0].innerHTML.split("?image=")[1]);
	var ord=0;}
	else{
	var pid=parseInt($("#scr .thumb-c:eq("+cnt_carusel_img+")")[0].innerHTML.split("?image=")[1]);
	var ord=1;}
		//alert("pid="+pid+"&ord="+ord+"&album="+album);						  
	$('.'+orient).html('<div style="z-index:400;width:16px;height:16px;float:left;position:relative;"><img src="include/ajax-loader.gif" border="0"  vspace="52" hspace="7"/></div>');
		$.ajax({
				 type: "GET",
				 url: "/ajax/get_4_film.php",
				 cache: false,
				 async: true,
				 data: "pid="+pid+"&ord="+ord+"&album="+album,
				 success: function(msg){
				 if (msg!=""){
				 var arr_p=msg.split('::');
				var w2=parseInt(arr_p[4])+14;
				arr_p[6]=parseInt(arr_p[6])-9+'px';
				var zoom2_right=(w-w2)/2;	

				$("#scr .thumb-c:first-child").replaceWith(
				'<span class="thumb-c" style="width:'+w+'px;left:0px;">'+arr_p[8]+'<div class="wrap1" style="width:'+w2+'px; margin-top: '+arr_p[6]+';"><div class="wrap2"><div class="wrap3"><div class="wrap4"><a style="margin: 0px; padding: 0px; top: '+arr_p[6]+'; right:'+zoom2_right+'px;" class="zoom2" href="'+arr_p[1]+arr_p[2]+'" title="'+arr_p[3]+'"></a><a href="displayimage.php?image='+arr_p[0]+'" style="margin: 0px; padding: 0px;"><img height="'+arr_p[5]+'" border="0" width="'+arr_p[4]+'" src="'+arr_p[1]+'thumb_'+arr_p[2]+'" class="image_thumb" alt="'+arr_p[3]+'" title="'+arr_p[3]+'"/></a></div></div></div></div></span>'); 
			if (orient=='prev'){												 
			 $("#scr .thumb-c:first-child").animate({marginLeft: w},5*w,"linear",function () {
				var curimg = $("#scr .thumb-c:last-child");
				$("#scr .thumb-c:first-child").css('margin-left','0');
			    $("#scr").remove(".thumb-c:last-child");
				curimg.prependTo("#scr");
					$("a.zoom2").fancybox({
					'zoomSpeedIn'		:	500,
					'zoomSpeedOut'		:	500			  
			  });
				//scroller(orient,album,5,width_arrow);		
				$('.'+orient).html('');											
				});
				}
				else
				{
				  $("#scr .thumb-c:first-child").animate({marginLeft: -w },5*w,"linear",function () {
			    var curimg = $("#scr .thumb-c:first-child");
			    $("#scr").remove(".thumb-c:first-child");
			    curimg.css('margin-left','0');
			    curimg.appendTo("#scr");
					$("a.zoom2").fancybox({
					'zoomSpeedIn'		:	500,
					'zoomSpeedOut'		:	500
				});			  
				//scroller(orient,album,5,width_arrow);					  
				$('.'+orient).html('');											
				//scroller();
			  });

				}
			 }
	    }
	  });	
	} 
