
function selectTab() {
	var pageArray = parent.currentPage.split(".");
	waitDiv(true);
	myTab = "tab" + pageArray[2];
    
	if (document.getElementById(myTab) != null) {
	    document.getElementById(myTab).className = "tabMenuItem_selected";
	}
	//removeLinkFocus(); // to remove focus off the tab links / arrows after clicking.
	waitDiv(false);
}

function selectSubMenu() {
	//alert(parent.currentPage);
	var pageArray = parent.currentPage.split(".");
	//waitDiv(true);
	mySubMenuItem = "subMenu" + pageArray[1];
	if (document.getElementById(mySubMenuItem) != null) {
	    document.getElementById(mySubMenuItem).className = "navSubMenuItem_selected";
	}
	//removeLinkFocus(); // to remove focus off the tab links / arrows after clicking.
	//waitDiv(false);
}

function tabExists(myTabId) {
	// identify if tab exists..
	//alert("looking for tab = " + myTabId);
	var myTab = "tab" + myTabId;
	if (document.getElementById(myTab)) {
		return true;
	} else {
		return false;
	}
}

function removeLinkFocus(){
	// removes the focus from all links on the page
	// to be referenced after clicking
	var i = 0;
	for (i = 0; i < document.links.length; i++) {
		document.links[i].onFocus = document.links[i].blur();
	}
}

// fix for ensuring to remove focus from links after being clicked.
document.onMouseDown = removeLinkFocus();

function notAvailable() {
	showErrorAlert('', 'This feature is not currently available.', '', '');
}

function disableNextBtn() {
	document.getElementById("nextBtnLink").href="javascript: void(0);";
	document.getElementById("nextBtn").className = "nextBtn_disabled";
}

//Nav buttons, handles navigation ensuring any "basix_form" forms are submited.
//Any page that calls the function MUST have a "form_validate_event(showMsg)" functions
function nav(pageUrl, validate) {

	//Check here to see if we need to validate
//	alert("Page number is --> \npageUrl=" + pageUrl + "\nvalidate=" + validate);
	rpcNeedsUpdate = false;
	//Before we do anything, make sure the page does not require updating, if so wait and retry
	try {
		//Do we need to update
		if (rpcNeedsUpdate) {
			if (!rpcRequestPending) rpc_apply_all();
			window.setTimeout("nav('" + pageUrl + "', " + validate + ")", 100); //Retry
			
			return;
		}
		
		//Ok, maybe we are all ready
		if (!ns6 && (rpcRequestPending || rpcRequestDirty)) {
//			rpcRequestPending = false;
			window.setTimeout("nav('" + pageUrl + "', " + validate + ")", 100); //Retry
			return;
		}
		
	} catch(exception) {
		//Dont worry, some pages may not support rpc
	}


	
	//Ok, validate if required
	if (validate) {
		//Check form values, this will call the validate_event function for the page (if it exists)

		var showMsg = true;  // default always show message even if going backwards.
		var validated = false;
		
		try {
			parent.frames[1].clearAllNotes();
		} catch (exception) {
		}

		if (!form_validate_event(showMsg)) {
			// form validate event has an error/warnings, they are put in the notes section of the appropriate page,
			// so a default confirmation alert popup needs to be displayed to ask if the user wishes to move on or
			// stay on the current page and fix the errors/warnings..
			//setTimeout("showErrorAlert('note', '', \"nav2('" + pageUrl + "', true, true);\", \"nav2('" + pageUrl + "', true, false);\");", 1000);
//			showErrorAlert("note", "", "nav2('" + pageUrl + "', true, true);", "nav2('" + pageUrl + "', true, false);");
			nav2(pageUrl, true, false);
		} else {
			nav2(pageUrl, true, true);
		}
	} else {
		nav2(pageUrl, false, false);
	}
}

function nav2(pageUrl, validate, validated) {
//alert("in here for " + pageUrl + " validate: " + validate + " validated: " + validated);
	if (validate) {
		//If the page contains a "validated" hidden value, update it
		try {
            if (document.basix_form && document.basix_form.validated){
                document.basix_form.validated.value = validated;
            }
		} catch(exception) {
			//No validated value, dont worry
		}

		if (!validated) {
			waitDiv(false);
			return false; //Block call
		}
		//Check rpc needs update !!!Should not get here now we have the retry function, but keep for debugging
		//try {
			if (rpcNeedsUpdate) {
				showErrorAlert('', 'Your index scores needs to be updated, please select the calculate button to update the scores before proceeding.', '', '');
				return;
			}
		//} catch(exception) {
			//No form validation on the calling form, dont worry
		//}
		
		//Check rpc busy flag !!!Should not get here now we have the retry function, but keep for debugging
	//	try {
			if (!ns6 && (rpcRequestPending || rpcRequestDirty)) {
				showErrorAlert('', 'The server is currently evaluating your index score, please wait until this is complete before continuing.', '', '');
				return;
			}
	//	} catch(exception) {
			//No form validation on the calling form, dont worry
	//	}
	}

	
	
	waitDiv(true);
	//Standard basix form, submit before move to the target page
	if (document.basix_form != null) {
		
		document.basix_form.action.value = "next";
		if (ie && mac) {
			pageUrl = "/basix.jsp?body=" + pageUrl;
		}
		document.basix_form.nextpage.value = pageUrl;
		//alert(document.basix_form.nextpage.value);

		/* for bug #2826:
		   Problem with ie if user clicks quickly on navigation item.  IE simply looks at the submit line above and ignores it.
		   Thus the page isn't submitted and remains locked by the waitDiv(true) command.
		   Following line is a fix for this to reenable the page after a certain number of seconds.
		*/
		
		if (ie) {
			// throw in delay for submitting to hopefully avoid bug #2826.
			setTimeout("parent.frames[0].document.basix_form.submit(true);", 1000);
		} else {
			parent.frames[0].document.basix_form.submit(true);
		}
		if (ie) setTimeout("waitDiv(false);", 30000); // safety precaution so that if a page stuffs up from submitting then it will re-enable itself after a period of time.
		//if (ie) setTimeout("parent.frames[0].document.basix_form.submit(true);", 15000); // an alternative option to the line above by attempting to resubmit the page again. Might have issues if the browser is still waiting on the server.
	} else {
	
		if (this.location) {
			this.location.href = pageUrl;
		} else {
			location.href = pageUrl;
		}
	}
}

/******************************/
/* pop ups */

var popupWindowRef = null;

function newPopUp(myUrl, myName, withReference) {
	if (withReference) {
		popupWindowRef = window.open(myUrl, 'popupWindowRef', 'width=450,height=500,menubar=no,statusbar=no,resizable=yes,scrollbars=yes');
	} else {
		window.open(myUrl, "", "width=450,height=500,menubar=no,statusbar=no,resizable=yes,scrollbars=yes");
	}
	return true;
}

/* modifications made by Helen --> helen@massmedia.com.au on 09/02/2005 */
function newWindow(mypage,myname,w,h,features) {
	var settings = "";
	if(w == "" && h == "") { // if-statement added to allow pages to open in a new window without a specified width and height
		//do nothing i.e. do not set a height and width for the new window
	}
	else {	
		if (screen.width) {
			var winl = (screen.width-w)/2;
			var wint = (screen.height-h)/2;
		} else {
	  		winl = 0;
			wint = 0;
		}
		if (winl < 0)
			winl = 0;
	 	if (wint < 0)
			wint = 0;
		settings = 'height=' + h + ',';
		settings += 'width=' + w + ',';
		settings += 'top=' + wint + ',';
		settings += 'left=' + winl + ',';
	}
	settings += features;
	win = window.open(mypage,myname,settings);
	win.window.focus();
}

//Save function and goto next page
function SavePageAndGoto(nextPageUrl) {
// currently bypasses the validation. eg. when logging out.
	try {
		if (!form_validate_event(true)) {
			// form validate event has an error/warnings, they are put in the notes section of the appropriate page,
			// so a default confirmation alert popup needs to be displayed to ask if the user wishes to move on or
			// stay on the current page and fix the errors/warnings..
			//showErrorAlert("note", "", "savePageAndGoto2('" + nextPageUrl + "');", "void(0);");
			return;
		} else {
			savePageAndGoto2(nextPageUrl);
		}
	} catch (exception) {
		debugAlert("error with form validate event function.");
	}
}

function savePageAndGoto2(nextPageUrl) {
// part 2 to function SavePageAndGoto().. Allows for form validation.
	waitDiv(true);
	if (document.basix_form != null) {
		// first check for page validation..
		
		//Standard basix form, submit before saving to ensure all data persisted
		document.basix_form.action.value = "save";
		document.basix_form.nextpage.value = nextPageUrl; //Send to self
		document.basix_form.submit();
	} else {
		//Non basix form, send simply save request
		var submitPageUrl = "";
		if (document.URL.indexOf('?') != -1) {
			submitPageUrl = document.URL.substring(0, document.URL.indexOf('?')) + "?action=save";
		} else {
			submitPageUrl = document.URL + "?action=save";
		}
		submitPageUrl = submitPageUrl + "&nextpage=" + escape(nextPageUrl); 
		location.href = submitPageUrl;
	}
}

function toggleScrollbars(show) {
	if (show) {
		document.body.style.overflow = "auto";
	} else {
		document.body.style.overflow = "hidden";
	}
}

function currentlyInPopUp() {
// returns true if the current document is in a popup or not.. false otherwise.
	if (typeof(unsetModal) != "undefined") {
		return true;
	} else {
		return false;
	}
}

function waitDiv(show) {
	waitDiv_msg(show, "");
}

function calcState(certType) {
	waitDiv(true);
	var myDiv = document.getElementById("waitDiv");
	var url =  "/calcProgress.jsp";
	
	setTimeout("getCalcStatePageAsync('" + url + "')", 3000);
}


function getYYYYMMDDhhmmss() {
    var X;
    with (new Date) {
        X = ((((getFullYear() * 100 + getMonth() + 1) * 100 + getDate()) * 100 + getHours()) * 100 + getMinutes()) * 100 + getSeconds();
    }
    return X;
}

var origHtml;

