
// FUNTION "ShowBucket" TAKES THE FOLLOWING ARGUMENTS : 
//("FORM.SELECT-BOX","MULTIPLE/SINGLE",STORED-PROCEDURE)



function ShowBucket(formField, selectionType, storedProcedure) {

	var warnMsg="";

	if (formField == null)
		warnMsg=warnMsg + "\n --  FieldName of the Form to Show SelectedValues";

	if ((selectionType.toLowerCase() != "multiple") && (selectionType.toLowerCase() != "single"))
		warnMsg=warnMsg + "\n --  Selection Type(MULTIPLE/SINGLE)";

	else if (selectionType.toLowerCase() == "single")
		selectionType="";

	if ((storedProcedure == null) || (storedProcedure == ""))
		warnMsg=warnMsg + "\n --  Stored Procedure";

	if (warnMsg != "") {
		warnMsg = "\nERROR\n\nArguments not correctly provided : \n" + warnMsg;
		alert(warnMsg);
		return false;
	}



	var vReturnValue;

	vReturnValue = showModalDialog("bucket.asp?selectionType=" + selectionType + "&storedProcedure=" + storedProcedure,formField,"dialogHeight: 364px; dialogWidth: 740px; dialogTop: 150px; dialogLeft: 150px; edge: Sunken; center: Yes; help: No; resizable: Yes; status: No;");

	if(vReturnValue==null)  // when window is "CANCELED" or "CLOSED"
		return false;

	for(i=(formField.length-1);i>=0;i--)
		formField.options[i]=null;

	for(i=1,j=0;i<(vReturnValue[0]);i=i+2,j++)
		formField.options[j]=new Option(vReturnValue[i],vReturnValue[i+1]);

}
