function resWin()
{
	var width = document.body.clientWidth;
	var blockWidth = $("#win").width();
	var height = screen.height;
	var blockHeight = $("#win").height();

	$("#win").css('left',(width-blockWidth)/2+"px");
	$('#win').css("width",$("#photos").width()+90+"px");
	$('#win').css("height",$("#photos").height()+90+"px");

	if($("#win").css("top") !== "-1000px")
	{
		$("#win").css('top',((height-blockHeight)*0.3)/2+"px");
	}
}

$(document).ready(function(){
	var width = document.body.clientWidth;
	var blockWidth = $("#photos").width();
	var height = screen.height;
	var blockHeight = $("#photos").height();
	
	
	var wdt = (((height-550)/1.7)<215) ? (height-550) : (height-550)/1.7;
	$('#photos').galleryView({
		panel_width: (width/1.6),
		panel_height: wdt,
		frame_width: 96,
		frame_height: 96,
		transition_interval:0
	});
	
	$('#photogallery').click(function(){
		$('#win').css('top','20px');
		$("#shadow").css("display","inline");
		resWin();
	});
	$('#close').click(function(){
		$('#win').css('top','-1000px');
		$("#shadow").css("display","none");
	});
	$("#shadow").click(function(){
		$('#win').css('top','-1000px');
		$("#shadow").css("display","none");
	});
	

	$(window).resize(function(){
		resWin();
	});
});