// JavaScript Document


window.onload = (function()	{
						  
// position small images
						  
var selector = 'img.small_image';
	
	$(selector).each(function()	{
							  							  
		var width = $(this).width();
		var height = $(this).height();
		
		if (width > height) {
			
			var position_top = Math.floor((180 - height)/2);
			
			$(this)
				.css("position","relative")
				.css("top",position_top + "px");

		} else {
			
			var position_left = Math.floor((180 - width)/2);
			
			$(this)
				.css("position","relative")
				.css("left",position_left + "px");
		}
		
	});
	
// position medium images
						   
var selector = 'img.medium_image';
	
	$(selector).each(function()	{
							  
		var width = $(this).width();
		var height = $(this).height();
		
		if (width > height) {
			
			var position_top = Math.floor((360 - height)/2);
			
			$(this)
				.css("position","relative")
				.css("top",position_top + "px");

		} else {
			
			var position_left = Math.floor((360 - width)/2);
			
			$(this)
				.css("position","relative")
				.css("left",position_left + "px");
		}
	});

// position thumb images

var selector = 'img.thumb_image';
	
	$(selector).each(function()	{
							  
		var width = $(this).width();
		var height = $(this).height();
		
		if (width > height) {
			
			var position_top = Math.floor((60 - height)/2);
			
			$(this)
				.css("position","relative")
				.css("top",position_top + "px");

		} else {
			
			var position_left = Math.floor((60 - width)/2);
			
			$(this)
				.css("position","relative")
				.css("left",position_left + "px");
		}
						
	});
    
//gallery tabber

$('.image_holder').hide();
$('.image_holder:first').show();


var tabContainers = $('div.image_viewer > div.gallery > div');

$('div.image_viewer span.tabNavigation a').click(function () {
	tabContainers.hide().filter(this.hash).show();
	
	$('div.image_viewer span.tabNavigation a').removeClass('selected');
	$(this).addClass('selected');
	
	return false;
}).filter(':first').click();

//lightbox

$('.image_holder a').lightBox();

});
