$(document).ready(function(){
	if($('.login-block').length != 0){
		var gurov = new Gurov();
		gurov.init();
	}
	$('.span-link').hover(
		function () {
			$(this).addClass('hover');
		}, 
		function () {
			$(this).removeClass('hover');
		}
	);
});

function Gurov(){
	
}

Gurov.prototype = {
	init:function(){
		var _my = this;
		this.block = $('.header .login-block');
		this.loginForm = $('.header .form');
		this.login = this.block.find('input[type=text]');
		this.password = this.block.find('input[type=password]');
		this.lPlaceholder = this.login.attr('placeHolder');
		this.pPlaceholder = this.password.attr('placeHolder');
		this.loginButton = $('.header .login-button');
		this.loginButton.click(function(){
			_my.loginButton.toggle();
			_my.loginForm.toggle();
		});
		if(!$.browser.safari){
			this.login.val(this.lPlaceholder).focus(function(){
				if(_my.login.val() == _my.lPlaceholder){
					_my.login.val('');
				}
			}).blur(function(){
				if(_my.login.val() == ''){
					_my.login.val(_my.lPlaceholder);
				}
			});
			this.password.val(this.pPlaceholder).focus(function(){
				if(_my.password.val() == _my.pPlaceholder){
					_my.password.val('');
				}
			}).blur(function(){
				if(_my.password.val() == ''){
					_my.password.val(_my.pPlaceholder);
				}
			});
		}
	}
}