<!-- (C) 2004 Ashwin van Rooijen                                    -->
<!--                                                                -->
<!-- All rights are reserved. Reproduction or modification in       -->
<!-- whole or in part is prohibited without the written consent     -->
<!-- of the copyright owner.                                        -->
<!--




	
var whitespace = " \t\n\r";
var bChanged = false;





function ChangeImage(obj, str)
{
	obj.src = (isempty(str) ? '/sitemaster/images/imagena.gif' : str);
}





function isEmpty(s)
{
	return ((s == null) || (s.length == 0))
}





function isWhitespace (s)
{
	var i;
	
	if(isEmpty(s))
	{
		return true;
	}
	
	for(i = 0; i < s.length; i++)
	{
    	var c = s.charAt(i);
        if(whitespace.indexOf(c) == -1)
        {
        	return false;
        }
	}
	
	return true;
}





function ChangePathLinks(strPath, strFromClass, strToClass)
{
	
	var i, n, s;
	
	i = n = 0;
	
	do
	{
		s = document.links[i].pathname + document.links[i].search;
		//if(document.links[i].pathname.toLowerCase() == document.location.pathname.toLowerCase())
		if(s.toLowerCase() == strPath.toLowerCase())
		{
			++n;
			if(document.links[i].className.toLowerCase() == strFromClass.toLowerCase())
			{
				document.links[i].className = strToClass;
			}
		}
	}
	while(++i < document.links.length)
		
	return n;
}





function ChangeSelfLinks(strFromClass, strToClass)
{
	
	var i, n;
	
	i = n = 0;
	
	do
	{
		if(document.links[i].href.toLowerCase() == document.location.href.toLowerCase())
		{
			++n;
			if(document.links[i].className.toLowerCase() == strFromClass.toLowerCase())
			{
				document.links[i].className = strToClass;
			}
		}
	}
	while(++i < document.links.length)
		
	return n;
}





function Strip(strValue)
{
	while(strValue.charAt(0) == " ")
	{
		strValue = strValue.substr(1);
	}
	
	var iLength = strValue.length;
	
	while(strValue.charAt(iLength - 1) == " ")
	{
		strValue = strValue.substr(0, iLength - 1);
		
		iLength = strValue.length;
	}
	
	return strValue;
}





function ForceEntry(val, str)
{
	var strInput = new String(val.value);
    
    if(isWhitespace(strInput))
    {
    	alert(str);
    	val.focus();
    	return false;
    }
    else
    {
    	return true;
    }
}





function OnUnload()
{
	if(bChanged) alert("WARNING: you have unsaved changes.\nTo save the changes you have just made, click the Back button from the following page, then click Save again.");
	
	return true;
}





function DiscardChanges()
{
	if(!bChanged) return true;
		
	if(confirm("WARNING: you have unsaved changes. Discard them?"))
	{
		bChanged = false;
		return true;
	}
	
	return false;
}

