// JavaScript Document

function additionalPresenterCallBack(field, subSection, index)
{

	var i = subList.length;

	if(field.checked && field.value == "0")
	{
		Ext.get(subSection).hide(true);
		Ext.get(subSection).setStyle("position", "absolute");
		subSectList[subSection] = 0;
		Ext.get("display_" + subSection).dom.value = "0";
		
		while (i > 0) 
		{
			i--;

			if(subList[i] == subSection)
			{
				break;
			}
			
			Ext.get(subList[i]).hide(true);
			
			document.frmMain["main_additional-" + i][1].checked = true;
		}
	}
	else
	{
		Ext.get(subSection).show(true);
		Ext.get(subSection).setStyle("position", "relative");
		subSectList[subSection] = 1;
		Ext.get("display_" + subSection).dom.value = "1";
		document.location.href = "#bookmark_" + subSection;
	}
}


function resetForm()
{
	var targetForm = document.frmMain;
	targetForm.target = "";
	targetForm.action = "";
	targetForm.reset();
}

function previewForm()
{

	submitForm("preview");
	
}

function viewSample()
{
	createDialogEx("sample_summary.jsp", "Sample Summary Descriptions for Program Book", "sample_summary", "sample_summary", 512, 600);
}


function countWords(w, x)
{
	//var y=w.value;
	var y=w.getValue();
	var r = 0;
	a=y.replace(/\s/g,' ');
	a=a.split(' ');
	for (z=0; z<a.length; z++) 
	{
		if (a[z].length > 0) r++;
	}
	//x.value=r;
	return r;
}
