var aSkip = new Array();

aSkip[0]=new Array();
aSkip[1]=new Array();
aSkip[2]=new Array();
aSkip[3]=new Array();
aSkip[4]=new Array();
aSkip[5]=new Array();
aSkip[6]=new Array();
aSkip[7]=new Array();

function populatePrices()
{

//2 cubic yard mini
aSkip[0][0] = 63.83;
aSkip[0][1] = 76.595;
aSkip[0][2] = 85.11;
aSkip[0][3] = 93.62;

//3 cubic yard midi
aSkip[1][0] = 76.595;
aSkip[1][1] = 89.36;
aSkip[1][2] = 97.87;
aSkip[1][3] = 106.38;

//7.3 cubic yard builders
aSkip[2][0] = 136.17;
aSkip[2][1] = 148.94;
aSkip[2][2] = 157.45;
aSkip[2][3] = 165.96;

//10 cubic yard covered 
aSkip[3][0] = 153.19;
aSkip[3][1] = 165.96;
aSkip[3][2] = 174.47;
aSkip[3][3] = 182.98;

//14 cubic yard open
aSkip[4][0] = 208.51;
aSkip[4][1] = 221.28;
aSkip[4][2] = 229.79;
aSkip[4][3] = 238.30;

//16 cubic yard roll on off
aSkip[5][0] = 215.00;
aSkip[5][1] = 230.00;
aSkip[5][2] = 245.00;
aSkip[5][3] = 255.00;

//16 cubic yard roll on off
aSkip[6][0] = 324.00;
aSkip[6][1] = 330.00;
aSkip[6][2] = 340.00;
aSkip[6][3] = 355.00;

//35 cubic yard roll on off
aSkip[7][0] = 324.00;
aSkip[7][1] = 330.00;
aSkip[7][2] = 340.00;
aSkip[7][3] = 355.00;

}

function populateAllObjects()
{
	populatePrices();	
	populateDropdowns();
}

function roundNumber(num, dec) {
	var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);
	return result;
}


function performCalc()
{

var iLocation = document.frmQuote.selLocation.options[document.frmQuote.selLocation.selectedIndex].value;
var iSkipType = document.frmQuote.selSkipType.options[document.frmQuote.selSkipType.selectedIndex].value;
var iVatRate = 17.5;

if (iLocation != "-1") {
	if (iSkipType != "-1"){

iPrice = aSkip[iSkipType][iLocation] * 1.175;

iRndPrice = iPrice.toFixed(2) //roundNumber(iPrice,2)

sPrice = "£" + iRndPrice;


//document.frmQuoteResults.spanPrice.innerText = "asasa"; // + sPrice + "</B>";


 //if(document.all){ document.getElementById('spanPrice').innerText = sPrice; } else{ document.getElementById('spanPrice').textContent = sPrice; } 
 
var sLocation = document.frmQuote.selLocation.options[document.frmQuote.selLocation.selectedIndex].text;
var sSkipType = document.frmQuote.selSkipType.options[document.frmQuote.selSkipType.selectedIndex].text;

//alert(sLocation + " " + sSkipType);

var sQuoteBody; // = sSkipType + "\n" + sLocation + "\n" + sPrice;

var sULStyle = "style=color:#3F4140;font-family:Trebuchet MS,Arial,Helvetica,sans-serif;font-size:14px;type=square;";

sQuoteBody = "<UL " + sULStyle + "><LI>" + sSkipType + "</LI><LI>" + sLocation + "</LI><UL>";

document.getElementById('divQuoteBody').innerHTML = sQuoteBody;
var objForm = document.getElementById('frmDetails');
var objInputs = objForm.getElementsByTagName("input");
for (var i = 0; i < objInputs.length; i++) {
    objInputs[i].disabled = false;
}
if (iSkipType <= 2) {
    document.getElementById('spanPrice').innerHTML = sPrice;

    document.getElementById('spanIncVAT').innerHTML = " inc VAT";
}
else {
    document.getElementById('spanPrice').innerHTML = "";
    document.getElementById('spanIncVAT').innerHTML = "Contact the office for a quote";
    for (var i = 0; i < objInputs.length; i++) {
        objInputs[i].disabled = true;
    }
}



document.getElementById('amount').value = iRndPrice;

document.getElementById('item_name').value = sSkipType;

//alert(document.getElementById('amount').value);


// if(document.all){ document.getElementById('spanPrice').innerHTML = sQuoteBody; } else{ document.getElementById('spanPrice').innerHTML = sQuoteBody; } 
 



//alert(sPrice);

//document.getElementById('spanPrice').innerText = sPrice; 


//alert("£ " + roundNumber(iPrice,2));
	}
}
}

