(function($){
	$.fn.cleanDubleSpace = function() {
		while ($(this).val().search('  ') != -1) {
			$(this).val($(this).val().replace('  ', ' '));
		}
		return this;
	}
})(jQuery);

$(function() {
	$('a').add('img').bind('mouseup', function(event) { self.focus(); });
	$('.foot img').css('opacity','0.5').hover(function(event) { $(this).css('opacity','1'); }, function(event) { $(this).css('opacity','0.5'); });
	$('.hmenu li:last').addClass('last');
	$('.hmenu li ul').children('li:last-child').addClass('last');
	$('.hmenu li').addClass('shover1').hover(
		function(event) {
			$('.shover').removeClass('shover');
			$(this).addClass('shover').children('ul').show();
		},
		function(event) {
			$('.shover').removeClass('shover');
			$(this).children('ul').hide();
		}
		).children('ul').each( function(i) {
			$(this).width($(this).width()); }
		).hide();
	$('#imgMenu>div>span').bind('mouseover', function(event) {
		$('.over').removeClass('over');
		$(this).parent().addClass('over');
	});
	$('#imgMenu>div').bind('mouseout', function(event) {
		if(event.target != this) {
			return;
		}
		$(this).removeClass('over');
	});
	$('.corner').corner();
	$('#price tr:even').addClass('c1').each(function() { $(this).children('td:gt(0)').addClass('c3') });
	$('#price tr:odd').addClass('c2').each(function() { $(this).children('td:gt(0)').addClass('c3') });
	$('.imgzoom').each(function() {
		var srcPathArray = $(this).attr("src").split('/');
		var imgFile = srcPathArray[srcPathArray.length-1];
		var srcPath = $(this).attr("src").split(imgFile , 1);
		$(this).wrap("<a class=\"fancybox\" rel=\"gallery1\" href=\"" + srcPath + "big_" + imgFile + "\" title=\"" + $(this).attr("alt") + "\"></a>")
	});
	$('.fancybox').fancybox({
		openEffect	: 'fade',
		closeEffect	: 'fade'
	});
});                     	

