

	



		
				
		
		
		
			
			
			
			
			
			
			
			
			
			
			
			
			            
			
			
			
			
			            			
			
			
			
			
				
			
		
		
		
		
			
						
		
	

	


















	





	
	
	























var loading = null;
loadFunc[loadFunc.length] = "local_finishedLoading()";
loadFunc[loadFunc.length] = "self.focus()";

function createLoading () {
	document.write('<div class="loading" id="loading_div"><p>Page loading.  Please wait...</p>&nbsp;</div>');
}
createLoading();

function local_finishedLoading()
{
	if(carm_v)
		external_manuallyClearPageState();
	$('#loading_div').hide();
}

function local_transitionToNextPage()
{
	if (loading) {
	loading.style.visibility = "auto";
	}
}

function displayOptSum() {
	var temp = '<table class="actions" border="0" cellpadding="0" cellspacing="0" name="contributions" align="center">';
		temp = temp+'<tr><td colspan="2"><p class="invisible_red">Summary of options selected</p></td></tr>';
		temp = temp+'<tr><td colspan="2"><textarea class="newcar" name="frm_listName" cols="44" readonly=true rows="6"></textarea></td></tr></table>';
	$('#optSum').html(temp);
}
function displayActions(id) {
	// create beginning of table
	
		var temp = '<table class="actions" border="0" cellpadding="0" cellspacing="0" align="center">';
		
			
				temp = temp+'<tr><td class="default action-text">Subtotal of Taxable Options</td>';
				temp = temp+'<td class="default action-reset">&nbsp;</td>';
				temp = temp+'<td class="default action-calc"><input name="frm_costTotal" type="text" readonly="readonly" class="invisible" value="0.00" size="8" /></td></tr>';
				temp = temp+'<tr><td class="default action-text">Subtotal of Non-taxable Options</td>';
				temp = temp+'<td class="default action-reset">&nbsp;</td>';
				temp = temp+'<td class="default action-calc"><input name="frm_nontaxGross" type="text" readonly="readonly" class="invisible" value="0.00" size="8" /></td></tr>';
			
		
		temp = temp+'<tr><td colspan="3">&nbsp;</td></tr>';
		temp = temp+'<tr class="actions-btn"><td class="default action-text">Click calculate once options have been selected:</td>';
		temp = temp+'<td class="default action-reset">';
		temp = temp+'<input id="btn_reset" onclick="external_init(); document.proDep[\'nam99969\'].disabled = false; document.proDep[\'tfc99969\'].disabled = false;return(false);" type="reset" class="buttonstyle" value="reset" name="reset" />';
		temp = temp+'</td><td class="default action-calc">';
		temp = temp+'<input name="submit" type="submit" class="buttonstyle" id="btn_calc" value="calculate" onclick="return(v3_processCalcClick(true));" />';
		temp = temp+'</td></tr>';
		
			temp = temp+'<input name="reanalyse" type="hidden" value="ignore" />';
		
	
	
	// end table and output generated HTML
	temp = temp+'</table>';	
	$('#subTotals').html(temp);
} // displayActions


function displayExtraOptions (num,moreflag,hideflag,removeableflag) {
	var temp = '';
	temp = temp +'<tr id="tr'+num+'_title"><td colspan="2" class="options-title"><p class="invisible_red">Unlisted option or accessory: ';
	if (removeableflag == "true") {
		temp = temp +'<a href="##" onclick="javascript: local_addOptRemove('+num+'); return(false);" id="arem'+num+'">[Remove]</a>';
	}
	temp = temp +'</p></td></tr><tr class="options" id="tr'+num+'"><td width="320" class="options">';
	temp = temp +'<textarea class="newcar" name="nam'+num+'" cols="36" onclick="javascript:local_clearBox(this);" rows="3">Enter description of options and accessories not listed above.</textarea>';
	temp = temp +'</td><td class="default options" style="text-align: left; padding-left: 42px;">';
	temp = temp +'<input name="opt'+num+'" type="checkbox" value="'+num+'" onclick="';
	temp = temp +'if ((document.proDep[\'nam'+num+'\'].value!=\'Enter description of options and accessories not listed above.\')';
	temp = temp +' || (document.proDep[\'tfc'+num+'\'].value!=\'&pound;0.00\')';
	temp = temp +') {';
	temp = temp+'local_disOther(this,document.proDep[\'nam'+num+'\'],document.proDep[\'tfc'+num+'\']);external_updateOptionName('+num+',\'Unlisted options: \');';
	temp = temp+'return(external_processClick('+num+')); } else { alert(\'Please enter a value and description of the option first.\'); return(false);}" /><br />';
	temp = temp +'<input name="tfc'+num+'" type="text" class="invisible-bordered" value=\'&pound;0.00\' size="11" />';
	temp = temp +'<input name="cot'+num+'" type="hidden" value="0" />';
	temp = temp +'<input name="mpg'+num+'" type="hidden" value="0" />';
	temp = temp +'</td></tr>';
	if (moreflag == "true") {
		temp = temp+'<tr id="tr'+num+'_next"><td colspan="2" class="options-title"><p><a href="##" onclick="javascript: local_addOptNext('+num+'); return(false);">Add another option</a></p></td></tr>';
	}

	// output generated HTML
	$('#optionstable').append(temp);

	if (hideflag == "true") {
		// hiding code for elem #num#
		document.getElementById('tr'+num+'_title').style.display = 'none';		
		document.getElementById('tr'+num).style.display = 'none';		
		if (moreflag == "true") {
			document.getElementById('tr'+num+'_next').style.display = 'none';
		}
	}
}