function getCalcStatePageAsync(url) {
	var xmlhttp = getRequestObject();
    if(!xmlhttp){
        //in cases where xmlhttp is not supported or activeX is disabled.
        return;
    }
    // <=ie6 caches the page, so we need a unique one each time.
    var sendUrl =  url + "?" + getYYYYMMDDhhmmss(); //add a datestamp to fool proxies into acting right
	xmlhttp.open("GET", sendUrl ,true);
	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4) {
			//alert(xmlhttp.responseText)
			var myDiv = document.getElementById("waitDiv");
			var resp = xmlhttp.responseText;
			if (resp != null && resp.replace(/^\s+|\s+$/g,"") == "DONE" && origHtml) {
				myDiv.innerHTML = origHtml;
				origHtml = '';
				myDiv.style.backgroundColor = '';
				myDiv.style.border = '';
				myDiv.style.width = '';
				myDiv.style.height = '';
				myDiv.style.textAlign = '';
				//return to original position. if css changes, this needs to be changed.
   			    myDiv.style.top = '50%';
				waitDiv(false);
				try {
					if (doPageRefresh) {
						//if the page is expected to refresh and doesn't, the timeout will trigger
						//and refresh the page.
//						alert("timeout happening");
						setTimeout("gotoPage(parent.currentPage);", 3000);
					}
				} catch (e) {
					//only summary pages that are expected to refresh after calculation will have this 
					//flag.
//					alert("error caught - nothing to see here");
				}
			} else if (myDiv.className == 'show') {
				myDiv.style.backgroundColor = '#FFFFFF';
				myDiv.style.border = '2pt solid black';
				myDiv.style.width = '250px';
				myDiv.style.height = '100px';
				myDiv.style.textAlign = 'left';
                //ie and ie7 are global objects created in global.js
                if(ie && !ie7){
                     myDiv.style.top = '100px';
                }
				if (!origHtml) {
					origHtml = myDiv.innerHTML;
				}
				myDiv.innerHTML = xmlhttp.responseText;
				setTimeout("getCalcStatePageAsync('" + url + "')", 1000);
			}
		}
	}
 	xmlhttp.send(null);
}

function getRequestObject() {
	var xmlhttp=false;
	/*@cc_on @*/
	/*@if (@_jscript_version >= 5)
	// JScript gives us Conditional compilation, we can cope with old IE versions.
	// and security blocked creation of the objects.
	 try {
	  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	 } catch (e) {
	  try {
	   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	  } catch (E) {
	   xmlhttp = false;
	  }
	 }
	@end @*/
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
		try {
			xmlhttp = new XMLHttpRequest();
		} catch (e) {
			xmlhttp=false;
		}
	}
	if (!xmlhttp && window.createRequest) {
		try {
			xmlhttp = window.createRequest();
		} catch (e) {
			xmlhttp=false;
		}
	}
	return xmlhttp;
}

function waitDiv_msg(show, myMsg) {
// not currently using myMsg.. as it does render fast enough before the div displays.
	//if (parent != null && parent.frames[0] != null && parent.frames[0].document != null) {
	
	
	if (!currentlyInPopUp() && parent.currentPage != "1.0.99") {
		if (parent.frames[0]) {
			var myDiv = parent.frames[0].document.getElementById("waitDiv");
		} else {
			var myDiv = document.getElementById("waitDiv");
		}
		var myOffset = 0;
		if (show) {
			if (parent.frames[0]) {
				parent.frames[0].scroll(0,0);  //move to top of page to display div in center of page.
			}
			disableCalculate();
			disableSave();
			disableLinks();
			if (myDiv) myDiv.className = "show";
		} else {
			enableLinks();
			enableCalculate();
			enableSave();
			if (myDiv) myDiv.className = "hide";
			
		}
	}
}

function isWaiting() {
	if (parent.frames[0]) {
		var myDiv = parent.frames[0].document.getElementById("waitDiv");
	} else {
		var myDiv = document.getElementById("waitDiv");
	}
	if (myDiv) {
		if(myDiv.className == "show"){
			return true;
		}
	}
	return false;
}

function getPageArray(projectType) {
	if (projectType == "detached") {
		return parent.pageArray_detached;
	} else {
		return parent.pageArray_multiunit;
	}
}

function arrayCombineOrdered(array1, array2) {
// returns an array of the ordered combination of two arrays.
// it assumes that the two arrays are ordered already and that
// there is no interchanging between arrays in the middle.
	var tempArray = Array();
	var isAdded = false;
	for (var i=0; i < array1.length; i++) {
		if (!isAdded && array1[i] > array2[0]) {
			for (var j=0; j < array2.length; j++) {
				tempArray[tempArray.length] = array2[j];
				isAdded = true;
			}
		}
		tempArray[tempArray.length] = array1[i];
	}
	return tempArray;
}

function arrayRemoveArray(array1, removeArray) {
// removes an array from array1 and returns the result.
// it assumes the entire removeArray exists in array1.
// if it doesn't exist at all then it returns array1.
	var tempArray = Array();
	for (var i=0; i < array1.length; i++) {
		if (array1[i] == removeArray[0]) {
			i += removeArray.length;
		}
		tempArray[tempArray.length] = array1[i];
	}
	return tempArray;
}

function pageArray_resetThermal() {
	// remove existing thermal pages..
	parent.pageArray_detached = arrayRemoveArray(parent.pageArray_detached, parent.pageArray_detached_tc_simulation);
	parent.pageArray_detached = arrayRemoveArray(parent.pageArray_detached, parent.pageArray_detached_tc_dtc);
	parent.pageArray_detached = arrayRemoveArray(parent.pageArray_detached, parent.pageArray_detached_tc_dtc_rapid);
}

function pageArray_useThermal(thermalSelection) {
	pageArray_resetThermal();
	// add in pages for thermalSelection..
	switch (thermalSelection) {
		case 'simulation':
			parent.pageArray_detached = arrayCombineOrdered(parent.pageArray_detached, parent.pageArray_detached_tc_simulation);
			break;
		case 'dtc':
			parent.pageArray_detached = arrayCombineOrdered(parent.pageArray_detached, parent.pageArray_detached_tc_dtc);
			break;
		case 'dtc_rapid':
			parent.pageArray_detached = arrayCombineOrdered(parent.pageArray_detached, parent.pageArray_detached_tc_dtc_rapid);
			break;
	}
}

function gotoTabLocal(tab) {//This is here for compatibility sake...
	gotoTabLocal_OL(tab, true);
}

function gotoTabLocal_OL(tab, firstCall) {
	waitDiv(true);
	
	//Call event when moving from one tab to another
	try {
		if (firstCall) moving_tabs(tab, currentTab);
	} catch(exception) {
		//Dont worry, maybe no function defined
	}

	if (firstCall && currentTab > 0 && tab > currentTab) {
		if (!rpcRequestPending) {
			try {
				exec_all(currentTab);
			} catch(exception) {
				//Dont worry, maybe no function defined
			}
			window.setTimeout("gotoTabLocal_OL(" + tab + ", false)", 100); //Retry
		} else {
			window.setTimeout("gotoTabLocal_OL(" + tab + ", true)", 100); //Retry
		}
		return;
	}
	
	//Ok, maybe we are all ready
	if (rpcRequestPending || rpcRequestDirty) {
		window.setTimeout("gotoTabLocal_OL(" + tab + ", false)", 100); //Retry
		return;
	}
	
	//Ok... all done, first check if there was an error
	if (rpcErrors.length > 0 && tab > currentTab) {
		if (!confirm("Warning, the current tab contains one or more errors that need to be addressed.\nClick OK to move on or CANCEL to stay and fix the errors.")) {
			waitDiv(false);
			return;
		}
	}
	if (tab != currentTab) {
		rpcErrors = ""; //This needs to be cleared
	}
	//parent.frames[1].clearAllNotes();
	gotoTab(tab);
	currentTab = tab; //Save current tab
	
	//Update this tab
	try {
		exec_all(tab);
	} catch(exception) {
		//Dont worry, maybe no function defined
	}
}

// looks after page order for goNext() and goBack() functions.
if (!currentlyInPopUp()) {
	var pageArray = getPageArray(getProjectType());
}

function navSubmitPage() {
	rpc_apply_local();
}

function navCalc() {
	rpc_apply_all();
}

function gotoPage(pageNum) {
	waitDiv(true);
	if (!gotoPageQS(pageNum, "")) { // call gotopageqs with empty querystring parameter.
//		alert("gotoPage issue!" + pageNum);
		return;  // if gotopageqs failed simply return without doing anything yet.
	}
}

function refreshCalcMe(gotoPageNum) {
	if (rpcRequestPending) {
		window.setTimeout("refreshCalcMe('" + gotoPageNum + "');", 100); //Retry
		return;
	}
	if (location.href.indexOf("mypage") == -1) {
		if (form_validate_event(true)) {
			document.basix_form.nextpage.value = location.href + "?calc=true&mypage=" + gotoPageNum;
			document.basix_form.action.value="next";
			document.basix_form.submit(true);
		} else {
			waitDiv(false);
		}
		return false;
	}
	return true;
}

function gotoPageQS(pageNum, qs) {
	// Page navigation for the pageNum and querystring added.
	// pageNum is made up of section number + "." + subsection number + "." + tab number.

	// show wait Div to indicate page loading etc.
	waitDiv(true);
	var pageArray = pageNum.split(".");
	
	// setup querystring
	if (qs != "") {
		qs = "?" + qs;
	}
	
	/* add page references here to submit current page data to spreadsheet or
	   run any functions before leaving the current page */
	switch (parent.currentPage) {
		case '2.0.1':
//		case '2.0.3':
		case '2.0.4':
            if (pageRefresh()) {
				navSubmitPage();
				if (getProjectType() == "multiunit") {
					if (pageRefreshCalc()) {
						waitDiv(true);
						if (!refreshCalcMe(pageNum)) {
							return false;
						}
					}
				}
				break;
			}
		case '2.0.2':
		case '3.0.2':
			/* calculate for building type change which effects the targets */
			if (pageRefresh()) {
				//navSubmitPage(); // to submit current page's data
				waitDiv(true);
				if (!refreshCalcMe(pageNum)) {
					return false;
				}
				//navCalc(); // to update the targets
				break;
			}
	}
	// else must be navigating through common pages as per normal:
	switch (pageNum) {
		case "1.0.1":
			nav("/tabs/project_portfolio/current_projects.jsp", true);
			break;
		case "1.0.2":
			nav("/tabs/project_portfolio/completed_projects.jsp", true);
			break;
		case "1.0.3":
			nav("/tabs/project_portfolio/archived_projects.jsp", true);
			break;
		
		default:
			switch (getProjectType()) {
				case "multiunit":
					gotoPageQS_multiunit(pageNum, qs);
					return;
					break;
				case "detached":
					gotoPageQS_detached(pageNum, qs);
					return;
					break;
				default:
					alert("project type not set");
					//alert("404: Page not found.");
					parent.currentPage = "2.0.1";
					parent.frames[0].location.href="/detached/tabs/project_details/project_address.jsp";
			}
	}
//	parent.currentPage = pageNum; // set current page. --> now done in every page individually when it loads.
}

