function ShowHideDiv(elementID,doShow)
{
	if (document.getElementById)
	{
		if (document.getElementById(elementDiv))
		{
			document.getElementById(elementDiv).style.display = (doShow)?'inline':'none';
		}
	}
	else
	{
		if (document.all)
		{
			if (document.all[elementDiv])
			{
				document.all[elementDiv].style.display = (doShow)?'inline':'none';
			}
		}
	}
}

function DoFixImagePath()
{
	var i = 0;
	
	// do the images first
	var oType = document.getElementsByTagName('IMG');
	for (i=0; i<oType.length; i++)
	{
		var oPath = oType[i].src;
		if (oPath.indexOf('images') > -1)
		{			
			var nPath = '/' + BasePath + '/' + oPath.substr(oPath.indexOf('images'));
			oType[i].src = nPath;
		}
	}
	
	// image inputs
	oType = document.getElementsByTagName('INPUT');
	for (i=0; i<oType.length; i++)
	{
		if (oType[i].type.toUpperCase() == 'IMAGE')
		{
			var oPath = oType[i].src;
			var nPath = '/' + BasePath + '/' + oPath.substr(oPath.indexOf('images'));
			oType[i].src = nPath;
		}
	}
	
	// table backgrounds
	oType = document.getElementsByTagName('TABLE');
	for (i=0; i<oType.length; i++)
	{
		if (oType[i].background != '' && oType[i].background)
		{
			var oPath = oType[i].background;
			alert(oPath);
			var nPath = '/' + BasePath + '/' + oPath.substr(oPath.indexOf('images'));
			oType[i].background = nPath;
		}
	}	
	
	// table backgrounds
	oType = document.getElementsByTagName('TD');
	for (i=0; i<oType.length; i++)
	{
		if (oType[i].background != '' && oType[i].background)
		{
			var oPath = oType[i].background;
			var nPath = '/' + BasePath + '/' + oPath.substr(oPath.indexOf('images'));
			oType[i].background = nPath;
		}
	}
	

	// style sheets
	oType = document.getElementsByTagName('LINK');
	for (i=0; i<oType.length; i++)
	{
		if (oType[i].rel.toUpperCase() == 'STYLESHEET')
		{
			var oPath = oType[i].href;
			var nPath = '/' + BasePath + '/' + oPath.substr(oPath.indexOf('includes'));
			oType[i].href = nPath;
		}
	}	
	
	
	if (navigator.appName.toLowerCase().indexOf('explorer') == -1)
	{
		// mozilla, do some special stuff for style sheets
		for (i=0; i<document.all.length; i++)
		{
			if (document.all[i].tagName.toLowerCase() == 'link')
			{
				if (document.all[i].rel.toUpperCase() == 'STYLESHEET')
				{
					var oPath = document.all[i].href;
					var nPath = '/' + BasePath + '/' + oPath.substr(oPath.indexOf('includes'));
					document.all[i].href = nPath;
				}				
			} 
		}
	}		
}

function PopWin(inURL, winProps)
{
	if (!winProps || winProps.length == 0) {
		winProps = 'scrollbars=no,resizable=no,resize=no,location=no';
	}
	var nWin = window.open(inURL,'PopWinUp',winProps);
}

function StuffFormVal(fObject, fVal)
{
	if (document.getElementById(fObject)) 
	{
		document.getElementById(fObject).value = fVal;
	}
}

/*--------------------------------------------------------------
CUAll
This function performs a globale Check / UnCheck function for all check boxes on a page.
It is generally used in a list-type view
----------------------------------------------------------------------*/
function CUAll(blnCheck) {
	 var oEl = document.getElementsByTagName('INPUT');
	 var x=0;
	 
	 for (x=0; x<oEl.length; x++)
	 {
		if (oEl[x].type.toLowerCase() == 'checkbox') { oEl[x].checked = blnCheck; }
	 }
}

/*
--------------------------------------------------------------------------------
FilterDropDown
This function removes all items from a drop down list except the one whose
value matches the value setn in
REC'VS:
	[oSel] - the ID of the drop down list
	[sVal] - the value to keep in the list
-----------------------------------------------------------------------------------
*/
function FilterDropDown(oSel,sVal)
{
	if (document.getElementById(oSel))
	{
		var oS = document.getElementById(oSel);
		var x=0;
		var nVal = '';
		var nText = '';
		for (x=0; x<oS.options.length; x++)
		{
			if (oS.options[x].value == sVal) 
			{ 
				nVal = oS.options[x].value;
				nText = oS.options[x].text;
			}
		}
		while (oS.options.length > 0) { oS.options[0] = null; }
		oS.options[0] = new Option(nText,nVal);
	}
}
