function checkValue(elmnt, evnt, orig)
{
	if(evnt == 'focus')
	{
		if(elmnt.value == orig)
		{
			elmnt.value = '';
		}
	}
	
	if(evnt == 'blur')
	{
		if(elmnt.value == '')
		{
			elmnt.value = orig;
		}
	}
}

function Check(id, domain, tld, checked)
{
	$.getJSON('/domain/search/index/sld/' + domain + '/tld/' + tld + '/checked/' + checked, function(json){
		if(checked != '2') {
			var dC = $("#domainCheck" + id);
			dC.html(json.statusValue);
			dC.css("color", json.statusColor);
			var dCB = $("#domainCheckbox" + id);
			dCB.css("visibility", json.checkedVisibility);
			if(json.checked == '0') {
				dCB.attr("checked", false);
			}
			else {
				dCB.attr("checked", true);
			}
			
			$("#transferCheckbox" + id).css("visibility", json.transferVisibility);
		}
		else {
			$("#domainTransfer" + id).css("visibility", json.transferVisibility);
		}
	});
}

function WhoisDialog(search)
{
	var id = Number(new Date());
	$('body').prepend('<div id="WhoisDialog' + id + '" title="WHOIS-resultater for ' + search + '">Laster, vennligst vent...</div>');
	$('#WhoisDialog' + id).dialog({
		autoOpen: true,
		width: 640,
		height: 480,
		buttons: {
			"Lukk vindu": function() {
				$(this).dialog("close");
			}
		},
		modal: true,
		overlay: {
			opacity: 0.5,
			background: "#EEEEEE"
		},
		close: function() {
			$("#WhoisDialog" + id).remove();
		}
	});
	$.getJSON('/domain/whois/index/search/' + search + '/width/74', function(data) {
		$('#WhoisDialog' + id).html('<pre>' + data.data + '</pre>');
	});
}