function gotoPageQS_detached(pageNum, qs) {

	// Page navigation for the pageNum and querystring added.
	// pageNum is made up of section number + "." + subsection number + "." + tab number.
	
	// show wait Div to indicate page loading etc.
	waitDiv(true);

	var pageArray = pageNum.split(".");
	
	// setup querystring
	if (qs != "") {
		qs = "?" + qs;
	}

	//check first for if project selected...
	
	if ((parseInt(pageArray[0]) >= 3) && !hasProject) {
		showErrorAlert('', 'selectProject', 'gotoPage("1.0.1");', '');
		return false;
	}
	
	switch (pageNum) {
		case "2.0.1":
			nav("/detached/tabs/project_details/project_address.jsp" + qs, true);
			break;
		case "2.0.2":
			nav("/detached/tabs/project_details/project_type.jsp" + qs, true);
			break;
		case "2.0.3":
			nav("/detached/tabs/project_details/site_details.jsp" + qs, true);
			break;
		case "2.0.4":
			nav("/projectApplicationDetails.action" + qs, true);
			break;
		case "4.0.1":
			nav("/detached/tabs/water/intro.jsp", true);
			break;
		case "4.1.1":
			nav("/detached/tabs/water/water_details/landscape.jsp" + qs, true);
			break;
		case "4.1.2":
			nav("/detached/tabs/water/water_details/fixtures.jsp" + qs, true);
			break;
		case "4.1.3":
			nav("/detached/tabs/water/water_details/alternative_water.jsp" + qs, true);
			break;
		case "4.1.4":
			nav("/detached/tabs/water/water_details/alternative_water_details.jsp" + qs, true);
			break;
		case "4.1.5":
			nav("/detached/tabs/water/water_details/pool_spa.jsp" + qs, true);
			break;
		case "4.2.1":
			nav("/tabs/water/status/status.jsp" + qs, true);
			break;
		case "5.0.1":
			nav("/detached/tabs/thermal/intro.jsp", true);
			break;
		case "5.1.1":
			nav("/detached/tabs/thermal/simulation/assessor_details.jsp", true);
			break;
		case "5.1.2":
			nav("/detached/tabs/thermal/simulation/thermal_loads.jsp", true);
			break;
		case "5.1.3":
			nav("/detached/tabs/thermal/simulation/cross_ventilation.jsp", true);
			break;
		case "5.1.4":
			nav("/detached.construction.action", true);
			break;
		case "5.2.1":
			//if (parent.currentPage == "5.0.1") showErrorAlert("error","Please note that you will not be able to use this method to generate a certificate until 16 December 2005.","","");
			//showErrorAlert('error','dtcFull','gotoPage(\"5.0.1\")','');
			//waitDiv(false);
			nav("/detached/tabs/thermal/deemed_to_comply/construction_type.jsp", true);
			break;
		case "5.2.2":
			//waitDiv(false);
			nav("/detached/tabs/thermal/deemed_to_comply/construction_details.jsp", true);
			break;
		case "5.2.3":
			//waitDiv(false);
			if (parent.currentPage == "5.2.2") {
				qs = "?calc=1";
			}
			nav("/detached/tabs/thermal/deemed_to_comply/insulation.jsp" + qs, true);
			break;
		case "5.2.4":
			//waitDiv(false);
			nav("/detached/tabs/thermal/deemed_to_comply/windows_skylights.jsp", true);
			//showErrorAlert("error","The glazing tab is incomplete and does not feature any rules or functions, please do not test this page for functionality.","","");
			break;
		case "5.2.5":
			//waitDiv(false);
			nav("/detached/tabs/thermal/deemed_to_comply/winsky_details.jsp", true);
			//showErrorAlert("error","The skylights tab is incomplete and does not feature any rules or functions, please do not test this page for functionality.","","");
			break;
		case "5.2.6":
			//showErrorAlert('error','dtcFull','gotoPage(\"5.0.1\")','');
			//waitDiv(false);
			nav("/detached/tabs/thermal/deemed_to_comply/cross_ventilation.jsp", true);
			break;
		case "5.3.1":
			nav("/detached/tabs/thermal/dtc_rapid/criteria.jsp", true);
			break;
		case "5.4.1":
			//waitDiv(false);
			nav("/tabs/thermal/status/status.jsp", true);
			break;			
		case "6.0.1":
			nav("/detached/tabs/energy/intro.jsp", true);
			break;
		case "6.1.1":
			nav("/detached/tabs/energy/energy_details/hot_water.jsp", true);
			break;
		case "6.1.2":
			nav("/detached/tabs/energy/energy_details/heating_cooling.jsp", true);
			break;
		case "6.1.3":
			nav("/detached/tabs/energy/energy_details/ventilation.jsp", true);
			break;
		case "6.1.4":
			nav("/detached/tabs/energy/energy_details/lighting.jsp", true);
			break;
		case "6.1.5":
			nav("/detached/tabs/energy/energy_details/pool_spa.jsp", true);
			break;
		case "6.1.6":
			nav("/detached/tabs/energy/energy_details/alternative_energy.jsp", true);
			break;
		case "6.1.7":
			nav("/detached/tabs/energy/energy_details/other.jsp", true);
			break;
		case "6.2.1":
			nav("/tabs/energy/status/status.jsp", true);
			break;
		case "7.0.1":
			nav("/tabs/summary/summary.jsp", true);
			break;
		case "8.0.1":
			nav("/tabs/certificate/certificate.jsp", true);
			break;
		default:
			//alert("404: Page not found.");
			parent.currentPage = "2.0.1";
			parent.frames[0].location.href="/detached/tabs/project_details/project_address.jsp";
	}
}

function gotoPageQS_multiunit(pageNum, qs) {
	// Page navigation for the pageNum and querystring added.
	// pageNum is made up of section number + "." + subsection number + "." + tab number.
	
	var pageArray = pageNum.split(".");
	
	//check first for if project selected...
	if (parseInt(pageArray[0]) >= 3 && !hasProject) {
		showErrorAlert('', 'selectProject', 'gotoPage("1.0.1");', '');
		return false;
	} else {
		// check if project has dwellings..
		if (pageArray[0] >= 4 && !hasDwellings) {
			showErrorAlert('', 'mustHaveDwellings', 'gotoPage("3.0.2");', '');
			return false;
		}
	}

	switch (pageNum) {
		case "2.0.1":
			nav("/multiunit/tabs/project_address/project_address.jsp" + qs, true);
			break;
		case "2.0.2":
			nav("/multiunit/tabs/project_address/project_type.jsp" + qs, true);
			break;
		case "2.0.4":
			nav("/projectApplicationDetails.action" + qs, true);
			break;
		case "3.0.1":
			nav("/multiunit/tabs/project_details/site_details.jsp" + qs, true);
			break;
		case "3.0.2":
			nav("/multiunit/tabs/project_details/multiunit_details.jsp" + qs, true);
			break;
		case "3.0.3":
			nav("/multiunit/tabs/project_details/common_areas.jsp" + qs, true);
			break;
		case "3.0.4":
			nav("/multiunit/tabs/project_details/central_systems.jsp" + qs, true);
			break;
		case "3.0.5":
			nav("/multiunit/tabs/project_details/dwelling_details.jsp" + qs, true);
			break;
		case "4.0.1":
			nav("/multiunit/tabs/water/intro.jsp", true);
			break;
		case "4.1.1":
			nav("/multiunit/tabs/water/common/landscape.jsp" + qs, true);
			break;
		case "4.1.2":
			nav("/multiunit/tabs/water/common/alternative_water_supply.jsp" + qs, true);
			break;
		case "4.1.3":
			nav("/multiunit/tabs/water/common/alternative_water_use.jsp" + qs, true);
			break;
		case "4.1.4":
			nav("/multiunit/tabs/water/common/pool_spa.jsp" + qs, true);
			break;
		case "4.1.5":
			nav("/multiunit/tabs/water/common/other.jsp" + qs, true);
			break;
		case "4.2.1":
			nav("/multiunit/tabs/water/individual/fixtures.jsp" + qs, true);
			break;
		case "4.2.2":
			nav("/multiunit/tabs/water/individual/alternative_water.jsp" + qs, true);
			break;
		case "4.2.3":
			nav("/multiunit/tabs/water/individual/pool_spa.jsp" + qs, true);
			break;
		case "4.3.1":
			nav("/tabs/water/status/status.jsp", true);
			break;
		case "5.0.1":
			nav("/multiunit/tabs/thermal/intro.jsp", true);
			break;
		case "5.1.1":
			nav("/multiunit/tabs/thermal/simulation/assessor_details.jsp", true);
			break;
		case "5.1.2":
			nav("/multiunit/tabs/thermal/simulation/thermal_loads.jsp", true);
			break;
		case "5.1.3":
			nav("/multiunit/tabs/thermal/simulation/cross_ventilation.jsp", true);
			break;
		case "5.1.4":
			nav("/multiunit/tabs/thermal/simulation/construction.jsp", true);
			break;
		case "5.2.1":
			nav("/tabs/thermal/status/status.jsp", true);
			break;
		case "6.0.1":
			nav("/multiunit/tabs/energy/intro.jsp", true);
			break;
		case "6.1.1":
			nav("/multiunit/tabs/energy/centralised/hot_water.jsp", true);
			break;
		case "6.1.2":
			nav("/multiunit/tabs/energy/centralised/cooling.jsp", true);
			break;
		case "6.1.3":
			nav("/multiunit/tabs/energy/centralised/heating.jsp", true);
			break;
		case "6.1.4":
			nav("/multiunit/tabs/energy/centralised/alternative_energy_supply.jsp", true);
			break;
		case "6.1.5":
			nav("/multiunit/tabs/energy/centralised/lifts.jsp", true);
			break;
		case "6.1.6":
			nav("/multiunit/tabs/energy/centralised/pool_spa.jsp", true);
			break;
		case "6.1.7":
			nav("/multiunit/tabs/energy/centralised/sauna.jsp", true);
			break;
		case "6.1.8":
			nav("/multiunit/tabs/energy/centralised/other.jsp", true);
			break;
		case "6.2.1":
			nav("/multiunit/tabs/energy/common/ventilation.jsp", true);
			break;
		case "6.2.2":
			nav("/multiunit/tabs/energy/common/cooling_heating.jsp", true);
			break;
		case "6.2.3":
			nav("/multiunit/tabs/energy/common/lighting.jsp", true);
			break;
		case "6.3.1":
			nav("/multiunit/tabs/energy/individual/hot_water.jsp" + qs, true);
			break;
		case "6.3.2":
			nav("/multiunit/tabs/energy/individual/ventilation.jsp" + qs, true);
			break;
		case "6.3.3":
			nav("/multiunit/tabs/energy/individual/cooling.jsp" + qs, true);
			break;
		case "6.3.4":
			nav("/multiunit/tabs/energy/individual/heating.jsp" + qs, true);
			break;
		case "6.3.5":
			nav("/multiunit/tabs/energy/individual/lighting.jsp" + qs, true);
			break;
		case "6.3.6":
			nav("/multiunit/tabs/energy/individual/pool_spa.jsp" + qs, true);
			break;
		case "6.3.7":
			nav("/multiunit/tabs/energy/individual/appliances.jsp" + qs, true);
			break;
		case "6.3.8":
			nav("/multiunit/tabs/energy/individual/other.jsp" + qs, true);
			break;
		case "6.4.1":
			nav("/tabs/energy/status/status.jsp", true);
			break;
		case "7.0.1":
			nav("/tabs/summary/summary.jsp", true);
			break;
		case "8.0.1":
			nav("/tabs/certificate/certificate.jsp", true);
			break;
		default:
			//alert("404: Page not found.");
			parent.currentPage = "2.0.1";
			parent.frames[0].location.href="/multiunit/tabs/project_address/project_address.jsp";
			return false;
	}
//	parent.currentPage = pageNum; // set current page. --> now done in every page individually when it loads.
}

