// master javascript include file

	var navLastLoaded = "t1";

	var oc;	
	
	function ri(a) 
	{
		oc = a.style.backgroundColor;
		a.style.backgroundColor = '#FAFD9E';
	}
	
	function ro(a) 
	{
		a.style.backgroundColor = oc;
	}

	function generalclick(a,url) {
		a.style.backgroundColor = oc;
		window.location = url;
	}

	function generalclickpopup(a,url) {
		a.style.backgroundColor = oc;
		window.open(url,'editcontent');
	}

	function jumpPage(rown)
	{
		if(document.SelectForm)
		{
			document.SelectForm.rown.value = rown;
			document.SelectForm.submit();
		}		
	}
	
	function jumpPageType(pagetype)
	{
		if(document.SelectForm)
		{
			document.SelectForm.pagetype.value = pagetype;
			document.SelectForm.submit();
		}
		
		return false;
	}
	
	function showSection(n, sw)
	{	// show/hide section n		
		
		var ds = document.getElementById("section"+n);
		var ts = document.getElementById(n);		
		
		if(sw)
		{
			ts.className = "active";
			ds.style.display = "block";
			navLastLoaded = n;
		}
		else
		{
			ts.className = "";
			ds.style.display = "none";
		}			
	}

	function changesection(currentTab)
	{
		if(navLastLoaded != "")
		{
			showSection(navLastLoaded,false);
		}
		
		showSection(currentTab,true);	
	}
	
	function chsection(sectionname)
	{		
		currentTab = sectionname.id;				
		
		// Check To See If We Have The Auto-Save Enabled
		
		changesection(currentTab);
		
			
	}
	
function openhelp() {
	a = document.getElementById('extrahelp2');
	if(a.style.display=='block') {
		a.style.display = 'none';
	}
	else {
		a.style.display = 'block';
	}
}
function closehelp() {
	a = document.getElementById('extrahelp2');
	a.style.display = 'none';
}
function helpover(id) {
	a = document.getElementById('hoverhelp');
	a.innerHTML = "["+id+"] " + hoverhelp[id];
}
function helpout() {
	a = document.getElementById('hoverhelp');
	a.innerHTML = '&nbsp;';
}
var hoverhelp = new Array();

		
function actionbaropen(item) {
	document.getElementById('actionbar_'+item).style.display = 'none';
	document.getElementById('actiondiv_'+item).style.display = 'block';
	return false;
}
function actionbarclose(item) {
	document.getElementById('actionbar_'+item).style.display = 'block';
	document.getElementById('actiondiv_'+item).style.display = 'none';
	return false;
}
		
function blurSpecialDateField(field) { 
	
	var fieldValue = field.value;
		
	if(fieldValue.length == 4)
	{
		fieldValue = fieldValue.substring(0,2) + "-" + fieldValue.substring(2,4);
		field.value = fieldValue;
	}
	
	return true;
}
	
function addSelectOption(fieldname)
{
	var field = eval('document.theform.' + fieldname);
	
	if(field == null)
	{
		return;
	}
	
	var newOption = prompt('Enter New Value','');
	
	if(newOption == null || newOption == '')
	{
		// Blank Values Not Allowed
		return;
	}
	
	field.options.add(new Option(newOption,newOption));
	field.selectedIndex = field.options.length-1;
}

function noclick(e) {
	e.cancelBubble = true;
	e.returnValue=true;
	e.cancel = true;
	// if FF/Moz ONLY
	if (e.preventDefault)
		e.preventDefault();
	if (e.stopPropagation) 
		e.stopPropagation();
	return false;
}

function fmselpost(pagetype, rown, letter) {
	document.theform.pagetype.value = pagetype;
	document.theform.rown.value = rown;
	document.theform.letter.value = letter;
	
	// compile selections
	var arsel = new Array;
	var arunsel = new Array;
	var elements = document.getElementsByTagName('input'); 
	 // loop through all input elements in form 
 	for(var i = 0; i < elements.length; i++) {
		ename = elements[i].name;
		if(ename.search(/fmselbox/) == 0) {
			id = ename.substring(8);
			if(elements[i].checked) {
				arsel.push(id);
			}
			else {
				arunsel.push(id);
			}
		}
	}
	// flatten
	document.theform.fmsel.value = arsel.join();
	document.theform.fmunsel.value = arunsel.join();
	
	document.theform.submit();
	return true;	
}


