function random(){
ran = Math.floor(Math.random() * 500) + 1;
}
//var items = new Array(10);
//var numitems = 0;
function Item(d,c,q,itemcode,itemcap) {
this.M_desc = d;
this.M_price = c;
this.M_quantity = q;
this.M_itemcode = itemcode;
this.M_itemcap  = itemcap;
}
function additem(M_desc, M_price,M_quantity,M_itemcode,M_itemcap) {
top.items[++top.numitems] = new Item(M_desc,M_price,M_quantity,M_itemcode,M_itemcap);
displaycart();
}
function displaycart() {
var totalcost=0;
with (parent.cart.document) {
open();
write("<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 3.2 FINAL//EN'>");
write("<HTML><HEAD><META HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=ISO-8859-1'>");
write("<META NAME='Generator' CONTENT='NetObjects Fusion  3.0.1 for Windows'></HEAD><BODY>");
write("<div id='shopping'>");
write("<table border=0 width=155><tr><td><br></td></tr><tr><td align=center>")
write("<IMG HEIGHT=58 WIDTH=107 SRC=cart.gif BORDER=0></td></tr></table>")
if (top.numitems==0) {
write("No items ordered");
close();
return;
}
write("<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=2 WIDTH=155><tr><td align=left><font face=verdana color=000000 size=-2>All prices are quoted delivered to you wherever you are, within 3-7 days by DHL courier.</font></td></tr><tr><td align=right><IMG HEIGHT=28 WIDTH=100 SRC=dhl.gif BORDER=0></td></tr></table>");
write("<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=2 WIDTH=155><FORM NAME='form1'>");
write("<TR><TD width=20 BGCOLOR=#FF9966 rowspan=5><P><FONT SIZE=-2 FACE=Arial>Qty</FONT></P></TD>");
write("<TD width=135 BGCOLOR=#FF9966><P><FONT SIZE=-2 FACE=Arial>Item</FONT></P></TD></tr>");
write("<TR><TD BGCOLOR=#FF9966><P><FONT SIZE=-2 FACE=Arial>Item Code</FONT></P></TD></TR>");
write("<TR><TD BGCOLOR=#FF9966><P><FONT SIZE=-2 FACE=Arial>Capacity</FONT></P></TD></TR>");
write("<TR><TD BGCOLOR=#FF9966><P><FONT SIZE=-2 FACE=Arial>Price/Item</FONT></P></TD></TR>");
write("<TR><TD BGCOLOR=#FF9966><P><FONT SIZE=-2 FACE=Arial>Total $</FONT></P></TD></TR>");


for(i=1;i<=top.numitems;i++) {
write("<TR><TD BGCOLOR=#FFCC99 rowspan=5 width=20>");
write("<INPUT NAME='qty'");
write(" size=3 maxlength=3 TYPE='TEXT' onchange='return top.testcheck(this.form)' VALUE=");
write(top.items[i].M_quantity + ">");
write("<TD width=135 BGCOLOR=#FFCC99><P><FONT SIZE=-2 FACE=Arial>" + top.items[i].M_desc);
write("</font></td></TR>");
write("<TR><TD BGCOLOR=#FFCC99><P><FONT SIZE=-2 FACE=Arial>"+ top.items[i].M_itemcode);
write("</font></td></TR>");
write("<TR><TD BGCOLOR=#FFCC99><P><FONT SIZE=-2 FACE=Arial>"+ top.items[i].M_itemcap);
write("</font></td></TR>");
write("<TR><TD BGCOLOR=#FFCC99><P><FONT SIZE=-2 FACE=Arial>" + top.items[i].M_price);
write("</font></td></TR>");
write("<TR><TD BGCOLOR=#FFCC99><P><FONT SIZE=-2 FACE=Arial>" + (top.items[i].M_price * top.items[i].M_quantity));
write("</font></td>");
write("</TR>");
totalcost += (top.items[i].M_price * top.items[i].M_quantity);
}
write("</table>");
totalcost + Math.floor(totalcost*100) /100;
write("<table width=155><TR><TD width=105 BGCOLOR=#FF9966><B><P><FONT SIZE=-2 FACE=Arial>Grand Total $</font></B></td>");
write("<TD width=50 BGCOLOR=#FF9966><P><FONT SIZE=-2 FACE=Arial>" + totalcost);
write("</font></td></tr>");
write("</TABLE>");
write("<table width=155><tr><td align=left>");
write("<INPUT TYPE=BUTTON VALUE='Update'");
write("onclick='parent.products.updatecart();'>");
write("<br><INPUT TYPE=BUTTON VALUE='Complete Order'");
write("onclick='parent.products.complete();'>");
write("<br><INPUT TYPE=BUTTON VALUE='Clear'");
write("onclick='parent.products.closeCart();'>");
write("</td></tr></table></FORM>");
write("</div>");
write("</BODY></HTML>");
close();
}
}
function updatecart() {
for (i=1; i<=top.numitems;i++) {
if (top.numitems == 1)
top.items[i].M_quantity=parent.cart.document.form1.qty.value;
else
top.items[i].M_quantity=parent.cart.document.form1.qty[i-1].value;
}
displaycart();
}
function complete() {
OrdWin=window.open('completenew.html','OrdWin');
//OrdWin=window.open('https://www.rivageline.com/products_range/completenew.html','OrdWin');
}
function closeCart(){
	top.numitems=0;
	parent.cart.document.all.shopping.innerHTML='';
}