$(document).ready(function(){
	if($(window).width() > 500){
		iWidthContainer = parseInt($('body').css('width')) - 277;
		iWidthContent = parseInt($('body').css('width')) - 622;
		$('#content').css("width",iWidthContent);
		$('#subnav-box').animate({"width": "200px"}, 300);
		$('#container').animate({"width": iWidthContainer}, 1000);
	}
		
	$('input[type="text"]').focus(function(){
		$(this).val('');
	});
	$('input[type="password"]').focus(function(){
		$(this).val('');
	});
	
	$(window).resize(function() {
	  	setPadding();
	});
	
});

$('#menu').ready(function(){
	setPadding();
});

function setPadding(){
	if($(window).width() > 500){
		iHeightContent = parseInt($('#content').css('height'));
		iHeightMenu = parseInt($('#menu').css('height'));
		iHeightSubNav = parseInt($('#subnav').css('height'));
		iHeight = parseInt($('#container').css('height'));
	
		iPadding = iHeight/2 - iHeightContent/2;
		iPaddingMenu = iHeight/2 - iHeightMenu/2;
		iPaddingNav = iHeight/2 - iHeightSubNav/2;
		
		if(iPaddingMenu > 155){
			$('#menu').css('top', iPaddingMenu);
		}
		$('#menu').css('display', 'block');
		$('#subnav').css('padding-top', iPaddingNav);
		
		if($('#gallery-zoom')){
			iWidthGallery = parseInt($('#gallery-zoom').css('width'));
			iHeightGallery = parseInt($('#gallery-zoom').css('height'));
			
			$('#slide-zoom-right').css('top',iHeightGallery/2-10);
			$('#slide-zoom-left').css('top',iHeightGallery/2-10);
			
		}
	}
}

function slideGallery(){
	$('#mini-slider a').removeClass('current');

	$('#mini-slider a').each(function(index,el){
		if(index == iCurrent){
			$(this).addClass('current');
			sSrc = $(this).find('img').attr('src');
			sSrc = sSrc.replace('120X80','500');
			sAlt = $(this).find('img').attr('alt');
		}
	});
	$('#big-picture').attr('src',sSrc);
	$('#big-picture').attr('alt',sAlt);
}
