<!-- //  start of shopping cart support script

// modification history
//
// 03/28/02  Updated to allow for sales
// 04/20/02  Fixed bug in "price" field
// 06/07/02  Added time stamp field, fixed "regularly" display
// 10/21/02  Fixed regularly/sale spacing, updated for some xhtml and styles
// 04/08/03  Updated for root directory relative path to files
// 05/03/08  Updated listItem for margin-top setting on Add To Cart button.
// 05/08/08  Updated cartBar() to complete URLs for images
// 12/04/09  Updated for http://static.rainbo.net
// 04/21/10  Updated for saleCategories discounts

// MS Internet Explorer cookie/privacy controls documentation page:
// http://www.microsoft.com/windows/ie/evaluation/overview/privacy.asp

     if (document.images) {
   myImage1 = new Image();
   myImage1.src = "http://static.rainbo.net/cartb2.gif";
   myImage2 = new Image();
   myImage2.src = "http://static.rainbo.net/homebut2.gif";
   myImage3 = new Image();
   myImage3.src = "http://static.rainbo.net/lboxb2.gif";
   myImage4 = new Image();
   myImage4.src = "http://static.rainbo.net/rboxb2.gif";
   myImage5 = new Image();
   myImage5.src = "http://static.rainbo.net/qmbar2.gif";
   myImage6 = new Image();
   myImage6.src = "http://static.rainbo.net/cartbar2.gif";
   myImage7 = new Image();
   myImage7.src = "http://static.rainbo.net/shortb2.gif";
     } // endif

 if (canCookie()) { cartOK = true; }

 var processPath = "/cgi-bin/cookie.cgi";
 var itemCount = 0;        // init item counter for this page
 var saleExpired = false;  // init sale expired flag
 var regDiscount = 0;      // init discount for regular price mdse
 var saleDiscount = 20;     // init discount for sale price mdse
 var pageDiscount = 0;     // init discount for all mdse on page

 var today = new Date();
 var thisDay = today.getDate();
 var thisMonth = today.getMonth() + 1; // ordinal offset
 var thisYear = today.getYear();

// hopefully fix all the old non-compliant browsers
if (thisYear < 100) { thisYear=thisYear+2000; }
if (thisYear < 1900){ thisYear=thisYear+1900; }
if (thisYear < 2000) { thisYear=thisYear+100; }
if (document.images) { thisYear = today.getFullYear(); } // fix new browsers anyway

months = new Array;
 months[0] = "January";
 months[1] = "February";
 months[2] = "March";
 months[3] = "April";
 months[4] = "May";
 months[5] = "June";
 months[6] = "July";
 months[7] = "August";
 months[8] = "September";
 months[9] = "October";
 months[10] = "November";
 months[11] = "December";

// date sale expires
 var expDay = 30;
 var expMonth = 4;
 var expYear = 2010;

// automatically end sale on expDate


   if (thisYear > expYear) { saleExpired = true; }
       if (thisYear == expYear) {
        if (thisMonth > expMonth) { saleExpired = true; }
        if ((thisMonth == expMonth) && (thisDay > expDay)) { saleExpired = true; }
      }  // endif (thisYear == expYear)

var saleCategories = new Array;
  saleCategories[0] = '01';
  saleCategories[1] = '25';

var salePages = new Array;
 salePages[0] = "pages/ahgupuk.htm";
 salePages[1] = "pages/bakshi.htm";
 salePages[2] = "pages/betty.htm";
 salePages[3] = "pages/cats.htm";
 salePages[4] = "pages/cels.htm";
 salePages[5] = "pages/comic-strip.htm";
 salePages[6] = "pages/dinosaur.htm";
 salePages[7] = "pages/dtv.htm";
 salePages[8] = "pages/filmation.htm";
 salePages[9] = "pages/gallery.htm";
 salePages[10] = "pages/gallery2.htm";
 salePages[11] = "pages/goofy.htm";
 salePages[12] = "pages/hb.html";
 salePages[13] = "pages/jayward.htm";
 salePages[14] = "pages/jungle.htm";
 salePages[15] = "pages/limiteds.htm";
 salePages[16] = "pages/lithos.htm";
 salePages[17] = "pages/lobby-cards.htm";
 salePages[18] = "pages/mgmcels.htm";
 salePages[19] = "pages/model-sheets.htm";
 salePages[20] = "pages/ninja-turtles.htm";
 salePages[21] = "pages/otherart.htm";
 salePages[22] = "pages/others.htm";
 salePages[23] = "pages/poohcels.htm";
 salePages[24] = "pages/robin.htm";
 salePages[25] = "pages/sword.htm";
 salePages[26] = "pages/tvcels.htm";
 salePages[27] = "pages/warner.htm";

 salePage = "/pages/cels.htm"; // the place to start!

 var saleCount = salePages.length;    // number of pages from salePages[x] on sale
