var currentEntryFieldValue = "";
var searchModelAction = "/servlet/services?object=SearchModel";              

function valueChanged(anObject) {

}


function enterKeyPressed() {
	searchBusinessObject();
}

function searchBusinessObject() {

	form = document.BusinessObjectSearchForm;
	form.command.value = "search";
	form.action = searchModelAction;
	form.submit();
				
}


function newBusinessObject() {

	form = document.BusinessObjectSearchForm;
	form.command.value = "new";
	form.action = searchModelAction;
	form.submit();
				
}

function resetSearchModel() {

	form = document.BusinessObjectSearchForm;
	form.command.value = "reset";
	form.action = searchModelAction;
	form.submit();
				
}

function executeCommand(aCommandName) {

	form = document.BusinessObjectSearchForm;
	form.command.value = aCommandName;
	form.action = searchModelAction;
	form.target = window.name;
	form.submit();
	
				
}


function checkSelectAll(list) {
	checkboxAll = list[0];
	if (checkboxAll.checked) {
		for (i = 1; i < list.length; i++) {
			list[i].checked = true;}
	 } else {
		for (i = 1; i < list.length; i++) {
			list[i].checked = false; }
	}
}

function checkSelect(checkbox, list) {
	checkboxAll = list[0];
	allChecked = true;
	if (!checkbox.checked) {
		checkboxAll.checked = false;
	} 
	for (i = 1; i < list.length; i++) {
		if (!list[i].checked) {
			allChecked = false;
			break;
		} 
	}
	
	if (allChecked) checkboxAll.checked = true;
}

function checkboxClicked(anObject) {

	this.valueChanged(anObject)
}


function toggleCheckboxClicked (anObject) {

	value = anObject.value;
	box = eval("document.BusinessObjectSearchForm." + anObject.name); 
	for (i = 0; i < box.length; i++) {
		if (box[i].value != value) box[i].checked = false;
	}	
	this.valueChanged(anObject)

}

function changeSelectedCodeListUsingChildWindow(anAttributeName,  windowName, w, h) {

	attributeWindow = "";
  	attributeWindow = window.open("", windowName, "width=" + w + ",height=" + h + ",scrollbars=yes");
	form = document.BusinessObjectSearchForm;
	form.command.value = "changeSelectedCodeList" + "@" + anAttributeName;
	form.action = searchModelAction;
	form.target = attributeWindow.name;
	form.submit();
  	setTimeout("attributeWindow.focus()", 500);

}

function showSelectedCodeListUsingChildWindow(anAttributeName,  windowName, w, h) {

	attributeWindow = "";
  	attributeWindow = window.open("", windowName, "width=" + w + ",height=" + h + ",scrollbars=yes");
	form = document.BusinessObjectSearchForm;
	form.command.value = "showSelectedCodeList" + "@" + anAttributeName;
	form.action = searchModelAction;
	form.target = attributeWindow.name;
	form.submit();
  	setTimeout("attributeWindow.focus()", 500);

}