function validateForm()
{
	
if(document.getElementById('Title').value == '')
{
	return false;		
}
return true;	

}

//function submitForm()
//{
//document.paypalForm.frmDetails.submit();
//}

function populateDropdown(text,value,objSel)
{
	
try {
objSel.add(new Option(text,value),null);
} 
catch(ex){
objSel.add(new Option(text,value));
}

}

function populateDropdowns()
{
	populateSkipTypeDropdowns();
	populateLocationDropdowns();
}




function populateSkipTypeDropdowns()
{
	populateDropdown("2 cubic yard mini" ,0,document.frmQuote.selSkipType);
	populateDropdown("3 cubic yard midi" ,1,document.frmQuote.selSkipType);
	populateDropdown("7.3 cubic yard builders" ,2,document.frmQuote.selSkipType);
	populateDropdown("10 cubic yard covered - 2 tonnes" ,3,document.frmQuote.selSkipType);
	populateDropdown("14 cubic yard open - 2 tonnes" ,4,document.frmQuote.selSkipType);
	populateDropdown("16 cubic yard roll on off" ,6,document.frmQuote.selSkipType);
	populateDropdown("35 cubic yard roll on off" ,7,document.frmQuote.selSkipType);
}

function populateLocationDropdowns()
{
populateDropdown("Ansty" ,0,document.frmQuote.selLocation);
populateDropdown("Arley" ,1,document.frmQuote.selLocation);
populateDropdown("Atherstone" ,1,document.frmQuote.selLocation);
populateDropdown("Balsall Common" ,1,document.frmQuote.selLocation);
populateDropdown("Barnacle" ,0,document.frmQuote.selLocation);
populateDropdown("Bedworth" ,0,document.frmQuote.selLocation);
populateDropdown("Berkswell" ,1,document.frmQuote.selLocation);
populateDropdown("Binley Woods" ,0,document.frmQuote.selLocation);
populateDropdown("Bitteswell" ,3,document.frmQuote.selLocation);
populateDropdown("Brandon" ,0,document.frmQuote.selLocation);
populateDropdown("Brinklow" ,1,document.frmQuote.selLocation);
populateDropdown("Bubbenhall" ,0,document.frmQuote.selLocation);
populateDropdown("Bulkington" ,0,document.frmQuote.selLocation);
populateDropdown("Burbage" ,1,document.frmQuote.selLocation);
populateDropdown("Coleshill" ,1,document.frmQuote.selLocation);
populateDropdown("Coventry" ,0,document.frmQuote.selLocation);
populateDropdown("Desford" ,3,document.frmQuote.selLocation);
populateDropdown("Dorridge" ,3,document.frmQuote.selLocation);
populateDropdown("Dosthill" ,3,document.frmQuote.selLocation);
populateDropdown("Dunton Bassett" ,3,document.frmQuote.selLocation);
populateDropdown("Earl Shilton" ,1,document.frmQuote.selLocation);
populateDropdown("Eathorpe" ,1,document.frmQuote.selLocation);
populateDropdown("Fenny Drayton" ,1,document.frmQuote.selLocation);
populateDropdown("Fillongley" ,0,document.frmQuote.selLocation);
populateDropdown("Galley Common" ,0,document.frmQuote.selLocation);
populateDropdown("Harborough Magna" ,2,document.frmQuote.selLocation);
populateDropdown("Hartshill" ,0,document.frmQuote.selLocation);
populateDropdown("Hatton" ,2,document.frmQuote.selLocation);
populateDropdown("Higham on the Hill" ,1,document.frmQuote.selLocation);
populateDropdown("Hinckley" ,1,document.frmQuote.selLocation);
populateDropdown("Ibstock" ,3,document.frmQuote.selLocation);
populateDropdown("Kenilworth" ,1,document.frmQuote.selLocation);
populateDropdown("Kingsbury" ,2,document.frmQuote.selLocation);
populateDropdown("Knowle" ,2,document.frmQuote.selLocation);
populateDropdown("Lawford Heath" ,1,document.frmQuote.selLocation);
populateDropdown("Leamington Spa" ,2,document.frmQuote.selLocation);
populateDropdown("Leek Wooton" ,1,document.frmQuote.selLocation);
populateDropdown("Leire" ,2,document.frmQuote.selLocation);
populateDropdown("Long Itchington" ,2,document.frmQuote.selLocation);
populateDropdown("Lutterworth" ,3,document.frmQuote.selLocation);
populateDropdown("Market Bosworth" ,2,document.frmQuote.selLocation);
populateDropdown("Marton" ,1,document.frmQuote.selLocation);
populateDropdown("Maxstoke" ,2,document.frmQuote.selLocation);
populateDropdown("Meriden" ,0,document.frmQuote.selLocation);
populateDropdown("Monks Kirby" ,1,document.frmQuote.selLocation);
populateDropdown("Narborough" ,3,document.frmQuote.selLocation);
populateDropdown("Newbold Verdon" ,2,document.frmQuote.selLocation);
populateDropdown("Nuneaton" ,0,document.frmQuote.selLocation);
populateDropdown("Offchurch" ,2,document.frmQuote.selLocation);
populateDropdown("Osbaston" ,2,document.frmQuote.selLocation);
populateDropdown("Over Whitacre" ,1,document.frmQuote.selLocation);
populateDropdown("Pailton" ,1,document.frmQuote.selLocation);
populateDropdown("Peckleton" ,2,document.frmQuote.selLocation);
populateDropdown("Polesworth" ,2,document.frmQuote.selLocation);
populateDropdown("Princethorpe" ,1,document.frmQuote.selLocation);
populateDropdown("Radford Semele" ,2,document.frmQuote.selLocation);
populateDropdown("Rugby" ,2,document.frmQuote.selLocation);
populateDropdown("Ryton" ,0,document.frmQuote.selLocation);
populateDropdown("Sapcote" ,2,document.frmQuote.selLocation);
populateDropdown("Sharnford" ,2,document.frmQuote.selLocation);
populateDropdown("Shilton" ,0,document.frmQuote.selLocation);
populateDropdown("Shustoke" ,2,document.frmQuote.selLocation);
populateDropdown("Solihull" ,2,document.frmQuote.selLocation);
populateDropdown("Southam" ,2,document.frmQuote.selLocation);
populateDropdown("Stapleton" ,1,document.frmQuote.selLocation);
populateDropdown("Stockingford" ,0,document.frmQuote.selLocation);
populateDropdown("Stoke Golding" ,1,document.frmQuote.selLocation);
populateDropdown("Stoneleigh" ,0,document.frmQuote.selLocation);
populateDropdown("Stoney Stanton" ,2,document.frmQuote.selLocation);
populateDropdown("Stratford" ,3,document.frmQuote.selLocation);
populateDropdown("Tamworth" ,3,document.frmQuote.selLocation);
populateDropdown("Twycross" ,2,document.frmQuote.selLocation);
populateDropdown("Warwick" ,2,document.frmQuote.selLocation);
populateDropdown("Wellesbourne" ,3,document.frmQuote.selLocation);
populateDropdown("Whitnash" ,2,document.frmQuote.selLocation);
populateDropdown("Witherley" ,1,document.frmQuote.selLocation);
populateDropdown("Withybrook" ,2,document.frmQuote.selLocation);
populateDropdown("Wolston" ,0,document.frmQuote.selLocation);
populateDropdown("Wolvey" ,0,document.frmQuote.selLocation);
}