// var saleCount = 0; // force sale off!

 var saleTitle = "Mother's Day Art Sale!";
 var saleMessage = "<strong>Save " + saleDiscount + "% on all artwork: cels, prints, and lithographs!";
 saleMessage += " From now until " + months[expMonth-1] + " " + expDay + ", all of our cels " +
                  "are on sale for " + saleDiscount + "% off our regular and existing sale prices.</strong> ";
 saleMessage += " A Disney cel or lithograph is a great gift that will be treasured for years as a cherished rememberance of childhood, family and friendship.<br /><br />";
 saleMessage += "Surely Mom deserves something more thoughtful than a box of chocolates from Walgreens or brunch at the local IHop.<br /><br />";
 saleMessage += "<strong> This offer ends at Midnight on " + months[expMonth-1] + " " + expDay + ", " + expYear + " and is subject to change without notice.</strong><br />";

// saleMessage = "Free Priority Mail shipping on orders of $50.00 or more to US customers.  No coupon required!  See the Rainbo News message on the right side of our product pages for details.<br />";


if ((saleCount != 0) && (!saleExpired)) {
   for (i=0; i<saleCount; i++) {
   if (thisPage == salePages[i]) {
   pageDiscount = saleDiscount;  // set sale discount
      } // endif thisPage == salePages[i]
   } // end for i
 }


  function xshowSale() { // use this code to post announcements - no date checking!

   document.writeln("<div align=\"center\"><br /><table cellpadding=\"4\" width=\"450\" style=\"border: solid 1px black; padding:0; border-collapse:collapse;\"><tr><td bgcolor=\"yellow\">");
   document.writeln("<div class=\"itemtitle\" style=\"text-align:center\"><strong>Walt Disney Classics Collection Sale!</strong></div>");
   document.writeln("<p class=\"smalltext\">");
   document.writeln("We've just put our Walt Disney Classics Collection WDCC inventory online at SALE PRICES!  ");
   document.writeln("We need to clear out our inventory and so I've tried to set the sale prices well below the ");
   document.writeln("current market price.  If you see a piece you want, but the price is too high, make an offer by EMail to rick@rainbo.net.  No reasonable offers refused!</p>");
   document.writeln("<br /><p class=\"stdtext\" style=\"text-align:center\"><strong>Shop now and get a great deal!<br><a href=\"/wdcc/disney-classics.htm\">Click Here Now!</a></strong><br /><br />");
   document.writeln("</p>");
   document.writeln("</td></tr></table></div>");

  }  // end xshowSale

//------------------------------
// Set for vacation
//------------------------------
  function yshowSale() { // use this code to post announcements - no date checking!

   document.writeln("<div style=\"width:455px; margin:0 auto;\"><br /><table cellpadding=\"4\" width=\"450\" style=\"border: solid 1px black; padding:0; border-collapse:collapse;\"><tr><td bgcolor=\"yellow\">");
   document.writeln("<div class=\"itemtitle\" align=\"center\"><strong>Rainbo Animation Art is Closed For Vacation</strong></div>");
   document.writeln("<p class=\"smalltext\">");
   document.writeln("We will not be able to process any new orders until we reopen on September 14, 2009, and ");
   document.writeln("we will not be able to respond to your EMails until then.<br /><br />");
   document.writeln("We are attending the D23 Expo at Disneyland and we'll have");
   document.writeln("lots of great new collectibles to offer you when we return!<br />");
//   document.writeln("We appreciate your patience while we take some time for family and friends.<br /></p>");
//   document.writeln("<br /><p class=\"smalltext\" align=\"center\"><strong>We wish you all a Merry Christmas and Happy New Year!</strong><br /><br />");
   document.writeln("</p>");
   document.writeln("</td></tr></table></div>");

  }  // end yshowSale

  function zshowSale() { // use this code to post announcements - no date checking!

   document.writeln("<center><br /><table cellpadding=\"4\" width=\"450\" style=\"border: solid 1px black; padding:0; border-collapse:collapse;\"><tr><td bgcolor=\"yellow\">");
   document.writeln("<div class=\"itemtitle\" align=\"center\"><strong>Rainbo Animation Art is Closed for Maintenance</strong></div><br>");
   document.writeln("<p class=\"stdtext\">");
   document.writeln("<b>We are making some improvements to our website which requires we close briefly - ");
   document.writeln("It should only take a few hours.</b><br /></p><br />");
   document.writeln("<p class=\"smalltext\" align=\"center\"><b>We apologize for any inconvenience.  We will reopen very soon, so please come back later today!<br /><br /></p>");
   document.writeln("</td></tr></table></center>"); 

  }  // end zshowSale