function _gotoPageUsingOldEngine() {
    switch (getProjectType()) {
        case "multiunit":
            gotoPage("2.0.4");
            break;
        default:
            gotoPage("2.0.3");
    }
}

function goNext() {
	//move to next index page..
	if (parent.currentPage != "") {
		if (parent.currentPage == "1.0.1") {
			if (isUsingOldEngine) {
				_gotoPageUsingOldEngine();
			} else {
				gotoPage("2.0.1");
			}
			return;
		}

		if (parent.currentPage == "2.0.4") {
			gotoPage("2.0.1");
			return;
		}
		pageArray = getPageArray(getProjectType());
		for (var i=0; i < pageArray.length; i++) {
			if ((pageArray[i] == parent.currentPage) && (!(i+1 > pageArray.length - 1))) {
			    gotoPage(pageArray[i + 1]);
			    break;
			}
		}
	} else {
		gotoPage("2.0.1");
	}
}

function goBack() {
    // goto previous tab if one exists.. if not go to previous index page..
    // move to previous index page..
    if (parent.currentPage != "") {
        if (parent.currentPage != "1.0.1") {
            if (parent.currentPage == "2.0.1") {
                if (isUsingOldEngine) {
                    goApplicationDetails();
                } else {
                    gotoPage("1.0.1");
                }
            } else {
                pageArray = getPageArray(getProjectType());
                for (var i = 0; i < pageArray.length; i++) {
                    if (pageArray[i] == parent.currentPage) {
                        gotoPage(pageArray[i - 1]);
                        break;
                    }
                }
            }
        }
    } else {
        gotoPage("2.0.1");
    }
}

function goApplicationDetails() {
    gotoPage("2.0.4");
}

function getSelectedDwellings() {
	// for individual index pages only.
	// returns a string of the selected dwellings for the given tabname which is delimited by a "|" character.
	var dwellings = "";
	var found = false;
	
	for (var i=0; i < document.basix_form.elements.length; i++) {
		if (!found) {
			// if not found mastercheckbox for that tab
			if (document.basix_form.elements[i].name == "masterChkbox") {
				// if element name == "masterChkbox" + "_" + tabName
				found = true;
				if (document.basix_form.elements[i].checked) {
					// select all is checked therefore means all dwellings for current building.
					dwellings = "";
					break;
				}
			}
		} else {
			// loop through to end of tab. ie. until end of elements or until next mastercheckbox.
			if (document.basix_form.elements[i].name.search("masterChkbox") != -1) {
				// next masterChkbox found so no more need to continue searching.
				break;
			}
			if (document.basix_form.elements[i].name.substr(0,8) == "dwelling" && document.basix_form.elements[i].checked) {
				// if dwelling checkbox and is checked add to list of dwellings to edit.
				// since element name = "dwelling_" + something like a row number, then add the something (row number) to the dwelling variable to be passed to the popup.
				dwellings += document.basix_form.elements[i].name.substr(9) + "|";
			} else if (document.basix_form.elements[i].name.substr(0,11) == "commonCheck" && document.basix_form.elements[i].checked) {
				dwellings += document.basix_form.elements[i].name.substr(12) + "|";
			}
		}
	}
	if (dwellings == "") {
	// no checkboxes are selected so assume all dwellings in entire building..
		dwellings = "";
	}
	rpcDwellingList = "|" + dwellings; //Save it in the variable incase we need.
	
	return dwellings;
}

function open_popup(popup, checkDwellings) {
	// called by the buttons (topic buttons) to open a popup.
	
	//Build a pipe delimited string off all select units
	var dwellings = getSelectedDwellings();

	if (checkDwellings) {
		if (dwellings != "") {
			//Open it..
			showPopUp(popup, "btl_dwellings=|" + dwellings + "&btl_use_dwelling_defaults=use_current_indexname");
		} else {
			//showErrorAlert('', 'Please select one or more dwellings', '', '');
			// **** NEED TO INSERT QS FOR ALL DWELLINGS IN CURRENT BUILDING *****
			showPopUp(popup, "btl_dwellings=|" + dwellings + "&btl_use_dwelling_defaults=use_current_indexname");
		}
	} else { // no need for checking of dwellings being selected...
		showPopUp(popup, "btl_dwellings=|" + dwellings + "&btl_use_dwelling_defaults=use_current_indexname");
	}
}

function selectCell(myRow, myPopupName) {
	/* this function unchecks all dwellings listed in the dwelling tab.
	   it then selects the dwelling of the current row clicked by highlighting and checking the
	   associated checkbox.
	   if the myPopupName variable is set then it then opens the respective popup. */
	if (popupWindowRef != null && typeof(popupWindowRef) != 'undefined' && !popupWindowRef.closed) {
		// if there is a pop up window open then do not run this functionality
	} else {
		unCheckAll();
		highlightRow(myRow.parentNode, true);
		//check checkbox of dwelling, where checkbox is in the first cell of the row sitting within a <p> tag.
		if (ie) {
			myRow.parentNode.childNodes[0].childNodes[0].childNodes[0].checked = true;
		} else {
			myRow.parentNode.childNodes[1].childNodes[0].childNodes[0].checked = true;
		}
		// open popup if required.
		if (myPopupName != "") {
			open_popup(myPopupName, true);
		}
	}
}

function showPopUp(myPopUpName) {
	showPopUp(myPopUpName, "");
}

function showPopUp(myPopUpName, myQueryString) {
	var myUrl = "";
	var useReference = true;
	
	switch (myPopUpName) {
		case "newProject":
			myUrl = "/popups/project_portfolio/project_new.jsp";
			break;
		default:
			if (getProjectType() == "detached") {
				popupDetailsArray = showPopUp_detached(myPopUpName, myQueryString);
			} else {
				popupDetailsArray = showPopUp_multiunit(myPopUpName, myQueryString);
			}
			myUrl = popupDetailsArray[0];
			useReference = popupDetailsArray[1];
	}

	if (myQueryString != "") {
		myUrl += "?" + myQueryString;
	}
	
	newPopUp(myUrl, myPopUpName, useReference);
}

function showPopUp_multiunit(myPopUpName, myQueryString) {
	// library of popup urls.
	// open a popup for a given popupname and querystring..
	var myUrl = "";
	var useReference = true;
	switch (myPopUpName) {
		case "addBuildings":
			myUrl = "/multiunit/popups/project_details/add_buildings.jsp";
			break;
		case "addIdenticalDwellings":
			myUrl = "/multiunit/popups/project_details/add_identical_dwellings.jsp";
			break;
		case "addDwellings":
			myUrl = "/multiunit/popups/project_details/add_dwellings.jsp";
			break;
		case "addCommonAreas":
			myUrl = "/multiunit/popups/project_details/add_common_areas.jsp";
			break;
		case "addCentralSystems":
			myUrl = "/multiunit/popups/project_details/add_central_systems.jsp";
			break;
		case "waterFixtures":
			myUrl = "/multiunit/popups/water/fixtures.jsp";
			break;
		case "waterAltWater":
			myUrl = "/multiunit/popups/water/alternative_water.jsp";
			break;
		case "waterPoolSpa":
			myUrl = "/multiunit/popups/water/pool_spa.jsp";
			break;
		case "thermalLoads":
			myUrl = "/multiunit/popups/thermal/loads.jsp";
			break;
		case "constructionSM":
			myUrl = "/multi.construction.action";
			break;			
    	case "thermalCrossVent":
			myUrl = "/multiunit/popups/thermal/cross_ventilation.jsp";
			break;
		case "energyHotWater":
			myUrl = "/multiunit/popups/energy/hot_water.jsp";
			break;
		case "energyVentilation":
			myUrl = "/multiunit/popups/energy/ventilation.jsp";
			break;
		case "energyCoolingSystem":
			myUrl = "/multiunit/popups/energy/cooling_system.jsp";
			break;
		case "energyHeatingSystem":
			myUrl = "/multiunit/popups/energy/heating_system.jsp";
			break;
		case "energyLighting":
			myUrl = "/multiunit/popups/energy/lighting.jsp";
			break;
		case "energyPoolSpa":
			myUrl = "/multiunit/popups/energy/pool_spa.jsp";
			break;
		case "energyAppliances":
			myUrl = "/multiunit/popups/energy/appliances.jsp";
			break;
		case "energyOther":
			myUrl = "/multiunit/popups/energy/other.jsp";
			break;
		case "waterMustAddress":
			myUrl = "/multiunit/popups/water/status/mustAddress.jsp";
			useReference = false;
			break;
		case "waterHowToPass":
			myUrl = "/multiunit/popups/water/status/howtopass.jsp";
			useReference = false;
			break;
		case "waterConsumption":
			myUrl = "/multiunit/popups/water/status/consumption.jsp";
			useReference = false;
			break;
		case "thermalMustAddress":
			myUrl = "/multiunit/popups/thermal/status/mustAddress.jsp";
			useReference = false;
			break;
		case "thermalHowToPass":
			myUrl = "/multiunit/popups/thermal/status/howtopass.jsp";
			useReference = false;
			break;			
		case "energyMustAddress":
			myUrl = "/multiunit/popups/energy/status/mustAddress.jsp";
			useReference = false;
			break;
		case "energyHowToPass":
			myUrl = "/multiunit/popups/energy/status/howtopass.jsp";
			useReference = false;
			break;
		case "projectAddressMustAddress":
			myUrl = "/multiunit/popups/project_address/status/mustAddress.jsp";
			useReference = false;
			break;
		case "projectDetailsMustAddress":
			myUrl = "/multiunit/popups/project_details/status/mustAddress.jsp";
			useReference = false;
			break;
		case "defineFilter":
			myUrl = "/multiunit/popups/filter/filter.jsp";
			break;
		default:
			alert("Popup does not exist.");
	}
	return new Array(myUrl, useReference);
}

