aa=0
bb=0
cc=0
dd=0
dd2=0
ee=0
var chosen=1
var engchoice=1
var boxchoice=1
var totprice=0
var pricebasic=0
var reqqty5=0;

function startscreen()
{lev1=document.optionform.level1.value;
lev2=document.optionform.level2.value;
lev3=document.optionform.level3.value;
lev4=document.optionform.level4.value;
clearall();document.orderform.reset();
document.getElementById("pricedata").style.display = "none";
document.getElementById("engtype2").style.display="";
document.getElementById("boxtype1").style.display="";
document.engrav.engbut2.checked = true;
document.orderform.qty2.checked = true;
document.orderform.qty10.checked = true;
engchoice=2;clearq();
document.qform.qbut1.checked = true;
chosen=1;
document.qform.qchoice1.value=document.optionform.nam1.value;
//document.qform.qchoice2.value=document.optionform.nam2.value;
//document.qform.qchoice3.value=document.optionform.nam3.value;
document.qform.qchoice1.value=document.optionform.nam1.value;
document.orderform.product1.value = document.optionform.ref1.value+" "+document.optionform.nam1.value;
}
function clearall()
{var reqqty5=0;document.orderform.qtyorder.value="";clearchkeng();cleareng();clearbox();document.getElementById("pricedata").style.display = "none";
document.getElementById("engtype2").style.display="";
document.getElementById("boxtype1").style.display="";
document.engrav.engbut2.checked = true;
document.orderform.qty2.checked = true;
engchoice=1;clearq();
document.qform.qbut1.checked = true;
chosen=1;
document.qform.qchoice1.value=document.optionform.nam1.value;
//document.qform.qchoice2.value=document.optionform.nam2.value;
//document.qform.qchoice3.value=document.optionform.nam3.value;
document.qform.qchoice1.value=document.optionform.nam1.value;
document.orderform.product1.value = document.optionform.ref1.value+" "+document.optionform.nam1.value;

hideoption();
hidecheck();
document.qtyfm.reset();
document.engrav.reset();
document.boxes.reset();
document.pricetable.reset();
}
function hideoption()
{document.optionform.style.display = "none";
document.getElementById("prodcode1").style.display = "none";
//document.getElementById("prodcode2").style.display = "none";
//document.getElementById("prodcode3").style.display = "none";
}

function hidecheck()
{document.getElementById("engcheck2").style.display = "none";
document.getElementById("engcheck3").style.display = "none";
document.getElementById("engcheck4").style.display = "none";
document.getElementById("engcheck5").style.display = "none";
document.getElementById("engcheck6").style.display = "none";
document.getElementById("engcheck7").style.display = "none";
document.getElementById("engcheck8").style.display = "none";
document.getElementById("engcheck9").style.display = "none";
document.getElementById("boxcheck1").style.display = "none";
document.getElementById("boxcheck2").style.display = "none";
document.getElementById("boxcheck3").style.display = "none";
}

function cleareng()
{document.getElementById("engtype2").style.display = "none";
document.getElementById("engtype3").style.display = "none";
document.getElementById("engtype4").style.display = "none";
document.getElementById("engtype5").style.display = "none";
document.getElementById("engtype6").style.display = "none";
document.getElementById("engtype7").style.display = "none";
document.getElementById("engtype8").style.display = "none";
document.getElementById("engtype9").style.display = "none";
document.engrav.engbut2.checked = false;
document.engrav.engbut3.checked = false;
document.engrav.engbut4.checked = false;
document.engrav.engbut5.checked = false;
document.engrav.engbut6.checked = false;
document.engrav.engbut7.checked = false;
document.engrav.engbut8.checked = false;
document.engrav.engbut9.checked = false;
}
function clearbox()
{document.getElementById("boxtype1").style.display = "none";
document.getElementById("boxtype2").style.display = "none";
document.getElementById("boxtype3").style.display = "none";
document.boxes.boxbut1.checked = false;
document.boxes.boxbut2.checked = false;
document.boxes.boxbut3.checked = false;
}
function clearq()
{document.orderform.product1.value = document.qform.qchoice1.value ;
document.qform.qbut1.checked = false;
//document.qform.qbut2.checked = false;
//document.qform.qbut3.checked = false;
}
function zeroqty()
{if (reqqty5==0)
{startscreen();null;alert("please select quantity required first");
}
else return;
}
function item1()
{
clearq();
document.qform.qbut1.checked = true;
chosen=1;
calcprice();zeroqty();
}
function item2()
{clearq();
document.qform.qbut2.checked = true;
chosen=2;
calcprice();zeroqty();
}
function item3()
{clearq();
document.qform.qbut3.checked = true;
chosen=3; 
calcprice();zeroqty();}

