
function selectcover(value){
document.getElementById('QTOTAL').value = parseFloat(value);
document.getElementById('premium').innerHTML = '&pound;' + document.getElementById('QTOTAL').value;
selectextra();
}

function rup(value){

//var rnum = parseFloat(value);

return Math.round(value*100)/100;

}

function selectextra(){

var equip = '100.00';
var sword = '100.00';
var firew = '65.00';
var emplo = '20.00';

var total = parseFloat(document.quote.QTOTAL.value);

var extra = 0;

if (document.quote.QEQUIPMENT.checked) {

extra = extra + parseFloat(equip);

}

if (document.quote.QCEREMONIAL.checked) {

extra = extra + parseFloat(sword);

}

if (document.quote.QFIREWORKS.checked) {

extra = extra + parseFloat(firew);

}

if (document.quote.QEMPLOYERS.checked) {

extra = extra + parseFloat(emplo);

}


document.getElementById('QETOTAL').value = extra;

var gtotal = parseFloat(total) + parseFloat(extra);

document.getElementById('premium').innerHTML = '&pound;' + rup(gtotal);

}


function selectvisitors(navID, visitors){


var stateon = 'podselon';
var stateoff = 'podseloff';
var cells = 7;

for (i=0; i<=(cells); i++)

with (document) 

if (getElementById && ((obj=getElementById('L' + i))!=null)) { 

if(obj.id == navID ){  
obj.className = stateon;  
}  
else{
obj.className = stateoff;

}

}

dimcols(navID);

document.getElementById('QVISITORS').value = visitors;
document.getElementById('QCOVER').value = navID;

}



function dimcols(navID){

var highlight = 'podseloffdim';
var stateoff = 'podseloff';
var cells = 3;
var opts = 7;


with (document) 


for (n=1; n<=(opts); n++)

for (i=1; i<=(cells); i++)

if (getElementById && ((obj=getElementById('L' + n + 'cv' + i))!=null)) { 

if(navID == 'L' + n){

//alert('match L' + n + 'cv' + i);

obj.className = highlight;

}
else{

//alert('bad match L' + n + 'cv' + i);

obj.className = stateoff;

}

}



}


function selectpcover(navID, val){



var stateon = 'podselon';
var stateoff = 'podseloff';
var cells = 3;
var opts = 7;



with (document) 

for (n=1; n<=(opts); n++)

for (i=1; i<=(cells); i++)

if (getElementById && ((obj=getElementById('L' + n + 'cv' + i))!=null)) { 

if(navID == 'L' + n + 'cv' + i){ 

//alert('match L' + n + 'cv' + i);

obj.className = stateon;  
document.getElementById('QCPREMIUM').value = val;

}  
else{

obj.className = stateoff; 

}

}


qtotals();


}


function selectliability(navID, val){

var stateon = 'podselon';
var stateoff = 'podseloff';
var cells = 7;

with (document) 

if (getElementById && ((obj=getElementById(navID))!=null)) { 


if (obj.className==stateon){

obj.className = stateoff;  

document.getElementById('QLIABILITY').value = '0';

}  
else{
obj.className = stateon;
document.getElementById('QLIABILITY').value = val;

}

}

qtotals();
}



function selhiredprop(navID, val){

var stateon = 'podselon';
var stateoff = 'podseloff';
var cells = 6;

with (document) 

for (i=1; i<=(cells); i++)

if (getElementById && ((obj=getElementById('HP' + i))!=null)) { 

if(navID == 'HP' + i){ 

if (obj.className==stateon){

obj.className = stateoff; 
document.getElementById('QHPROPERTY').value = '0';

}
else{

obj.className = stateon; 
document.getElementById('QHPROPERTY').value = val;

}

//obj.className = stateon;  
}  
else{

obj.className = stateoff; 

}

}

qtotals();

}


function selcancelcover(navID, val){




var stateon = 'podselon';
var stateoff = 'podseloff';
var cells = 6;

with (document) 

for (i=1; i<=(cells); i++)

if (getElementById && ((obj=getElementById('CC' + i))!=null)) { 

if(navID == 'CC' + i){ 

if (obj.className==stateon){

obj.className = stateoff; 
document.getElementById('QCANCELC').value = '0';

}
else{

obj.className = stateon; 
document.getElementById('QCANCELC').value = val;

}


}  
else{

obj.className = stateoff; 

}

}

qtotals();

}


function qtotals(){

var premium 	= document.getElementById('QCPREMIUM').value;
var liability 	= document.getElementById('QLIABILITY').value;
var phire		= document.getElementById('QHPROPERTY').value;	
var cancellation	= document.getElementById('QCANCELC').value;

var total = Number(premium) + Number(liability) + Number(phire) + Number(cancellation);


document.getElementById('premium').innerHTML = '&pound;' + total;
document.getElementById('QTOTAL').value = rup(total);

}

function cleardate(navID) {
if (document.getElementById(navID).value =="mm / dd / yyyy") {
document.getElementById(navID).value="";
}
}


