// -------------------------------------------------------- //
// pCodeField	= the ID of the input that has the postcode //
// pJourney		= the journey ID                            //
// customParam	= (optional) for passing function results   //
// -------------------------------------------------------- //
function navigateWithPostCode(pCodeField, pJourney, customParam)
{	
	if (customParam === '') {
		// only return false if the type is string and it actually IS empty
		return false;
	}
	
	// debugger
	var pcode = document.getElementById(pCodeField);
	var startPage = GetHTTPPrefix() + "/at_home/applications/QuoteAndSwitch/AffiliateStart.aspx?journeyid=" + pJourney;
	// var startPage = GetHTTPSite() + "/at_home/forms/ApplicationStart.aspx?journeyid=" + pJourney;
	// var startPage = "http://localhost/at_home/forms/ApplicationStart.aspx?journeyid=" + pJourney;
	
	//append any query string to the URL?
	var q = location.search.substring(1);
	if (q) {
		startPage += '&' + q;
	}
	
	//append any custom parameter
	if (customParam) {
		startPage += '&' + customParam;
	}

	if (pcode) {
		var oNew = window.open(startPage + "&pcode=" + pcode.value,"qw","width=800,height=600,scrollbars,resizable,status");
	}else{
		var oNew = window.open(startPage,"qw","width=800,height=600,scrollbars,resizable,status");
	}
	
	return false;
}


// -------------------------------------------------------- //
// FOR MAXYMISER                                            //
// -------------------------------------------------------- //
function navigateWithPostCodeMaxi(pCodeField, pJourney, customParam)
{	
	if (customParam === '') {
		// only return false if the type is string and it actually IS empty
		return false;
	}
	
	// debugger
	var pcode = document.getElementById(pCodeField);
	var startPage = GetHTTPPrefix() + "/at_home/applications/QandS/AffiliateStart.aspx?journeyid=" + pJourney;
	
	//append any query string to the URL?
	var q = location.search.substring(1);
	if (q) {
		startPage += '&' + q;
	}
	
	//append any custom parameter
	if (customParam) {
		startPage += '&' + customParam;
	}

	if (pcode) {
		var oNew = window.open(startPage + "&pcode=" + pcode.value,"qw","width=1000,height=700,scrollbars,resizable,status");
	}else{
		var oNew = window.open(startPage,"qw","width=1000,height=700,scrollbars,resizable,status");
	}
	
	return false;
}