
$(function() {
	make_corners_rounded();
	bind_handler_to_polaroid();
	add_polaroid_animation();
//	adjust_position_paging();
	$(window).load(function(){
		adjust_layout_photogallery();
	});
});

function bind_handler_to_polaroid() {
	if($("a.link_to_cat").length > 0) {
		$("a.link_to_cat").click(function(event){
			event.stopPropagation();
		});
	}
}

function add_polaroid_animation() {
	if($("img.category_polaroid").length > 0) {
		$("img.category_polaroid").hoverIntent(function(){
			$(this).fadeTo(300, 0.65, function(){ $(this).fadeTo(300, 1); });
		}, dummy);
	}
}

function dummy() {;}

function adjust_position_paging() {
	if($('ul.rsx-page-num-list').length > 0) {
		var left_margin = $('ul.rsx-page-num-list').width() / 2 - 2;
		$('ul.rsx-page-num-list').css("margin-left", "-" + left_margin + "px");
	}
}

function adjust_layout_photogallery() {
	var content_area_height = $('div#content').height() + 5;
	// First column
	var photogallery_index_must_height = content_area_height - $('div#photogallery_info').outerHeight() - 5 - 10 - 10;
	$('div#photogallery_main_area').height(photogallery_index_must_height);
	// Second column
	$('div#side_banners').height(content_area_height - 15);
}

