/*
	(c) Copyright Mobile Bridges Ltd 2005. All Rights Reserved.

	Project: Project independent
	Version: 1.0
	Date:    04-03-2006

	Description: Eventhandler for ActionForm, generated by Code Generator
*/

function OnFilter()
{
	var theForm = document.getElementById("ActionForm");

    theForm.theAction.value = "Filter";
    theForm.submit();
}

function OnSelect()
{
	var theForm = document.getElementById("ActionForm");

    theForm.theAction.value = "Select";
    theForm.submit();
}

function OnEdit()
{
	var theForm = document.getElementById("ActionForm");

    theForm.theAction.value = "Load";
    theForm.submit();
}

function OnInsert()
{
	var theForm = document.getElementById("ActionForm");

    theForm.theAction.value = "Add";
    theForm.submit();
}

function OnRemove(inConfirmation)
{
	var isConfirmed = true;

	if (inConfirmation.length)
		isConfirmed = confirm(inConfirmation);

	if (isConfirmed)
	{
		var theForm = document.getElementById("ActionForm");

        theForm.theAction.value = "Remove";
        theForm.submit();
    }
}

function OnCancel()
{
	var theForm = document.getElementById("ActionForm");

    theForm.theAction.value = "Load";
    theForm.submit();
}

function OnSave()
{
	var theForm = document.getElementById("ActionForm");

    theForm.theAction.value = "Save";
    theForm.submit();
}

function OnAction(inAction)
{
	var theForm = document.getElementById("ActionForm");

    theForm.theAction.value = inAction;
    theForm.submit();
}

function OnBack(inPage, inAction)
{
	var theForm = document.getElementById("ActionForm");

	theForm.Page.value = inPage;
	theForm.theAction.value = inAction;
	theForm.submit();
}

function OnConfirm(inConfirmation, inPage, inAction)
{
	var isConfirmed = true;

	if (inConfirmation.length)
		isConfirmed = confirm(inConfirmation);

	if (isConfirmed)
	{
		var theForm = document.getElementById("ActionForm");

		theForm.Page.value = inPage;
    	theForm.theAction.value = inAction;
    	theForm.submit();
	}
}

function RestoreSelectBox(inName, inValue)
{
	var theSelectBox = document.getElementById(inName);
	if (theSelectBox)
	{
    	var theOptions = theSelectBox.options;
		for (i=0;i<theOptions.length;i++)
		{
            if (theOptions[i].value == inValue)
			{
				theOptions[i].selected = true;
				return true;
			}
		}
	}
}

 function OnOpenWindow(inPage, inWindowName, inWidth, inHeight){
    var lLeft = (screen.width-inWidth)/2;
    var lTop = (screen.height-inHeight)/2;
    var lDimensions = "width="+inWidth+",height="+inHeight+",top="+lTop+",left="+lLeft;
    var theOptions = lDimensions+",directories=0,menubar=0,personalbar=0,scrollbars=no,status=0,toolbar=0,resizable=0";
    var theWindow = window.open("Popup.php5?Page=" + inPage, inWindowName, theOptions);
    if (theWindow) {
        theWindow.focus();
    }
}

function RestoreCheckBox(inName)
{
	var theCheckBox = document.getElementById(inName);
	if (theCheckBox)
		theCheckBox.checked = !theCheckBox.checked;
}

function RestoreRadioButtonGroup(inName, inValue)
{
	var theChildNodes = document.getElementsByTagName("input");
	for (i=0;i<theChildNodes.length;i++)
	{
		var theChildNode = theChildNodes.item(i);
		if (theChildNode.getAttribute("id") == inName) {
			theChildNode.checked = true;
			return;
		}
	}
}

 function send( currentForm , nextForm )
{
    with ( currentForm )
    {
        action  = nextForm;
        target  = "_self"
        submit();
    }
}   
