// JavaScript Document

$(function(){
		   var currId=0;
		   img_slide(currId);
		   var imgcnts = $('.boxContent > li').size();
		   $(".slideCont:gt(0)").hide();
		   
		   $(".leftBut > a, .previous").click(function(){
										if(currId>0){
										img_slide(--currId);
										}else{
										currId=imgcnts-1;	
										img_slide(currId);
										}
										return false;
										});
		   $(".rightBut > a, .next").click(function(){
										 if(currId<imgcnts-1){
										 img_slide(++currId);
										 }else{
										currId=0; 
										img_slide(currId);
										 }
										 return false;
										 });
		  
			$(".boxContent > li").click(function(){
												 var tmp=parseInt($(this).attr("id"));
												 currId=tmp;
												 img_slide(currId);
												 });	  
		   
		   function img_slide(id){
			   $(".boxContent > li").removeClass("mouseOver");
				$(".boxContent > li").eq(id).addClass("mouseOver");
				//var src=$(".boxContent > li").eq(id).attr("imgsrc");
				//$("#targetimg").attr("src",src);
				$(".slideCont").hide();
				$(".slideCont").eq(id).show();
				
				if(id>3){
					$(".boxContent").animate({left:"-310px"},400);	
				}
				
				if(id>=0 && id<=3){
					$(".boxContent").animate({left:"0px"},400);		
				}
				
			}
		   
		   
		   
});


