function preview(){
	$('.preview').click(
	    function (){
			$('.medium').attr('src', this.src);
			return false;
		}
	)
}
function listEvent(){
	$('.list .group li').hover(
		function (){
//			$('.list .group li').addClass('opacity');
			$(this).addClass('hovered').children('.img:first').find('img').attr('width', '110');
			$('.list .group li').each(function(){
				if (!($(this).hasClass('hovered'))){
					$(this).find('.img img').stop().animate({
						opacity:0.4
					},500)
				}
			})
		},
		function(){
			$(this).removeClass('hovered').children('.img:first').find('img').attr('width', '100');
	//		$('.list .group li').removeClass('opacity');
			$('.list .group li').each(function(){
				if (!($(this).hasClass('hovered'))){
					$(this).find('.img img').stop().animate({
						opacity:1
					},500)
				}
			})
		}
	 )
}

function catalogShadow(){
	$('.catalog .contCatalog img').hover(
		function(){
			$(this).parent().siblings('a').children('img').stop().animate({
				opacity:0.3
			}, 300)
		},
		function(){
			$(this).parent().siblings('a').children('img').stop().animate({
				opacity:1
			}, 300)
		}
		
	)
}


function round(){
	if (!(($.browser.msie) && (parseInt(jQuery.browser.version) < 6))) {
		$("img[rel='wrapped']").each(function(){
			var iFloat = $(this).css('float');
			var iMargin = $(this).css('margin');
			var iWidth = $(this).width()+12;
			$(this).css('margin', '0')
				.wrap('<div class="lt" style="float:' + iFloat + '; margin:' + iMargin + '; width:'+iWidth+'px;"></div>')
				.wrap('<div class="rt"  style="float:' + iFloat + ';"></div>')
				.wrap('<div class="lb"  style="float:' + iFloat + ';"></div>')
				.wrap('<div class="rb" style="float:' + iFloat + '; "></div>');
		})
	} 
}


$(document).ready(function(e) {
	try {
		$("div[rel='hidden']").hide();
		$('.character  table.param tr:even').addClass('even');
		
		round();
		listEvent();
		catalogShadow();
		preview();		
	
		$('.slideshow').cycle({
			fx: 'fade'
		});
	
	
	} catch(e) {
		alert(e);
	}

}); 
