var totalArticles=0;
var articles=[];
var shiftamount=245;
var articleCounter=0;
var intervalTime = 4500;
var article_id=null;
var crtb=null;

jQuery(document).ready(function(){
								jQuery('.bullet').html("");
								totalArticles = jQuery("#article_plate ul").eq(0).children('li').length;
								var htmlc="";
								jQuery("#article_plate").css('left','0px');
								jQuery("#article_plate").css('width',totalArticles*shiftamount);
								jQuery("#article_plate ul").eq(0).children('li').each(function(n){ 
																							   
																							   htmlc = htmlc+"<div style='width:"+shiftamount+"px; height: 80px; float:left;'>";
																							   htmlc = htmlc+jQuery(this).html();
																							   htmlc = htmlc+"</div>";
																							   
													jQuery('.bullet').append('<img id="b_'+n+'" src="'+hlink+'images/bullet-n.jpg"/>&nbsp;');
																							   });
								
								jQuery("#article_plate").html(htmlc);
								jQuery('.bullet img').css('cursor','pointer');
								jQuery('.bullet img').bind('click',function(){
																			
																			 clearInterval(article_id);
																			 articleCounter = jQuery(this).attr('id').split("_")[1];
																			 numSlide();
																			 });
								numSlide();
								article_id = setInterval(function(){nextSlide();},intervalTime);
								
								});


function nextSlide()
{
	
	articleCounter<totalArticles-1 ? articleCounter++ : articleCounter=0;
	
	numSlide();
	
}

function numSlide()
{
	if(crtb!=null)
	{
	  crtb.attr('src',hlink+'images/bullet-n.jpg')	
	}
	
	tgt = shiftamount*(-1)*articleCounter;
	jQuery("#article_plate").animate({left:tgt},850);
	jQuery('.bullet img').eq(articleCounter).attr('src',hlink+'images/bullet-h.jpg')	
	crtb = jQuery('.bullet img').eq(articleCounter);
	
	
}

