var categoryWindow;
var businessObjectWindow;
var attributeWindow;
var newWindow;
var action;
var oid;

function addToCategoryUsingChildWindow(aRelationshipName, categoryName, windowName, w, h) {

	categoryWindow = "";
  	categoryWindow = window.open("", windowName, "width=" + w + ",height=" + h + ",scrollbars=yes");
	form = document.BusinessObjectForm;
	form.categoryName.value = categoryName;
	form.command.value = "chooseFromCategory";
	form.relationshipName.value = aRelationshipName;
	form.target = categoryWindow.name;
	form.submit();
  	setTimeout("categoryWindow.focus()", 500);

}

function showBusinessObjectAdminInNewWindow(anObjectId) {

	businessObjectWindow = "";
  	businessObjectWindow = window.open("", "Services", "width=300,height=400,scrollbars=yes");
	form = document.BusinessObjectForm;
	form.command.value = "showBusinessObject@";
	form.ooid.value = anObjectId;
	form.target = businessObjectWindow.name;
	form.submit();
	setTimeout("businessObjectWindow.focus()", 500);

}

function showBusinessObjectInNewWindow(anObjectId) {

	businessObjectWindow = "";
  	businessObjectWindow = window.open("", "Services", "width=300,height=400,scrollbars=yes");
	form = document.BusinessObjectForm;
	form.action = "/servlet/services?object=BusinessObject&command=show&oid=" + anObjectId;
	form.target = businessObjectWindow.name;
	form.submit();
	setTimeout("businessObjectWindow.focus()", 500);

}

function executeClose() {
	window.close();
}

function openChildWindow(url, name, w, h) {
	businessObjectWindow = "";
  	businessObjectWindow = window.open(url, name, "width=" + w + ",height=" + h + ",scrollbars=yes");
  	setTimeout("businessObjectWindow.focus()", 500);
}

function showDisclaimer() {
	attributeWindow = "";
  	attributeWindow = window.open("/servlet/services?object=Page&command=show&objectType=FSP&url=/jsp/Disclaimer.jsp", "Disclaimer", "width=475,height=600,scrollbars=no");
	setTimeout("attributeWindow.focus()", 500);
}

function addNewAggregationUsingChildWindow(aRelationshipName, name, w, h) {

	newWindow = "";
  	newWindow = window.open("", name, "width=" + w + ",height=" + h + ",scrollbars=yes");
  	form = document.BusinessObjectForm;
  	action = form.action;
	form.action = "/servlet/services?object=BusinessObjectAdmin";
	form.command.value = "addNewAggregation";
	form.relationshipName.value = aRelationshipName;
	form.target = newWindow.name;
	form.submit();
  	setTimeout("newWindow.focus()", 500);
  	
  	form.action = action;

}

function showTimeWindow(anObjectId, aJspFile) {

	businessObjectWindow = "";
  	businessObjectWindow = window.open("", "TimeWindow", "width=400,height=570,scrollbars=yes");
	form = document.BusinessObjectForm;
	action = form.action;
	form.action = "/servlet/services?object=BusinessObject&command=show&oid=" + anObjectId + "&url=/jsp/fspSideEffect/" + aJspFile;
	form.target = businessObjectWindow.name;
	form.submit();
	setTimeout("businessObjectWindow.focus()", 500);
	
	form.action = action;

}

function startExport(anExportType, aRootExportWrapperClassName) {
	form = document.BusinessObjectSearchResultsForm;
	action = form.action;
	form.action = "/servlet/services?object=Page&objectType=FSP&&command=startExport&exportType=" + anExportType;
	form.action += "&rootExportWrapperClassName=" + aRootExportWrapperClassName;
	form.target = "";
	form.submit();
	form.action = action;
}

function logout(aUrl) {

	form = document.BusinessObjectForm;
	form.target = "";
	form.action += "&url=" + aUrl;
	form.command.value = "logout"
	form.submit();
}	