// standard showSale with date checking - replace with letter prefix to swap with a different one
  function showSale() {

    if ((saleCount>0) && (!saleExpired)) {

   document.writeln("<br /><div style=\"width:550px; margin:2px auto; padding:4px 8px; border:double 3px black; background-color:linen;\">");
   document.writeln("<h2 style=\"margin:2px; text-align:center;\">" + saleTitle + "</h2>");
   document.writeln("<p class=\"smalltext\">" + saleMessage);
       if (pageDiscount > 0) {
   document.writeln("<br /><strong>All items on this page have been reduced by " + pageDiscount + "% through " +
      months[expMonth-1] + " " + expDay + ", " + expYear + ".  Other pages have savings, too!</strong><br /><br />");
         } else {
   document.writeln("</p><br /><p class=\"smalltext\" style=\"text-align:center;\"><a class=\"reg\" href=\"" + salePage + "\">Click here</a> " +
                    "to see the first page of the great deals we have for you!<br /><br />");
            }

   document.writeln("</p></div><br />");

   } // endif ((saleCount>0) && (pageDiscount>0))
 }  // end showSale


///////////
///////////

 buyButtonText = "Add&nbsp;To&nbsp;Cart";

///////////
///////////

// use when store closed only!
function xyzlistItem(itemNo, desc, baseWt, unitWt, multiple, price, salePrice) {
  document.write("<strong class=\"item\">Item #" + itemNo + "</strong>&nbsp&nbsp;");

      if ((salePrice == null) || (salePrice == 0)) {
  document.write("<strong class=\"item\">$" + makeDollars(price) + "<strong><br />");
    } else {
//  ******** used to have 2 &nbsp; here!  ************
  document.writeln("regularly&nbsp;$" + makeDollars(price) + "  <strong class=\"saleprice\">SALE&nbsp;PRICE:&nbsp;$" + makeDollars(salePrice) + "</strong>  \n");
//  ******** used to have 2 &nbsp; here!  ************
        }  // endif salePrice

  }  // end xyzlistItem

