$(document).ready(function(){
	//$.fn.fancyzoom.defaultsOptions.imgDir='/images/fancyzoom/'; //very important must finish with a /
	//$('a.tozoom').fancyzoom({Speed:400,showoverlay:true,overlay:4/10});
	$('a.tozoom').facebox();
	
	/**
	 * Эмулирует поведение input type="search" как в Сафари
	 * 
	 * @param {Element} elem Поле ввода
	 * @param {String} [class_empty] Класс для пустого поля ввода
	 */
	function makePlaceholder(elem, class_empty) {
		class_empty = (typeof class_empty === 'string') ? class_empty : 'empty';

		$(elem).focus(function () {
			if (this.value === $(this).attr('placeholder')) {
				this.value = '';
			}
			$(this).removeClass(class_empty);
		});

		$(elem).blur(function () {
			if (!this.value.length) {
				this.value = $(this).attr('placeholder');
				$(this).addClass(class_empty);
			}
		});

		if (!elem.value.length) {
			$(elem).blur();
		}
	}

	// В Сафари placeholder и так работает
	if (!$.browser.safari) {
		$('input[placeholder]').each(function () {
			makePlaceholder(this);
		});
	}
 });