function clickclear(thisfield, defaulttext) {
	if (thisfield.value == defaulttext) {
		thisfield.value = "";
	}
}

function clickrecall(thisfield, defaulttext) {
	if (thisfield.value == "") {
		thisfield.value = defaulttext;
	}
}

function popular_aux(popularId, id) {
	var popular = document.getElementById(popularId);
 	var tabs = popular.firstChild;
	while (tabs.className != "tabs" ) tabs = tabs.nextSibling;

		var Tab = tabs.firstChild;
		var i   = 0;

		do {
   			if (Tab.tagName == "A") {
				i++;
				Tab.href      = "javascript:popular_switch('"+popularId+"', "+i+");";
				Tab.className = (i == id) ? "active" : "";
				Tab.blur();
			}
		}
		while (Tab = Tab.nextSibling);

		var layers = popular.firstChild;
		while (layers.className != 'layers') layers = layers.nextSibling;

			var page = layers.firstChild;
			var i    = 0;

			do {
				if (page.className == 'page') {
					i++;
					if (layers.offsetHeight) page.style.height = (layers.offsetHeight-2)+"px";
					page.style.overflow = "auto";
					page.style.display  = (i == id) ? 'block' : 'none';
				}
			}
			while (page = page.nextSibling);
		}

function popular_switch(popularId, id) { popular_aux(popularId, id); }
function popular_initialize(popularId) { popular_aux(popularId,  1); }