// JavaScript Document
function AutoScroll(obj){  
	$(obj).find("ul:first").animate({  
		marginTop:"-20px" 
	},600,function(){  
		$(this).css({marginTop:"0px"}).find("li:first").appendTo(this);  
	});  
}

$(function(){
	
	var t=0
	var time=5000;
	var moveTime=700;
	var move=722;
	var pro=$("#pro");
	var copy=$("#copy");
	var s=parseInt(pro.width());
	$("#end").html($("#pro .group").last().html());
	copy.css({"display": "none"});
	function d(){
		t=t-move;
		if(t>-s){
			pro.animate({left: t}, moveTime); 
		}else{
			pro.css({"left": move+"px"});
			pro.animate({left: "0px"}, moveTime); 
			copy.css({"left": "0px", "display": "block"});
			copy.animate({left: -move+"px"}, moveTime); 
			t=0;
		}
		setTimeout(d,time);
	}; 
	setTimeout(d,2000);
	
	//news scroll
	setInterval('AutoScroll(".news .left .text")',3000);
	
	//with slider
	var num = 1;
	var current=0;
	var move2 = num*211;
	var speed = 500;
	var boxWidth = parseInt($('.with .slider .cont').width())-10;
	var conWidth=parseInt($('.with .slider .pro').width());
	 
	$('.with .slider .next').click(function(){
		if(conWidth+current-move2<=boxWidth) {

		}else{
			current=current-move2;
			$('.with .slider .hide').animate({left: current}, speed);
		}
		if(conWidth+current-move2<=boxWidth) {
			$('.with .slider .next').addClass('stop');
		}else{
			$('.with .slider .prev').removeClass('stop');
		}
		
	})
	$('.with .slider .prev').click(function(){ 
		if(current>-move2) {

		}else{
			current=current+move2;
			$('.with .slider .hide').animate({left: current}, speed);  
		}
		if(current>-move2) {
			$('.with .slider .prev').addClass('stop');
		}else{
			$('.with .slider .next').removeClass('stop');
		}
	});
	
	//find
	if($.browser.version == '6.0' || $.browser.version == '7.0'){
		$('.find').css('position','absolute');
		$('.find').css('top',($(window).height()-$('.find').height())/2);
		$(window).scroll(
			function(){
				$('.find').css('top',$(window).scrollTop()+($(window).height()-$('.find').height())/2);
			}
		)
	}else{
		$('.find').css('position','fixed');
		$('.find').css('top',($(window).height()-$('.find').height())/2);
	}
	
})



