/* header main news carousel */
function mainnewscarousel(){
	var totmainnews = jQuery('.maingallery_singlepicturecont').length;
	var curmainnews = 0;
	
	//
	for( var i = 1; i < totmainnews; i++)
	{
		//alert(i + "  - "  + totmainnews);
		jQuery('.maingallery_singlepicturecont')[i].style.display = "none";
	}
	//document.getElementById('maingallery_singlepicturecont')[1].style.display = "none";
	
	jQuery('#maingallery_arrowcont .right').click(function(){
		jQuery(jQuery('.maingallery_singlepicturecont')[curmainnews++]).fadeOut(function(){
			if(curmainnews == totmainnews){ curmainnews = 0; }
			jQuery(jQuery('.maingallery_singlepicturecont')[curmainnews]).fadeIn();
		});
	});
	
	jQuery('#maingallery_arrowcont .left').click(function(){
		jQuery(jQuery('.maingallery_singlepicturecont')[curmainnews--]).fadeOut(function(){
			if(curmainnews == -1){ curmainnews = totmainnews-1; }
			jQuery(jQuery('.maingallery_singlepicturecont')[curmainnews]).fadeIn();
		});
	});
	
	
}

function subcarousel(objid){
	var totnews = jQuery('#'+objid +' .singlepicturecont').length;
	var curnews = 0;
	
	
	//alert(totnews + "  - "  + objid);
	
	for( var i = 1; i < totnews; i++)
	{
		//alert(i + "  - "  + objid);
		jQuery('#'+objid +' .singlepicturecont')[i].style.display = "none";
	}
	
	
	jQuery('#'+objid +' .right').click(function(){
		jQuery(jQuery('#'+objid +' .singlepicturecont')[curnews++]).fadeOut(function(){
			if(curnews == totnews){ curnews = 0; }
			jQuery(jQuery('#'+objid +' .singlepicturecont')[curnews]).fadeIn();
		});
	});
	
	jQuery('#'+objid +' .left').click(function(){
		jQuery(jQuery('#'+objid +' .singlepicturecont')[curnews--]).fadeOut(function(){
			if(curnews == -1){ curnews = totnews-1; }
			jQuery(jQuery('#'+objid +' .singlepicturecont')[curnews]).fadeIn();
		});
	});
	

}


function init(){
	mainnewscarousel();
}
