function showstuff(boxid){

	var boxes = document.getElementsByTagName("div");
	for(i = 0; i < boxes.length; i++) {
		if(boxes[i].className == "text_box") {
			boxes[i].style.display="none";
		}
	}

        var headings = document.getElementsByTagName("a");
        for(i = 0; i < headings.length; i++) {
               if(headings[i].className == "text_heading") {
                        headings[i].style.fontWeight="normal";
                }
        }

	document.getElementById("text_box_"+boxid).style.display="block";
	document.getElementById("text_heading_"+boxid).style.fontWeight="bold";

	if(typeof pageTracker != "undefined") {
		pageTracker._trackPageview(location.pathname + "/" + boxid);
	}
}


function slideshow(elementname) {
	$(elementname).show("slide", {direction: "down"}, 500);
}

function slidehide(elementname) {
	$(elementname).hide("slide", {direction: "up"}, 500);
}

function fasthide(elementname) {
	$(elementname).hide();
}

function ajaxcheck() {
	$.getScript('/inc/ajaxcheck.js');
}

var domcur = '';
var firstrun = true;
var linewait = 0;

function domainsearch() {
	//Not using jQuery to check the ajaxcheck field value,
	//because we are actually trying to see if jQuery and Ajax are working
	if(document.getElementById("ajaxcheck").value != "yes") {
		return true;
	}

	$(".domtaken, .domfail").fadeOut("slow");

	var doman = $('#domansok').val();
	domcur = doman;
	//Updated with top domains here and in serverside script file
	//topdomains = [ "se", "com", "net", "org", "biz", "nu", "info", "eu" ];
	topdomains = $(".tld:checked");
	domleft = $(topdomains).length;
	var isfirstrun = firstrun;
	if(!isfirstrun) {
		domainline();
		var lastresult = $(".domresult:first").get(0);
	}else{
		$(".domresult").remove();
	}
	jQuery.each(topdomains, function(i, topdomain) {
		topdomain = $(topdomain).val();
		$.post(
			'/sv/doman.html',
			{ ajax : "1", domansok : doman, topdoman: topdomain},
			function(data) {
				if(doman != domcur) {
					return false;
				}
				if(isfirstrun) {
					firstrun = false;
					$(data).hide().appendTo("form table tbody").fadeIn("normal");
				}else{
					$(data).hide().insertBefore(lastresult).fadeIn("normal");
				}
				domleft--;
				if(domleft <= 0) {
					domleft = 0;
					$("body, input").css("cursor", "default");
				}
			},
			"html"
		);
	});
	$("body, input").css("cursor", "progress");
	return false;
}

function emptydomaincache() {
	$.post(
		'/sv/doman.html',
		{ ajax : "1", emptycache : "1" }
	);
}

function domainline() {
	linewait++;
	$.post(
		'/sv/doman.html',
		{ ajax : "1", domainline : "1" },
		function() {
			linewait--;
		}
	)
	$('<tr class="domresult domline"><td colspan="4"></td></tr>').insertBefore(".domresult:first");
}

function redir(obj) {
	obj.href = "/redir?"+obj.href;
}

function clickclear(thisfield, defaulttext) {
if (thisfield.value == defaulttext) {
thisfield.value = "";
}
}
function clickrecall(thisfield, defaulttext) {
if (thisfield.value == "") {
thisfield.value = defaulttext;
}
}

