// JavaScript Document
// Begin
function NewWindow(mypage, myname, w, h, scroll) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
win = window.open(mypage, myname, winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}
// End

//<!--
vsval1="";
if (!document.cookie){
document.cookie ="vspref="+document.referrer+"; path=/;";
}//-->

//<!--
function vsemail(vadr,msg){
var vsemp=/^(.+)@(.+)$/
var vssch="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
var validChars="\[^\\s" + vssch + "\]"
var vseu="(\"[^\"]*\")"
var vsipd=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
var vsatm=validChars + '+'
var vsbit="(" + vsatm + "|" + vseu + ")"
var vsup=new RegExp("^" + vsbit + "(\\." + vsbit + ")*$")
var vsdp=new RegExp("^" + vsatm + "(\\." + vsatm +")*$")
var vsma=vadr.match(vsemp)
if (vsma==null){
alert(msg)
return false
}
var vsubit=vsma[1]
var vsdom=vsma[2]

if (vsubit.match(vsup)==null){
alert(msg)
return false
}
var vsipa=vsdom.match(vsipd)
if (vsipa!=null){
for (var i=1;i<=4;i++){
if (vsipa[i]>255){
alert(msg)
return false
}
}
}
var vsdar=vsdom.match(vsdp)
if (vsdar==null){
alert(msg)
return false
}
var vsapa=new RegExp(vsatm,"g")
var vsdoa=vsdom.match(vsapa)
var len=vsdoa.length
if ((vsdoa[vsdoa.length-1].length<2)||(vsdoa[vsdoa.length-1].length>3)){
alert(msg)
return false
}
if (len<2){
alert(msg)
return false
}
}
// -->

//<!--
thispage="cheque-order.html";
vsval2="";
vsval3="";
nextpage="cheque-order.html";
vscurrency="&#163;";
vscartresponse="has been added to your basket.\n\nPlease make sure you have accepted our terms and conditions then click\n\nthe PLACE YOUR ORDER button to proceed to send this form using our Secure Server";
delship="";
deltax="";
vsshipdescrip="Shipping";
vstaxdescrip="Tax";
//-->

//<!--
//(c)VirtualShop by White-Hot Design.

var vsshipdescrip;
var vstaxdescrip;
var vsapu;
var vstb;

function priceFormat(value) {
if (parseFloat(value) < 0) {value=value-(value*2);vsminus=1;} else {vsminus=0;}
  roundup=""+value+"";
  if (roundup.substring(9,17)=='99999999'){
  value+=0.0000000000001;
  }
 if (parseInt(value) > 0.99) {
 adjHundred = parseInt(value);
 ften = parseInt((value+.0008 - parseInt(value))* 100);
  if (ften < 10) {
  adjTen = '0' + ften;}
  else{
  adjTen = ften;
  }
 adjResult = adjHundred + '.' + adjTen;
 } else {
 ften = '0' + value;

  if (ften.charAt(4) == "0") {
  adjResult = '0' + ften.charAt(1) + ften.charAt(2) + ften.charAt(3);
  } else {
  adjResult = '0' + ften.charAt(1) + ften.charAt(2) + ften.charAt(3) + ften.charAt(4);
  if (!ften.charAt(4)){adjResult = adjResult+'0';}
  if (adjResult == '000') {adjResult=0;}
  }
 }
 ften='';ftin='';adjTen=0;
 for (var i = 0; i < adjResult.length; i++) {
 if(adjResult.charAt(i) == '.') {adjTen=1;}
 if(adjTen==1) {ften+=adjResult.charAt(i);} else {ftin+=adjResult.charAt(i);}
 }
if (ftin=='00'){ftin='0';}

 adjResult=ftin+ften.charAt(0)+ften.charAt(1)+ften.charAt(2)
 if (adjResult.length == 3){adjResult=adjResult+'0'}
if (vsminus == 1) {adjResult='-'+adjResult;}
if (!adjResult) {adjResult='0.00'};
return (adjResult);
}

