var itms = 0;
	var itemwidth = 772;
	var otherwidth = 760;
	var itemlistwidth = 0;
	var ind = 0;	
	var ind_act = ind;
	var erk = 0;
	var ind_act_c = 0;
	var timer = 0;
	var timer2 = 0;
	var r = 4;
	var x= 1 ;
	var ii = 0;
	var y = 1;
	
$.noConflict();
  
jQuery(document).ready(function () {
	

	 if ( (jQuery('#sw_123_headlines').length || jQuery('#sw_124_headlines').length || jQuery('#sw_125_headlines').length)&& jQuery('.sw_32_1_preview_img_outer').length ){
	

	   
	var itm = jQuery(".sw_s1_gallery").find(".sw_s1_galitem");
		 itm.each(function(i){		
		itms++;		
	});
	
	itemlistwidth = itms*itemwidth;
	speed = itms.length*200;
	ind_act_c = -itemlistwidth;
	erk = itemlistwidth;
	
	var cl="<div class=\"scr_prev\" onclick=\"init_scr(0,0);\" href=\"javascript:void(0);\" style=\"display: block;\"><<</div>";
	var cr="<div class=\"scr_next\" onclick=\"init_scr(1,0);\" href=\"javascript:void(0);\" style=\"display: block;\">>></div>";
	var clono = jQuery(".sw_s1_gallery").html();
	jQuery(".sw_s1_gallery").html(cl+"<div class=\"sw_s1_galitem_list\">"+clono+"</div><div class=\"sw_s1_galitem_list\">"+clono+"</div>"+cr);
	jQuery(".sw_s1_galitem_list:first").css({left:ind,'z-index':'10','width':itemlistwidth+'px'});
	jQuery(".sw_s1_galitem_list:last").css({left:ind_act_c+'px','z-index':'1','width':itemlistwidth+'px'});	
	 
	 }
});
	
	function go(d,c){
		jQuery(".sw_s1_galitem_list:first").stop();
	jQuery(".sw_s1_galitem_list:last").stop();
	d=0;
	c=0;
	return false;
	}
	function scr_re(d,c){
					
					jQuery(".sw_s1_galitem_list:first").stop();
					jQuery(".sw_s1_galitem_list:last").stop();
					ind_act = ind;
					if(d==1){
							ind_act_c = itemlistwidth;
						}
					else{
							ind_act_c = 0-itemlistwidth;
					}		

						jQuery(".sw_s1_galitem_list:first").css({left:ind});
						jQuery(".sw_s1_galitem_list:last").css({left:ind_act_c+'px'});
						x=1;

										
						if(c==1){
							timer = setInterval( "scr("+d+","+c+")", 60 );					
						}
						
	}
	function scr(d,c){
		//alert(x+"#"+ind_act+"#"+erk)
		if(d==1 && x==1 && y==1){
					x=0;				
					if(ind_act>-itemlistwidth)	{
					
						if(ind_act==0){
						ind_act_c = itemlistwidth;
						jQuery(".sw_s1_galitem_list:last").css({left:ind_act_c+'px'});
						}

						ind_act = ind_act-1*itemwidth;			
						ind_act_c = ind_act_c-1*itemwidth;									

						jQuery(".sw_s1_galitem_list:first").animate( { left:ind_act+"px"}, 600 ,"swing",function(){x=1;clr(d,c)} );
						jQuery(".sw_s1_galitem_list:last").animate( { left:(ind_act_c)+"px"}, 600 ,"swing",function(){x=1;clr(d,c);} );
						return false;
						
					}	

					else {
							
						scr_re(1,c);
					}
						
					
		}
		else if(d==0 && x==1 && y==1){		
					x=0;
					if(ind_act<erk)	{

					if(ind_act==0){
						ind_act_c = 0-itemlistwidth;
						jQuery(".sw_s1_galitem_list:last").css({left:ind_act_c+'px'});
						}

						ind_act = ind_act+1*itemwidth;
						ind_act_c = ind_act_c+1*itemwidth;						

						jQuery(".sw_s1_galitem_list:first").animate( { left:ind_act+"px"}, 600 ,"swing",function(){x=1;clr(d,c)} );
						jQuery(".sw_s1_galitem_list:last").animate( { left:(ind_act_c)+"px"}, 600 ,"swing",function(){x=1;clr(d,c)} );
						return false;
						
					}
					else{
						
						scr_re(0,c);
						
					}
					
		}
			
	}

function clr(){
	clearInterval( timer );
	jQuery(".sw_s1_galitem_list:first").stop();
	jQuery(".sw_s1_galitem_list:last").stop();
	y=0;
	x=0;
	return true;
	}

function init_scr(dd,c){
			
	y=1;
	x=1;	
	jQuery(".sw_s1_galitem_list:first").stop();
	jQuery(".sw_s1_galitem_list:last").stop();
	timer = setInterval( "scr("+dd+","+c+")", 60 );		
	}







