 packageing = new Object();
 packageing.a = new Array("No Packaging","Jewel Case","Double Jewel Case","Slim Jewel Case","DVD Style Amaray Case","DVD Super Jewel Case","White Card Wallet","4 Colour Card Wallet","Plastic Mailing Case","Plastic Wallet (with flap)","Plastic Wallet (no flap)","Plastic Wallet (with sticky tabs)","Paper Sleeve");
 packageing.b = new Array("No Packaging","80mm Plastic Sleeve","80mm Card Wallet");
 packageing.c = new Array("No Packaging","Business Card Plastic Sleeve","Business Card Jewel Case");
 packageing.d = new Array("No Packaging","Playing Card Plastic Sleeve");
  
 printpack = new Object();
 printpack.a = new Array("No Booklet Printing","2 Sided Booklet (out 4 cols in 1)","2 Sided Booklet (out 4 cols in 4)","4 Sided Booklet (out 4 cols in 1)","4 Sided Booklet (out 4 cols in 4)","6 Sided Booklet (out 4 cols in 1)","6 Sided Booklet (out 4 cols in 4)","8 Sided Booklet (out 4 cols in 1)","8 Sided Booklet (out 4 cols in 4)","12 Sided Booklet (out 4 cols in 1)","12 Sided Booklet (out 4 cols in 4)","16 Sided Booklet (out 4 cols in 1)","16 Sided Booklet (out 4 cols in 4)","20 Sided Booklet (out 4 cols in 1)","20 Sided Booklet (out 4 cols in 4)","24 Sided Booklet (out 4 cols in 1)","24 Sided Booklet (out 4 cols in 4)");
 printpack.b = new Array("No Printing Opportunity");

 inlaypack = new Object();
 inlaypack.a = new Array("No Jewel Case Rear Inlay","1 Colour Jewel Case Rear Inlay","4 Colour Jewel Case Rear Inlay","2 Sided 4 col Jewel Case Rear Inlay")
 inlaypack.b = new Array("No Amaray Cover","4 Colour Amaray Cover") 
 inlaypack.c = new Array("No Super Jewel Rear Inlay","Super Jewel 4/1 Colour Rear Inlay","Super Jewel 4/4 Colour Rear Inlay")
 inlaypack.d = new Array("No Printing Opportunity");



function updateMenus(mydisc) {
  
document.test_form.packageing.selectedIndex = 0;
document.test_form.printing.selectedIndex = 0;
document.test_form.selrearinlay.selectedIndex = 0;

  var sel = document.test_form.mydisc.selectedIndex;
  if (sel == 0 || sel == 4 || sel == 5 ) {packin = packageing.a;}
  else if (sel == 1) {packin = packageing.b;} 
  else if (sel == 2) {packin = packageing.c;} 
  else if (sel == 3) {packin = packageing.d;}
  //else {packin = new Array();}
  
  mydisc.form.packageing.length = packin.length;
  for(i=0;i<packin.length;i++)  {mydisc.form.packageing.options[i].text = packin[i];}

}

function maxSix() {
  
if (document.test_form.disccolour.selectedIndex == 6 && document.test_form.basecolour.selectedIndex == 1){alert("It is only possible to print 6 colours on a silver base");document.test_form.basecolour.selectedIndex = 0}


}




function updatePrint(packprint) {

document.test_form.printing.selectedIndex = 0;
document.test_form.selrearinlay.selectedIndex = 0;


whatdisc = document.test_form.mydisc.selectedIndex;
whatpack = document.test_form.packageing.selectedIndex;

if (whatdisc == 0  || whatdisc == 4 || whatdisc	 == 5)
	{
	if (whatpack == 1 ){printed = printpack.a; var inlayprint = inlaypack.a;}
	else if (whatpack == 2 ){printed = printpack.a; inlayprint = inlaypack.a;}
	else if (whatpack == 3 ){printed = printpack.a; inlayprint = inlaypack.a;}
	else if (whatpack == 4 ){printed = printpack.a; inlayprint = inlaypack.b;}
	else if (whatpack == 5 ){printed = printpack.a; inlayprint = inlaypack.c;}
	else if (whatpack == 6 ){printed = printpack.a; inlayprint = inlaypack.d;}
	else if (whatpack == 7 ){printed = printpack.a; inlayprint = inlaypack.d;}
	else if (whatpack == 8 ){printed = printpack.a; inlayprint = inlaypack.d;}
	else if (whatpack == 9 ){printed = printpack.a; inlayprint = inlaypack.d;}
	else if (whatpack == 10 ){printed = printpack.a; inlayprint = inlaypack.d;}
	else if (whatpack == 11 ){printed = printpack.a; inlayprint = inlaypack.d;}
	else {printed = printpack.b; inlayprint = inlaypack.d;} 
	}

else {printed = printpack.b; inlayprint = inlaypack.d;}

  packprint.form.printing.length = printed.length;
  for(i=0;i<printed.length;i++) {packprint.form.printing.options[i].text = printed[i];}

  packprint.form.selrearinlay.length = inlayprint.length;
  for(i=0;i<inlayprint.length;i++) {packprint.form.selrearinlay.options[i].text = inlayprint[i];}
}



//------------------------------------------------------------------------------------
function initArray() {
 for(i=0;i<initArray.arguments.length; i++)
  this[i] = initArray.arguments[i];
}
//------------------------------------------------------------------------------------

var isnMonths=new initArray("January","February","March","April","May","June","July","August","September","October","November","December");
var isnDays= new initArray("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday");
var today=new Date();


//------------------------------------------------------------------------------------
function getFullYear(d) { 
 yr = d.getYear();
 if (yr < 1000)
  yr+=1900;
 return yr;
}

//------------------------------------------------------------------------------------


// Declare variables



var packString = 0
var totalprice = 0
var vat = 0
var film = 0