function displayCart(vsshowtax,vsccolor1,vsccolor2,vscfont,vscfontsize,vscfontcolor,vscfont1,vscfontsize1,vscfontcolor1,vsitems,vsqty,vseach,vstotal,vsremove,vsordertotal,vsempty,vscborder,vsbold,vsbold1,showrembut) {
afval=0;
orderref='';
vstb1=0;vstb2=0;vstb3=0;vstb4=0;vstb5=0;vstb6=0;vstb7=0;vstb8=0;vstb9=0;vstb10=0;vstb11=0;vstb12=0;
vstrack = document.cookie.indexOf("vsCart");
startcount = (document.cookie.indexOf("=", vstrack) + 1);
finishcount = document.cookie.indexOf(";", vstrack);
if (finishcount == -1) {
 finishcount = document.cookie.length;
 }
alldata = document.cookie.substring(startcount, finishcount);
alltotal = 0;
allweight = 0;
listcount = 0;
vscount = 0;
if (vsshowtax==0) {document.writeln('<TABLE width=100% border="0" border='+vscborder+' cellspacing=1 cellpadding=3 '+vsccolor1+' cols=5>');}
 for (var i = 0; i <= alldata.length; i++) {
  if (alldata.substring(i,i+1) == ']') {
  listcount=listcount+1;
  }
 }
 if (listcount > 0){
  if (vsshowtax==0) {
   if (showrembut==2){
   document.writeln('<TR><td nowrap><font face="'+vscfont+'" size='+vscfontsize+' color='+vscfontcolor+'>'+vsbold+'<img src="im/general/cart7.gif" valign=bottom border=0 hspace=5>'+vsitems+'</TD><TD valign="bottom" width=1 colspan=1><font face="'+vscfont+'" size='+vscfontsize+' color='+vscfontcolor+'>'+vsbold+vsqty+'</b></TD><TD valign="bottom" width=1 colspan=1><font face="'+vscfont+'" size='+vscfontsize+' color='+vscfontcolor+'>'+vsbold+vseach+'</TD><td valign="bottom" width=1 colspan=1 align=right><font face="'+vscfont+'" size='+vscfontsize+' color='+vscfontcolor+'>'+vsbold+vstotal+'</TD></TR>');
   }else{
   document.writeln('<TR><td nowrap><font face="'+vscfont+'" size='+vscfontsize+' color='+vscfontcolor+'>'+vsbold+'<img src="im/general/cart7.gif" valign=bottom border=0 hspace=5>'+vsitems+'</TD><TD valign="bottom" width=1 colspan=1><font face="'+vscfont+'" size='+vscfontsize+' color='+vscfontcolor+'>'+vsbold+vsqty+'</b></TD><TD valign="bottom" width=1 colspan=1><font face="'+vscfont+'" size='+vscfontsize+' color='+vscfontcolor+'>'+vsbold+vseach+'</TD><td valign="bottom" width=1 colspan=1 align=right><font face="'+vscfont+'" size='+vscfontsize+' color='+vscfontcolor+'>'+vsbold+vstotal+'</TD><TD valign="bottom" width=1 colspan=1 align=center><font face="'+vscfont+'" size='+vscfontsize+' color='+vscfontcolor+'>'+vsbold+vsremove+'</TD></TR>');
   }
  }
 } else {
 if (vsshowtax==0) {document.writeln('<TR><TD colspan=5><font face="'+vscfont+'" size='+vscfontsize+' color='+vscfontcolor+'>'+vsbold+'<img src="im/general/cart7.gif" align=middle border=0 hspace=5><font face="'+vscfont+'" size='+vscfontsize+' color='+vscfontcolor+'>'+vsbold+vsempty+'</TD></TR>');}
 }
listcount = 0;
 for (var i = 0; i <= alldata.length; i++) {
  if (alldata.substring(i,i+1) == '[') {
  listbegin = i+1;
  } else if (alldata.substring(i,i+1) == ']') {
  listfinish = i;
  listtotal = 0;
  vscount = 0;
  listtotal = (eval(vsprice*vsamount));
  vsweight = vsweight * vsamount;
  liststore = listtotal * 100;
  alltotal = alltotal + listtotal;
  allweight = allweight + vsweight;
  listcount=listcount+1;

   vscode = '';
   vswpobject = '';
   vshavcode = '';
    for (var j = 0; j <= vsobject.length; j++) {
     if ((vsobject.charAt(j) != ':')){
      if (vshavcode == '1'){
      if (vsobject.charAt(j-1) != ':') {vswpobject = vswpobject+vsobject.charAt(j);}
      }else{
      vscode = vscode+vsobject.charAt(j);
      }
    }else{
    vshavcode = '1';

if (vscode == vsshipdescrip) {delship = listcount;}
if (vscode == vstaxdescrip) {deltax = listcount;}
    }
   }

   if (vsshowtax==0) {
   listtotal=priceFormat(listtotal);
   if (!vsprice){vsprice=0;listtotal=0;}


   if ((vscode==vsshipdescrip||vscode==vstaxdescrip) && (showrembut==1)){
   vsshowdel='&nbsp;';
   }else{
   vsshowdel='<a href="javascript:clearSlot('+listcount+')"><image src=im/general/delete2.gif border=0></a>';
   }

   if (showrembut==2) {
   remcolumn=''
   }else{
   remcolumn='<td align=center colspan=1><font face="'+vscfont1+'" size='+vscfontsize1+' color='+vscfontcolor1+'>'+vsbold1+vsshowdel+'</td>'
   }

   document.writeln('<tr '+vsccolor2+'><td><font face="'+vscfont1+'" size='+vscfontsize1+' color='+vscfontcolor1+'>'+vsbold1+vsobject+'</td><td colspan=1 align=center><font face="'+vscfont1+'" size='+vscfontsize1+' color='+vscfontcolor1+'>'+vsbold1+vsamount+'</td><td colspan=1 nowrap align=right><font face="'+vscfont1+'" size='+vscfontsize1+' color='+vscfontcolor1+'>'+vsbold1+vsprice+'</td><td colspan=1 align=right nowrap><font face="'+vscfont1+'" size='+vscfontsize1+' color='+vscfontcolor1+'>'+vsbold1+listtotal+'</td>'+remcolumn+'</tr>');
   document.writeln('<INPUT TYPE="hidden" NAME="Purchase'+listcount+'" VALUE="'+vsobject+'">');
   vsval1=vsval1+"Purchase"+listcount+",";
   document.writeln('<INPUT TYPE="hidden" NAME="Quantity'+listcount+'" VALUE="'+vsamount+'">');
   vsval1=vsval1+"Quantity"+listcount+",";
   document.writeln('<INPUT TYPE="hidden" NAME="Price Each'+listcount+'" VALUE="'+vsprice+'">');
   vsval1=vsval1+"Price Each"+listcount+",";
   document.writeln('<INPUT TYPE="hidden" NAME="Total Cost'+listcount+'" VALUE="'+listtotal+'">');
   vsval1=vsval1+"Total Cost"+listcount+",";
   }
}

else if (alldata.substring(i,i+1) == '#') {
vscount = vscount + 1;
   if (vscount == 1) {vsobject = alldata.substring(listbegin, i);}
   if (vscount == 2) {vsprice = alldata.substring(listbegin, i);}
   if (vscount == 3) {vsweight = alldata.substring(listbegin, i);}
   if (vscount == 4) {vsamount = alldata.substring(listbegin, i);}
   if (vscount == 5) {vstb1 += (parseFloat(alldata.substring(listbegin, i))*vsamount)*vsprice/100;}
   if (vscount == 6) {vstb2 += (parseFloat(alldata.substring(listbegin, i))*vsamount)*vsprice/100;}
   if (vscount == 7) {vstb3 += (parseFloat(alldata.substring(listbegin, i))*vsamount)*vsprice/100;}
   if (vscount == 8) {vstb4 += (parseFloat(alldata.substring(listbegin, i))*vsamount)*vsprice/100;}
   if (vscount == 9) {vstb5 += (parseFloat(alldata.substring(listbegin, i))*vsamount)*vsprice/100;}
   if (vscount == 10) {vstb6 += (parseFloat(alldata.substring(listbegin, i))*vsamount)*vsprice/100;}
   if (vscount == 11) {vstb7 += (parseFloat(alldata.substring(listbegin, i))*vsamount)*vsprice/100;}
   if (vscount == 12) {vstb8 += (parseFloat(alldata.substring(listbegin, i))*vsamount)*vsprice/100;}
   if (vscount == 13) {vstb9 += (parseFloat(alldata.substring(listbegin, i))*vsamount)*vsprice/100;}
   if (vscount == 14) {vstb10 += (parseFloat(alldata.substring(listbegin, i))*vsamount)*vsprice/100;}
   if (vscount == 15) {vstb11 += (parseFloat(alldata.substring(listbegin, i))*vsamount)*vsprice/100;}
   if (vscount == 16) {vstb12 += (parseFloat(alldata.substring(listbegin, i))*vsamount)*vsprice/100;}
   listbegin = i+1;
  }
 }

 if (listcount > 0) {
 vsval1=vsval1+"Goods Total,";
 if (vsshowtax==0) {
 if (showrembut==2){vsmtcol=''}else{vsmtcol='<td>&nbsp;</td>'}
 document.writeln('<tr><td colspan=3 align=right><font face="'+vscfont+'" size='+vscfontsize+' color='+vscfontcolor+'>'+vsbold+vsordertotal+': '+vscurrency+'</b></td><td align=right bgcolor=#eeeeff><font size=2 color=#ff0000><font face="'+vscfont+'" size='+vscfontsize+' color='+vscfontcolor+'></font>'+vsbold+priceFormat(alltotal)+'</b></td><td align=center><b>Free Delivery</b></td>'+vsmtcol+'</tr></table>');
 document.writeln('<INPUT TYPE="hidden" NAME="Goods Total" VALUE="'+priceFormat(alltotal)+'">');
    vsnl=new Date();
    orderref=vsnl.getDate()+''+(vsnl.getMonth()+1)+''+vsnl.getYear()+''+vsnl.getHours()+''+vsnl.getMinutes()+''+vsnl.getSeconds()+parseInt(alltotal);
    document.writeln('<input type=hidden name=vshop_orderref value='+orderref+'>');

  vs2x=0
  vs2y=0
  if (delship){
  vs2x=priceFormat(parseFloat(document.vsorder['Total Cost'+delship].value));
  }
  if (deltax){
  vs2y=priceFormat(parseFloat(document.vsorder['Total Cost'+deltax].value));
  }

  if (listcount>0){
  afval=priceFormat(priceFormat(parseFloat(alltotal))-(parseFloat(vs2x)+parseFloat(vs2y)));
  document.writeln('<input type=hidden name=vshop_netamount value='+afval+'>');
  }
}
 } else {
if (vsshowtax==0) {document.writeln('<tr><td colspan=5>&nbsp;</td></tr></TABLE>');}
 }
}