function showeng2()
{cleareng();
document.getElementById("engtype2").style.display = "";
document.engrav.engbut2.checked = true;
clearchkeng();
document.orderform.qty2.checked = true;
engchoice=2;
calcprice();zeroqty();
}
function showeng3()
{cleareng();
document.getElementById("engtype3").style.display = "";
document.engrav.engbut3.checked = true;
clearchkeng();
document.orderform.qty3.checked = true;
engchoice=3;
calcprice();zeroqty();
}
function showeng4()
{cleareng();
document.getElementById("engtype4").style.display = "";
document.engrav.engbut4.checked = true;
clearchkeng();
document.orderform.qty4.checked = true;
engchoice=4;
calcprice();zeroqty();
}
function showeng5()
{cleareng();
document.getElementById("engtype5").style.display = "";
document.engrav.engbut5.checked = true;
clearchkeng();
document.orderform.qty5.checked = true;
engchoice=5; 
calcprice();zeroqty();
}
function showeng6()
{cleareng();
document.getElementById("engtype6").style.display = "";
document.engrav.engbut6.checked = true;
clearchkeng();
document.orderform.qty6.checked = true;
engchoice=6; 
calcprice();zeroqty();
}
function showeng7()
{cleareng();
document.getElementById("engtype7").style.display = "";
document.engrav.engbut7.checked = true;
clearchkeng();
document.orderform.qty7.checked = true;
engchoice=7; 
calcprice();zeroqty();
}
function showeng8()
{cleareng();
document.getElementById("engtype8").style.display = "";
document.engrav.engbut8.checked = true;
clearchkeng();
document.orderform.qty8.checked = true;
engchoice=8; 
calcprice();zeroqty();
}
function showeng9()
{cleareng();
document.getElementById("engtype9").style.display = "";
document.engrav.engbut9.checked = true;
clearchkeng();
document.orderform.qty9.checked = true;
engchoice=9; 
calcprice();zeroqty();
}


function showbox1()
{clearbox();
document.getElementById("boxtype1").style.display = "";
document.boxes.boxbut1.checked = true;
clearchkbox()
document.orderform.qty10.checked = true;
boxchoice=1;
calcprice();zeroqty();
}
function showbox2()
{clearbox();
document.getElementById("boxtype2").style.display = "";
document.boxes.boxbut2.checked = true;
clearchkbox()
document.orderform.qty11.checked = true;
boxchoice=2; 
calcprice();zeroqty();
}
function showbox3()
{
clearbox();
document.getElementById("boxtype3").style.display = "";
document.boxes.boxbut3.checked = true;
clearchkbox()
document.orderform.qty12.checked = true;
boxchoice=3; 
calcprice();zeroqty();
}
function clearchkeng()
{document.orderform.qty2.checked = false;
document.orderform.qty3.checked = false;
document.orderform.qty4.checked = false;
document.orderform.qty5.checked = false;
document.orderform.qty6.checked = false;
document.orderform.qty7.checked = false;
document.orderform.qty8.checked = false;
document.orderform.qty9.checked = false;
}

function clearchkbox()
{document.orderform.qty10.checked = false;
document.orderform.qty11.checked = false;
document.orderform.qty12.checked = false;
}
function qtyreqd()
{
reqqty5=document.qtyfm.reqqty.options[document.qtyfm.reqqty.selectedIndex].value;
document.pricetable.reqqty2.value=reqqty5;
}

/////////

function item1price()
{aa=0;bb=0;cc=0;dd=0;ee=0;
document.orderform.product1.value = document.optionform.ref1.value+" "+document.optionform.nam1.value ;
if (reqqty5==0)
{return;}
else if (reqqty5<(lev2*1))
{pricebasic = document.optionform.pric1v1.value;
}
else if (reqqty5<(lev3*1))
{
pricebasic = document.optionform.pric1v2.value;
;}
else if (reqqty5<(lev4*1))
{
pricebasic = document.optionform.pric1v3.value;
;}
else if (reqqty5>=(lev4*1))
{
pricebasic = document.optionform.pric1v4.value;
;}
aa=pricebasic;priceeach2=0;
if (engchoice==2)
{bb=0.00;dd=0.00;}
else if (engchoice==3)
{bb=document.optionform.engv1.value;
dd=document.optionform.arttext1.value;}
else if (engchoice==4)
{bb=document.optionform.engv1.value;
dd=(document.optionform.arttext1.value*1)+(document.optionform.arttext1a.value*(reqqty5-1))
}
else if (engchoice==5)
{bb=document.optionform.engv1.value;
dd=document.optionform.artclip1.value;}

else if (engchoice==6)
{bb=document.optionform.engv1.value;
dd=(document.optionform.artclip1.value*1)+(document.optionform.artclip1a.value*(reqqty5-1))}

else if (engchoice==7)
{bb=document.optionform.engv1.value;
dd=document.optionform.artlogo1.value;}

else if (engchoice==8)
{bb=document.optionform.engv1.value;
dd=(document.optionform.artlogo1.value*1)+(document.optionform.artlogo1a.value*(reqqty5-1))}

else if (engchoice==9)
{bb=document.optionform.engv1.value;
dd=(document.optionform.artlogo1.value*1)+(document.optionform.artlogo1b.value*(reqqty5-1))}

if (boxchoice==1)
{cc=0.00}
else if (boxchoice==2)
{cc=document.optionform.pbx1.value;cc=cc*1;
}
else if (boxchoice==3)
{cc=document.optionform.bxplaq1.value;cc=cc*1;
}

priceeach2=((pricebasic*1)+(bb*1)+(cc*1)*1);
document.pricetable.priceeach.value=priceeach2.toFixed(2);
dd2=dd*1;
document.pricetable.artwork.value=dd2.toFixed(2);
ee=(document.optionform.deliv1.value*1);
document.pricetable.delivery.value=ee.toFixed(2);
}

