$(document).ready(function() {

	if($("body").attr("resizable") == "true"){
		$(window).resize(function(){
			resizer();
		});

		resizer();
	}
	
	var ctr = 0;
	
	$("div#photo_scroll img").each(function(){
		ctr++;
		$(this).attr("number", ctr);
	});
	
	$("div#photo_scroll img").click(function(e){
		var img = $(this);
		var num = img.attr("number");
		
		if(num == 1){
			pos -= 727;
			scrollImages(pos);
		} else if(num < 6){
			var clickX = e.pageX - img.offset().left;
			
			if(clickX > 353){
				pos -= 727;
				scrollImages(pos);
			} else {
				pos += 727;
				scrollImages(pos);
			}
		} else {
			pos += 727;
			scrollImages(pos);
		}
	});
	
});

var pos = 0;

function resizer(){
	var h = $(window).height();
	if(h < 880){
		$("div#title").css("display", "block");
		$("div#title_big").css("display", "none");
	} else {
		$("div#title").css("display", "none");
		$("div#title_big").css("display", "block");
	}
}

function scrollImages(pos){
	$("#photo_scroll").animate({
    left: pos
  }, 500, function() {});
}

