<!-- 
order_total =0;  
item_num = 1
present_item = 1;
items_ordered = 0;
total_item_price =0;
maxarray = 50
var st_astr = '<html><body bgcolor=#ffffff>'
var en_astr = '</body></html>'

function change2(nav,main)
{
window.open(nav,"navigate");
window.open(main,"main");
//top.navigate.location=nav;
//top.main.location=main;

}

function item_tot_price(i)
{
 total_item_price = eval((itemlist[i].price * itemlist[i].quan));
 return total_item_price;
}

function all_order_totals()

{order_total = 0.001;
if (item_num > 0)
 {  
for (i =1;i < item_num;i++)
 {order_total = order_total + item_tot_price(i)}
   
 } return order_total;
}

function ship_totals()

{ship_total = 0;
if (item_num > 0)
 {  
 for (i=1; i<item_num; i++)
  {
   code=itemlist[i].code;
   if (code != "LLU" && code != "LLC" && code != "LLO" && code != "DON")
   {ship_total = ship_total + item_tot_price(i); }
  }
 } return ship_total;
}

function remove_nil_items(inputlist)
{var i = 0; 
 var j = 1; 
  for (i=1;i < item_num;i++)
   {if (itemlist[i].quan != 0)
    {temp_array[j]=itemlist[i]
     items_ordered =j 
     j=j+1
     } 
   } 
  itemlist = temp_array
  item_num = items_ordered + 1
}

function update_this_page()
{
var i = 0; 
var k = 0; 
 {for (i = 0;i < parent.main.document.form1.elements.length;i++)
  {for (k=1;k <= items_ordered;k++)
   {
if ((itemlist[k].code ==  parent.main.document.form1.elements[i].name) && (k<=items_ordered) && (i<=parent.main.document.form1.elements.length))
         parent.main.document.form1.elements[i].value = itemlist[k].quan
   }
  }
 }   
}

function item_quan(code)
{
var loc = check_if_in(code)
if (loc > 0)
 var quantities = itemlist[loc].quan
else
 var quantities = 0;
return quantities
}


function createArray(n)
//n		size of array
//init	what you want all values initialized to
{               this.length = n
		var i = 0
		for (i = 1 ; i < n ; i++) 
			this[i] = null;	
                return this
}


function product(code,price,desc,quan,url)
{ this.price = 0
  this.code = code
  this.price = price
  this.desc = desc
  this.quan = quan
  this.url = url
  this.amount = format((price * quan + .005),2);
 return this;
}

var itemlist = new createArray(50);
var temp_array = new createArray(50);

function initialize_arrays(arraysa)
{
for (i = 1;i < maxarray;i++)
{
arraysa[i] = new product('',0,'',0,'')
}
}

function updatemain_order()
{
parent.frames[1].document.close()
// parent.frames[1].document.open()
parent.frames[1].location = "order.html";
parent.frames[1].document.close()
}

function updatenav_nav()
{
  parent.frames[0].document.close()
  // parent.frames[0].document.open()
  parent.frames[0].location = "navigate.htm";
  parent.frames[0].document.close()
}

function check_if_in(code_check) // this works
{
var i = 1
loc = 0;

while ((i < item_num) && (itemlist[i].code != code_check))
  i = i + 1;
   if (itemlist[i].code == code_check)
    loc = i
   else
    loc = -1;

return loc;
}


function additem(codes,prices,descrip,url)
{
loc = check_if_in(codes)
// present_item = item_num
//last_item = item_num;
//alert('item_num = ' + item_num)

if (loc != -1){
  // update existing item
  olditem =  itemlist[loc].quan
  itemlist[loc] = new product(codes,prices,descrip,olditem + 1,url)}
    else // new item
    {olditem =  itemlist[item_num].quan
    itemlist[item_num] = new product(codes,prices,descrip,olditem + 1,url);
    items_ordered = item_num
    item_num = item_num + 1
     }
    remove_nil_items(itemlist)
   
 }

function setitem(quantity,codes,prices,descrip,url)
{
loc = check_if_in(codes)

if (loc != -1){
  // update existing item
  olditem =  itemlist[loc].quan
  itemlist[loc] = new product(codes,prices,descrip,quantity,url)}
    else // new item
    {olditem =  itemlist[item_num].quan
    itemlist[item_num] = new product(codes,prices,descrip,quantity,url);
    items_ordered = item_num
    item_num = item_num + 1
     }
    remove_nil_items(itemlist)
}

function subitem(codes,prices,descrip,url)
{
loc = check_if_in(codes)
if ((loc != -1) && (itemlist[loc].quan > 0)) {
  // update existing item
  olditem =  itemlist[loc].quan
  //alert(' loc is before oldvalue ' + loc);
  //alert('olditem is ' + olditem);
  itemlist[loc] = new product(codes,prices,descrip,olditem - 1,url)}
  //updatepage(codes) 
  
}


initialize_arrays(itemlist)
initialize_arrays(temp_array)

function check_window()
{
if (self.location.href < 'https://secure.www.pacifier.com/rosary-center.org/' ||
    self.location.href > 'https://secure.www.pacifier.com/rosary-center.org/z' )
  {
  urlsplit = self.location.href.split('/');
  self.location = "https://secure.www.pacifier.com/rosary-center.org/" + urlsplit[urlsplit.length-1];
  }

if (self != top)
  {document.write('<head><META HTTP-EQUIV="Refresh" CONTENT="5;URL="https://secure.www.pacifier.com/rosary-center.org/shopcartindex.html"></head> <body><center><h1>Warning!</h1><br><font color=#ff000><b>This is inside a multiple frame window.<br>The scripts may not work correctly!!!!,</font><BR>We are jumping you directly to our <a href="https://secure.www.pacifier.com/rosary-center.org/shopcartindex.html" target="_top">Order page</a>.</center>');
    urlsplit = self.location.href.split('/');
    self.location = "https://secure.www.pacifier.com/rosary-center.org/" + urlsplit[urlsplit.length-1];
    parent.document.close();
  }
}

function format(val, post)
{
    var decpoint;
    var begin;
    var end;
    var valstr;
	var temp_char;

    valstr = "" + val;
	//alert('valstr = ' + valstr);
    decpoint = valstr.indexOf(".")
    if (decpoint != -1) {
	    //alert('decpoint = ' + decpoint);
        begin = valstr.substring(0,decpoint);
        end = valstr.substring(decpoint+1,valstr.length);
		//alert('begin = ' + begin + '\nend= ' + end);
    }
    else {
        begin = valstr;
        end = "";
    } 
	if (end.length < post)
	 {while (end.length < post)
	    {
        end += "0";
        }
	 }
     
	end = end.substring(0,post);
	//alert('begin = ' + begin + '\nend= ' + end);
    return (begin+"."+end);
}

<!--  end hide -->