function clearSlot(datnumber) {
wantItList = null;
listcount = 0;
 for (var i = 0; i <= alldata.length; i++) {
  if (alldata.substring(i,i+1) == '[') {
  listbegin = i+1;
  } else if (alldata.substring(i,i+1) == ']') {
  listfinish = i;
  listcount=listcount+1;
   if (listcount != datnumber) {
   wantItList = wantItList+'['+alldata.substring(listbegin, listfinish)+']';
   }
  }
 }
document.cookie="vsCart="+wantItList+"; path=/;";
if (thispage){location = thispage;}else{window.location.reload();}
}

function addToCart(wantIt, wantPrice, wantWeight, wantAmount, vstb1, vstb2, vstb3, vstb4, vstb5, vstb6, vstb7, vstb8, vstb9, vstb10, vstb11, vstb12, noreload, remslot, vsnooptxt, vszeroitems) {
x = 0; vsicode = '';
 for (var i = 0; i <= wantIt.length; i++) {
 if (wantIt.charAt(i) == ':') {
  x = x + 1;
  } else {
  if (!x) {vsicode = vsicode+wantIt.charAt(i);}
  }
 }

if (x > 1) {
alert(vsnooptxt);
} else {

if (remslot){
 if (((delship) && (vsicode == vsshipdescrip))||((deltax) && (vsicode == vstaxdescrip))){
 wantItList = null;
 listcount = 0;
  for (var i = 0; i <= alldata.length; i++) {
   if (alldata.substring(i,i+1) == '[') {
   listbegin = i+1;
   } else if (alldata.substring(i,i+1) == ']') {
   listfinish = i;
   listcount=listcount+1;
    if ((listcount != delship)&&(listcount != deltax)) {
    wantItList = wantItList+'['+alldata.substring(listbegin, listfinish)+']';
    }
   }
  }
document.cookie="vsCart="+wantItList+"; path=/;";
 }
}
vsMcode = '';
gd = 0;
pPrice = '';
 for (var i = 0; i <= wantIt.length; i++) {
  if (wantIt.charAt(i) == '[') {
  gd = 1;}
  if (wantIt.charAt(i) == ']') {
  gd = 0;}

if (gd == 0) {
 if (wantIt.charAt(i) != ']'){
 pPrice = pPrice+wantIt.charAt(i);}
} else {
 if (wantIt.charAt(i) != '['){
 vsMcode = vsMcode+wantIt.charAt(i);}
 }
}
wantIt = pPrice;
pPrice = '';
 for (var i = 0; i <= wantIt.length; i++) {
 if (wantIt.charAt(i) != ':') {
  pPrice = pPrice + wantIt.charAt(i);
  }else
  {
  pPrice = pPrice + vsMcode + ':';
  }
 }
wantIt = pPrice;

pPrice = '';
vsmin = '0'
 if (wantPrice.charAt(wantPrice.length-1) == '%'){
  for (var x = 0; x < wantPrice.length-1; x++) {
   if (wantPrice.charAt(x) != '-'){pPrice = pPrice + wantPrice.charAt(x);} else {vsmin = '1';}
   }
 wantPrice = (pPrice * priceFormat(alltotal)) / 100;
 wantPrice = priceFormat(wantPrice);
 if (vsmin == '1') {wantPrice = '-'+wantPrice;}
 }
 pPrice=''
  if ((wantPrice.charAt(wantPrice.length-3) != '.') && (wantPrice.charAt(wantPrice.length-3) != "0")){
  for (var x = 0; x < wantPrice.length-1; x++) {
  pPrice = pPrice + wantPrice.charAt(x);
  }
  wantPrice = pPrice;
 }
 if (wantAmount <= 0) {
 alert(vszeroitems);
 return;
 }

 vstrack = document.cookie.indexOf("vsCart");
 startcount = (document.cookie.indexOf("=", vstrack) + 1);
 finishcount = document.cookie.indexOf(";", vstrack);
  if (finishcount == -1) {
  finishcount = document.cookie.length;
  document.cookie="vsCart="+document.cookie.substring(startcount, finishcount)+"["+wantIt+"#"+wantPrice+"#"+wantWeight+"#"+wantAmount+"#"+vstb1+"#"+vstb2+"#"+vstb3+"#"+vstb4+"#"+vstb5+"#"+vstb6+"#"+vstb7+"#"+vstb8+"#"+vstb9+"#"+vstb10+"#"+vstb11+"#"+vstb12+"#]; path=/;";
   if (!noreload){
    if (nextpage){location = nextpage;}else{alert(wantAmount+' x '+wantIt+' '+vscartresponse);}
   }
  }
 }
}
//-->