function process()
 {
 
var discnum = 0

var user_choice = 1; 
var html = "\n"
var htmlbr = "\n\n"
if(document.test_form.printable.value="true"){html = "<br>"; htmlbr = "<p>"}

var discnum = document.test_form.mydisc.selectedIndex;
var cdtype = document.test_form.mydisc.options[discnum].text ;
var disccolour = document.test_form.disccolour.selectedIndex ;
var basecolour = document.test_form.basecolour.selectedIndex ;
var basecolour = document.test_form.basecolour.options[basecolour].text ;
var quant = document.test_form.qty.value;

var film = disccolour; 

{
document.bgColor ="#FFFFFF";



//array qty				500	  1K	  2k	  3k	  4k	  5k	  10k	  20k 	 25k	 30k	 40k
if(discnum == 0)//cd
{cdprice = 			new Array(0.469	,0.269	,0.295	,0.26	,0.247	,0.231	,0.208	,0.208	,0.208	,0.195	,0.182)
addcolour = 			new Array(0.025	,0.026	,0.026	,0.026	,0.025	,0.025	,0.025	,0.025	,0.025	,0.025	,0.025)
masterBreak = 2000
turnaround =10}

if(discnum == 1)//80mm
{cdprice = 			new Array(0.770	,0.455	,0.538	,0.465	,0.435	,0.416	,0.362	,0.338	,0.338	,0.328	,0.318)
addcolour = 			new Array(0.02	,0.02	,0.02	,0.02	,0.02	,0.02	,0.02	,0.02	,0.02	,0.02	,0.02)
masterBreak = 2000
turnaround =10}

if(discnum == 2)//bizcard
{cdprice = 			new Array(0.543	,0.49	,0.48	,0.47	,0.438	,0.395	,0.31	,0.28	,0.27	,0.26	,0.265)
addcolour = 			new Array(0.03	,0.03	,0.03	,0.03	,0.03	,0.03	,0.03	,0.02	,0.02	,0.02	,0.02)
masterBreak = 2000
turnaround =10}

if(discnum == 3)//playing card
{cdprice = 			new Array(2.00	,1.33	,1.13	,1.00	,0.87	,0.80	,0.73	,0.69	,0.69	,0.66	,0.66)
addcolour = 			new Array(0.03	,0.03	,0.03	,0.03	,0.03	,0.03	,0.03	,0.02	,0.02	,0.02	,0.02)
masterBreak = 0
turnaround =15}

if(discnum == 4)//dvd5
{cdprice = 			new Array(0.89	,0.494	,0.481	,0.468	,0.455	,0.442	,0.429	,0.416	,0.416	,0.403	,0.39)
addcolour = 			new Array(0.026	,0.026	,0.026	,0.026	,0.026	,0.026	,0.026	,0.026	,0.026	,0.026	,0.026)
masterBreak = 3000
turnaround =15}

if(discnum == 5)//dvd9
{cdprice = 			new Array(0.93	,0.507	,0.494	,0.481	,0.468	,0.455	,0.442	,0.429	,0.429	,0.416	,0.403)
addcolour = 			new Array(0.026	,0.026	,0.026	,0.026	,0.026	,0.026	,0.026	,0.026	,0.026	,0.026	,0.026)
masterBreak = 3000
turnaround =15}



//array qty				500	  1K	  2k	  3k	  4k	  5k	  10k	  20k 	 25k	 30k	 40k
jewelcasep = 			new Array(0.125	,0.12	,0.12	,0.12	,0.12	,0.12	,0.12	,0.12	,0.12	,0.12	,0.12)
dbljewelcasep = 		new Array(0.16	,0.16	,0.16	,0.16	,0.16	,0.16	,0.16	,0.16	,0.16	,0.16	,0.16)
slimjewelcasep= 		new Array(0.14	,0.14	,0.14	,0.14	,0.14	,0.14	,0.14	,0.14	,0.14	,0.14	,0.14)
amaray = 			new Array(0.169	,0.169	,0.169	,0.169	,0.169	,0.169	,0.169	,0.169	,0.169	,0.169	,0.169)
superjewel = 			new Array(0.68	,0.68	,0.68	,0.68	,0.68	,0.68	,0.68	,0.68	,0.68	,0.68	,0.68) 
diamond = 			new Array(0.42	,0.52	,0.52	,0.52	,0.52	,0.52	,0.52	,0.52	,0.52	,0.52	,0.52)
whitecardwallet =		new Array(0.11	,0.10	,0.95	,0.95	,0.95	,0.95	,0.085 	,0.075	,0.075	,0.070	,0.070)
cardwallet = 			new Array(0.15	,0.15	,0.13	,0.125	,0.125	,0.115	,0.085 	,0.075	,0.075	,0.070	,0.070)
plasticflap = 			new Array(0.063	,0.063	,0.053	,0.043	,0.043	,0.043	,0.043	,0.043	,0.043	,0.043	,0.043)
plasticnoflap = 		new Array(0.058	,0.058	,0.048	,0.048	,0.048	,0.038	,0.038	,0.038	,0.038	,0.038	,0.038)
plasticsticky =			new Array(0.099	,0.097	,0.095	,0.095	,0.089	,0.088	,0.083	,0.083	,0.083	,0.083	,0.083)
papersleeve = 			new Array(0.053	,0.043	,0.043	,0.043	,0.043	,0.043	,0.043	,0.043	,0.043	,0.043	,0.043)
bizcardwallet = 		new Array(0.05	,0.05	,0.05	,0.05	,0.05	,0.05	,0.05	,0.05	,0.05	,0.05	,0.05)
bizcardjewel =			new Array(0.35	,0.35	,0.24	,0.24	,0.24	,0.24	,0.24	,0.24	,0.24	,0.24	,0.24)
playcardwallet=			new Array(0.08	,0.08	,0.08	,0.08	,0.08	,0.08	,0.08	,0.08	,0.08	,0.08	,0.08)
eightycardwallet=		new Array(0.143	,0.143	,0.143	,0.143	,0.143	,0.143	,0.143	,0.143	,0.143	,0.143	,0.143)
eightyplasticwallet=		new Array(0.072	,0.072	,0.072	,0.072	,0.072	,0.072	,0.072	,0.072	,0.072	,0.072	,0.072)

celloprice = 			new Array(0.030,0.028	,0.026	,0.026	,0.026	,0.026	,0.026	,0.026	,0.026	,0.026	,0.026)

	
twosidesm = new Array(0.1600  ,0.0800  ,0.0720  ,0.0640  ,0.0624  ,0.0600  ,0.0496  ,0.0450  ,0.0410  ,0.0410  ,0.0410)
twosidesc = new Array(0.1920  ,0.0960  ,0.0936  ,0.0917  ,0.0907  ,0.0899  ,0.0723  ,0.0618  ,0.0554  ,0.0554  ,0.0554)
foursidesm = new Array(0.1600  ,0.0800  ,0.0720  ,0.0640  ,0.0624  ,0.0600  ,0.0496  ,0.0450  ,0.0410  ,0.0410  ,0.0410)
foursidesc = new Array(0.1920  ,0.0960  ,0.0936  ,0.0917  ,0.0907  ,0.0899  ,0.0723  ,0.0618  ,0.0554  ,0.0554  ,0.0554)
sixsidesm = new Array(0.3155  ,0.1578  ,0.1347  ,0.1258  ,0.1142  ,0.0986  ,0.0741  ,0.0634  ,0.0568  ,0.0568  ,0.0568)
sixsidesc = new Array(0.3200  ,0.1600  ,0.1424  ,0.1302  ,0.1192  ,0.1027  ,0.0811  ,0.0704  ,0.0682  ,0.0682  ,0.0682)
eightsidesm = new Array(0.4067  ,0.2034  ,0.1797  ,0.1418  ,0.1229  ,0.1115  ,0.0886  ,0.0822  ,0.0806  ,0.0806  ,0.0806)
eightsidesc = new Array(0.5235  ,0.2618  ,0.2336  ,0.1843  ,0.1597  ,0.1450  ,0.1280  ,0.1160  ,0.1078  ,0.1078  ,0.1078)
twelvesidesm = new Array(0.5926  ,0.2963  ,0.2573  ,0.2070  ,0.1818  ,0.1667  ,0.1365  ,0.1157  ,0.1086  ,0.1086  ,0.1086)
twelvesidesc = new Array(0.7488  ,0.3744  ,0.3306  ,0.2627  ,0.2286  ,0.2083  ,0.1675  ,0.1472  ,0.1368  ,0.1368  ,0.1368)
sixteensidesm = new Array(0.6080  ,0.3040  ,0.2720  ,0.2222  ,0.1973  ,0.1824  ,0.1485  ,0.1280  ,0.1163  ,0.1163  ,0.1163)
sixteensidesc = new Array(0.7904  ,0.3952  ,0.3536  ,0.2890  ,0.2565  ,0.2371  ,0.1930  ,0.1440  ,0.1346  ,0.1346  ,0.1346)
twentysidesm = new Array(1.3066  ,0.6533  ,0.3926  ,0.3056  ,0.2622  ,0.2362  ,0.1749  ,0.1381  ,0.1299  ,0.1299  ,0.1299)
twentysidesc = new Array(1.9882  ,0.9941  ,0.5554  ,0.4091  ,0.3360  ,0.2920  ,0.2043  ,0.1605  ,0.1517  ,0.1517  ,0.1517)
twentyfoursidesm = new Array(1.6643  ,0.8322  ,0.4890  ,0.3744  ,0.3173  ,0.2829  ,0.2144  ,0.1798  ,0.1730  ,0.1730  ,0.1730)
twentyfoursidesc = new Array(2.6138  ,1.3069  ,0.7387  ,0.5493  ,0.4546  ,0.3976  ,0.2885  ,0.2272  ,0.2158  ,0.2158  ,0.2158)

rearinlay = new Array(0.0876  ,0.0438  ,0.0312  ,0.0258  ,0.0258  ,0.0222  ,0.0204  ,0.0192  ,0.0192  ,0.0113  ,0.0113)
monorearinlay = new Array(0.0564  ,0.0282  ,0.0204  ,0.0174  ,0.0174  ,0.0150  ,0.0132  ,0.0114  ,0.0114  ,0.0180  ,0.0180)
doublerearinlay =new Array(0.1272  ,0.0636  ,0.0432  ,0.0384  ,0.0348  ,0.0312  ,0.0270  ,0.0240  ,0.0240  ,0.0240  ,0.0240)
whatpack = document.test_form.packageing.selectedIndex;
if (whatpack == 2 || whatpack == 3){//amaray or superjewel	
//array qty				500	 1K	 2k	 3k	 4k	 5k	 10k	 20k	 25k	 30k	 40k
twosidesm = 			new Array(0.186	,0.186	,0.143	,0.143	,0.143	,0.114	,0.107	,0.10	,0.10	,0.10	,0.10)
twosidesc = 			new Array(0.229	,0.229	,0.171	,0.171	,0.171	,0.126	,0.121	,0.114	,0.114	,0.114	,0.114)
foursidesm = 			new Array(0.214	,0.214	,0.157	,0.157	,0.157	,0.126	,0.121	,0.114	,0.114	,0.114	,0.114)
foursidesc = 			new Array(0.257	,0.257	,0.186	,0.186	,0.186	,0.143	,0.136	,0.126	,0.126	,0.126	,0.126)
sixsidesm = 			new Array(0.30 	,0.30	,0.20	,0.20	,0.20	,0.157	,0.15	 ,0.143	,0.143	,0.143	,0.143)
sixsidesc = 			new Array(0.343	,0.343	,0.214	,0.214	,0.214	,0.171	,0.164	,0.157	,0.157	,0.157	,0.157)
eightsidesm = 			new Array(0.30 	,0.30	,0.20	,0.20	,0.20	,0.157	,0.15	,0.143	,0.143	,0.143	,0.143)
eightsidesc = 			new Array(0.343	,0.343	,0.214	,0.214	,0.214	,0.171	,0.164	,0.157	,0.157	,0.157	,0.157)
twelvesidesm = 			new Array(0.371	,0.371	,0.229	,0.229	,0.229	,0.186	,0.179	,0.171	,0.171	,0.171	,0.171)
twelvesidesc = 			new Array(0.414	,0.414	,0.271	,0.271	,0.271	,0.214	,0.207	,0.20	,0.20	,0.20	,0.20)
sixteensidesm =			new Array(0.429	,0.429	,0.271	,0.271	,0.271	,0.257	,0.25	,0.20	,0.20	,0.20	,0.20)
sixteensidesc =			new Array(0.518	,0.518	,0.392	,0.314	,0.314	,0.255	,0.190	,0.187	,0.187	,0.167	,0.167)
twentysidesm = 			new Array(0.486	,0.486	,0.30	,0.30	,0.30	,0.243	,0.236	,0.229	,0.229	,0.229	,0.229)
twentysidesc = 			new Array(0.557	,0.557	,0.343	,0.343	,0.343	,0.30	,0.293	,0.286	,0.286	,0.286	,0.286)
twentyfoursidesm = 		new Array(0.529	,0.529	,0.339	,0.339	,0.339	,0.271	,0.264	,0.257	,0.257	,0.257	,0.257)
twentyfoursidesc = 		new Array(0.614	,0.614	,0.371	,0.371	,0.371	,0.336	,0.329	,0.329	,0.329	,0.329	,0.329)

amarayinlay = 			new Array(0.157	,0.157	,0.129	,0.129	,0.129	,0.10	,0.093	,0.086	,0.086	,0.086	,0.086)
sjewelfourone = 		new Array(0.214	,0.214	,0.143	,0.143	,0.143	,0.114	,0.107	,0.10	,0.10	,0.10	,0.10)
sjewelfourfour = 		new Array(0.243	,0.243	,0.171	,0.171	,0.171	,0.143	,0.136	,0.129	,0.129	,0.129	,0.129)
}




delivery = new Array(0.05	,0.02	,0.065)

Handling = 35

if(discnum == 0 ) {var glassmaster = 195}
if(discnum == 1 ) {var glassmaster = 200}
if(discnum == 2 || discnum == 3) {var glassmaster = 140}
if(discnum == 4 ) {var glassmaster = 300}
if(discnum == 5 ) {var glassmaster = 500}

if (discnum == 2 || discnum == 3) {var filmprice = 15.00}
else {var filmprice = 15.00}
}
//________________________________________________________________________________________________________

var deldate= "Date yet to be confirmed"



var orderString=""

var packname = document.test_form.packageing.selectedIndex;
var packname =document.test_form.packageing.options[packname].text ;

	if(discnum == 0 || discnum == 4 || discnum == 5 &&  document.test_form.packageing.selectedIndex > 0){
	if(document.test_form.packageing.options[1].selected){pack = jewelcasep;}
	else if(document.test_form.packageing.options[2].selected){pack = dbljewelcasep;}
	else if(document.test_form.packageing.options[3].selected){pack = slimjewelcasep;}
	else if(document.test_form.packageing.options[4].selected){pack = amaray;}
	else if(document.test_form.packageing.options[5].selected){pack = superjewel;}
	else if(document.test_form.packageing.options[6].selected){pack = whitecardwallet;}
	else if(document.test_form.packageing.options[7].selected){pack = cardwallet;}
	else if(document.test_form.packageing.options[8].selected){pack = diamond;}
	else if(document.test_form.packageing.options[9].selected){pack = plasticnoflap;}
	else if(document.test_form.packageing.options[10].selected){pack = plasticflap;}
	else if(document.test_form.packageing.options[11].selected){pack = plasticsticky;}
	else if(document.test_form.packageing.options[12].selected){pack = papersleeve;}
	}

if(discnum == 1 ){
if(document.test_form.packageing.options[1].selected){pack = eightyplasticwallet}
if(document.test_form.packageing.options[2].selected){pack = eightycardwallet; film = film+4 }
}

if(discnum == 2 ){
if(document.test_form.packageing.options[1].selected){pack = bizcardwallet}
else if(document.test_form.packageing.options[2].selected){pack = bizcardjewel}
}

if(discnum == 3 ){
if(document.test_form.packageing.options[1].selected){pack = playcardwallet}
}

var printname = document.test_form.printing.selectedIndex;
var myprintname = document.test_form.packageing.selectedIndex;
var printname =document.test_form.printing.options[printname].text ;


if (document.test_form.packageing.selectedIndex != -1){
if ((discnum == 0 || discnum == 4 || discnum ==5)  && ((myprintname > 5 && myprintname < 9) ||(myprintname >0 && myprintname <4)) ){  

	if(document.test_form.printing.options[1].selected){printa = twosidesm ; film = film+0}
	else if(document.test_form.printing.options[2].selected){printa = twosidesc ; film = film+0} 
	else if(document.test_form.printing.options[3].selected){printa = foursidesm ; film = film+0} 
	else if(document.test_form.printing.options[4].selected){printa = foursidesc ; film = film+0}
	else if(document.test_form.printing.options[5].selected){printa = sixsidesm ; film = film+0}
	else if(document.test_form.printing.options[6].selected){printa = sixsidesc ; film = film+0}
	else if(document.test_form.printing.options[7].selected){printa = eightsidesm ; film = film+0}
	else if(document.test_form.printing.options[8].selected){printa = eightsidesc ; film = film+0}
	else if(document.test_form.printing.options[9].selected){printa = twelvesidesm ; film = film+0}
	else if(document.test_form.printing.options[10].selected){printa = twelvesidesc ; film = film+0}
	else if(document.test_form.printing.options[11].selected){printa = sixteensidesm  ; film = film+0}
	else if(document.test_form.printing.options[12].selected){printa = sixteensidesc  ; film = film+0}
	else if(document.test_form.printing.options[13].selected){printa = twentysidesm ; film = film+0}
	else if(document.test_form.printing.options[14].selected){printa = twentysidesc ; film = film+0}
	else if(document.test_form.printing.options[15].selected){printa = twentyfoursidesm ; film = film+0}
	else if(document.test_form.printing.options[16].selected){printa = twentyfoursidesc  ; film = film+0}
}
}
if(document.test_form.printable.value="true")
{

orderString+="<style>td { font-size: 8pt; FONT-WEIGHT: BOLD; font-family: 'Verdana'}"
orderString+="SMALL {font-size: 6pt; FONT-WEIGHT: BOLD; font-family: 'Verdana'}" 
orderString+="BODY {font-size: 9pt; font-family: 'Verdana'}" 
orderString+="h1 {font-size: 11pt; FONT-WEIGHT: BOLD; font-family: 'Verdana'}</style>"

orderString+="<left><IMG SRC= images/top.jpg vspace=10 hsapce=10>"
orderString+="</left>"
orderString+="<center>"
orderString+="<br><font face=verdana size=5>www.cd-uk.co.uk </font>"
orderString+="<br><hr noshade size=1><SMALL>Syonica Limited T/a cd-uk, Alder House, High Road, Rayleigh, Essex SS6 7SA, Tel: 01268 765674, Fax:01268 763316, sales@cd-uk.co.uk</SMALL><hr noshade size=1><p>"
orderString+="</center>"
}

if (user_choice >1){
   if(document.test_form.salesman.options[0].selected != "")
     {var salesman = (getCookie("SalesMan"));}
   if(document.test_form.salesman.options[1].selected != "")
     {var salesman ="Martin Ley"}
   if(document.test_form.salesman.options[2].selected != "")
     {var salesman ="Martin Ley"}
   if(document.test_form.salesman.options[3].selected != "")
     {var salesman ="Martin Ley"}
   if(document.test_form.salesman.options[4].selected != "")
     {var salesman ="Martin Ley"}
}
var salesman ="CD Sales"

if (user_choice == 1){
if(document.test_form.myname.value != "")
{orderString+="<table><tr><td width =25%>To : </td><td>"+document.test_form.myname.value+"<tr><td>From : </td><td>"+salesman }
}

if (user_choice ==2){
if(document.test_form.printable.value="true"){orderString+="<font face=stamp size=5> TOP SECRET</FONT><P>"}
if(document.test_form.myname.value != "")
{orderString+="<table><tr><td width =35%>Sales Contact : </td><td>"+salesman+"<tr><td>Contact Name : </td><td>"+document.test_form.myname.value }
                    }

if (user_choice == 3){
if(discnum == 2 || discnum == 3 ){orderString+="<table><tr><td width =25%>To : </td><td>Sales </td><tr><td>From : </td><td>"+salesman+" </td><tr><td> Company : </td><td>Diskxpress <tr> Fax : 01454 820075"}
else {orderString+="<table><tr><td width=40%>To : </td><td>Gary Birch</td><tr><td>From : </td><td>"+salesman+"</td><tr><td>Company : </td><td>SDC </td><tr><td>Fax : </td><td>0208 581 9248"}
}

if (user_choice == 1){
if(document.test_form.myname.value != "")
{orderString+="<tr><td>Subject: </td><td>Your recent enquiry about CD Replication"}
}



if (user_choice == 3){orderString+="<tr><td>Subject: </td><td>CD Replication Order"}

day = today.getDate();
var grammar="";
if (day==1 || day==21 || day==31) {grammar="st"}
else if (day==2 || day==22) {grammar="nd"}
else if (day==3 || day==23) {grammar="rd"}
else {grammar="th"}
 	   
 	   
 	   
orderString+="<tr><td>Date : </td><td>"+isnDays[today.getDay()]+" the "+today.getDate()+grammar+" "+isnMonths[today.getMonth()]+" "+getFullYear(today); 


if (user_choice <3){
if(document.test_form.company.value != "") {orderString+="<tr><td>Company : </td><td>"+document.test_form.company.value}
}
if (user_choice >1){

if (user_choice ==3){{orderString+="<tr><td>CD-UK Customer Name : </td><td>"+document.test_form.company.value}
{orderString+="<tr><td>Project Title : </td><td>"+document.test_form.project.value}}

if (user_choice ==3){{orderString+="<tr><td>Order Number : </td><td>"+document.test_form.cdplantorder.value}}
if (user_choice ==2){{orderString+="<tr><td>CD Plant Order Number : </td><td>"+document.test_form.cdplantorder.value}}

}

if (user_choice <3){
	if(document.test_form.email.value != "") {orderString+="<tr><td>Email : </td><td>"+document.test_form.email.value}
	if(document.test_form.telephone.value != "") {orderString+="<tr><td>Phone : </td><td>"+document.test_form.telephone.value}
	if(document.test_form.fax.value != "") {orderString+="<tr><td>Fax : </td><td>"+document.test_form.fax.value}
	if(document.test_form.address1.value != "") {orderString+="<tr><td>Address : </td><td>"+document.test_form.address1.value}
	if(document.test_form.address2.value != "") {orderString+="<tr><td> </td><td>"+document.test_form.address2.value}
	if(document.test_form.city.value != "") {orderString+="<tr><td> </td><td>"+document.test_form.city.value}
	if(document.test_form.state.value != "") {orderString+="<tr><td> </td><td>"+document.test_form.state.value}
	if(document.test_form.zip.value != "") {orderString+="<tr><td> </td><td>"+document.test_form.zip.value}

}

if (user_choice >1){
if(document.test_form.deladdress.value != "") 
{orderString+="<tr><td>Delivery Address : </td><td>"+document.test_form.deladdress.value}
                   }

orderString+="</table>"

var refer = 1;
//document.test_form.refer.selectedIndex ;
//var refer = document.test_form.refer.options[refer].text ;

if(user_choice ==2){
orderString+=htmlbr+"How Did You Hear of Us : "+refer;
}


if(user_choice > 1)
{
	if(document.test_form.title.options.selectedIndex == 0)
	{var title = ""+cdtype+" Replication Quotation"}

	if(document.test_form.title.options.selectedIndex == 1)
	{var title = ""+cdtype+" Replication Proforma Invoice"}

	if(document.test_form.title.options.selectedIndex == 2)
	{var title = ""+cdtype+" Replication Order Confirmation"
		if(document.test_form.deldate.value != "") 
		{var deldate = document.test_form.deldate.value}
	}
}
else {var title = ""+cdtype+" Replication Quotation"}




if(document.test_form.purchasing.value != "") {orderString+=htmlbr+"Required Delivery Date : "+document.test_form.purchasing.value+htmlbr+""}
else {orderString+=htmlbr+""}

if(document.test_form.printable.value="true"){orderString+="<hr noshade size=1><h1><b>"}

if (user_choice ==1){orderString+=""+title+""+htmlbr}
if (user_choice ==2){orderString+="Syonica Limited Schedule of Costs"+htmlbr}
if (user_choice ==3){orderString+="Details Of Order"+htmlbr}

if(document.test_form.printable.value="true"){orderString+="</center></b></h1>"}








if(discnum < 2)
	{
	if(quant < 500)
               {alert( "Our minimum quantity on "+cdtype+" is 500 \r Your quantity has been adjusted to 500");
               quant = 500;
               document.test_form.qty.value = quant;}}

else {

	 if(quant < 500)	

               {{alert( "Our minimum quantity on "+cdtype+" is 500\r Your quantity has been adjusted to 500");
	       quant = 500;
               document.test_form.qty.value = quant;}}

}

//###############################################################################################
if (quant > 39999) {alert( "Please contact sales for a price");}
if (quant >499 && quant < 40000)

{

var totalprice = 0;

if ( quant < 1000) {var suffix = "0";}
else if (quant < 2000) {var suffix = "1";}
else if (quant < 3000) {var suffix = "2";}//only on cards
else if (quant < 4000) {var suffix = "3";}
else if (quant < 5000) {var suffix = "4";}
else if (quant < 10000) {var suffix = "5";}
else if (quant < 20000) {var suffix = "6";}
else if (quant < 25000) {var suffix = "7";}
else if (quant < 30000) {var suffix = "8";}// only on dvd
else if (quant < 40000) {var suffix = "9";}

var vat = 0;

//Basic CD Price


if (discnum != 2 && discnum != 3)
{ 
if (disccolour > 3) {additionalcols = disccolour - 3;}
else {additionalcols = 0;}
}

else if (discnum == 2 || discnum == 3 ) 
{ 
if (disccolour > 4) {additionalcols = disccolour - 4;}
else {additionalcols = 0;}
}

newprice=currencyfix(cdprice[suffix]+(addcolour[suffix] * additionalcols));
totalprice = totalprice + quant*(newprice)
orderString+=""+cdtype+html+quant +" off "+cdtype+"'s printed in "+disccolour+" cols on a "+basecolour+" base, Unit Cost = £"+currencyfix(newprice)+ " Total cost  = £" +currencyfix1(quant*newprice)
 

//packageing option

myquant = document.test_form.packoverride.value;
if (myquant == ""){myquant = quant}
//var packsel = document.test_form.packageing.selectedIndex;


	if( document.test_form.packageing.selectedIndex > parseInt(0))
	{
	totalprice = totalprice + myquant*pack[suffix];
	orderString+=htmlbr+"Packaging"+html+myquant + " off "+packname+", Unit Cost = £"+currencyfix(pack[suffix])+ " Total cost  = £" +currencyfix(myquant*pack[suffix])
	}

//Cellophane Wrapping

if(document.test_form.packageing.selectedIndex > parseInt(0) && document.test_form.Cellophane.checked){
totalprice = totalprice + quant*celloprice[suffix];orderString+=html+quant +" off Cellophane Wrapping Unit Cost = £"+celloprice[suffix]+ " Total cost  = £" +currencyfix(quant*celloprice[suffix]);
}


// printing option


if(document.test_form.printing.selectedIndex > parseInt(0))
	{
	totalprice = totalprice + quant*printa[suffix]; 
	orderString+=htmlbr+"Printing"+html+quant + " off "+printname+" Unit Cost = £"+printa[suffix]+ " Total cost  = £" +currencyfix(quant*printa[suffix]);
	}

	// rear inlay card


	rinlay = document.test_form.selrearinlay.selectedIndex;
	rinlayno = document.test_form.selrearinlay.options[rinlay].text;



if (whatpack == 1)
	{
		if (rinlay == 1)
		{film = film+0 ; totalprice = totalprice + quant*monorearinlay[suffix];
		orderString+=html+quant +" off "+rinlayno+" = £"+monorearinlay[suffix]+ " Total cost  = £" +currencyfix(quant*monorearinlay[suffix]);
		}

		if (rinlay == 2)
		{film = film+0; totalprice = totalprice + quant*rearinlay[suffix];
		orderString+=html+quant +" off "+rinlayno+" = £" +rearinlay[suffix]+ " Total cost  = £" +currencyfix(quant*rearinlay[suffix]);
		}
		
		if (rinlay == 3)
		{film = film+0; totalprice = totalprice + quant*doublerearinlay[suffix];
		orderString+=html+quant +" off "+rinlayno+" = £" +doublerearinlay[suffix]+ " Total cost  = £" +currencyfix(quant*doublerearinlay[suffix]);
		}
		
	}
	
if (whatpack == 2)
	{
		if (rinlay == 1)
		{film = film+4; totalprice = totalprice + quant*amarayinlay[suffix];
		orderString+=html+quant +" off "+rinlayno+" = £"+amarayinlay[suffix]+ " Total cost  = £" +currencyfix(quant*amarayinlay[suffix]);
		}

	}
	
if (whatpack == 3)
	{
		if (rinlay == 1)
		{film = film+5; totalprice = totalprice + quant*sjewelfourone[suffix];
		orderString+=html+quant +" off "+rinlayno+" = £"+sjewelfourone[suffix]+ " Total cost  = £" +currencyfix(quant*sjewelfourone[suffix]);
		}

		if (rinlay == 2)
		{film = film+8; totalprice = totalprice + quant*sjewelfourfour[suffix];
		orderString+=html+quant +" off "+rinlayno+" = £"+sjewelfourfour[suffix]+ " Total cost  = £" +currencyfix(quant*sjewelfourfour[suffix]);
		}
		
	}
	


// handling and mastering


	if (user_choice == 1 ||user_choice == 2){totalprice = totalprice + Handling}
	
	if (document.test_form.rerun.selectedIndex == 0){
		if (quant < masterBreak) {totalprice = totalprice + glassmaster}
	}



if (user_choice ==2)
{orderString+=htmlbr+"Mastering and Handling"+html+"1 off Amtrak Collection Charge £"+currencyfix(Handling)}

else if (user_choice == 1)
{orderString+=htmlbr+"Mastering and Handling"+html+"1 off Project Handling Fee £"+currencyfix(Handling)}

else if (user_choice == 3)
{orderString+=htmlbr+"Mastering and Handling"+html}


if (document.test_form.rerun.selectedIndex == 0){
if (quant < masterBreak) {orderString+=html+"1 off Glass Mastering (applicable to all "+cdtype+" orders under " + masterBreak + " units) £"+currencyfix(glassmaster)}
if (quant >= masterBreak) {orderString+=html+"1 off Glass Mastering  £ F.O.C"}
}
else {orderString+=html+"Re-run no new Glass Mastering required"}



if (quant < 20000){
packnum = parseInt(document.test_form.packageing.selectedIndex);


	// no packageing or wallet delivery rate
	if(discnum == 1 || discnum == 2 || discnum == 3){
		if (discnum ==2 && packnum == 2)
			{
			totalprice = totalprice + quant*delivery[0];
			orderString+=htmlbr+"Delivery"+html+quant + " off Delivery of "+cdtype+"'s with  "+packname+"\n"+"Unit Cost = £"+delivery[0]+ " Total cost  = £" +currencyfix(quant*delivery[0]);
			}
		else
			{
			totalprice = totalprice + quant*delivery[1];
			orderString+=htmlbr+"Delivery"+html+quant + " off Delivery of "+cdtype+"'s with  "+packname+"\n"+"Unit Cost = £"+delivery[1]+ " Total cost  = £" +currencyfix(quant*delivery[1]);
			}
	
}
	if(discnum == 0 || discnum == 4 || discnum == 5 ){
		// jewel case delivery rate
		if(packnum == 1 || packnum == 4 ) 
		{
		totalprice = totalprice + quant*delivery[0];
		orderString+=htmlbr+"Delivery"+html+quant + " off Delivery of "+cdtype+" Packed in "+packname+ "\n"+"Unit Cost = £"+delivery[0]+ " Total cost  = £" +currencyfix(quant*delivery[0]);
		}

		// dvd case rate

		else if( packnum == 2 || packnum == 3)
		{
		totalprice = totalprice + quant*delivery[2];
		orderString+=htmlbr+"Delivery"+html+quant + " off Delivery of "+cdtype+" Packed in "+packname+ "\n"+"Unit Cost = £"+delivery[2]+ " Total cost  = £" +currencyfix(quant*delivery[2]);
		}
		else//if( packnum == 0) 
		{
		totalprice = totalprice + quant*delivery[1];
		orderString+=htmlbr+"Delivery"+html+quant + " off Delivery of "+cdtype+"'s with  "+packname+"\n"+"Unit Cost = £"+delivery[1]+ " Total cost  = £" +currencyfix(quant*delivery[1]);
		}
	}
}

else if (quant > 19999) {orderString+=htmlbr+"Delivery"+html+"F.O.C on all orders over 20000"}

}// close for element selections


if(document.test_form.digital.selectedIndex == 0 ){

totalprice = totalprice + (film)*filmprice; 
orderString+=htmlbr+"Film from Digital Artwork"+html+(film)+" off Films Needed to create Artwork Unit Cost £ "+currencyfix(filmprice)+" Total Cost = £ "+currencyfix((film)*filmprice);
}

if(document.test_form.digital.selectedIndex == 1 ) {
	if(user_choice <3) 	
		{orderString+=htmlbr+"Film "+html+"You will be responsible for finished films to create artwork (spec available on request)"}
	else {orderString+=htmlbr+"Film "+html+"Customer to supply finished film"}
}

if(document.test_form.digital.selectedIndex == 2) {

if(user_choice <3) 	
		 {orderString+=htmlbr+"Film "+html+"Reuse customer film previously supplied"}
	else {orderString+=htmlbr+"Film "+html+"Customer has previously supplied film for this job"}
}

//++++++++++++++++++++++++++++++++
if (user_choice > 1){// ignore misc article for sales form
if(document.test_form.miscqty.value >0){
alert ('arse');
if(user_choice == 1){
{totalprice = totalprice + document.test_form.miscqty.value*document.test_form.miscsaleprice.value}orderString+=htmlbr+"Misc "+html+""
+document.test_form.miscqty.value +" off "+document.test_form.miscdisc.value+" Unit cost = £" +document.test_form.miscsaleprice.value+ " Total cost  = £" +currencyfix(document.test_form.miscsaleprice.value*document.test_form.miscqty.value)}

if(user_choice == 2){
{totalprice = totalprice + document.test_form.miscqty.value*document.test_form.miscbuyprice.value}orderString+=htmlbr+"Misc "+html+""
+document.test_form.miscqty.value +" off "+document.test_form.miscdisc.value+" Unit cost = £" +document.test_form.miscbuyprice.value+ " Total cost  = £" +currencyfix(document.test_form.miscbuyprice.value*document.test_form.miscqty.value)}

if(user_choice == 3 && document.test_form.cdplant.checked){ 
totalprice = totalprice + document.test_form.miscqty.value*document.test_form.miscbuyprice.value;
orderString+=htmlbr+"Misc "+html+""+document.test_form.miscqty.value +" off "+document.test_form.miscdisc.value+" Unit cost = £" +document.test_form.miscbuyprice.value+ " Total cost  = £" +currencyfix(document.test_form.miscbuyprice.value*document.test_form.miscqty.value)}
}

if(document.test_form.miscqty1.value >0){

if(user_choice == 1){
{totalprice = totalprice + document.test_form.miscqty1.value*document.test_form.miscsaleprice1.value}orderString+=html+
document.test_form.miscqty1.value +" off "+document.test_form.miscdisc1.value+" Unit cost = £" +document.test_form.miscsaleprice1.value+ " Total cost  = £" +currencyfix(document.test_form.miscsaleprice1.value*document.test_form.miscqty1.value)}

if(user_choice == 2){
{totalprice = totalprice + document.test_form.miscqty1.value*document.test_form.miscbuyprice1.value}orderString+=html+
document.test_form.miscqty1.value +" off "+document.test_form.miscdisc1.value+" Unit cost = £" +document.test_form.miscbuyprice1.value+ " Total cost  = £" +currencyfix(document.test_form.miscbuyprice1.value*document.test_form.miscqty1.value)}

if(user_choice == 3 && document.test_form.cdplant1.checked){
{totalprice = totalprice + document.test_form.miscqty1.value*document.test_form.miscbuyprice1.value}orderString+=html+
document.test_form.miscqty1.value +" off "+document.test_form.miscdisc1.value+" Unit cost = £" +document.test_form.miscbuyprice1.value+ " Total cost  = £" +currencyfix(document.test_form.miscbuyprice1.value*document.test_form.miscqty1.value)}
}

 
if(document.test_form.miscqty2.value >0){

	if(user_choice == 1){
	{totalprice = totalprice + document.test_form.miscqty2.value*document.test_form.miscsaleprice2.value}orderString+=html+
	document.test_form.miscqty2.value +" off "+document.test_form.miscdisc2.value+" Unit cost = £" +document.test_form.miscsaleprice2.value+ " Total cost  = £" +currencyfix(document.test_form.miscsaleprice2.value*document.test_form.miscqty2.value)}

	if(user_choice == 2){
	{totalprice = totalprice + document.test_form.miscqty2.value*document.test_form.miscbuyprice2.value}orderString+=html+
	document.test_form.miscqty2.value +" off "+document.test_form.miscdisc2.value+" Unit cost = £" +document.test_form.miscbuyprice2.value+ " Total cost  = £" +currencyfix(document.test_form.miscbuyprice2.value*document.test_form.miscqty2.value)}

	if(user_choice == 3 && document.test_form.cdplant2.checked){
	totalprice = totalprice + document.test_form.miscqty2.value*document.test_form.miscbuyprice2.value}orderString+=html+
	document.test_form.miscqty2.value +" off "+document.test_form.miscdisc2.value+" Unit cost = £" +document.test_form.miscbuyprice2.value+ " Total cost  = £" +currencyfix(document.test_form.miscbuyprice2.value*document.test_form.miscqty2.value)
}
}//++++++++++++++++++++++++++++++++

if (quant > 499 && quant < 40000)
{orderString+=htmlbr+"Total Nett Price = £ "+currencyfix1(totalprice)

var payment = document.test_form.payment.selectedIndex;
var discountset = document.test_form.discounted.value;

if (payment ==1) {}

if(user_choice == 1){
if (discountset > 0){

var discountrate = discountset / 100

var discount= totalprice * discountrate

orderString+=html+document.test_form.discounted.value+"% Discount = £"+currencyfix1(discount)

totalprice = currencyfix1(totalprice - discount)

orderString+=html+"Discounted price = £"+totalprice}}

if (payment ==1) {surcharge = (totalprice /100 * 3.25);
orderString+=html+"Credit Card Surcharge (3.25%) = £"+currencyfix1(surcharge);
totalprice = totalprice + surcharge;
orderString+=html+"Surcharged Price = £"+currencyfix1(totalprice);
}

vat = totalprice * 1.175 - +totalprice

orderString+=html+"VAT = £"+currencyfix1(vat)

gross = totalprice + vat

orderString+=html+"Total Gross Price = £ "+currencyfix1(gross)

var unitprice = currencyfix(totalprice / quant)

if (user_choice <3){orderString+=htmlbr+"Unit Price (ex VAT) = £ "+unitprice}

if (user_choice == 3)
{
if(document.test_form.customerinst.checked){
if(document.test_form.instructions.value !=""){orderString+=htmlbr+document.test_form.instructions.value} 
}
}

if (user_choice != 1)
{
if(document.test_form.plantinst.checked){
if(document.test_form.instructions.value !=""){orderString+=htmlbr+document.test_form.instructions.value} 

}
orderString+=htmlbr+"Please supply 2 samples of finished product to Syonica Limited."+html+"Please stamp www.cd-uk.co.uk on the hub ring along with the project title.";
}

if(user_choice == 1)if(document.test_form.printable.value="true")
	{

//if(document.test_form.title.options[2].selected != ""){orderString+="<B>"}
//else{	

	{orderString+="<B>"}


{orderString+=htmlbr+"PAYMENT TERMS - ALL ORDERS ARE STRICTLY PAYMENT WITH ORDER."}
//}

if(document.test_form.printable.value="true"){orderString+="</B>"+htmlbr+" Turn around time for "+cdtype+"'s is "+turnaround+" days from receipt of payment and verified production parts"+htmlbr+" <FONT SIZE=1>";}


//if(document.test_form.title.options[2].selected != "")
//{orderString+=htmlbr+"<FONT SIZE=2>Thank you for your order (payment recieved with thanks) your project is due for delivery on - "+deldate
//}

//else{
orderString+=htmlbr+"This quotation is valid for 30 days and is subject to our terms and conditions of sale (available on request)." 
orderString+=html+"Prices include a single collection of artwork/masters and a single delivery to a mainland UK address."  

//}
orderString+=htmlbr+"Software Revision Date  20th January 2006 "

}


//document.test_form.summary.value=orderString

//if (user_choice ==1){document.test_form.valueof.value=totalprice}
//if (user_choice ==2){document.test_form.valueofs.value= currencyfix(totalprice)}
//if (document.test_form.valueof.value != "")
//{if (document.test_form.valueofs.value != "")
//{document.test_form.valueofp.value=currencyfix(document.test_form.valueof.value-document.test_form.valueofs.value)}
//}

if(document.test_form.printable.value="true"){

win2=open("","window2","toolbar=0,location=0,directories=0,status=0,menubar=1,scrollbars=1,resizable=1,alwaysraised=yes")

win2.document.open()

win2.document.write(orderString )

win2.document.close()

return false
}


}


}






