//
// @(#)$Header:   //VM/ecom/archives/agstore/htdocs/store/includes/cartMessages.js-arc   1.4   15 Apr 2008 14:35:08   dolejsis  $
//
function cartHeader() 
{
 return "<td valign=\"middle\" height=\"0\">" +
        "&nbsp;&nbsp;<img src=\"/images/sc_header.gif\" border=\"0\" ALT=\"Shopping Bag\">" +
        "</td>";
}

function keyCodeLabel() 
{
 return "Enter key code or promotional code (optional):";
}

function Write_add_to_bag(p_gift_registry_number) {
  var sOutput = "";
  if (p_gift_registry_number == ''){
    sOutput = sOutput + '&nbsp;Add to Bag. </td>';
    sOutput = sOutput + '<td valign="center" align="left">';
    sOutput = sOutput + '<a class="actionOn" href="javascript:document.cartform.submit();"><img src="/checkout/images/bag/addtobag.gif" border="0" alt="Add to Bag"></a>';
  } else {
    sOutput = sOutput + '</td>';
    sOutput = sOutput + '<td valign="center" align="right">';
    sOutput = sOutput + '<a class="actionOn" href="javascript:document.cartform.submit();"><img src="/gift_registry/images/btn_addtoregistry.gif" border="0" alt="Add to Registry"></a>';
  }

  document.write(sOutput);
}

function Write_Cart_Instructions() {
  var sOutput = "";
  sOutput = '<b>If you make any changes to your shopping bag, be sure to press the "Update Items" button.</b>';
  document.write(sOutput);
}

function Write_Save_Cart_Instructions() {
  var sOutput = "";
  sOutput = sOutput + '<b>To save your shopping bag contents for 30 days, ';
  sOutput = sOutput + '<a href="shopping_cart_interface.save_cart?p_sc_type=S" target="_main">click here</a>.</b>';
  document.write(sOutput);
}

function Write_Cart_Saved() {
  var sOutput = "";
  sOutput = sOutput + '<b class=hl1b>The contents of your shopping bag will be stored for 30 days. ';
  sOutput = sOutput + 'Please log in when you return to americangirl.com to access your order. ';
  sOutput = sOutput + 'Note that saving the contents does not guarantee item availability.</b>';
  document.write(sOutput);
}

function Write_Sold_Out_Message() {
  var sOutput = "";
  sOutput = 'We are sorry, the following item(s) you selected are Sold Out and cannot be purchased at this time: ';
  document.write(sOutput);
}

function Write_Invalid_Key_Code() {
  var sOutput = "";
  sOutput = sOutput + 'is an invalid Key Code. Please check the back of your catalogue and re-enter the code. ';
  sOutput = sOutput + 'If you continue to get this error, leave the Key Code blank and begin entering Product Codes.';
  document.write(sOutput);
}

function Write_Invalid_Key_Code_Msg() {
  var sOutput = "";
  sOutput = sOutput + 'is an invalid Key Code. Please check the back of your catalogue and re-enter the code. ';
  sOutput = sOutput + 'If you continue to get this error, leave the Key Code blank and proceed with shopping.';
  document.write(sOutput);
}

function Write_Invalid_Item(prodcode) {
  var sOutput = "";
  sOutput = "We're sorry. " + prodcode + " is an invalid Product Code.";
  document.write(sOutput);
}

function Write_Unavailable_Item(prodcode) {
  var sOutput = "";
  sOutput = "We're sorry. " + prodcode + " currently sold out.";
  document.write(sOutput);
}

function Write_Noqf_Item(prodcode,pagelink,prodmessage) {
  var sOutput = "";
  if (prodmessage != '') {
    sOutput = sOutput + prodmessage;
  } else {
    sOutput = sOutput + "We're sorry.  " + prodcode + " cannot be ordered using Catalogue Quick Order.  ";
    sOutput = sOutput + 'Please go to the <a href="' + pagelink + '">product page</a>.';
  }
  document.write(sOutput);
}

function Write_QCart_Step1() {
  var sOutput = "";
  sOutput = 'If this box is empty, simply enter the Key Code highlighted in yellow on the back of your American Girl catalogue ';
  sOutput = sOutput + '(for example, A12345).  When a number automatically appears here, do <b>not</b> change it to your catalogue Key Code. ';
  sOutput = sOutput + ' <a class="popUpLnk" href="javascript:win_popup(\'/html/shared/KeyCode.html\',\'450\',\'425\');" border="0">Where is this?</a>';
  document.write(sOutput);
}