///////////////////////
//
// Working Code Below
//
///////////////////////

  function listItem(itemNo, desc, baseWt, unitWt, multiple, price, salePrice) {
    oldSalePrice = salePrice;
    categoryMatch = false;
   if (!saleExpired) { 

   var itemInfo = itemNo.split('-');
   var itemClass = itemInfo[0];

// Check Sale Categories!
  if ((saleCategories[0] != '') && (pageDiscount == 0)) {  // do catMatch only if pageDis == 0
    for (i=0; i<saleCategories.length; i++) {
     if (itemClass == saleCategories[i]) { pageDiscount = saleDiscount; categoryMatch = true; }
    } // end for i
  } // endif saleCategories[0]

   } else {
  pageDiscount = 0;
  } // endif !saleExpired


   if (cartOK) {  // only display link if cookies are enabled
  itemCount++;
  document.write("<form method=\"post\" action=\"" + processPath + "\" ");
  document.writeln("name=\"item" + itemCount + "\">");
  document.write("<strong class=\"item\">Item #" + itemNo + "</strong>&nbsp&nbsp;");

   if (pageDiscount != 0) {
      if ((salePrice == null) || (salePrice == 0)) {
        salePrice = price - (price*(pageDiscount/100));
       } else {
        if (price == 0) { price = salePrice; }
        salePrice = salePrice - (salePrice*(pageDiscount/100));
      } // endif salePrice == 0
   } // endif pageDiscount != 0

   if ((salePrice == null) || (salePrice == 0)) {
     document.writeln("<b class=\"item\">$" + makeDollars(price) + "</b>&nbsp;&nbsp;");
       } else {
    if (price != 0) {
  document.writeln("regularly&nbsp;$" + makeDollars(price) + "  <strong class=\"saleprice\">SALE&nbsp;PRICE:&nbsp;$" + makeDollars(salePrice) + "</strong>  \n");
       } else {
  document.writeln("<strong class=\"saleprice\">SPECIAL&nbsp;VALUE:&nbsp;$" + makeDollars(salePrice) + "</strong>  \n");
        }
        }

  document.writeln("<input type=\"hidden\" name=\"thisPage\" value=\"" + document.location + "\">\n");
  document.write("<input type=\"hidden\" name=\"command\" value=\"AddItem\">\n");
  document.write("<input type=\"hidden\" name=\"itemNo\" value=\"" + itemNo  + "\">\n");
  document.write("<input type=\"hidden\" name=\"desc\" value=\"" + desc  + "\">\n");
  document.write("<input type=\"hidden\" name=\"baseWt\" value=\"" + baseWt  + "\">\n");
  document.write("<input type=\"hidden\" name=\"unitWt\" value=\"" + unitWt  + "\">\n");

// !!!!!!!!! //
  sellPrice = price;
// !!!!!!!!! //

   if ((salePrice != 0) && (salePrice != null)) { sellPrice = makeDollars(salePrice); }

  document.write("<input type=\"hidden\" name=\"price\" value=\"" + sellPrice  + "\">\n");

  document.write("<br />\n");  // add a hard break before Qty./Add Button
  document.write("<p style=\"margin-top:7px;\">");

   if (multiple) {
  document.write("<b>Qty.</b>&nbsp;&nbsp;<input type=\"text\" size=\"2\" name=\"qty\" value=\"1\" style=\"font-size:9px;\">&nbsp&nbsp;");
     } else {
  document.write("<input type=\"hidden\" name=\"qty\" value=\"1\">\n");
  } // endif multiple

  document.write("<input type=\"hidden\" name=\"clickTime\" value=\"\">\n");
//  document.write("<input type=\"image\" src=\"http://static.rainbo.net/add.gif\" border=\"0\" onclick=\"addClick(this.form);\">\n");
  document.write("<a class=\"addButton\" href=\"#\" onclick=\"javascript:addClick(document.forms.item" + itemCount + ");return false;\">&nbsp;" + buyButtonText + "&nbsp;</a></p>\n");
  document.writeln("</form>");

  } else {
// in case (!cartOK) but JavaScript works
   document.writeln("<strong>Item #" + itemNo + ":&nbsp;$" + makeDollars(price) + "</strong><br>");
   } // endif cartOK
   if (categoryMatch) { pageDiscount = 0; }  // patch for mixed pages
 } // end listItem

 function addClick (form) {
   addTime = new Date();
   addClickTime = addTime.getTime();
   form.clickTime.value = addClickTime;
   form.submit();
  } // end addClick

 function viewButton() {
     if (cartOK) {  // cart requires JavaScript and cookies
   document.writeln("<form method=\"post\" action=\"" + processPath + "\" name=\"viewForm\" style=\"text-align:center\">");
   document.writeln("<input type=\"hidden\" name=\"command\" value=\"ViewCart\">");
   document.writeln("<input type=\"hidden\" name=\"thisPage\" value=\"" + document.location + "\">\n");
   document.writeln("<input type=\"submit\" name=\"viewCart\" value=\"Review Your Order or Checkout\" style=\"font-size: 10px;\">");
   document.writeln("</form>");
      }  // 
  } // end viewButton

 function doView() {
   document.forms.viewForm.submit();
    }

 function makeDollars(value) {
   var  dStr = "";
   var  tStr = "";
   var  sValue = 0;
  with (Math) {
    sValue = round(value*100);
    tStr = " " + sValue;
    lValue = tStr.length;
    dStr = tStr.substring(1, lValue-2) + "." + tStr.substring(lValue-2, lValue);
       } // end with(Math)
    return dStr;
  } // end makeDollars

 function listOffer(itemNo,desc,baseWt,unitWt,qty,price) {
 
//      $command = $query->param('command');
//      $itemNo = $query->param('itemNo');    # field 0
//      $desc =  $query->param('desc');       # field 1
//      $baseWt = $query->param('baseWt');    # field 2
//      $unitWt =  $query->param('unitWt');   # field 3
//      $qty =  $query->param('qty');         # field 4
//      $price = $query->param('price');      # field 5

  document.writeln("<form method=\"post\" name=\"offer_" + itemNo +
       "\" action=\"../cgi-bin/makeOffer.cgi\">");
    makeInput("hidden","command","newOffer");
    makeInput("hidden","itemNo",itemNo);
    makeInput("hidden","desc",desc);
    makeInput("hidden","baseWt",baseWt);
    makeInput("hidden","unitWt",unitWt);
    makeInput("hidden","qty",qty);
    makeInput("hidden","price",price);
  document.writeln("<input type=\"image\" src=\"http://static.rainbo.net/offer1.gif\">");
  document.writeln("</form>");

  } // end listOffer

 function makeInput(tmp,tmp1,tmp2) {
// $tmp = TYPE, $tmp1 = NAME, $tmp2 = VALUE
 document.writeln("<input type=\"" + tmp + "\" name=\"" + tmp1 + 
      "\" value=\"" + tmp2 + "\">");
  } // end makeInput

