
/******************************************************************************************************************************************************************************/
//	Author:	Greg Rechtin
//	Create:	04/21/2009
//	App:		ISO 14001 Certification Report (http://www.toyotawarpsupplier.com/AAE/ISO/)
//	includes standard form variables and functions for ISO app on TWS.com
/******************************************************************************************************************************************************************************/


/******************************************************************************************************************************************************************************/
/*					standard constants																					*/
/******************************************************************************************************************************************************************************/


/******************************************************************************************************************************************************************************/
/*					standard variables																					*/
/******************************************************************************************************************************************************************************/


/******************************************************************************************************************************************************************************/
/*					standard files																						*/
/******************************************************************************************************************************************************************************/

document.write('<SCRIPT LANGUAGE="JavaScript" SRC="../../include/js/gInclude.js"></SCRIPT>');									//	include standard files & functions
document.write('<SCRIPT LANGUAGE="JavaScript" SRC="../../include/js/date-picker.js"></SCRIPT>');									//	include date pick code


/******************************************************************************************************************************************************************************/
/*					standard functions																					*/
/******************************************************************************************************************************************************************************/
/*
function list()																											//	for easy documentation
{
	function addPlantDetail(intPlantID)																						//	pop up window to edit plant details
	function addTrain(strGroupCd,intSuppID)																				//	pop up window to add training request
	function addMBEDetail(strGroupCd)																					//	pop up window to add MBE details
	function getDefinition(strTerm)
	function submitForm(theForm, bComplete)																				//	validate main form and submit or save
}
*/

function addAttendee(intAttdID,intSuppID, bDelete)
{
	var page	= "Attendee.asp?AttdID=" + intAttdID;
	var hght	= "475";
	var wdth	= "525";
	var title	= "AttendeeDetail";
	
	if(bDelete)
		page += "&RegID=delete";
	else
		page += "&RegID=" + intSuppID;
	windowprops = "height=" + hght + ",width=" + wdth + ",location=no,scrollbars=yes,status=yes,resizable";

	window.open(page, title, windowprops);
}

function addOEContact(intContactID,intSuppID)
{
	var page	= "OEXContact.asp?CID=" + intContactID + "&RegID=" + intSuppID;
	var hght	= "550";
	var wdth	= "525";
	var title	= "ContactDetail";
	
	windowprops = "height=" + hght + ",width=" + wdth + ",location=no,scrollbars=yes,status=yes,resizable";

	window.open(page, title, windowprops);
}

function addOEProduct(intCatID,intSuppID,intContactID, bPurch)
{
//	alert(intCatID + ", " + intSuppID + ", " + intContactID + ", " + bPurch)
	if(intContactID == "")
		intContactID = 0

	if(bPurch == "False")
		bPurch = 0
	else if(bPurch == "True")
		bPurch = 1

	var page	= "OEXProduct.asp?CatID=" + intCatID + "&RegID=" + intSuppID + "&ContID=" + intContactID + "&Purch=" + bPurch;
	var hght	= "550";
	var wdth	= "760";
	var title	= "ProductDetail";
	
	windowprops = "height=" + hght + ",width=" + wdth + ",location=yes,scrollbars=yes,status=yes,resizable";

	window.open(page, title, windowprops);
}

function viewOEOppMatch(intProdID, bPurch, intSuppID)
{
	var page	= "OEXOppMatch.asp?PID=" + intProdID + "&Purch=" + bPurch + "&RegID=" + intSuppID;
	var hght	= "550";
	var wdth	= "575";
	var title	= "ProductDetail";
	
	windowprops = "height=" + hght + ",width=" + wdth + ",location=no,scrollbars=yes,status=yes,resizable";

	window.open(page, title, windowprops);
}

function cancelAdd()
{
//	window.opener.document.forms[0].FSEAttendeeChg.value	= 0;
	window.close();
}

function updateChkVal(frmField)
{
	if(frmField.checked && frmField.value.substr(frmField.value.length-6) == " - RMV")
		frmField.value	= frmField.value.substr(0,frmField.value.length-6);
	else if(!frmField.checked && frmField.value.substr(frmField.value.length-6) != " - RMV")
		frmField.value	= frmField.value + " - RMV";
//	alert(frmField.value)
}


//-------------	may or may not use in future	-------------------//

function getDefinition(strTerm)
{
	var page	= "ISOInstructions.asp#" + strTerm;
	if(strTerm == "FAQ")
		page = "ISOFAQs.asp";
	var hght	= "500";
	var wdth	= "900";
	var title	= "Instructions";
	
	windowprops = "height=" + hght + ",width=" + wdth + ",location=no,scrollbars=yes,status=yes,resizable";

	window.open(page, title, windowprops);
}

function submitForm(theForm, bComplete)
{
	if(!bComplete)
	{
		//theForm.SuppComplete.value	= "saved";
		theForm.SuppComplete.value	= "done";
		theForm.submit();
	}
	else if(validateForm(theForm))
	{
		var mssg	= "You are about to submit the Tier II Minority Report for this report period.\nOnce submitted, you will not be able to make further changes.\n\nClick 'OK' to continue or 'Cancel' to return to the form."
		if(confirm(mssg))
		{
			theForm.SuppComplete.value	= "done";
			theForm.submit();
		}
	}
}
