
var iew = {
	main_whois: function() {
		var domain = jQuery.trim(jQuery('#home-whois-query').val());
		return iew.whois(domain);
	},
	
	qinput_whois: function() {
		var domain = jQuery.trim(jQuery('#qinput-whois').val());
		return iew.whois(domain);
	},
	
	whois: function(domain) {
		location.href = '/' + domain.toLowerCase();
		return;
	},
	
	toggle: function(what) {
		jQuery(what).toggle();
		return;
	}
};

function showQuickLogin() {
	if(jQuery('#quick-login').is(':visible')) { hideQuickForms(); return; }
	
	jQuery('#quick-register').hide();
	jQuery('#quick-login').show();
	jQuery('#quick-login input:first').focus();
	return;
}
function showQuickRegister() {
	if(jQuery('#quick-register').is(':visible')) { hideQuickForms(); return; }
	
	jQuery('#quick-login').hide();
	jQuery('#quick-register').show();
	jQuery('#quick-register input:first').focus();
	return;
}
function hideQuickForms() {
	jQuery('#quick-login,#quick-register').hide();
	return;
}

jQuery(document).ready(function(){
	// qinput whois
	jQuery('#qinput-whois-commit').bind('click',iew.qinput_whois);
	jQuery('#qinput-whois').bind('keypress',function(e){if(e.keyCode==13)iew.qinput_whois();}).focus();
	
	// main whois
	jQuery('#home-whois-commit').bind('click',iew.main_whois);
	jQuery('#home-whois-query').bind('keypress',function(e){if(e.keyCode==13)iew.main_whois();}).focus();
});