function showPopUp_detached(myPopUpName, myQueryString) {
	// library of popup urls.
	// open a popup for a given popupname and querystring..
	var myUrl = "";
	var useReference = true;
	switch (myPopUpName) {
		case "thermalBreeze1":
			myUrl = "/detached/popups/thermal/breeze_path1.jsp";
			break;
		case "thermalBreeze2":
			myUrl = "/detached/popups/thermal/breeze_path2.jsp";
			break;
		case "thermalBreeze3":
			myUrl = "/detached/popups/thermal/breeze_path3.jsp";
			break;
		case "thermalBreeze4":
			myUrl = "/detached/popups/thermal/breeze_path4.jsp";
			break;
		/*case "glazingWindowsDoors":
			myUrl = "/detached/popups/thermal/glazing_windows_doors.jsp"; // TO BE REMOVED FROM CVS
			break;
		case "glazingCharacteristics":
			myUrl = "/detached/popups/thermal/glazing_characteristics.jsp";
			break;
		/*case "glazingOvershadowing":
			myUrl = "/detached/popups/thermal/glazing_overshadowing.jsp";
			break;
		case "glazingIdenticalValues":
			myUrl = "/detached/popups/thermal/glazing_identicalValues.jsp";
			break;
		case "glazingShading":
			myUrl = "/detached/popups/thermal/glazing_shading.jsp";
			break;
		case "skylightsAdd":
			myUrl = "/detached/popups/thermal/skylights_add.jsp";
			break;
		case "skylightsCharacteristics":
			myUrl = "/detached/popups/thermal/skylights_characteristics.jsp";
			break;
		case "skylightsShading":
			myUrl = "/detached/popups/thermal/skylights_shading.jsp";
			break;*/
		case "waterMustAddress":
			myUrl = "/detached/popups/water/status/mustAddress.jsp";
			useReference = false;
			break;
		case "waterHowToPass":
			myUrl = "/detached/popups/water/status/howtopass.jsp";
			useReference = false;
			break;
		case "waterConsumption":
			myUrl = "/detached/popups/water/status/consumption.jsp";
			useReference = false;
			break;
		case "thermalMustAddress":
			myUrl = "/detached/popups/thermal/status/mustAddress.jsp";
			useReference = false;
			break;
		case "thermalHowToPass":
			myUrl = "/detached/popups/thermal/status/howtopass.jsp";
			useReference = false;
			break;
		case "energyMustAddress":
			myUrl = "/detached/popups/energy/status/mustAddress.jsp";
			useReference = false;
			break;
		case "energyHowToPass":
			myUrl = "/detached/popups/energy/status/howtopass.jsp";
			useReference = false;
			break;
/* project address removed from detached..:
		case "projectAddressMustAddress":
			myUrl = "/detached/popups/project_address/status/mustAddress.jsp";
			break;
*/
		case "projectDetailsMustAddress":
			myUrl = "/detached/popups/project_details/status/mustAddress.jsp";
			useReference = false;
			break;
		default:
			alert("Popup does not exist.");
	}
	
	return new Array(myUrl, useReference);
}


function openHelp(myPage) {
	var myUrl;
	var projectPortfolioPopup = false;
	var projectType;
	if (parent.currentPage == "1.0.3") {
		projectPortfolioPopup = true;
	}
	if (currentlyInPopUp()) {
		unsetModal();
		projectType = opener.getProjectType();
		/*if (opener.parent.currentPage == "1.0.1" || opener.parent.currentPage == "1.0.2") {
			projectPortfolioPopup = true;
		}*/
	} else {
		projectType = getProjectType();
	}
	if (projectPortfolioPopup) {
		switch (myPage) {
			// new project popup
			case "pd_pt_dwelling":
				myUrl = "/help_detached/project_details/project_type/dwelling.htm";
				break;
			case "pd_pt_grannyFlat":
				myUrl = "/help_detached/project_details/project_type/granny_flat_or_bedsitter.htm";
				break;
			case "pd_pt_dualOccupancy":
				myUrl = "/help_detached/project_details/project_type/dual_occupancy.htm";
				break;
			case "pd_pt_requireCertificate":
				myUrl = "/information/common/pdf/require_basix_certificate.pdf";
				break;
			case "pd_pt_dualOccupancy":
				myUrl = "/information/common/pdf/designguidelines/dualoccupancy.pdf";
				break;
			default:
				myUrl = "/help_detached/getting_started.htm";
				break;
		}
	} else if (parent.currentPage == "1.0.1" || parent.currentPage == "1.0.2") {
		switch (myPage) {
			// general
			case "help_home":
				myUrl="/popups/help/help.jsp";
				break;
			case "help_definitions":
				myUrl="/popups/definitions/definitions.jsp";
				break;
			default:
				myUrl = "/help_detached/getting_started.htm";
				break;
		}
	} else {
		switch (projectType) {			
			// if detached help pages
			case "detached":
				myUrl = openHelp_detached(myPage);
				break;
			// if multiunit help pages
			case "multiunit":
				myUrl = openHelp_multiunit(myPage);
				break;
			default:
				myUrl = "/help_detached/getting_started.htm";
				break;
		}
	}
	//location.href = myUrl; - testing new way to open popup windows
	helpWindowRef = window.open(myUrl, 'helpWindowRef', 'width=450,height=500,menubar=no,statusbar=no,resizable=yes,scrollbars=yes');
}