function currencyfix(num) {
//fix to 3 places
string = num;

	string = string * 1000;
	string = Math.round(string);
	string = string/1000;
	
stuff = "" + string;
if (stuff.indexOf('.')== -1)
{string = stuff + '.00'}

else{
seperation = stuff.length - stuff.indexOf('.');
if (seperation <= 2) {string = stuff + '0'}
}
return string;}

function currencyfix1(num) {
//fix to 2 places
string = num;

	string = string * 100;
	string = Math.round(string);
	string = string/100;
	
stuff = "" + string;
if (stuff.indexOf('.')== -1)
{string = stuff + '.00'}

else{
seperation = stuff.length - stuff.indexOf('.');
if (seperation <= 2) {string = stuff + '0'}
}
return string;}





         function getCookie (name) { 
         var dcookie = document.cookie; 
         var cname = name + "=";
         var clen = dcookie.length;
         var cbegin = 0;
             while (cbegin < clen) {
             var vbegin = cbegin + cname.length;
                 if (dcookie.substring(cbegin, vbegin) == cname) { 
                 var vend = dcookie.indexOf (";", vbegin);
                     if (vend == -1) vend = clen;
                 return unescape(dcookie.substring(vbegin, vend));
                 }
             cbegin = dcookie.indexOf(" ", cbegin) + 1;
                 if (cbegin == 0) break;
             }
         return null;
         }


 