function Write_QCart_Step2(p_gift_registry_number) {
  var sOutput = "";
  if (p_gift_registry_number == ""){
    sOutput = 'Enter Product Codes for items you would like to order.';
    sOutput = sOutput + ' The code appears near the end of each item description (for example, A7-MDMC).';
    sOutput = sOutput + ' <a class="popUpLnk" href="javascript:win_popup(\'/html/shared/ProductCode.html\',\'450\',\'250\');" border="0">Where is this?</a>';
  } else {
    sOutput = sOutput + 'In order to update a Gift Registry through Catalogue Quick Entry, simply enter the ';
    sOutput = sOutput + 'desired product codes in the spaces provided.';
  }

  document.write(sOutput);
}

function Write_QCart_Step3() {
  var sOutput = "";
  sOutput = 'To view or remove items added to your Shopping Bag using Catalogue Quick Order, click "Confirm."';
  document.write(sOutput);
}

function Write_Max_Club_Qty_Message() {
  var sOutput = "";
  sOutput = "We're sorry. The item you requested is an American Girl Club exclusive product.  ";
  sOutput = sOutput + "If you are a Club member, you may purchase this item after you log in with your user name and password.";
  sOutput = sOutput + "<br><br>";
  sOutput = sOutput + "Not a member? Join today! In the American Girl Club, girls can send messages to new friends, play online games, ";
  sOutput = sOutput + "earn Stars, collect Treasures, and even purchase exclusive Club exclusive products. Click ";
  sOutput = sOutput + "<a href=\"http://club.americangirl.com/demo/index.html\">here</a> to explore the American Girl Club, see a video, ";
  sOutput = sOutput + "or check out an online demo!";
  document.write(sOutput);
}

function Write_Max_Order_Qty_Message() {
  var sOutput = "";
  sOutput = 'The following product(s) have purchase quantity limits. Your item quantity has been set to the maximum quantity.: ';
  document.write(sOutput);
}

function Write_Note_Item_Qty_Message() {
  var sOutput = "";
  sOutput = 'Additional quantities for the following product(s) can be entered through their product page(s): ';
  document.write(sOutput);
}

function Write_QCart_Added_Message() {
  var sOutput = "";
  sOutput = '<span class="txtError">The following items have been added to your Shopping Bag using Catalogue Quick Order.</span>';
  document.write(sOutput);
}

function Write_Cart_Footer() {
  var sOutput = "";
  sOutput = sOutput + '<hr><span class="txtError">If you are experiencing difficulties with the americangirl.com ';
  sOutput = sOutput + 'Web site and/or wish to order by phone, please call us toll-free at <nobr>1-800-845-0005,</nobr>';
  sOutput = sOutput + ' seven days a week, 6 a.m. to midnight, Central Time.</span>';
  document.write(sOutput);
}

function Write_Expired_Item() {
  var sOutput = "";
  sOutput = 'The following item(s) you had saved in your shopping bag are no longer available, and have been removed from your bag:';
  document.write(sOutput);
}

function Write_Cart_Specials_Link() {
  var sOutput = "";
  sOutput = '<a href="/pls/ag/AG_pagemthspc?catid=369413" target="_top">';
  document.write(sOutput);
}

function Write_Empty_Form() {
  var sOutput = "";
  sOutput = 'Please enter a valid Product Code from your catalogue.';
  document.write(sOutput);
}

function Write_Need_Selection() {
  var sOutput = "";
  sOutput = '* Listed below are one or more items that still need your attention.  Once you have made your selection(s), please choose "Add to Bag" to start the checkout process.';
  document.write(sOutput);
}

function Write_Ship_Tier_Max() {
  var sOutput = "";
  sOutput = 'Your shipping rate will not increase if you add any additional products to your order.';
  document.write(sOutput);
}

function Write_Ship_Tier(tierRemaining) {
  var sOutput = "";
  sOutput = '<font color="990033">You may purchase an additional ' + tierRemaining + ' of products without increasing your shipping costs.</font>';
  document.write(sOutput);
}

function Write_Bts_Link() {
  var cookieString = document.cookie;
  var refererUrl = "REFERURL";
  var refererUrlExists = cookieString.indexOf(refererUrl);
  var sOutput = "";
  var linkStr = "";

  if(refererUrlExists != -1){

    var start = cookieString.indexOf(refererUrl) + refererUrl.length + 1;
    var end = cookieString.indexOf(";",start);

    if (end == -1){
      end = cookieString.length;
    }

    linkStr = cookieString.substring(start,end);
  
    if ((linkStr.indexOf('americangirl.com') == -1) ||
        (linkStr.indexOf('wishlist') > -1)) {
      linkStr = "/";
    }

  } else {

    linkStr = "/";
  }

  sOutput = '<a href="' + linkStr + '" target="_top"><img src="/images/sc_back_to_shop.gif" alt="Back to Shopping" border="0"></a>';

  document.write(sOutput);
}

