
cur_photo=new Array();
photos=new Array();
photos_names=new Array();

$(document).ready(function(){

	$('.menu > li > .submenu').parent().children('a').click(function(){
		$(this).parent().children('.submenu').slideDown(300);
		$(this).parent().addClass('sel');
		return false;
	});

	$('.menu > li > .submenu').parent().mouseleave(function(){
		$(this).children('.submenu').slideUp(200);
		$(this).removeClass('sel');
	});
	

	$('.photogallery_photo').load(function(){$(this).fadeIn(300)});
	
	$('.photogallery > a.photo, .photogallery_next').click(function(){
		rel=$(this).attr('rel');

		cur_photo[rel]++;
		if(cur_photo[rel] > photos[rel].length-1)
			cur_photo[rel]=0;
		$('#photogallery_photo_'+rel).fadeOut(200,function(){
    	$('#photogallery_photo_'+rel).attr('src',photos[rel][cur_photo[rel]]);
    	$('#photogallerycomm_'+rel).html(photos_names[rel][cur_photo[rel]]); 
		});

		return false;
	});
	
	$('.photogallery_thumbs > a').click(function(){
		hr=$(this).attr('href');
		hr=hr.replace('#','');
		
		rel=$(this).attr('rel');

		cur_photo[rel]=hr;
		if(cur_photo[rel] > photos[rel].length-1)
			cur_photo[rel]=0;
		$('#photogallery_photo_'+rel).fadeOut(200,function(){
    	$('#photogallery_photo_'+rel).attr('src',photos[rel][cur_photo[rel]]);
    	$('#photogallerycomm_'+rel).html(photos_names[rel][cur_photo[rel]]); 
		});

		return false;
	});
	
	$('#c_archive').hoverscroll({
	    width:    792,      // Width of the list container
	    height:   150,      // Height of the list container
	    arrows:   false      // Display direction indicator arrows or not
	});
	
		
});