/////////
function item2price()
{aa=0;bb=0;cc=0;dd=0;ee=0;
document.orderform.product1.value = document.optionform.ref2.value+" "+document.optionform.nam2.value ;
if (reqqty5==0)
{}
else if (reqqty5<(lev2*1))
{pricebasic = document.optionform.pric2v1.value;
}
else if (reqqty5<(lev3*1))
{
pricebasic = document.optionform.pric2v2.value;
;}
else if (reqqty5<(lev4*1))
{
pricebasic = document.optionform.pric2v3.value;
;}
else if (reqqty5>=(lev4*1))
{
pricebasic = document.optionform.pric2v4.value;
;}
aa=pricebasic;priceeach2=0;
if (engchoice==2)
{bb=0.00;dd=0.00;}
else if (engchoice==3)
{bb=document.optionform.engv2.value;
dd=document.optionform.arttext2.value;}
else if (engchoice==4)
{bb=document.optionform.engv2.value;
dd=(document.optionform.arttext2.value*1)+(document.optionform.arttext2a.value*(reqqty5-1))
}
else if (engchoice==5)
{bb=document.optionform.engv2.value;
dd=document.optionform.artclip2.value;}

else if (engchoice==6)
{bb=document.optionform.engv2.value;
dd=(document.optionform.artclip2.value*1)+(document.optionform.artclip2a.value*(reqqty5-1));}

else if (engchoice==7)
{bb=document.optionform.engv2.value;
dd=document.optionform.artlogo2.value;}

else if (engchoice==8)
{bb=document.optionform.engv2.value;
dd=(document.optionform.artlogo2.value*1)+(document.optionform.artlogo2a.value*(reqqty5-1));}

else if (engchoice==9)
{bb=document.optionform.engv2.value;
dd=(document.optionform.artlogo2.value*1)+(document.optionform.artlogo2b.value*(reqqty5-1))}

if (boxchoice==1)
{cc=0.00}
else if (boxchoice==2)
{cc=document.optionform.pbx1.value;cc=cc*1;
}
else if (boxchoice==3)
{cc=document.optionform.bxplaq1.value;cc=cc*1;
}

priceeach2=((pricebasic*1)+(bb*1)+(cc*1)*1);
document.pricetable.priceeach.value=priceeach2.toFixed(2);
dd2=dd*1;
document.pricetable.artwork.value=dd2.toFixed(2);
ee=(document.optionform.deliv1.value*1);
document.pricetable.delivery.value=ee.toFixed(2);
}
//////////
function item3price()
{aa=0;bb=0;cc=0;dd=0;ee=0;
document.orderform.product1.value = document.optionform.ref3.value+" "+document.optionform.nam3.value ;
if (reqqty5==0)
{return}
else if (reqqty5<(lev2*1))
{pricebasic = document.optionform.pric3v1.value;
}
else if (reqqty5<(lev3*1))
{
pricebasic = document.optionform.pric3v2.value;
;}
else if (reqqty5<(lev4*1))
{
pricebasic = document.optionform.pric3v3.value;
;}
else if (reqqty5>=(lev4*1))
{
pricebasic = document.optionform.pric3v4.value;
;}
aa=pricebasic;priceeach2=0;
if (engchoice==2)
{bb=0.00;dd=0.00;}
else if (engchoice==3)
{bb=document.optionform.engv3.value;
dd=document.optionform.arttext3.value;}
else if (engchoice==4)
{bb=document.optionform.engv3.value;
dd=(document.optionform.arttext3.value*1)+(document.optionform.arttext3a.value*(reqqty5-1))
}
else if (engchoice==5)
{bb=document.optionform.engv3.value;
dd=document.optionform.artclip3.value;}

else if (engchoice==6)
{bb=document.optionform.engv3.value;
dd=(document.optionform.artclip3.value*1)+(document.optionform.artclip3a.value*(reqqty5-1));}

else if (engchoice==7)
{bb=document.optionform.engv3.value;
dd=document.optionform.artlogo3.value;}

else if (engchoice==8)
{bb=document.optionform.engv3.value;
dd=(document.optionform.artlogo3.value*1)+(document.optionform.artlogo3a.value*(reqqty5-1));}

else if (engchoice==9)
{bb=document.optionform.engv1.value;
dd=(document.optionform.artlogo3.value*1)+(document.optionform.artlogo3b.value*(reqqty5-1))}

if (boxchoice==1)
{cc=0.00}
else if (boxchoice==2)
{cc=document.optionform.pbx1.value;cc=cc*1;
}
else if (boxchoice==3)
{cc=document.optionform.bxplaq1.value;cc=cc*1;
}

priceeach2=((pricebasic*1)+(bb*1)+(cc*1)*1);
document.pricetable.priceeach.value=priceeach2.toFixed(2);
dd2=dd*1;
document.pricetable.artwork.value=dd2.toFixed(2);
ee=(document.optionform.deliv1.value*1);
document.pricetable.delivery.value=ee.toFixed(2);
}

