
_uacct = "UA-1825418-2";
trackPageHit = true

///////////////////////////////////////// Search /////////////////////////////////////
function searchClicked()
{
	if(document.all.searchText.value == "")
	{
		alert("Please enter a search criteria")
		document.all.searchText.focus()
		return false
	}
	
	return true
}

function searchKeyUp(e)
{
	if(!e)
		e = window.event
		
	if(e.keyCode == 13)
		if(searchClicked())
			document.all.searchForm.submit()
}

GetInnerText = function(obj)
{
	///http://geekswithblogs.net/timh/archive/2006/01/19/66383.aspx
	if (document.all) // IE;
		return obj.innerText;
	else if (obj.textContent)
		return obj.textContent;
	else
		return "Error: Unknown or unsupported browser"
}

SetInnerText = function(obj, newValue)
{
	if (document.all) // IE;
		obj.innerText = newValue;
	else if (obj.textContent)
		obj.textContent = newValue;
}

    
function getSelected(selectField)
{
	if(selectField.options)
	{
	    return selectField.options[selectField.selectedIndex].value
	}
	else
    {
    	////This is a <radio> object
    	if(typeof(selectField.length) == "undefined")
    		if(selectField.checked)
	    		return selectField.value
	    	else
	    		return ""
    	else
    		for(var i=0; i < selectField.length; i++)
    		{
    			if(selectField[i].checked)
    				return selectField[i].value
    		}

    	return ""
    }
}

function isIe6()
{
	return navigator.userAgent.indexOf("MSIE 6") >= 0
}

function setInnerText(elem, strInnerText)
{
	if(isIe6())
		elem.innerText = strInnerText //couldn't be easier
	else
	{
		//elem.innerHTML = strInnerText //nope sorry, since then for example "a < b" would appear as "a b"
		elem.innerHTML = htmlEncode(strInnerText)
		
		//RANTHERE: why am i doing all this work just for 10% of the people out there????
	}
}

function htmlEncode(strInnerText)
{
	//http://radio.javaranch.com/channel/pascarello/2005/01/14/1105721395000.html
	strInnerText = strInnerText.replace("<","&lt;");
	strInnerText = strInnerText.replace(">","&gt;");
	strInnerText = strInnerText.replace("&","&amp;");
	return strInnerText
}

ShowMask = function(message)
{
    window.onresize = SetLayerPosition;
    window.onscroll = SetLayerPosition;
    SetLayerPosition();

    document.getElementById("masker").style.display = "block"; 
    document.getElementById("progress").style.display = "block"; 
}

function SetProgress(message)
{
    setInnerText(document.getElementById("ProgressMessage"), message)
}

HideMask = function()
{
    window.onresize = function(){ }
    window.onscroll = function(){ }

    var masker = document.getElementById("masker");
    var progress = document.getElementById("progress");

    masker.style.display = "none"; 
    progress.style.display = "none";
}

function SetLayerPosition() 
{
    ///Masker should mask all the screen and scrolled areas:
    
    var shadow = document.getElementById("masker");

    intH = document.body.scrollHeight;
    intW = document.body.scrollWidth;
        
    shadow.style.width = intW + "px";
    shadow.style.height = intH + "px";

    ///Then center the loading div on the page:
    if(typeof window.innerWidth  == 'number' ) 
    {
       intH = window.innerHeight;
       intW = window.innerWidth;
    } 
    else
    {
        intH = document.body.clientHeight;
        intW = document.body.clientWidth;
    }
    
    var progress = document.getElementById("progress");
    progress.style.left = parseInt((intW - 200) / 2) + document.body.scrollLeft + "px";
    progress.style.top = parseInt((intH - 100) / 2) + document.body.scrollTop;    
}
