//// Helper function

function getItem(id)
{
	// IE5+, Mozilla, NS5
	if (document.getElementById)
		return document.getElementById(id);
	
	// IE4
	if (document.all)
		return document.all.item(id);

	// NS4
	return eval("document."	+ id + ".document." + id);
}

function searchSite(form)
{
	if (form.q.value.length > 0)
	{
		form.q.value = form.q.value + " site:noeld.com";
		form.submit();
	}
	
	return false;
}

function Translate(language)
{
	var url = window.location.href;
	var index = url.indexOf('#');

	if (index > 0)
	{
		url = url.substring(0, index);
	}

	window.location = "http://babelfish.altavista.com/babelfish/tr?doit=done&tt=url&intl=1&trurl=" + escape(url) + "&lp=" + language;
}


//// Error management

function stopError() 
{ 
	return true; 
}

window.onerror = stopError;

//// Image Preloading Functions

var Images = new Array();

function PreloadImage(hoverImageName, defaultImageName)
{
	var index = Images.length;

	Images[index] = new Image();
	Images[index].src = "/images/" + hoverImageName;
	Images[index+1] = new Image();
	Images[index+1].src = "/images/" + defaultImageName;
	
	return index;
}

function SwitchImage(index, img, hover)
{
	if (hover)
		img.src = Images[index].src;
	else
		img.src = Images[index+1].src;
}

var idxHome = PreloadImage("home-new-hover.gif", "home-new.gif");

//// Window Functions

function PopUp(popup, left, top, width, height)
{
	window.open(popup,null,'toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,scrollbars=no,width=' + width + ',height=' + height + ',left=' + left + ',top=' + top)
}

function Teleporter()
{
	PopUp('teleporter.htm', 0, 0, 185, 265)
}
