/* FORM events */
$.fn.extend({ reset: function() {
    return this.each(function() {
        $(this).is('form') && this.reset();
    });
} });
$.fn.extend({ submit: function() {
    return this.each(function() {
        $(this).is('form') && this.submit();
    });
} });

function inputIn(obj, text) {
   if ($(obj).val() == text) {
      $(obj).val('');
      $(obj).removeClass('empty');
   }
}
function inputOut (obj, text) {
   if ($(obj).val() == '' || $(obj).val() == text) {
      $(obj).val(text);
      $(obj).addClass('empty');
   }
}	
function inputHelper(obj, text) {
   $(obj)
      .bind ('focus', function () {
         inputIn (this, text);
      })
      .bind ('blur', function () {
         inputOut (this, text);
      });
	inputOut(obj, text);
}

$(document).ready(function() {

	inputHelper($('input.internal').addClass('empty'), 'Логин');

	$('.logo')
		.hover(function() {
			$('.popup').show();
		}, function() {
			//$('.popup').hide();
		});
	if ($('.popup').length > 0) {
		$('.popup-close').click(function() {
			$('.popup').hide();
		});
	}
	
	if ($('.link-login').length > 0) {
	  $('.link-login a').click(function() {
	     $('.popup-login').show();
	     return false;
	  });
	  $('.popup-login-close').click(function() {
	     $('.popup-login').hide();
	  });
	}
	
	$('.form-submit').click(function() {
			$('#form-feedback').submit();
			return false;
		}); 
});

$(window).bind('resize', function() {
   
});
