// global variables
var finanzCfgappSessURL = '';
var finanzCfgappSessKey = '';
var finanzCurrentTotalPrice = '';

// siehe getPbvSessionURL2()
// (Aufrufe aus: cc3angebot.txt, cc3.behaviour.js)
function getPbvSessionURL()
{
	return getPbvSessionURL2(confmodell.modellcode, finanzCurrentTotalPrice);
}

// URL fuer Session-basierten Aufruf von PBV Finanzierungstools ueber CFG-SVC,
// Leerstring '' falls noch keine Finanzierung berechnet wurde
// (Aufrufe aus: cc3finanzFwd.htm, getPbvSessionURL())
function getPbvSessionURL2(pbvModcode, pbvPrice)
{
	if (finanzCfgappSessURL == '')
	{	// URL not set yet (for current modell configuration)
		return '';
	}
	if (finanzCfgappSessKey != makePbvKey(pbvModcode, pbvPrice))
	{	// configuration has changed (different modell / different price) - forget financing information
		return '';
	}
	return finanzCfgappSessURL;
}


// (Aufrufe aus: cc3angebot.txt, cc3.behaviour.js)
function setPbvSessionURL(newURL)
{
	setPbvSessionURL2(confmodell.modellcode, finanzCurrentTotalPrice, newURL);
}

// (Aufrufe aus: cc3finanzFwd.htm, setPbvSessionURL())
function setPbvSessionURL2(pbvModcode, pbvPrice, newURL)
{
	finanzCfgappSessKey = makePbvKey(pbvModcode, pbvPrice);
	finanzCfgappSessURL = newURL;
}


function makePbvKey(pbvModcode, pbvPrice)
{
	return '|' + pbvModcode + '|' + pbvPrice + '|';
}


function pbvSave(action)
{
	if ("KREDIT_NEU" == action.substring(10,0) || "LEASING_NEU" == action.substring(11,0))
		return true;
	else
		return false;
}

function pbvPrint(action)
{
	if ("KREDIT_PRINT" == action.substring(12,0) || "LEASING_PRINT" == action.substring(13,0))
		return true;
	else
		return false;
}