// -->


 function cartBar() {
// draw extra icons in rainbo bar - works only on files in /pages!
  document.write("<td bgcolor=\"red\" width=\"30\"><a href=\"javascript: popHelp();\" onmouseover=\"qmbar.src='http://static.rainbo.net/qmbar2.gif';\" onmouseout=\"qmbar.src='http://static.rainbo.net/qmbar1.gif';\">");
  document.write("<img src=\"http://static.rainbo.net/qmbar1.gif\" border=\"0\" width=\"30\" height=\"20\" alt=\"Help\" title=\"Help\" name=\"qmbar\"></a></td>");

   if (cartOK) {  // can't view cart without cookies and JavaScript
  document.write("</td><td bgcolor=\"red\" width=\"30\"><a href=\"" + processPath + "?command=ViewCart&amp;thisPage=" + document.location + "\" ");
  document.write("onmouseover=\"cartbar.src='http://static.rainbo.net/cartbar2.gif';\" onmouseout=\"cartbar.src='http://static.rainbo.net/cartbar1.gif';\"><img src=\"http://static.rainbo.net/cartbar1.gif\" border=\"0\" width=\"30\" height=\"20\" alt=\"View Your Shopping Cart\" title=\"View Your Shopping Cart\" name=\"cartbar\"></a></td>");
   } // endif cartOK
 } // end cartBar


 function cartBar2() { // was CartBar2
// draw extra icons in rainbo bar - works only on files in /pages!
// relies on document.location for setting thisPage??????
  document.write("<a href=\"javascript: popHelp();\" onmouseover=\"qmbar.src='http://static.rainbo.net/qmbar2.gif';\" onmouseout=\"qmbar.src='http://static.rainbo.net/qmbar1.gif';\">");
  document.write("<img src=\"http://static.rainbo.net/qmbar1.gif\" border=\"0\" width=\"30\" height=\"20\" alt=\"Help\" title=\"Help\" name=\"qmbar\"></a>");

   if (cartOK) {  // can't view cart without cookies and JavaScript
  document.write("</td><td bgcolor=\"red\" width=\"30\"><a href=\"" + processPath + "?command=ViewCart&amp;thisPage=" + document.location + "\" ");
  document.write("onmouseover=\"cartbar.src='http://static.rainbo.net/cartbar2.gif';\" onmouseout=\"cartbar.src='http://static.rainbo.net/cartbar1.gif';\"><img src=\"http://static.rainbo.net/cartbar1.gif\" border=\"0\" width=\"30\" height=\"20\" alt=\"View Your Shopping Cart\" title=\"View Your Shopping Cart\" name=\"cartbar\"></a>");
   } // endif cartOK
 } // end cartBar2


 function showNoCookies() {
   cookieTitle = "Cookies Can Be Good For You!";
   cookieMessage = "Your browser is not accepting cookies.  Our website uses cookies " +
                   "to deliver special features, including access to our online " +
                   "ordering system.  Please turn cookie support back on in your " +
                   "browser, or at least enable them for our website.  We promise " +
                   "to respect your <a href=\"/about.htm#privacy\">privacy.</a> " +
                   "Once you have turned cookie support back on, please press the <strong>Reload</strong> or <strong>Refresh</strong>" +
                   "button.  Thank-you.";
   document.writeln("<center><table cellpadding=\"4\" width=\"350\" style=\"border: solid 1px black; padding:0px;\"><tr><td bgcolor=\"yellow\">");
   document.writeln("<center><strong class=\"smalltitle\">" + cookieTitle + "</strong></center>");
   document.writeln("<p class=\"smalltext\">" + cookieMessage);
   document.writeln("</p>");
   document.writeln("</td></tr></table></center>");

 } // end showNoCookies