function openHelp_detached(myPage) {
	switch (myPage) {
		// general
		case "help_home":
			myUrl="/popups/help/help.jsp";
			break;
		case "help_definitions":
			myUrl="/popups/definitions/definitions.jsp";
			break;
		// project details
		case "2.0.1":
			myUrl = "/help_detached/project_details/project_address/how_do_i_complete_this_page.htm";
			break;
		case "2.0.2":
			myUrl = "/help_detached/project_details/project_type/project_type_help.htm";
			break;
		case "2.0.3":
			myUrl = "/help_detached/project_details/site_details/site_details.htm";
			break;
		// project details - project type
		case "pd_pt_separateDwelling":
			myUrl = "/help_detached/project_details/project_type/separate_dwelling_house.htm";
			break;
		case "pd_pt_attachedDwelling":
			myUrl = "/help_detached/project_details/project_type/attached_dwelling_house.htm";
			break;
		case "pd_pt_unit":
			myUrl = "/help_detached/project_details/project_type/unit.htm";
			break;
		// project details - site details
		case "pd_sd_siteArea":
			myUrl = "/help_detached/project_details/site_details/what_is_site_area.htm";
			break;
		case "pd_sd_roofArea":
			myUrl = "/help_detached/project_details/site_details/what_is_roof_area.htm";
			break;
		case "pd_sd_conditionedFloor":
			myUrl = "/help_detached/project_details/site_details/conditioned_floor_area.htm";
			break;
		case "pd_sd_unconditionedFloor":
			myUrl = "/help_detached/project_details/site_details/what_is_unconditioned_floor_area.htm";
			break;
		// water
		case "w_howToPass":
			myUrl = "/help_detached/basix_targets/water.htm";
			break;
		// water - water details
		case "4.1.1":
			myUrl = "/help_detached/water/landscape/private_landscape.htm";
			break;
		case "4.1.2":
			myUrl = "/help_detached/water/fixtures/fixtures.htm";
			break;
		case "4.1.3":
			myUrl = "/help_detached/water/alternative_water/alternative_water_for_dwellings.htm";
			break;
		case "4.1.4":
			myUrl = "/help_detached/water/alternative_water_details/alternative_water_details_page.htm";
			break;
		case "4.1.5":
			myUrl = "/help_detached/water/pool_and_spa/private_pool_and_spa.htm";
			break;
		// water - water details - landscape
		case "w_land_lawnGardenArea":
			myUrl = "/help_detached/water/landscape/area_or_lawn_or_area_of_garden.htm";
			break;
		case "w_land_indigenousSpecies":
			myUrl = "/help_detached/water/landscape/indigenous_species.htm";
			break;
		case "w_land_areaIndigenousSpecies":
			myUrl = "/help_detached/water/landscape/area_of_indigenous_species.htm";
			break;
		case "w_land_increaseScore":
			myUrl = "/help_detached/water/landscape/use_this_page_to_increase_score.htm";
			break;
		case "w_land_landscapePlan":
			myUrl = "/help_detached/water/landscape/landscaping_on_my_da_plans.htm";
			break;
		// water - water details - fixtures
		case "w_fix_waterRating":
			myUrl = "/help_detached/water/fixtures/what_is_water_rating.htm";
			break;
		case "w_fix_onDemandHWRS":
			myUrl = "/help_detached/water/fixtures/on_demand_hot_water_recirculation_system.htm";
			break;
		// water - water details - alternative water
		case "w_aw_rainwater":
			myUrl = "/help_detached/water/alternative_water/what_is_rainwater.htm";
			break;
		case "w_aw_stormwater":
			myUrl = "/help_detached/water/alternative_water/what_is_stormwater.htm";
			break;
		case "w_aw_reticulated":
			myUrl = "/help_detached/water/alternative_water/reticulated_recycled_water_supply.htm";
			break;
		case "w_aw_greywaterTreatment":
			myUrl = "/help_detached/water/alternative_water/what_is_greywater_wastewater_treatment_system.htm";
			break;
		case "w_aw_greywaterDiversion":
			myUrl = "/help_detached/water/alternative_water/what_is_greywater_diversion_system.htm";
			break;
		case "w_aw_wastewaterGuidance":
		case "w_awd_wastewaterGuidance":
			myUrl = "/help_detached/water/alternative_water/approval_for_on_site_greywater_wastewater.htm";
			break;
		case "w_aw_privateDam":
			myUrl = "/help_detached/water/alternative_water/do_i_need_approval_for_private_dam.htm";
			break;
		case "w_aw_groundwater":
		case "w_awd_groundwater":
			myUrl = "/help_detached/water/alternative_water/what_is_groundwater.htm";
			break;
		// water - water details - alternative water details
		case "w_awd_rw_areasDivertedToCWT":
			myUrl = "/help_detached/water/alternative_water_details/areas_diverted_to_central_water_tank.htm";
			break;
		case "w_awd_rw_divertOverflow":
			myUrl = "/help_detached/water/alternative_water_details/divert_over_flow_to.htm";
			break;
		case "w_awd_sw_imperviousArea":
			myUrl = "/help_detached/water/alternative_water_details/impervious_areas.htm";
			break;
		case "w_awd_sw_planterBox":
			myUrl = "/help_detached/water/alternative_water_details/what_is_planter_box.htm";
			break;
		case "w_awd_dam_measureAreas":
			myUrl = "/help_detached/water/alternative_water_details/how_to_measure_areas_for_the_private_dam_supply.htm";
			break;
		case "w_awd_dam_catchmentAreas":
			myUrl = "/help_detached/water/alternative_water_details/what_are_impervious_and_pervious_dam_catchment_areas.htm";
			break;
		case "w_awd_alternativeWaterUse":
			myUrl = "/help_detached/water/alternative_water_details/alternative_water_use.htm";
			break;
		// water - water details - pool and spa
		case "w_pas_cover":
			myUrl = "/help_detached/water/pool_and_spa/what_is_pool_or_spa_cover.htm";
			break;
		case "w_pas_shadingProtection":
			myUrl = "/help_detached/water/pool_and_spa/shading_and_protection.htm";
			break;
		// thermal comfort
		case "tc_howToPass":
			myUrl = "/help_detached/basix_targets/thermal_comfort.htm";
			break;
		case "5.0.1":
			myUrl = "/help_detached/thermal_comfort/thermal_comfort.htm";
			break;
		case "tc_deemedToComplyRapid":
			myUrl = "/help_detached/thermal_comfort/what_is_deemed_to_comply_rapid_method.htm";
			break;
		case "tc_deemedToComplyFull":
			myUrl = "/help_detached/thermal_comfort/what_is_deemed_to_comply_full_method.htm";
			break;
		case "tc_simulation":
			myUrl = "/help_detached/thermal_comfort/what_is_simulation_method.htm";
			break;
		// thermal comfort - deemed to comply rapid
		case "5.3.1":
			myUrl = "/help_detached/thermal_comfort/what_is_deemed_to_comply_rapid_method.htm";
			break;
		// thermal comfort - simulation
		case "5.1.1":
			myUrl = "/help_detached/thermal_comfort/simulation_method/assessor_details/assessor_details.htm";
			break;
		case "5.1.2":
			myUrl = "/help_detached/thermal_comfort/simulation_method/thermal_loads/thermal_loads.htm";
			break;
		case "5.1.3":
			myUrl = "/help_detached/thermal_comfort/simulation_method/cross_ventilation/cross_ventilation.htm";
			break;
		// thermal comfort - simulation - assessor details
		case "tc_sim_ad_accreditedAssessor":
			myUrl = "/help_detached/thermal_comfort/simulation_method/assessor_details/accredited_assessor.htm";
			break;
		case "tc_sim_ad_requiredShading":
			myUrl = "/help_detached/thermal_comfort/simulation_method/assessor_details/required_shading.htm";
			break;
		// thermal comfort - simulation - thermal loads
		case "tc_sim_tl_elevatedFloor":
			myUrl = "/help_detached/thermal_comfort/simulation_method/thermal_loads/elevated_floor.htm";
			break;
		case "tc_sim_tl_correctedCooling":
			myUrl = "/help_detached/thermal_comfort/simulation_method/thermal_loads/corrected_cooling.htm";
			break;
		// thermal comfort - simulation - cross ventilation
		case "tc_sim_cv_breezePathFlow":
			myUrl = "/help_detached/thermal_comfort/simulation_method/cross_ventilation/breeze_path_flow.htm";
			break;
		case "tc_sim_cv_breezePathLength":
			myUrl = "/help_detached/thermal_comfort/simulation_method/cross_ventilation/breeze_path_length.htm";
			break;
		case "tc_sim_cv_ventOpeningLocation":
			myUrl = "/help_detached/thermal_comfort/simulation_method/cross_ventilation/ventilation_opening_locations.htm";
			break;
		case "tc_sim_cv_ventOpening":
			myUrl = "/help_detached/thermal_comfort/simulation_method/cross_ventilation/ventilation_opening.htm";
			break;
		case "tc_sim_cv_doorsBtwnOpening":
			myUrl = "/help_detached/thermal_comfort/simulation_method/cross_ventilation/doors_between_ventilation_openings.htm";
			break;
		// thermal comfort - diy - construction type
		case "5.2.1":
			myUrl = "help_detached/thermal_comfort/do-it-yourself_(diy)/construction_type/construction_type_page.htm";
			break;
		case "tc_diy_ct_combinationTypes":
			myUrl = "help_detached/thermal_comfort/do-it-yourself_(diy)/construction_type/floor_types.htm";
			break;
		// thermal comfort - diy - construction details
		case "5.2.2":
			myUrl = "help_detached/thermal_comfort/do-it-yourself_(diy)/construction_details/construction_details_page.htm";
			break;
		case "tc_diy_cd_slabHeating":
			myUrl = "help_detached/thermal_comfort/do-it-yourself_(diy)/construction_details/in_slab_heating_system.htm";
			break;
		case "tc_diy_cd_measureFloor":
			myUrl = "help_detached/thermal_comfort/do-it-yourself_(diy)/construction_details/how_to_measure_floor_area.htm";
			break;
		case "tc_diy_cd_insulatingCavity":
			myUrl = "help_detached/thermal_comfort/do-it-yourself_(diy)/construction_details/insulating_cavity_brick_wall.htm";
			break;
		case "tc_diy_cd_suspendedFloorConcession":
			myUrl = "help_detached/thermal_comfort/do-it-yourself_(diy)/construction_details/suspended_floor_concession.htm";
			break;
		case "tc_diy_cd_aacSkin":
			myUrl = "help_detached/thermal_comfort/do-it-yourself_(diy)/construction_details/autoclaved_aerated_concrete_aac.htm";
			break;
		// thermal comfort - diy - insulation
		case "5.2.3":
			myUrl = "help_detached/thermal_comfort/do-it-yourself_(diy)/insulation/insulation_page.htm";
			break;
		// thermal comfort - diy - windows & skylights
		case "5.2.4":
			myUrl = "help_detached/thermal_comfort/do-it-yourself_(diy)/windows_and_skylights/windows_and_skylight_page.htm";
			break;
		case "tc_diy_ws_orientation":
			myUrl = "help_detached/thermal_comfort/do-it-yourself_(diy)/windows_and_skylights/orienatation_sector.htm";
			break;
		case "tc_diy_ws_overShadowing":
			myUrl = "help_detached/thermal_comfort/do-it-yourself_(diy)/windows_and_skylights/overshadowing.htm";
			break;
		case "tc_diy_ws_glazingScore":
			myUrl = "help_detached/thermal_comfort/do-it-yourself_(diy)/window_and_skylight_details/improving_performance_of_glazing.htm";
			break;
		// thermal comfort - diy - window & skylight details
		case "5.2.5":
			myUrl = "help_detached/thermal_comfort/do-it-yourself_(diy)/window_and_skylight_details/window_and_skylight_details_page.htm";
			break;
		case "tc_diy_wsd_frameGlassTypes":
			myUrl = "help_detached/thermal_comfort/do-it-yourself_(diy)/window_and_skylight_details/frame_and_glass_types.htm";
			break;
		case "tc_diy_wsd_qualifyCrossVent":
			myUrl = "help_detached/thermal_comfort/do-it-yourself_(diy)/window_and_skylight_details/required_shading_to_qualify_for_cross_ventilation_bonus.htm";
			break;
		case "tc_diy_wsd_shadingDevice":
			myUrl = "help_detached/thermal_comfort/do-it-yourself_(diy)/window_and_skylight_details/shading_device.htm";
			break;
		// thermal comfort - diy - cross ventilation
		case "5.2.6":
			myUrl = "help_detached/thermal_comfort/simulation_method/cross_ventilation/cross_ventilation.htm";
			break;
		// energy
		case "e_howToPass":
			myUrl = "/help_detached/basix_targets/energy.htm";
			break;
		// energy - energy details
		case "6.1.1":
			myUrl = "/help_detached/energy/hot_water/hot_water_for_dwellings.htm";
			break;
		case "6.1.2":
			myUrl = "/help_detached/energy/heating_&_cooling/heating_systems_for_dwellings.htm";
			break;
		case "6.1.3":
			myUrl = "/help_detached/energy/ventilation/ventilation_for_dwellings.htm";
			break;
		case "6.1.4":
			myUrl = "/help_detached/energy/lighting/lighting_for_dwellings.htm";
			break;
		case "6.1.5":
			myUrl = "/help_detached/energy/pool_and_spa/private_pool_or_spa_energy.htm";
			break;
		case "6.1.6":
			myUrl = "/help_detached/energy/alternative_energy/alternative_energy.htm";
			break;
		case "6.1.7":
			myUrl = "/help_detached/energy/other/other_energy_systems_for_dwellings.htm";
			break;
		// energy - energy details - hot water
		case "e_hw_hotWaterSystem":
			myUrl = "/help_detached/energy/hot_water/most_efficient_hot_water_system.htm";
			break;
		case "e_hw_REC":
			myUrl = "/help_detached/energy/hot_water/what_is_a_rec_.htm";
			break;
		// energy - energy details - heating & cooling
		case "e_hac_individualCooling":
			myUrl = "/help_detached/energy/heating_&_cooling/most_efficient_option_for_individual_cooling.htm";
			break;
		case "e_hac_individualHeating":
			myUrl = "/help_detached/energy/heating_&_cooling/most_efficient_option_for_individual_heating.htm";
			break;
		case "e_hac_energyEfficiencyRating":
			myUrl = "/help_detached/energy/heating_&_cooling/eer_cop.htm";
			break;
		case "e_hac_dayNightZoning":
			myUrl = "/help_detached/energy/heating_&_cooling/what_is_day_night_zoning_.htm";
			break;
		// energy - energy details - ventilation
		case "e_vent_internalVentOption":
			myUrl = "/help_detached/energy/ventilation/most_efficient_option_of_internal_ventilation.htm";
			break;
		// energy - energy details - lighting
		case "e_light_directLight":
			myUrl = "/help_detached/energy/lighting/direct_natural_light.htm";
			break;
		case "e_light_directLightCompliance":
			myUrl = "/help_detached/energy/lighting/direct_natural_light.htm#compliance";
			break;
		case "e_light_fluorescentLight":
			myUrl = "/help_detached/energy/lighting/fluorescent_lighting.htm";
			break;
		case "e_light_dedicatedFluorescentFitting":
			myUrl = "/help_detached/energy/lighting/dedicated_fluorescent_fitting.htm";
			break;
		// energy - energy details - pool and spa
		case "e_pas_heatingOption":
			myUrl = "/help_detached/energy/pool_and_spa/most_efficient_pool_or_spa_heating_option.htm";
			break;
		case "e_pas_pumpControlledByTimer":
			myUrl = "/help_detached/energy/pool_and_spa/what_is_pump_controlled_by_timer.htm";
			break;
		// energy - energy details - alternative energy
		case "e_ae_photovoltaicSystem":
			myUrl = "/help_detached/energy/alternative_energy/photovoltaic_system.htm";
			break;
		// energy - energy details - other
		case "e_other_cooktopOven":
			myUrl = "/help_detached/energy/other/most_efficient_cooktop_and_oven.htm";
			break;
		case "e_other_ventilatedFridgeSpace":
			myUrl = "/help_detached/energy/other/well_ventilated_fridge_space.htm";
			break;
		case "e_other_unshelteredClothesLine":
			myUrl = "/help_detached/energy/other/private_outdoor_unsheltered_clothes_drying_line.htm";
			break;
		case "e_other_shelteredClothesLine":
			myUrl = "/help_detached/energy/other/indoor_or_sheltered_clothes_drying_line.htm";
			break;		
		// certificate
		case "8.0.1":
			myUrl = "/help_detached/using_the_basix_tool/generate_save_and_print_the_basix_certificate.htm";
			break;
		case "cert_troubleShooting":
			myUrl = "/help_detached/using_the_basix_tool/troubleshooting.htm";
			break;
		case "alt_assessment_info":
			myUrl = "/information/faq.jsp#alternative1";
			break;
		case "altAssessment2":
			myUrl = "/help_detached/alternative_assessment_and_new_technologies/what_is_the_process_.htm";
			break;
		default:
			myUrl = "/help_detached/getting_started.htm";
			break;
	}
	return myUrl;
}