function hideDiv(){
	var optionstable = document.getElementById('optionstable');
	var standardslink = document.getElementById('standardslink');
	var rows = optionstable.getElementsByTagName('tr');
	for (var i = 0; i < rows.length; i++) {
		if((rows[i].className == 'options standards') || (rows[i].className == 'standards')) {
			if ((rows[i].style.display == 'none') || (rows[i].style.display == '')){
				if (navigator.appName == "Microsoft Internet Explorer") {
					rows[i].style.display = 'inline';
				} else {
					rows[i].style.display = 'table-row';
				}
			standardslink.innerHTML = "Click to hide";
			} else {
			  rows[i].style.display = 'none';
			  standardslink.innerHTML = "Click to view";
			}
		}
	}
} // hideDiv

function local_clearBox( field)
{
	if (field.value == "Enter description of options and accessories not listed above.")
	{
		field.value = "";
	}
}

function local_disOther( f, disText, disVal)
{
	if (f.checked)
	{
		// ticking, there disable value
		disVal.value = external_shakeOutOptionValue(disVal.value);
		disVal.disabled = true;
		disText.disabled = true;
	} else {
		disVal.disabled = false;
		disText.disabled = false;
	}
}

function local_addOptNext( num)
{
	var elem;
	// hide 'add another option button' for current
	document.getElementById("tr"+num+"_next").style.display = 'none';
	// hide remove for previous
	elem = document.getElementById("arem"+num)
	if (elem != null)
		elem.style.display = 'none';
	num++;
	// make visible all three for next
	document.getElementById("tr"+num+"_title").style.display = 'block';
	document.getElementById("tr"+num).style.display = 'block';
	elem = document.getElementById("tr"+num+"_next")
	if (elem != null)
		elem.style.display = 'block';
}

function local_addOptRemove( num)
{
	var elem;
	// hide all three for current/clicked
	document.getElementById("tr"+num+"_title").style.display = 'none';
	document.getElementById("tr"+num).style.display = 'none';
	elem = document.getElementById("tr"+num+"_next")
	if (elem != null)
		elem.style.display = 'none';
	// make visible add & remove for previous
	num--;
	elem = document.getElementById("arem"+num)
	if (elem != null)
		elem.style.display = 'block';
	elem = document.getElementById("tr"+num+"_next")
	if (elem != null)
		elem.style.display = 'block';
}

function local_processCalcClick(id)
{
	var resultcode = false;
	external_presend();
	if (document.proDep['reanalyse'].checked)
		document.proDep.action='g4adjust.cfm?ID='+id+'&clk=125';
	if (document.proDep['opt99969'].checked == false)
	{
		if ( (document.proDep['nam99969'].value == 'Enter description of options and accessories not listed above.') ||
			 (document.proDep['tfc99969'].value == '&amp;0.00') )
		{
			resultcode = true;
		}
		if (!resultcode)
			resultcode = confirm("You have described an option, but not selected it.  Click OK to ignore the option you've entered, or Cancel to go back and select it.");
	} else {
		resultcode = true;
	}
	// finally execute local_transitionToNextPage to turn loading div back on (incase of back button)
	local_transitionToNextPage();
	return(resultcode);
}