$(function(){
	/*
	 * New Products listing on index
	 */
	$('.new_products .prod_image img').each(function(){
		var img = $(this).attr('src');
		$(this).parent().css('background','url(\'' + img + '\') no-repeat 50% 50%');
		$(this).hide();
	});

	/*
	 * Admin Box
	 */
	$('#adminbox h3').click(function(){
		$('#adminbox div').slideToggle();
	}).live('mouseover',function(){
		if($('#adminbox div').css('display')=='none'){
			$('#adminbox h3').css('background','url(/templates/silberfaser/img/down_16.png) no-repeat 100% 50%');
		} else {
			$('#adminbox h3').css('background','url(/templates/silberfaser/img/up_16.png) no-repeat 100% 50%');
		}
	}).live('mouseout',function(){
		$('#adminbox h3').css('background','none');
	});

	/*
	 * Correct radiobutton width in FF for Windows
	 */
	$('.formArea input[type=radio],.formArea input[type=checkbox]').css('width','10px');

	/*
	 * Correct subcategory height
	 */
	if($('.subcategory').length){
		var sh = 0;
		$('.subcategory').each(function(i, item){
			if(sh < $(this).height()){
				sh = $(this).height();
			}
		});
		$('.subcategory').css('height', sh + 'px');
	}

	/*
	 * yoxview for product images
	 */
	if($('.product_image').length){
		$('.product_image').yoxview({defaultDimensions: { iframe: { width: 560, height: 720 }}});
	}
	if($('a[target=yoxview]').length){
		$('a[target=yoxview][href!=\/stoffmuster]').yoxview();
		$('a[target=yoxview][href^=\/stoffmuster]').yoxview({defaultDimensions: { iframe: { width: 550, height: 550 }}});
	}
});
