//
//@(#)$Header:   //VM/ecom/archives/bcstore/htdocs/store/includes/shoppingBagMessages.js-arc   1.4   30 Jan 2009 02:59:32   rajasuma  $
//

switch (location.hostname) {
  case "dev.shop.barbiecollector.com":
    bcContentURL = 'estwr-12-4';
    break;
  case "stage.shop.barbiecollector.com":
    bcContentURL = 'barbiecollector.mattel.net';
    break;
  default:
    bcContentURL = 'www.barbiecollector.com';
    break;
}

function cartHeader() 
{
 return "<td valign=\"top\">" +
        "<span class=\"header\">Shopping Bag</span>" +
        "</td>";
}

function Write_Cart_Instructions() {
  var sOutput = "";
  sOutput = 'If you make any changes to your shopping bag, be sure to press the "Update Items" button.';
  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 barbiecollector.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 = '<font color="red">We are sorry, the following item(s) you selected are Sold Out and cannot be purchased at this time:</font> ';
  document.write(sOutput);
}

function Write_Invalid_Key_Code() {
  var sOutput = "";
  sOutput = sOutput + 'is an invalid Key Code. Please check the back of your catalog and re-enter the code. ';
  sOutput = sOutput + 'If you continue to get this error, leave the Key Code blank and proceed to Step 2.';
  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 + " is currently sold out.";
  sOutput = "! We're sorry. " + prodcode + " is no longer available or cannot be purchased through the " +
            "Catalogue Quick Order Form.  If you are attempting to purchase a club item, you must go to the item's product page."
  document.write(sOutput);
}

function Write_Note_Item(pagelink) {
  var sOutput = "";
  sOutput = sOutput + "! We're sorry. Gift Certificates cannot be ordered using Catalog Quick Order.  ";
  sOutput = sOutput + 'Please go to the <a href="' + pagelink + '">Gift Certificate</a> product page.';
  document.write(sOutput);
}

function Write_Club_Item(pagelink) {
  var sOutput = "";
  sOutput = "You must be a club member to order this item. Please click here " + pagelink + " to log into the club. Once you log in, you will be returned to your shopping cart to purchase the club item."
  document.write(sOutput);
}

function Write_QCart_Step1() {
  var sOutput = "";
  sOutput = 'Enter the Key Code from the back of your catalog (e.g., AA111).';
  document.write(sOutput);
}

function Write_QCart_Step2() {
  var sOutput = "";
  sOutput = sOutput + 'Enter Product Codes for items you wish to order (e.g., C1-53873). When finished, ';
  sOutput = sOutput + 'or if you need to enter additional items, click "Add to Shopping Bag." If prompted, ';
  sOutput = sOutput + 'please make color or size selections for marked items and re-click "Add to Shopping Bag."';
  document.write(sOutput);
}

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

function Write_Max_Club_Qty_Message() {
  var sOutput = "";
  sOutput = "<b><font color=\"red\">You have either selected an item that requires a Club Membership, or you have reached the " +
            "item quantity limit on an online exclusive product. You need to add a Club Membership to your " +
            "shopping cart in order to purchase this item. If you exceeded the quantity limit, your quantity " +
            "has been reset to the maximum available for the following item(s)</font></b>:";
  document.write(sOutput);
}

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

function Write_Point_Limit_Message() {
  var sOutput = "";
  sOutput = '<font color="red">You have selected an item which requires a higher point balance than you currently have available for redemption. Please review your Current Point Balance, then <a href="'+bcURL+'/shop/shelf.aspx?deptid=6&shelfid=150158">click here</a> to review which items you can redeem with your points today!</font> ';
  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 Catalog Quick Order.</span>';
  document.write(sOutput);
}

function Write_Cart_Footer() {
  var sOutput = "";
  //replaced by shared navigation
  //sOutput = sOutput + '<br><br><center><font face="Arial,Helvetica,sans-serif" size="1" color="#401752">';
  //sOutput = sOutput + '<a href="bc1.cat_wrap?proc=privacy" target="_top" >Mattel\'s Online Privacy Policy</a><br>';
  //sOutput = sOutput + '<a href="bc1.cat_wrap?proc=terms" target="_top">Legal Terms/Conditions</a><br>';
  //sOutput = sOutput + 'Use of this site signifies your acceptance of the terms and conditions.<br>';
  //sOutput = sOutput + '&#169; 1996-2001 Mattel, Inc. All Rights Reserved.<br></font></center><br><br>';
  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="" target="_top">';
  document.write(sOutput);
}

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

function Write_Need_Selection() {
  var sOutput = "";
  sOutput = '* Please make a selection for the item(s) marked below.';
  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 = 'You may still order an additional ' + tierRemaining + ' worth of product and stay at the same shipping rate.';
  document.write(sOutput);
}

function backToCatalog() {

  var catalog = ''

  regEx = /catalog=([^&=]*)(&|$)?/

  m=regEx.exec(location.search);

  if (m) {
    catalog = m[1];
  }

  regEx = /catalog_name=([^&=]*)(&|$)?/

  m=regEx.exec(location.search);

  if (m) {
    catalog_name = m[1];
  }

  regEx = /firstpage=([^&=]*)(&|$)?/

  m=regEx.exec(location.search);

  if (m) {
    firstpage = m[1];
  }

  if (catalog == '1') {
    return '<a href="http://' + bcContentURL + '/shop/catalog.aspx?catalog_name=' + catalog_name  + '&firstpage=' + firstpage + '"><img src="http://' + bcContentURL + '/images/shop/buttons/onlinecatalogicon.jpg" width=21 height=21 border=0>Back to Online Catalog</a>';
  } else {
    return '';
  }

}

function backToShopLink() {
  var cookieString = document.cookie;
  var refererUrl = "REFERURL";
  var refererUrlExists = cookieString.indexOf(refererUrl);
  var sOutput = "";
  var linkStr = "";
  var temp_linkStr =""; // #995394

  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);
      temp_linkStr = linkStr;  // #995394

     if (linkStr.indexOf('americangirlstore.com') == -1)
     {
        linkStr = "/";
     }
// #995394 - start
	
     if (temp_linkStr.indexOf('barbiecollector.com') != -1)
     {
	  linkStr = temp_linkStr;
     }

// #995394 - end

  }
  else
  {
     linkStr = "/";
  }
  return "<a href=\"javaScript:backToShopping('" +
         linkStr +
         "');\"><img src=\"/checkout/images/bag/backtoshopping.gif\" border=\"0\"></a>";
}
