var count=''; var position=5; var move=0; banner=0; var img_move = 0; 
var img_pos = 0;


$().ready(function(){
/******************* For the Photo gallery **************************/
 
$('.gallery_con').each(function(){
	var Main =  $(this).children('.main');
	$(Main).find('img').attr('src', $(this).find('.active').children('img').attr('src'));
	$(this).find('.main .title_img').slideDown('slow');
	$(this).find('.main .title_img').html('<p>'+$(this).find('div.active').children('img').attr('alt')+'</p>');
	
});





$('.img_thumb').click(function(){
	var GlaCon = $(this).parents('.gallery_con');
	var im = $(GlaCon).children('.main').find('img');
	var title = $(GlaCon).children('.main').find('.title_img');
	$(im).attr('src', $(this).attr('src'));
	$(title).hide(); $(im).hide();
	var name ='<p>'+ $(this).attr('alt')+'</p>';
	
	$(GlaCon).children('.main').find('.title_img').html(name);
	$(title).slideDown('slow'); $(im).fadeIn('slow'); 
});
 
$('span.move').click(function(){ scrollphoto(this) });
}); // ready ends
 
 
/******* Photo Gallery Scroll Function ***********/
 
function scrollphoto(div)
{
	var thumnails_con =  $(div).parent();
	var cnt = $(thumnails_con).find('.thumb').size();

	if($(div).hasClass('next')){
		if(cnt > 5 && img_pos < (cnt-5)){
			img_move=img_move+84;
			img_pos++;
			$(thumnails_con).find('.photo_scroll').animate( {marginLeft:'-'+String (img_move)+'px'},'slow');
		}
	}else{
		if(img_pos > 0 ){
			img_move=img_move-84;
			img_pos--; 
			$(thumnails_con).find('.photo_scroll').animate( {marginLeft:'-'+String (img_move)+'px'},'slow');
		}		 
 	}

}