function openHelp_multiunit(myPage) {
	switch (myPage) {
		// general
		case "help_home":
			myUrl="/popups/help/help.jsp";
			break;
		case "help_definitions":
			myUrl="/popups/definitions/definitions.jsp";
			break;
		// current and completed projects
		case "1.0.1":
			myUrl="/help/Getting_started.htm";
			break;
		case "1.0.2":
			myUrl="/help/Getting_started.htm";
			break;
		// project address
		case "2.0.1":
			myUrl="/help/Project_address_and_Type/Project_address/How_do_I_complete_this_page.htm";
			break;
		case "2.0.2":
			myUrl="/help/Project_address_and_Type/Project_type/Project_type_help.htm";
			break;
		case "pa_pt_separateDwelling":
			myUrl="/help/Project_address_and_Type/Project_type/Separate_dwelling_house.htm";
			break;
		case "pa_pt_attachedDwelling":
			myUrl="/help/Project_address_and_Type/Project_type/Attached_dwelling_house.htm";
			break;
		case "pa_pt_unitBuilding":
			myUrl="/help/Project_address_and_Type/Project_type/unit_building.htm";
			break;
		// project details
		case "3.0.1":
			myUrl="/help/Project_details/Site_details/Site_details.htm";
			break;
		case "pd_sd_siteArea":
			myUrl="/help/Project_details/Site_details/What_is_site_area.htm";
			break;
		case "pd_sd_roofArea":
			myUrl="/help/Project_details/Site_details/What_is_roof_area.htm";
			break;
		case "pd_sd_nonResFloorArea":
			myUrl="/help/Project_details/Site_details/non_residential_floor_area.htm";
			break;
		case "pd_sd_carSpaces":
			myUrl="/help/Project_details/Site_details/number_of_residential_nonres_car.htm";
			break;
		case "3.0.2":
			myUrl="/help/Project_details/Unit_building_details/Unit_building_details.htm";
			break;
		case "pd_ub_storeys":
			myUrl="/help/Project_details/Unit_building_details/number_of_storeys_in_a_unit_building.htm";
			break;
		case "3.0.3":
			myUrl="/help/Project_details/Common_areas/Common_areas.htm";
			break;
		case "pd_ca_commonAreaDefn":
			myUrl="/help/Project_details/Common_areas/common_area.htm";
			break;
		case "3.0.4":
			myUrl="/help/Project_details/Central_systems/Central_systems.htm";
			break;
		case "pd_cs_centralSystemsDefn":
			myUrl="/help/Project_details/Central_systems/central_system_or_facility.htm";
			break;
		case "3.0.5":
			myUrl="/help/Project_details/Dwelling_details/Dwelling_details.htm";
			break;
		case "pd_dd_conditionedFloorArea":
			myUrl="/help/Project_details/Dwelling_details/conditioned_floor_area.htm";
			break;
		case "pd_dd_unconditionedFloorArea":
			myUrl="/help/Project_details/Dwelling_details/What_is_unconditioned_floor_area.htm";
			break;
		// water
		case "w_howToPass":
			myUrl="/help/BASIX_Targets/Water.htm";
			break;
		// water central systems and common areas
		case "4.1.1":
			myUrl="/help/Water/Common_areas_and_Central_systems/Landscape/Common_landscape.htm";
			break;
		case "w_csca_land_lawnGardenArea":
			myUrl="/help/Water/Common_areas_and_Central_systems/Landscape/area_or_lawn_or_area_of_garden.htm";
			break;
		case "w_csca_land_indigenousSpecies":
			myUrl="/help/Water/Common_areas_and_Central_systems/Landscape/area_of_indigenous_species.htm";
			break;
		case "4.1.2":
			myUrl="/help/Water/Common_areas_and_Central_systems/Alternative_water_supply/Alternative_water_supply.htm";
			break;
		case "w_csca_aws_mixedUseDev":
			myUrl="/help/Water/Common_areas_and_Central_systems/Alternative_water_supply/Central_water_tank_future_or_mixed_use.htm";
			break;
		case "w_csca_aws_imperviousAreas":
			myUrl="/help/Water/Common_areas_and_Central_systems/Alternative_water_supply/impervious_areas.htm";
			break;
		case "w_csca_aws_divertOverflow":
			myUrl="/help/Water/Common_areas_and_Central_systems/Alternative_water_supply/divert_over_flow_to.htm";
			break;
		case "w_csca_aws_reticulatedWater":
			myUrl="/help/Water/Common_areas_and_Central_systems/Alternative_water_supply/reticulated_recycled_water_supply.htm";
			break;
		case "4.1.3":
			myUrl="/help/Water/Common_areas_and_Central_systems/Alternative_water_use/Alternative_water_use.htm";
			break;
		case "w_csca_awu_commonLand":
			myUrl="/help/Water/Common_areas_and_Central_systems/Alternative_water_use/area_of_common_landscape.htm";
			break;
		case "w_csca_awu_centralCoolSys":
			myUrl="/help/Water/Common_areas_and_Central_systems/Alternative_water_use/central_cooling_system_with_cooling_tower.htm";
			break;
		case "4.1.4":
			myUrl="/help/Water/Common_areas_and_Central_systems/Pool_and_Spa/Central_Pool_and_Spa__Water.htm";
			break;
		case "w_csca_pas_shadingProtection":
			myUrl="/help/Water/Common_areas_and_Central_systems/Pool_and_Spa/shading_and_protection.htm";
			break;
		case "4.1.5":
			myUrl="/help/Water/Common_areas_and_Central_systems/Other/Other_common_areas_and_central_systems.htm";
			break;
		case "w_csca_other_fireSprinkler":
			myUrl="/help/Water/Common_areas_and_Central_systems/Other/fire_sprinkler_test_water.htm";
			break;
		case "w_csca_other_closedSystem":
			myUrl="/help/Water/Common_areas_and_Central_systems/Other/closed_system.htm";
			break;
		case "w_csca_other_privateWaterMeter":
			myUrl="/help/Water/Common_areas_and_Central_systems/Other/private_water_meter.htm";
			break;
		case "w_csca_other_conductivityController":
			myUrl="/help/Water/Common_areas_and_Central_systems/Other/conductivity_controller.htm";
			break;
		// water dwellings
		/*case "4.2.1":
			myUrl="/help/Water/Dwellings/Landscape/Private_landscape.htm";
			break;*/
		case "w_d_land_lawnGardenArea":
			myUrl="/help/Water/Common_areas_and_Central_systems/Landscape/area_or_lawn_or_area_of_garden.htm";
			break;
		case "w_d_land_indigenousSpecies":
			myUrl="/help/Water/Common_areas_and_Central_systems/Landscape/area_of_indigenous_species.htm";
			break;
		case "4.2.1":
			myUrl="/help/Water/Dwellings/Fixtures/Fixtures.htm";
			break;
		case "w_d_fix_hwrs":
			myUrl="/help/Water/Dwellings/Fixtures/on_demand_hot_water_recirculation_system.htm";
			break;
		case "4.2.2":
			myUrl="/help/Water/Dwellings/Alternative_water/Alternative_water_for_dwellings.htm";
			break;
		case "w_d_aw_source":
			myUrl="/help/Water/Dwellings/Alternative_water/alternative_water_source.htm";
			break;
		case "4.2.3":
			myUrl="/help/Water/Dwellings/Pool_and_Spa/Private_Pool_and_Spa.htm";
			break;
		case "w_d_pas_cover":
			//unsetModal();
			myUrl="/help/Water/Dwellings/Pool_and_Spa/What_is_pool_or_spa_cover.htm";
			break;
		// thermal comfort
		case "tc_howToPass":
			myUrl="/help/BASIX_Targets/Thermal_comfort.htm";
			break;
		// thermal comfort simulation
		case "5.1.1":
			myUrl="/help/Thermal_comfort/Simulation_method/Assessor_details/Assessor_details.htm";
			break;
		case "tc_s_ad_accreditedAssessor":
			myUrl="/help/Thermal_comfort/Simulation_method/Assessor_details/Accredited_Assessor.htm";
			break;
		case "tc_s_ad_requiredShading":
			myUrl="/help/Thermal_comfort/Simulation_method/Assessor_details/required_shading.htm";
			break;
		case "5.1.2":
			myUrl="/help/Thermal_comfort/Simulation_method/Thermal_loads/Thermal_loads.htm";
			break;
		case "tc_s_tl_tcScore":
			myUrl="/help/Thermal_comfort/Simulation_method/Thermal_loads/What_is_TC_Score.htm";
			break;
		case "tc_s_tl_adjustedLoads":
		    myUrl = "/help/Thermal_comfort/Simulation_method/Thermal_loads/How_do_I_complete_this_page.htm";
			break;
		case "tc_s_tl_elevatedFloor":
			myUrl="/help/Thermal_comfort/Simulation_method/Thermal_loads/elevated_floor.htm";
			break;
		case "tc_s_tl_correctedCooling":
			myUrl="/help/Thermal_comfort/Simulation_method/Thermal_loads/corrected_cooling.htm";
			break;
		case "5.1.3":
			myUrl="/help/Thermal_comfort/Simulation_method/Cross_ventilation/Cross_ventilation.htm";
			break;
		case "tc_s_cv_breezePathFlow":
			myUrl="/help/Thermal_comfort/Simulation_method/Cross_ventilation/breeze_path_flow.htm";
			break;
		case "tc_s_cv_breezePathLength":
			myUrl="/help/Thermal_comfort/Simulation_method/Cross_ventilation/breeze_path_length.htm";
			break;
		case "tc_s_cv_ventOpenings":
			myUrl="/help/Thermal_comfort/Simulation_method/Cross_ventilation/Ventilation_opening_locations.htm";
			break;
		case "tc_s_cv_aboveTenthFloor":
			myUrl="/help/Thermal_comfort/Simulation_method/Cross_ventilation/What_is_on_or_above_10th_floor.htm";
			break;
		case "tc_s_cv_doorsBtwnVentOpenings":
			myUrl="/help/Thermal_comfort/Simulation_method/Cross_ventilation/doors_between_Ventilation_openings.htm";
			break;
		case "5.1.4":
			myUrl="/help/Thermal_comfort/Simulation_method/Construction_page.htm";
			break;
		// energy
		case "e_howToPass":
			myUrl="/help/BASIX_Targets/Energy.htm";
			break;
		// energy central systems
		case "6.1.1":
			myUrl="/help/Energy/Central_systems/Hot_water_system/Central_hot_water_system.htm";
			break;
		case "e_cs_hw_systemType":
			myUrl="/help/Energy/Central_systems/Hot_water_system/most_efficient_hot_water_system.htm";
			break;
		case "e_cs_hw_solarArea":
			myUrl="/help/Energy/Central_systems/Hot_water_system/What_is_solar_collector_area.htm";
			break;
		case "e_cs_hw_pipingInsulation":
			myUrl="/help/Energy/Central_systems/Hot_water_system/piping_insulation_ringmain_and_supply_riser.htm";
			break;
		case "6.1.2":
			myUrl="/help/Energy/Central_systems/Cooling_system/Central_cooling_system.htm";
			break;
		case "e_cs_cool_systemType":
			myUrl="/help/Energy/Central_systems/Cooling_system/most_efficient_cooling_system.htm";
			break;
		case "e_cs_cool_energySource":
			myUrl="/help/Energy/Central_systems/Cooling_system/energy_sources_for_cooling_systems.htm";
			break;
		case "e_cs_cool_unitEfficiency":
			myUrl="/help/Energy/Central_systems/Cooling_system/unit_efficiency_for_cooling_system_types.htm";
			break;
		case "6.1.3":
			myUrl="/help/Energy/Central_systems/Heating_system/Central_heating_system.htm";
			break;
		case "e_cs_heat_systemType":
			myUrl="/help/Energy/Central_systems/Heating_system/most_efficient_heating_system.htm";
			break;
		case "e_cs_heat_energySource":
			myUrl="/help/Energy/Central_systems/Heating_system/energy_sources_for_heating_system.htm";
			break;
		case "e_cs_heat_unitEfficiency":
			myUrl="/help/Energy/Central_systems/Heating_system/unit_efficiency_for_heating_system.htm";
			break;
		case "6.1.4":
			myUrl="/help/Energy/Central_systems/Alternative_energy_supply/Alternative_energy_supply.htm";
			break;
		case "e_cs_aes_cogeneration":
			myUrl="/help/Energy/Central_systems/Alternative_energy_supply/cogeneration_system.htm";
			break;
		case "e_cs_aes_photovoltaic":
			myUrl="/help/Energy/Central_systems/Alternative_energy_supply/Photovoltaic_system.htm";
			break;
		case "e_cs_aes_fuelType":
			myUrl="/help/Energy/Central_systems/Alternative_energy_supply/fuel_type_for_Cogen_system.htm";
			break;
		case "e_cs_aes_electricalOutput":
			myUrl="/help/Energy/Central_systems/Alternative_energy_supply/electrical_output_of_Cogen_system.htm";
			break;
		case "e_cs_aes_efficiency":
			myUrl="/help/Energy/Central_systems/Alternative_energy_supply/efficiency_of_fuel.htm";
			break;
		case "e_cs_aes_ratedOutput":
			myUrl="/help/Energy/Central_systems/Alternative_energy_supply/rated_output_of_PV.htm";
			break;
		case "6.1.5":
			myUrl="/help/Energy/Central_systems/Lifts/Lifts.htm";
			break;
		case "e_cs_lifts_systemType":
			myUrl="/help/Energy/Central_systems/Lifts/What_is_the_most_efficient_lift_system.htm";
			break;
		case "e_cs_lifts_levels":
			myUrl="/help/Energy/Central_systems/Lifts/number_of_levels.htm";
			break;
		case "6.1.6":
			myUrl="/help/Energy/Central_systems/Pool_and_Spa/Central_Pool_and_Spa_Energy.htm";
			break;
		case "e_cs_pas_heatingSystem":
			myUrl="/help/Energy/Central_systems/Pool_and_Spa/most_efficient_heating_option.htm";
			break;
		case "e_cs_pas_pump":
			myUrl="/help/Energy/Central_systems/Pool_and_Spa/What_is_pump_controlled_by_timer.htm";
			break;
		case "6.1.7":
			myUrl="/help/Energy/Central_systems/Sauna/Central_Sauna.htm";
			break;
		case "e_cs_sauna_heatingSource":
			myUrl="/help/Energy/Central_systems/Sauna/most_efficient_heating_option.htm";
			break;
		case "e_cs_sauna_efficiencyMeasure":
			myUrl="/help/Energy/Central_systems/Sauna/efficiency_measures_for_saunas.htm";
			break;
		case "6.1.8":
			myUrl="/help/Energy/Central_systems/Other/Other_central_systems.htm";
			break;
		case "e_cs_other_BMS":
			myUrl="/help/Energy/Central_systems/Other/building_management_system.htm";
			break;
		case "e_cs_other_PFC":
			myUrl="/help/Energy/Central_systems/Other/Active_power_factor_correction.htm";
			break;
		case "e_cs_other_clothesDryer":
			myUrl="/help/Energy/Central_systems/Other/Common_area_electric_gas_clothes_dryer.htm";
			break;
		case "e_cs_other_clothesWasher":
			myUrl="/help/Energy/Central_systems/Other/Common_area_clothes_washer.htm";
			break;
		// energy common areas
		case "6.2.1":
			myUrl="/help/Energy/Common_areas/Ventilation/Common_area_ventilation.htm";
			break;
		case "6.2.2":
			myUrl="/help/Getting_started.htm";
			break;
		case "6.2.3":
			myUrl="/help/Energy/Common_areas/Lighting/Common_area_lighting.htm";
			break;
		case "e_ca_light_systemType":
			myUrl="/help/Energy/Common_areas/Lighting/primary_lighting_type_lamp_type.htm";
			break;
		case "e_ca_light_efficiency":
			myUrl="/help/Energy/Common_areas/Lighting/efficiency_measures.htm";
			break;
		case "e_ca_light_LCS":
			myUrl="/help/Energy/Common_areas/Lighting/Lighting_control_systems.htm";
			break;
		// energy dwellings
		case "6.3.1":
			myUrl="/help/Energy/Dwellings/Hot_water/Hot_water_for_dwellings.htm";
			break;
		case "e_d_hw_indSystem":
			myUrl="/help/Energy/Dwellings/Hot_water/most_efficient_hot_water_system.htm";
			break;
		case "6.3.2":
			myUrl="/help/Energy/Dwellings/Ventilation/Ventilation_for_dwellings.htm";
			break;
		case "e_d_vent_systemType":
			myUrl="/help/Energy/Dwellings/Ventilation/most_efficient_option_of_internal_ventilation.htm";
			break;
		case "e_d_vent_operationControl":
			myUrl="/help/Energy/Dwellings/Ventilation/What_is_Operational_control.htm";
			break;	
		case "6.3.3":
			myUrl="/help/Energy/Dwellings/Cooling/Cooling_systems_for_dwellings.htm";
			break;
		case "6.3.4":
			myUrl="/help/Energy/Dwellings/Heating/Heating_systems_for_dwellings.htm";
			break;
		case "e_d_heat_indSystem":
			myUrl="/help/Energy/Dwellings/Heating/most_efficient_option_for_individual_heating.htm";
			break;
		case "6.3.5":
			myUrl="/help/Energy/Dwellings/Lighting/Lighting_for_dwellings.htm";
			break;
		case "e_d_light_fluorescentLight":
			myUrl="/help/Energy/Dwellings/Lighting/fluorescent_lighting.htm";
			break;
		case "e_d_light_fluorescentFitting":
			myUrl="/help/Energy/Dwellings/Lighting/dedicated_fluorescent_fitting.htm";
			break;
		case "e_d_light_directNaturalLight":
			myUrl="/help/Energy/Dwellings/Lighting/direct_natural_light.htm";
			break;
		case "6.3.6":
			myUrl="/help/Energy/Dwellings/Pool_and_Spa/Private_Pool_or_Spa_Energy.htm";
			break;
		case "e_d_pas_heatingSystem":
			myUrl="/help/Energy/Dwellings/Pool_and_Spa/most_efficient_pool_or_spa_heating_option.htm";
			break;
		case "e_d_pas_pump":
			myUrl="/help/Energy/Central_systems/Pool_and_Spa/What_is_pump_controlled_by_timer.htm";
			break;
		case "6.3.7":
			myUrl="/help/Energy/Dwellings/Appliances/Appliances_for_dwellings.htm";
			break;
		case "e_d_app_ovenType":
			myUrl="/help/Energy/Dwellings/Appliances/most_efficient_cooktop_and_oven.htm";
			break;
		case "e_d_app_refridgeRating":
			myUrl="/help/Energy/Dwellings/Appliances/most_efficient_appliances.htm";
			break;
		case "e_d_app_ventFridgeSpace":
			myUrl="/help/Energy/Dwellings/Appliances/well_ventilated_fridge_space.htm";
			break;
		case "6.3.8":
			myUrl="/help/Energy/Dwellings/Other/Other_energy_systems_for_dwellings.htm";
			break;
		case "e_d_other_shelteredLine":
			myUrl="/help/Energy/Dwellings/Other/indoor_or_sheltered_clothes_drying_line.htm";
			break;
		case "e_d_other_unshelteredLine":
			myUrl="/help/Energy/Dwellings/Other/private_outdoor_unsheltered_clothes_drying_line.htm";
			break;
		// certificate
		case "8.0.1":
			myUrl = "/help/Using_the_BASIX_tool/Generate_save_and_print_the_BASIX_Certificate.htm";
			break;
		case "cert_troubleShooting":
			myUrl = "/help/Using_the_BASIX_tool/Troubleshooting.htm";
			break;
		case "alt_assessment_info":
			myUrl = "http://www.basix.nsw.gov.au/information/faq.jsp#alternative1";
			break;
		case "altAssessment2":
			myUrl = "/help/Alternative_assessment_and_new_technologies/what_is_the_process_.htm";
			break;
		// default
		default:
			myUrl="/help/Getting_started.htm";
			break;
	}
	return myUrl;
}

// to set target of links to _blank  - testing new way to open popup windows
function popupWinLinks() {
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i < anchors.length; i++) {
		var anchor = anchors[i];
		if (anchor.getAttribute("href") && anchor.getAttribute("rel") && anchor.getAttribute("rel").indexOf("popupWin") != -1) {
			var tempArray = anchor.getAttribute("rel").split("::");
			anchor.href = "javascript: newWindow(\'" + tempArray[1] + "\', '', 450, 500, 'menubar=no,statusbar=no,resizable=yes,scrollbars=yes');";
		}
	}
}

