/**************************************************************************************************
***************************************************************************************************

f_menu.js

Written by Chris Harding and Joshua McKinney
© Copyright F1 Solutions Pty Ltd 2003

This file holds the manu manipulation code for all pages.

Production Version 2.0 - June 2007

***************************************************************************************************
**************************************************************************************************/


/* Function: Navigate(pintWhere, pstrSubLoc)               */
/* This function saves all data (using the local saveAll   */
/* function) and navigates to the page specified by        */
/* pintWhere. It also navigates to the bookmark within the */
/* page specified by pstrSubLoc if needed.                 */
/* INPUTS : int, string                                    */
/* OUTPUTS: none                                           */
function Navigate(pintWhere, pstrSubLoc) {
	switch (pintWhere){
		case iIntroduction:
			if (saveAll()) {
				location.href="dgrr.htm";
			}
			break;
		case iInstructions:
			if (saveAll()) {
				if(pstrSubLoc) {
					location.href="instructions.htm#"+pstrSubLoc;
				} else {
					location.href="instructions.htm";
				}
			}
			break;
		case iUpdate:
			if (saveAll()) {
				location.href="premises.htm";
			}
			break;
		case iPremises:
			if (saveAll()) {
				location.href="premises.htm";
			}
			break;
		case iClear:
			if(confirm("This will erase ALL data from the DGRR!    \n\n"+
						  "        This cannot be undone!\n\n"+
						  "  Are you sure you wish to do this?")==true) {
				deleteData();
				location.href = "dgrr.htm";
			}
			break;
		case iNew:
			if(!isData()||confirm("This will erase ALL data from the DGRR!    \n\n"+
						  "        This cannot be undone!\n\n"+
						  "  Are you sure you wish to do this?")==true) {
				deleteData();
				location.href="premises.htm";
			}
			break;
		case iPlacardReport:
			if (saveAll()) {
				location.href="placard_r.htm";
			}
			break;
		case iManifestReport:
			if (saveAll()) {
				if (!checkManifestRequirements()) {
					window.alert('A Manifest is not required under Regulation 427 of the Victorian Dangerous Goods (Storage and handling) Regulations 2000');
				} else {
					location.href="manifest_r.htm"
				}
			}
			break;
		case iInventoryReport:
			if (saveAll()) {
				location.href="inventory_r.htm"
			}
			break;
		case iPlacardFile:
			if (saveAll()) {
				window.open("placard_f.htm");
			}
			break;
		case iManifestFile:
			if (saveAll()) {
				window.open("manifest_f.htm");
			}
			break;
		case iInventoryFile:
			if (saveAll()) {
				window.open("inventory_f.htm");
			}
			break;
		case iExamples:
			if (saveAll()) {
				location.href="examples.htm";
			}
			break;
		case iGoods:
			if (saveAll()) {
				location.href="goods.htm";
			}
		default:
	}
}