//<!--
function popup(url){
window.open(url,'csc',"scrollbars=yes,resizable=no,width=500,height=450,topmargin=0,leftmargin=0")
}
//-->

//<!--
function vsgetrefer(){
 for (var j = 0; j <= document.cookie.length; j++) {
  if (document.cookie.substring(j,j+7) == 'vspref=') {
  startref=j+7;
   for (var j = startref; j <= document.cookie.length; j++) {
    if (document.cookie.charAt(j) == ';'){
    return(document.cookie.substring(startref,j));
    }
   }
  }
 }
 return '';
}
document.writeln('<INPUT TYPE="hidden" NAME="Referring URL" VALUE="'+vsgetrefer()+'">');
//-->


//<!--
function vsgetrequired(){
 c='';
 y=document.vsorder.required.value;
 z=0;
 for(g=1;g<=y.length+1;g++) {
  if (y.substring(g,g+1)==','||g==y.length) {
  x=y.substring(z,g);
if(document.vsorder[x].name=='E-Mail'){
notemail=vsemail(document.vsorder[x].value,'The E-Mail address you entered appears to be invalid!\n\nIf you are sure you have typed in your email address correctly, please\nreport the problem by sending us an email. Please view contact page.\n\nWe will then contact you regarding your order as soon as possible.\n\nTHANK YOU');
if (notemail==false){return false};
}
if(document.vsorder[x].name=='Credit_Card_No'){
notcc=vsCCno(document.vsorder.Credit_Card_No.value,'');
if (notcc==false){return false};
}
  b=document.vsorder[x].value;
   if (b==null){
   b=document.vsorder[x].options[document.vsorder[x].selectedIndex].text
   }
    if (b.length==0){
     if (c.length>0){
     c=c+'\n'+document.vsorder[x].name;
     }else{
     c=document.vsorder[x].name;
     }
    }
  z=g+1;
  }
 }
 if (c.length>0){
 alert(vsnovals+'\n\n'+c);
 return false
 }
}
//-->
















