function initRating() {
	$j('input[type=radio].star').rating({
		split:4,
		readOnly:true
	});
	$j('.vote-bar').show();
}

function initFancy() {
    var autoScale = true;
    var centerOnScroll = true;
    
    if ($j.browser.msie && BrowserDetect.version < 7) {
        autoScale = false;
        centerOnScroll = false;
    }
    
	$j('.sv-fancy').fancybox({'overlayShow': true, 'hideOnContentClick': true, 'centerOnScroll': centerOnScroll, 'titlePosition': 'inside', 'transitionIn': 'elastic', 'transitionOut': 'elastic', 'autoScale': autoScale});
}

function initSpin(baseUrl, color) {
	$j.spin.imageBasePath = baseUrl + '/' + color + '/';
	$j.spin.btnClass = 'spin-img';
	$j.spin.btnCss = null;
	$j('.spin').spin({min: 1});
}

function checkCookie(err) {
	if (!isCookieEnabled()) {
		ProcessMsgs('', $j.base64Encode(err));
	}
}

$j(window).scroll(function(){
	$j('#sv-msgs-block').animate({top:$j(window).scrollTop() + "px"}, {queue: false, duration: 0});
});

$j(document).ready(function(){
	$j('input[type="text"], input[type="password"]').keypress(function(e){
		if (e.which == 13 && this.form.action != '') {
			this.form.submit();
		}
	});
	
	// Исправление проблемы с шириной SELECT-BOX в IE
	/*if ($j.browser.msie) {
		var select_clicked = {};
		
		$j('.product-options select, #product-variants-select').mousedown(function(){
			var was_offset = $j(this).offset();
			
			this.style.position = 'absolute';
			this.style.width = 'auto';
			
			this.style.left = was_offset.left;
			this.style.top  = was_offset.top;
			
			var id = $j(this).attr('id');
			
			if (!select_clicked[id]) {
				select_clicked[id] = true;
				$j(this).mousedown();
			}
		});
		
		$j('.product-options select, #product-variants-select').change(function(){
			$j(this).blur();
		});
		
		$j('.product-options select').blur(function(){
			var id = $j(this).attr('id');
			
			this.style.position = '';
			this.style.width = '100px';
			select_clicked[id] = false;
		});
		
		$j('#product-variants-select').blur(function(){
			var id = $j(this).attr('id');
			
			this.style.position = '';
			this.style.width = '330px';
			select_clicked[id] = false;
		});
	}*/
});