function calcprice()
{
aa=0;bb=0;cc=0;dd2=0;dd=0;ee=0;dd2=0;vat2=0;
qtyreqd()
if (chosen==1)
{item1price()}
else if (chosen==2)
{item2price()}
else if (chosen==3)
{item3price()}
totprice=(((aa*1)+(bb*1)+(cc*1))*(reqqty5*1));
document.pricetable.itemtotal.value=totprice.toFixed(2);
xvat=(totprice+dd2+ee);
document.pricetable.totexvat.value=xvat.toFixed(2);
vat2=(totprice+dd2+ee)*.175;
document.pricetable.totalvat.value=vat2.toFixed(2);
grandt=totprice+dd2+ee+vat2;
document.pricetable.totalincvat.value=grandt.toFixed(2);
document.orderform.price1.value=(((aa*1)+(bb*1)+(cc*1))*1).toFixed(2);
document.orderform.qty1.value=(reqqty5*1);
document.orderform.qtyorder.value=(reqqty5*1);
document.orderform.price14.value=(dd*1).toFixed(2);
}

function engrave(){
var popurl="thankyou.htm"
winpops=window.open("/menu/engravehelp.htm","","width=300,height=300,scrollbars,resizable,")
}
function currency(){
var popurl="currency.htm"
winpops=window.open("/menu/currency.htm","","width=400,height=400,scrollbars,resizable,")
}
function metric(){
var popurl="metric.htm"
winpops=window.open("/menu/metric.htm","","width=400,height=400,scrollbars,resizable,")
}
function boxinfo(){
var popurl="metric.htm"
winpops=window.open("http://www.warwickcrystal.co.uk/info/boxinfo.htm","","width=400,height=400,scrollbars,resizable,")
}
function clipartinfo(){
var popurl="clipart"
winpops=window.open("http://www.warwickcrystal.co.uk/info/clipmain.htm","clipA","width=550,height=400,scrollbars,resizable,")
}
function clipartinfo2(){
var popurl="clipart"
winpops=window.open("http://www.warwickcrystal.co.uk/info/clipmain2.htm","clipA","width=550,height=400,scrollbars,resizable,")
}
function textenginfo(){
var popurl="clipart"
winpops=window.open("http://www.warwickcrystal.co.uk/info/textenginfo.htm","","width=550,height=400,scrollbars,resizable,")
}
function crestinfo(){
var popurl="metric.htm"
winpops=window.open("http://www.warwickcrystal.co.uk/info/crestinfo.htm","","width=400,height=400,scrollbars,resizable,")
}
function yourartworkinfo(){
var popurl="metric.htm"
winpops=window.open("http://www.warwickcrystal.co.uk/info/yourartworkinfo.htm","","width=400,height=400,scrollbars,resizable,")
}
function viewclipart(){
var popurl="clipA"
winpops=window.open("http://www.warwickcrystal.co.uk/info/viewclipart.htm",clipA,"width=400,height=400,scrollbars,resizable,")
}
function movein(which){
which.style.background='#00D9D9';
document.body.style.cursor='hand';
}
function moveout(which){
which.style.background='#009D9D';
document.body.style.cursor='default';
}
function goin(which){
which.style.background='#EFFFFF'
}
function goout(which){
which.style.background='#ffffff'
}
function engin(which){
which.style.background='#CBD6E4'
}
function engout(which){
which.style.background='#EBEFF5'
}