
//this is for the ones which can be bolded
//necessary otherwise it'll take off the orange arrow from the ones that are bolded
function highlightArrow2(divTag, highlight)
{
	var texttag;
	texttag = document.getElementById("text" + divTag);
	if(texttag.innerHTML.indexOf("<B>") < 0)
	{
		highlightArrow(divTag, highlight);
	}
}

//this is for the ones where you can't possibly bold them.
function highlightArrow(divTag, highlight)
{
	var tag;
	tag = document.getElementById("arrow" + divTag);
	if(highlight)
	{
		tag.innerHTML = "<img src=\"../../common/imagesv2/orangearrow_right.gif\">";
	}
	else
	{
		tag.innerHTML = "<img src=\"../../common/imagesv2/greyarrow_right.gif\">";
	}
}

function deselectCategories(categoryList)
{
	var arr;
	var arrowtag;
	var texttag;
	arr = categoryList.split(",");
	for(var i = 0; i < arr.length; i++)
	{
		arrowtag = document.getElementById("arrow" + arr[i]);
		texttag = document.getElementById("text" + arr[i]);
		if(arrowtag && texttag)
		{
			arrowtag.innerHTML = "<img src=\"../../common/imagesv2/greyarrow_right.gif\">";
			if(texttag.innerHTML.indexOf("<B>") > -1)
			{
				texttag.innerHTML = texttag.innerHTML.substring(3, texttag.innerHTML.length - 3);
			}
		}
	}
}

function selectCategory(catDivTag, categoryList)
{
	var tag;

	deselectCategories(categoryList);

	tag = document.getElementById("arrow" + catDivTag);
	tag.innerHTML = "<img src=\"../../common/imagesv2/orangearrow_right.gif\">";
	tag = document.getElementById("text" + catDivTag);
	if(tag.innerHTML.indexOf("<B>") < 0)
	{
		tag.innerHTML = "<b>" + tag.innerHTML + "</b>";
	}
	document.forms[0].hiddenFocus.focus();
}

function displayNewWindow(thisObj) 
{
	newwindow = window.open(thisObj.href,'offworld','width=630,height=500,directories=yes,resizable=yes,status=yes,menubar=yes,location=yes,scrollbars=yes'); 
	newwindow.focus();
	return false;
}

function checkDeleteFields(thisForm)
{
	if(get_radio_value(thisForm.rdArticleID).trim() == "")
	{
		alert("Select an article to delete");
		return false;
	}
	if(confirm("You are about to delete this article.  Press OK to continue."))
	{
		return true;
	}
	return false;
}

function checkAddFields(thisForm)
{
	if(thisForm.filedate.value.trim()=="")
	{
		requiredTextBox(thisForm.filedate, "Date");
		return false;
	}
	if(!isDate(thisForm.filedate.value.trim()))
	{
		alert("Invalid date.");
		thisForm.filedate.focus()
		return false;
	}
	if(thisForm.titleshown.value.trim()=="")
	{
		requiredTextBox(thisForm.titleshown, "Title");
		return false;
	}
	if(thisForm.fileToUpload.value.trim() == "")
	{
		requiredTextBox(thisForm.fileToUpload, "File");
		return false;
	}
	if(getExtension(thisForm.fileToUpload.value.trim()) != "htm" && 
		getExtension(thisForm.fileToUpload.value.trim()) != "html" && 
		getExtension(thisForm.fileToUpload.value.trim()) != "pdf")
	{
		alert("Only htm and pdf files are permitted.");
		return false;
	}
	if(thisForm.expDate.value.trim()=="")
	{
		requiredTextBox(thisForm.expDate, "Expiration Date");
		return false;
	}
	if(thisForm.expDate.value.trim().toLowerCase() != "none" && !isDate(thisForm.expDate.value.trim()))
	{
		alert("Expiration Date must be a valid date or 'none'.");
		thisForm.expDate.focus();
		return false;
	}
	else if(thisForm.expDate.value.trim().toLowerCase() != "none" && !isFutureDate(thisForm.expDate.value.trim()))
	{
		alert("Expiration Date must be a future date.");
		thisForm.expDate.focus();
		return false;
	}
	return true;
}

function checkLoginFields(thisForm)
{
	if(thisForm.employeeNumber.value.trim()=="")
	{
		requiredTextBox(thisForm.employeeNumber, "Employee Number");
		return false;
	}
	if(thisForm.employeePassword.value.trim()=="")
	{
		requiredTextBox(thisForm.employeePassword, "Password");
		return false;
	}
	return true;
}