var border4px = RUZEE.ShadedBorder.create({ corner:4, shadow:7,  border:0 });
var corners4px = RUZEE.ShadedBorder.create({ corner:4, shadow:0,  border:0 });

var RecaptchaOptions = {
   lang : 'ru'
};

$(function() {
	if ($('#intro')[0]) {
		border4px.render('intro');
		if ($.browser.msie) {
			$('#glass-link, #instruments-link').show();
		}
		corners4px.render('glass-link');
		corners4px.render('instruments-link');
		if ($.browser.msie) {
			$('#glass-link, #instruments-link').hide();
		}
	}

	if ($('#main')[0]) {
		border4px.render('main');
	}

	if ($('#sec')[0]) {
		border4px.render('sec');
	}


	border4px.render('main-menu');

	$('#search-field, #search-field2').focus(function() {
		if(this.value === 'Поиск') {
			this.value = '';
		}
	});
	
	$('#search-field, #search-field2').blur(function() {
		if(this.value === '') {
			this.value = 'Поиск';
		}
	});
	
	$('#search-form').submit(function() {
		if($('#search-field')[0].value === '' || $('#search-field')[0].value === 'Поиск') {
			return false;
		}
	});
	
	$('#search-form2').submit(function() {
		if($('#search-field2')[0].value === '' || $('#search-field2')[0].value === 'Поиск') {
			return false;
		}
	});
	
	
	$('#glass-trigger, #instruments-trigger').hover(
		function() {
			$(this).children().show();
		}, function() {
			$(this).children().hide();
	});
	
	$('#catselect').change(function() {
		window.location.href = '/catalog/' + this.value + '/';
	});
	
	$('a.zoom').lightBox({
				imageLoading:			'/static/images/lightbox/lightbox-ico-loading.gif',		// (string) Path and the name of the loading icon
				imageBtnPrev:			'/static/images/lightbox/lightbox-btn-prev.gif',			// (string) Path and the name of the prev button image
				imageBtnNext:			'/static/images/lightbox/lightbox-btn-next.gif',			// (string) Path and the name of the next button image
				imageBtnClose:			'/static/images/lightbox/lightbox-btn-close.gif',		// (string) Path and the name of the close btn
				imageBlank:				'/static/images/lightbox/lightbox-blank.gif'			// (string) Path and the name of a blank image (one pixel)
	});
	
	$('#main .pics .thumb').click(function() {
		if (this.href == $('#main .zoom')[0].href) {
			return false;
		}
		$('#main .pics .big').fadeOut('slow');
		$('#main .pics .big').eq($('#main .pics .thumb').index(this)).fadeIn('slow');
		$('#main .zoom')[0].href = this.href;
		return false;
	});	

	$('#currency').change(function() {
		var old_currency = $.cookie('currency');
		var currency = $(this).children(':selected')[0].value;
		if (old_currency !== currency) {
			$.cookie('currency', currency, {path: '/'});
			window.location.reload();
		}
	});

});
