

/****************************************************************************************************

Browser Dectection

****************************************************************************************************/

var HM_DOM    = (document.getElementById) ? true : false;
var HM_NS4    = (document.layers) ? true : false;
var HM_IE     = (document.all) ? true : false;
var HM_IE4    = HM_IE && !HM_DOM;
var HM_Mac    = (navigator.appVersion.indexOf("Mac") != -1);
var HM_IE4M   = HM_IE4 && HM_Mac;
var HM_NS6    = (navigator.appName == "Netscape" && parseFloat(navigator.appVersion) > 4 && parseFloat(navigator.appVersion) < 7);
var HM_IsMenu = (HM_DOM && !HM_NS6) || (HM_IE4 && !HM_IE4M);



/*Prototype extensions*/
if(!Array.prototype.findAll)
{
  Array.prototype.findAll = function(func)
  {
    if(typeof func != 'function') throw new TypeError();

    var len = this.length;
    var arr = [];
    var thisp = arguments[1];
    for(var i=0; i < len; i++)
    {
      if(func.call(thisp, this[i], i, this))
      {
        arr.push(this[i]);
      }
    }
    return arr;
  }
}

if(!Array.prototype.removeAll)
{
  Array.prototype.removeAll = function(func)
  {
    if(typeof func != 'function') throw new TypeError();

    var len = this.length;
    var thisp = arguments[1];
    var b = this.slice(0); //create a copy of this array
    this.length = 0; //clear this array
    for(var i=0; i < len; i++)
    {
      if(!func.call(thisp, b[i]))
      {
        this.push(b[i]); //selectively add back to this array
      }
    }
  }
}

if (!Array.prototype.forEach)
{
  Array.prototype.forEach = function(func /*, thisp*/)
  {
    var len = this.length;
    if (typeof func != "function")
      throw new TypeError();

    var thisp = arguments[1];
    for (var i = 0; i < len; i++)
    {
      if (i in this)
        func.call(thisp, this[i], i, this);
    }
  };
}





/****************************************************************************************************

Main Navigation Dropdowns

****************************************************************************************************/



var timeout    = 500;
var closetimer = 0;
var ddmenuitem = 0;

function navigation_open()
{  navigation_canceltimer();
   navigation_close();
   ddmenuitem = jQuery(this).find('ul').css('visibility', 'visible');};

function navigation_close()
{  if(ddmenuitem) ddmenuitem.css('visibility', 'hidden');};

function navigation_timer()
{  closetimer = window.setTimeout(navigation_close, timeout);};

function navigation_canceltimer()
{  if(closetimer)
   {  window.clearTimeout(closetimer);
      closetimer = null;}};

jQuery(document).ready(function()
{  jQuery('#navigation > li').bind('mouseover', navigation_open)
   jQuery('#navigation > li').bind('mouseout',  navigation_timer)});

document.onclick = navigation_close;





/****************************************************************************************************

com.overstock.util name space
Created by Troy Watt - 10/02/2009

****************************************************************************************************/

if(!os)
{
  var os = {};
}
os.overstock = {};
/*
 * Allow inheritance of multiple object
 *
 * example:
 * Obj.prototype = os.overstock.extend(os.overstock.core,{
 *   prop1: 'prop1',
 *   method1: function(){ return this.prop1; }
 * });
 *
 * Obj.prototype with inherit both os.core and the config object.
 */
os.overstock.extend = function(obj, extObj) {
  if(arguments.length > 2)
  {
    for (var a = 1; a < arguments.length; a++)
    {
      extend(obj, arguments[a]);
    }
  }
  else
  {
    for(var i in extObj) {
      obj[i] = extObj[i];
    }
  }
  return obj;
};


os.overstock.core = {
  applyConfig: function(mixin, inObj)
  {
    for(var p in inObj)
    {
      mixin[p] = inObj[p];
    }
    for(var p in mixin)
    {
      this[p] = inObj[p];
    }
  }
};


os.overstock.util = {
  isLteIE6: (function()
  {
    if (typeof document.all != 'undefined' && navigator.userAgent.indexOf('Opera') < 0)
    {
      var reIE = new RegExp('MSIE (\\d+\\.\\d+)');
      reIE.test(navigator.userAgent);
      var fIEVersion = parseFloat(RegExp['$1']);

      if(typeof document.uniqueID != 'undefined')
      {
        if(fIEVersion <= 6)
        {
          return true;
        }
      }
    }

    return false;
  }()),

  addEvent: (function()
  {
    if(typeof window.addEventListener != 'undefined') {
      return function(elm, evType, fn)
      {
        elm.addEventListener(evType, fn, false);
      }
    }
    else if(typeof window.attachEvent != 'undefined') {
      return function(elm, evType, fn)
      {
        elm.attachEvent('on' + evType, fn);
      }
    }
    else {
      return function(elm, evType, fn)
      {
        elm['on' + evType] = fn;
      }
    }
  }()),

  bindEventListener: function(elm, evType, fn)
  {
    this.addEvent(elm, evType, function(){
        var e = os.overstock.util.Event.getEvent(elm);
        fn(e);
      });
  },

  addLoadListener: function(funcRef)
  {
    if(typeof window.addEventListener != 'undefined') {
      window.addEventListener('load', funcRef, false);
    }
    else if(typeof document.addEventListener != 'undefined') {
      document.addEventListener('load', funcRef, false);
    }
    else if(typeof window.attachEvent != 'undefined') {
      window.attachEvent('onload', funcRef);
    }
    else {
      var olfFunc = window.onload;
      if(typeof window.onload != 'function') {
        window.onload = funcRef;
      }
      else {
        window.onload = function() {
          oldFunc();
          funcRef();
        };
      }
    }
  },

  removeEvent: function(elm, evType, fn, capture)
  {
    if(typeof elm.removeEventListener != 'undefined')
    {
      elm.removeEventListener(evType, fn, capture);
    }
    else if(typeof elm.detachEvent != 'undefined')
    {
      elm.detachEvent('on' + evType, fn);
    }
    else
    {
      elm['on' + evType] = null;
    }
  },

  addClass: function(target, classValue)
  {
    this.reClassValue = new RegExp("(^| )" + classValue + "( |$)");

    if(!reClassValue.test(target.className))
    {
      if(target.className == "")
      {
        target.className = classValue;
      }
      else
      {
        target.className += " " + classValue;
      }
    }
    return true;
  },

  getAncestor: function(oNode, oTarget)
  {
    while(oNode.nodeName.toLowerCase() != oTarget && oNode.parentNode != null)
    {
      oNode = oNode.parentNode;
    }

    return oNode;
  },

  getElementsByAttribute: function(attrType, attrName, rootElm)
  {
    this.rootElm = rootElm || document.documentElement;
    this.elementArray = new Array();
    this.matchedArray = new Array();
    this.reAttrName = new RegExp('(^| )' + attrName + '( |$)');

    if (document.all)
    {
      this.elementArray = this.rootElm.all;
    }
    else
    {
      this.elementArray = this.rootElm.getElementsByTagName('*');
    }

    for(var i=0; i < this.elementArray.length; i++)
    {

      if(attrType == 'class')
      {
        if (this.reAttrName.test(this.elementArray[i].className))
        {
          this.matchedArray[this.matchedArray.length] = this.elementArray[i];
        }
      }

      else if(attrType == 'for')
      {
        if(this.elementArray[i].getAttribute('for') ||  this.elementArray[i].getAttribute('htmlFor'))
        {
          if(this.elementArray[i].htmlFor == attrName)
          {
            this.matchedArray[this.matchedArray.length] = this.elementArray[i];
          }
        }
      }

      else if (this.elementArray[i].getAttribute(attrType) == attrName)
      {
          this.matchedArray[this.matchedArray.length] = this.elementArray[i];
      }

    }

    return this.matchedArray;
  },

  getScrollPosition: function()
  {
    this.scrollPos = [];
    this.scrollPos.x = 0;
    this.scrollPos.y = 0;
    if(typeof window.pageXOffset != 'undefined')
    {
      /*** W3 standard methods FF 2.0 +, Safari 3.0, Opera 9.0**/
      this.scrollPos.x = window.pageXOffset;
      this.scrollPos.y = window.pageYOffset;
      return this.scrollPos;
    }
    else if(typeof document.body.parentElement.scrollTop != 'undefined' && document.compatMode != 'BackCompat')
    {
      /*** IE7 with Strict Doctype/Standards Compliant ***/
      this.scrollPos.x = document.body.parentElement.scrollLeft;
      this.scrollPos.y = document.body.parentElement.scrollTop;
      return this.scrollPos;
    }
    else if(typeof document.documentElement.scrollTop != 'undefined' &&
            document.documentElement.scrollTop > 0)
    {
      /*** IE6 with Strict Doctype/Standards Compliant ***/
      this.scrollPos.x = document.documentElement.scrollLeft;
      this.scrollPos.y = document.documentElement.scrollTop;
      return this.scrollPos;
    }
    else if(typeof document.body.scrollTop != 'undefined')
    {
      /*** IE5 & IE6 Quirks mode ***/
      this.scrollPos.x = document.body.scrollLeft;
      this.scrollPos.y = document.body.scrollTop;
      return this.scrollPos;
    }
    return this.scrollPos;
  },

  getViewportSize: function()
  {
    this.size = [];
    this.size.x = 0;
    this.size.y = 0;
    if(typeof window.innerWidth != 'undefined')
    {
      this.size.x = window.innerWidth;
      this.size.y = window.innerHeight;
    }
    else if(typeof document.documentElement != 'undefined' &&
            typeof document.documentElement.clientWidth != 'undefined' &&
            document.documentElement.clientWidth != 0)
    {
      this.size.x = document.documentElement.clientWidth;
      this.size.y = document.documentElement.clientHeight;
    }
    else
    {
      this.size.x = document.getElementsByTagName('body')[0].clientWidth;
      this.size.y = document.getElementsByTagName('body')[0].clientHeight;
    }
    return this.size;
  },

  /*
   * Return a unigue id string created from a date object, use for preventing an ajax request from caching.
   */
  createUniqueId: function()
  {
    var d = new Date();
    return Date.UTC(
        d.getFullYear(),
        d.getMonth(),
        d.getDate(),
        d.getMinutes(),
        d.getSeconds(),
        d.getMilliseconds()
    );
  }

};

os.overstock.util.Ajax = function() {
  this.request = null;
  this.events = new os.overstock.util.Observer();
  this.url = null;
  this.method = 'GET';
  this.async = true;
  this.cacheRequest = false;
  this.status = null;
  this.statusText = '';
  this.postData = null;
  this.readyState = null;
  this.responseText = null;
  this.responseXML = null;
  this.handleResp = null;
  this.responseFormat = 'text', // 'text', 'xml', or 'object'
  this.mimeType = null;

  this.init = function() {
    if(!this.request) {
      try {
       this.request = new XMLHttpRequest();
      } catch (e) {
        try {
          this.request = new ActiveXObject('MSXML2.XMLHTTP');
        } catch (e) {
          try {
            this.request = new ActiveXObject('Microsoft.XMLHTTP');
          } catch (e) {
            return false;
          }
        }
      }
    }
    return this.request;
  };

  this.doReq = function() {
    if(!this.init()) {
      alert('Could not create XMLHttpRequest Object');
      return; //if this.request is null exit function
    }
    this.request.open(this.method, this.url, this.async);
    if(this.mimeType) {
      try {
        req.overrideMimeType(mimeType);
      } catch (e) {
        //do nothing IE6- or Opera
      }
    }

    var self = this;    //correct loss of scope inside inner function
    this.request.onreadystatechange = function() {
      var resp = null;
      if(self.request.readyState == 4) {
        switch (self.responseFormat) {
          case 'text':
            resp = self.request.responseText;
            self.responseText = resp;
            break;

          case 'xml':
            resp = self.request.responseXML;
            self.responseXML = resp;
            break;

          case 'object':
            resp = req;
            break;
        }
        if(self.request.status >= 200 && self.request.status <= 299) {
          self.handleResp(resp);
        } else {
          self.handleErr(resp);
        }
      }
    };

    this.request.send(this.postData);
  };

  this.setAsync = function(async)
  {
    this.async = async;
  };

  this.setMimeType = function(mimeType) {
    this.mimeType = mimeType;
  };

  this.handleErr = function(resp) {
    this.events.dispatch('StatusError','Status ' + (this.request.status + ': ' + this.request.statusText));
  };

  this.setHandlerErr = function(funcRef) {
    this.handleErr = funcRef; //allows you to set a custom error message
  };

  this.setHandlerBoth = function(funcRef) {
    this.handleResp = funcRef;
    this.handleErr = funcRef;
  };

  this.abort = function() {
    if(this.request) {
      this.request.onreadystatechange = function() { };
      this.request.abort();
      this.request = null;
    }
  };

  this.doGet = function(url, handlerFunc, format) {
    this.url = (this.cache) ? url : url + '?reqId=' + os.overstock.util.createUniqueId();
    this.handleResp = handlerFunc;
    this.responseFormat = format || 'text';
    this.doReq();
  };
}

os.overstock.util.Observer = function() {
  this.listeners = [];
}
os.overstock.util.Observer.prototype = {
    addListener: function(type, callback)
    {
      var exists = (this.listeners.findAll(function(item){
          return (item.type == type && item.callback == callback);
        }).length > 0)
      if(!exists)
      {
        this.listeners.push(new os.overstock.util.Watcher(type, callback));
      }
    },

    removeListener: function(type, callback)
    {
      this.listeners.removeAll(function(item){
          return (item.type === type && item.callback === callback);
        });
    },

    dispatch: function(type, data, scope)
    {
      scope = scope || window;
      var l = this.listeners.findAll(function(item){
          return (item.type.toLowerCase() === ('on' + type).toLowerCase());
        });
      l.forEach(function(item){
        item.callback.call(scope, data);
      });
    }
}
os.overstock.util.Watcher = function(type, callback)
{
  this.type = type;
  this.callback = callback;
}



os.overstock.util.Event = {
  getEvent: function(IECurrentTarget)
  {

    if(typeof window.event != 'undefined' && navigator.userAgent.indexOf('MSIE') >= 0)
    {
      return os.overstock.util.Event.formatEvent(window.event, IECurrentTarget);
    }
    else
    {
      return  os.overstock.util.Event.getEvent.caller.arguments[0];
    }
  },

  formatEvent: function(e, currentTarget)
  {
    e.target = e.srcElement;
    e.currentTarget = currentTarget;
    e.pageX = e.clientX + (document.body.scrollLeft > 0 ? document.body.scrollLeft : document.documentElement.scrollLeft);
    e.pageY = e.clientY + (document.body.scrollTop > 0 ? document.body.scrollTop : document.documentElement.scrollTop);
    e.timeStamp = (new Date()).getTime();

    if(e.type == 'mouseover')
    {
      e.relatedTarget = e.fromElement;
    }
    else if(e.type == 'mouseout')
    {
      e.relatedTarget = e.toElement;
    }

    e.preventDefault = function()
    {
      this.returnValue = false;
    };
    e.stopPropagation = function()
    {
      this.cancelBubble = true;
    };
    return e;
  }


};

os.overstock.ui = {
    showSessionTimeout: function(e, siteElement, redirectUrl)
    {
      redirectUrl = redirectUrl || 'https://www.overstock.com/myaccount';
      siteElement = siteElement || '<img width="404" height="193" border="0" alt="Your current session has expired. Please login to continue. [Click here to confirm]" '
        + 'src="https://www.overstock.com/img/mxc/09-myacc-login-layer.png"/>';

      jQuery.Event(e).preventDefault();
      var $body = jQuery('body').addClass('noscroll');
      var $sessionLayer = jQuery('<div>').attr('id','session-layer');
      var $modal = jQuery('<div>').addClass('modal');
      $sessionLayer.html('<a href="'+ redirectUrl +'">' + siteElement + '</a>');
      $body.append($modal).append($sessionLayer);
      $sessionLayer.center().show(600, 'easeInOutQuart');

      os.overstock.util.bindEventListener(document, 'keydown', handleKeyEvent);
      function handleKeyEvent(e)
      {
        e.preventDefault();
        window.location = redirectUrl;
        return false;
      };
    }
};




/****************************************************************************************************

Tabs - Created by Bucky Flowers 7/23/09

****************************************************************************************************/


jQuery.fn.tabs = function() {
  return this.each(function() {
    var ul = jQuery(this);

    ul.find('a[href^=#]').each(function (i) {
      var tablink = jQuery(this);

      if (i) {
        jQuery(tablink.attr('href')).hide();

      }
      else {
        tablink.addClass('current');
      }

      tablink.click(function () {
        jQuery(ul.find('a.current').removeClass('current').attr('href')).hide();
        jQuery(tablink.addClass('current').attr('href')).show();
        if(tablink.attr('rel')){
          $("#tab-preloader").show();
          $.ajax(
            {
              url: tablink.attr('rel'),
              cache: false,
              success: function(message)
              {
              jQuery(tablink.attr('href')).empty().append(message);
              $("#tab-preloader").hide();
              }
            });
        };

        return false;
      });
    });
  });
};







/****************************************************************************************************

jcarousellite  with an easing extention for jquery

****************************************************************************************************/


// jcarousel lite modified by Bucky Flowers to include pause on mouseover, and external position indicators

(function(jQuery) {                                          // Compliant with jquery.noConflict()
jQuery.fn.jCarouselLite = function(o) {
    o = jQuery.extend({
        btnPrev: null,
        btnNext: null,
        mouseWheel: false,
        auto: null,
        speed: 200,
        easing: null,
        vertical: false,
        circular: true,
    navcontainer:null,
    sectionlinks:null,
        visible: 3,
        start: 0,
        scroll: 1,
    pauseOnHover: true,
        beforeStart: null,
        afterEnd: null
    }, o || {});

    return this.each(function() {                           // Returns the element collection. Chainable.

        var running = false, animCss=o.vertical?"top":"left", sizeCss=o.vertical?"height":"width";
        var div = jQuery(this), ul = jQuery("ul", div), tLi = jQuery("li", ul), tl = tLi.size(), v = o.visible;

     var isMouseOver = false;


            // added: only perform if li > 1
            if(o.circular && tl > 1) {
                                ul.prepend(tLi.slice(tl-v-1+1).clone()).append(tLi.slice(0,v).clone());
                                o.start += v;
                        }



                        update_navigation(1);

        var li = jQuery(o.panel), itemLength = li.size(), curr = o.start;
        div.css("visibility", "visible");

        li.css({overflow: "hidden", float: o.vertical ? "none" : "left"});
        ul.css({margin: "0", padding: "0", position: "relative", "list-style-type": "none", "z-index": "1"});
        div.css({overflow: "hidden", position: "relative", "z-index": "2", left: "0px"});

        var liSize = o.vertical ? height(li) : width(li);   // Full li size(incl margin)-Used for animation
        var ulSize = liSize * itemLength;                   // size of full ul(total length, not just for the visible items)
        var divSize = liSize * v;                           // size of entire div(total length for just the visible items)
    var nav = jQuery(o.navcontainer);

        li.css({width: li.width(), height: li.height()});
        ul.css(sizeCss, ulSize+"px").css(animCss, -(curr*liSize));

        div.css(sizeCss, divSize+"px");                     // Width of the DIV. length of visible images

    li.mouseover(function(){ isMouseOver = true; });
        li.mouseout(function(){ isMouseOver = false; });
    nav.mouseover(function(){ isMouseOver = true; });
        nav.mouseout(function(){ isMouseOver = false; });

        if(o.btnPrev)
            jQuery(o.btnPrev).click(function() {
                return go(curr-o.scroll);
            });

        if(o.btnNext)
            jQuery(o.btnNext).click(function() {
                return go(curr+o.scroll);
            });

        if(o.btnGo) {
            jQuery.each(o.btnGo, function(i, val) {
            jQuery(val).click(function() {

                return go(o.circular ? o.visible+i : i+1);
                });
              });
            }

        if(o.mouseWheel && div.mousewheel)
            div.mousewheel(function(e, d) {
                return d>0 ? go(curr-o.scroll) : go(curr+o.scroll);
            });

        if(o.auto){
                                setInterval(function() {
                                        if(o.pauseOnHover && isMouseOver) return;
                                        go(curr+o.scroll);
                                }, o.auto+o.speed);
                        }

        function vis() {
            return li.slice(curr).slice(0,v);
        };

        function go(to) {
            if(!running) {

                if(o.beforeStart)
                    o.beforeStart.call(this, vis());

                if(o.circular) {            // If circular we are in first or last, then goto the other end
                    if(to<=o.start-v-1) {           // If first, then goto last
                        ul.css(animCss, -((itemLength-(v*2))*liSize)+"px");
                        // If "scroll" > 1, then the "to" might not be equal to the condition; it can be lesser depending on the number of elements.
                        curr = to==o.start-v-1 ? itemLength-(v*2)-1 : itemLength-(v*2)-o.scroll;
                    } else if(to>=itemLength-v+1) { // If last, then goto first
                        ul.css(animCss, -( (v) * liSize ) + "px" );
                        // If "scroll" > 1, then the "to" might not be equal to the condition; it can be greater depending on the number of elements.
                        curr = to==itemLength-v+1 ? v+1 : v+o.scroll;
                    } else curr = to;
                } else {                    // If non-circular and to points to first or last, we just return.
                    if(to<0 || to>itemLength-v) return;
                    else curr = to;
                }                           // If neither overrides it, the curr will still be "to" and we can proceed.

                running = true;

                ul.animate(
                    animCss == "left" ? { left: -(curr*liSize) } : { top: -(curr*liSize) } , o.speed, o.easing,
                    function() {
                        if(o.afterEnd)
                            o.afterEnd.call(this, vis());
                        running = false;
                    }


                );
        update_navigation((o.circular) ? 0+curr : 1+curr);
                // Disable buttons when the carousel reaches the last/first, and enable when not
                if(!o.circular) {
                    jQuery(o.btnPrev + "," + o.btnNext).removeClass("disabled");
                    jQuery( (curr-o.scroll<0 && o.btnPrev)
                        ||
                       (curr+o.scroll > itemLength-v && o.btnNext)
                        ||
                       []
                     ).addClass("disabled");
                }

            }
            return false;
        };


    function update_navigation(curr){
                                var kids = jQuery(o.panel);
                                var cloneVal = (o.circular) ? 2 : 0;
                                var pos = (kids.size()-cloneVal <= curr) ? (curr > kids.size()-cloneVal) ? 1 : kids.size()-cloneVal : curr;
                                pos = (pos == 0) ? kids.size()-cloneVal : pos;

                                var sectionLinks = jQuery(o.sectionlinks);



                                for(k = 0; k < sectionLinks.size(); k++){
                                        if(pos == k+1){
                                                jQuery(sectionLinks[k]).attr("class", 'selected');
                                        } else {
                                                jQuery(sectionLinks[k]).attr("class", 'off');
                                        }
                                }
                        };

    });
};

function css(el, prop) {
    return parseInt(jQuery.css(el[0], prop)) || 0;
};
function width(el) {
    return  el[0].offsetWidth + css(el, 'marginLeft') + css(el, 'marginRight');
};
function height(el) {
    return el[0].offsetHeight + css(el, 'marginTop') + css(el, 'marginBottom');
};

})(jQuery);


jQuery.extend( jQuery.easing,
{
  easeInQuad: function (x, t, b, c, d) {
    return c*(t/=d)*t + b;
  },
  easeOutQuad: function (x, t, b, c, d) {
    return -c *(t/=d)*(t-2) + b;
  },
  easeInOutQuad: function (x, t, b, c, d) {
    if ((t/=d/2) < 1) return c/2*t*t + b;
    return -c/2 * ((--t)*(t-2) - 1) + b;
  }

});



/****************************************************************************************************

jQuery.DropDownMenu[plugin] - Created by Troy Watt:       11.24.2009

****************************************************************************************************/
jQuery.fn.DropDownMenu = function(o)
{
  this.timeoutId = null;

  var _opt = jQuery.extend(true, {
    open: 'slideDown',
    close: 'slideUp',
    openDuration: 400,
    closeDuration: 200,
    closeTimeout: 300,
    preventDefault: false
  },o || {});

  /* !Don't use jQuery.fn.extend here! - causes object to behave as a singleton*/
  return this.each(function() {
    /* _PRIVATE */
    var _$trigger = jQuery(this);
    var _$menu = jQuery('.menu', _$trigger);

    return {
      initialize: function()
      {
        var self = this;
        _$trigger.hover(
            function()
            {
              self.showMenu();
            },
            function()
            {
              self.hideMenu();
            }
        );
        if(_opt.preventDefault)
        {
          _$trigger.children(':first-child').click(function(e){
              e.preventDefault();
            });
        }
      },
      showMenu: function(){
        this.cancelTimeout();
        _$menu[_opt.open](_opt.openDuration);
      },
      hideMenu: function($elm){
        this.timeoutId = setTimeout(function(){
          _$menu[_opt.close](_opt.closeDuration);
        }, _opt.closeTimeout);
      },
      cancelTimeout: function()
      {
        if(this.timeoutId)
        {
          clearTimeout(this.timeoutId);
          this.timeoutId = null;
        }
      }
    }.initialize();
  });
};


/****************************************************************************************************

jQuery.OSDialog[plugin] - Created by Troy Watt:       10.05.2009
                          Last Updated By Troy Watt:  11.11.2009

****************************************************************************************************/
jQuery.fn.OSDialog = function(o) {

  return this.each(function() {

    var _opt = jQuery.extend(true, {
      openOnLoad: false,
      open: 'fadeIn',
      close: 'fadeOut',
      openDuration: 200,
      closeDuration: 500
    },o || {});

    var _$dialog = jQuery(this);
    jQuery.fn.extend({
      initialize: function()
      {
        var closeButton = jQuery('<a href="#" title="close" class="close-dialog"></a>').click(function(e){
          jQuery(this).hideDialog(e);
        });
        _$dialog.prepend(closeButton);

        if(_opt.openOnLoad)
        {
          _$dialog.showDialog();
        }
      },

      showDialog: function(e){
        var $this = jQuery(this);
        jQuery.Event(e).preventDefault();
        $this.center();
        $this[_opt.open](_opt.openDuration);
      },

      hideDialog: function(e){
        jQuery.Event(e).preventDefault();
        jQuery(this).parent()[_opt.close](_opt.closeDuration);
      }
    }).initialize();

  })
};

jQuery.fn.OpenDialog = function(d,o) {

  var _opt = jQuery.extend(true, {
    openOnLoad: false,
    open: 'fadeIn',
    close: 'fadeOut',
    openDuration: 200,
    closeDuration: 500
  },arguments[1] || {});

  return this.each(function() {
    var _$link = jQuery(this);
    var _$dialog = jQuery('#' + d);

    return {
      initialize: function()
      {
        var self = this;
        _$link.click(function(e){
          e.preventDefault();
          self.showDialog();
        });
        var closeButton = jQuery('<a href="#" title="close" class="close-dialog"></a>').click(function(e){
          self.hideDialog(e);
        });
        _$dialog.prepend(closeButton);

        if(_opt.openOnLoad)
        {
          this.showDialog();
        }
      },

      showDialog: function(e){
        var $this = jQuery(this);
        jQuery.Event(e).preventDefault();
        _$dialog.center();
        _$dialog[_opt.open](_opt.openDuration);
      },

      hideDialog: function(e){
        e.preventDefault();
        _$dialog[_opt.close](_opt.closeDuration);
      }
    }.initialize();

  })
};


/****************************************************************************************************

jQuery.center[plugin] - Created by Troy Watt 10/05/2009

****************************************************************************************************/
/**
 * Center a dialog/ui element to the browser's viewport
 */
jQuery.fn.center = function()
{
  return this.each(function() {
    var $this = jQuery(this);
    var viewport = os.overstock.util.getViewportSize();
    var scrollPos = os.overstock.util.getScrollPosition();
    $this.css('left', parseInt((((viewport.x / 2) + scrollPos.x - ($this.width() / 2))) + 'px'));
    $this.css('top', parseInt((((viewport.y / 2) + scrollPos.y- ($this.height() / 2))) + 'px'));
  });

};


/****************************************************************************************************

jQuery Easing v1.3

****************************************************************************************************/
/*
 *
 * TERMS OF USE - jQuery Easing
 *
 * Open source under the BSD License.
 * Copyright © 2008 George McGinley Smith
 * All rights reserved.
 * Redistribution and use in source and binary forms, with or without modification,
 * are permitted provided that the following conditions are met:
 * Redistributions of source code must retain the above copyright notice, this list of
 * conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list
 * of conditions and the following disclaimer in the documentation and/or other materials
 * provided with the distribution.
 * Neither the name of the author nor the names of contributors may be used to endorse
 * or promote products derived from this software without specific prior written permission.
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 * OF THE POSSIBILITY OF SUCH DAMAGE.
 *
*/

// t: current time, b: begInnIng value, c: change In value, d: duration
jQuery.easing['jswing'] = jQuery.easing['swing'];

jQuery.extend( jQuery.easing,
{
  def: 'easeOutQuad',
  swing: function (x, t, b, c, d) {
    //alert(jQuery.easing.default);
    return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
  },
  easeInQuad: function (x, t, b, c, d) {
    return c*(t/=d)*t + b;
  },
  easeOutQuad: function (x, t, b, c, d) {
    return -c *(t/=d)*(t-2) + b;
  },
  easeInOutQuad: function (x, t, b, c, d) {
    if ((t/=d/2) < 1) return c/2*t*t + b;
    return -c/2 * ((--t)*(t-2) - 1) + b;
  },
  easeInCubic: function (x, t, b, c, d) {
    return c*(t/=d)*t*t + b;
  },
  easeOutCubic: function (x, t, b, c, d) {
    return c*((t=t/d-1)*t*t + 1) + b;
  },
  easeInOutCubic: function (x, t, b, c, d) {
    if ((t/=d/2) < 1) return c/2*t*t*t + b;
    return c/2*((t-=2)*t*t + 2) + b;
  },
  easeInQuart: function (x, t, b, c, d) {
    return c*(t/=d)*t*t*t + b;
  },
  easeOutQuart: function (x, t, b, c, d) {
    return -c * ((t=t/d-1)*t*t*t - 1) + b;
  },
  easeInOutQuart: function (x, t, b, c, d) {
    if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
    return -c/2 * ((t-=2)*t*t*t - 2) + b;
  },
  easeInQuint: function (x, t, b, c, d) {
    return c*(t/=d)*t*t*t*t + b;
  },
  easeOutQuint: function (x, t, b, c, d) {
    return c*((t=t/d-1)*t*t*t*t + 1) + b;
  },
  easeInOutQuint: function (x, t, b, c, d) {
    if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
    return c/2*((t-=2)*t*t*t*t + 2) + b;
  },
  easeInSine: function (x, t, b, c, d) {
    return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
  },
  easeOutSine: function (x, t, b, c, d) {
    return c * Math.sin(t/d * (Math.PI/2)) + b;
  },
  easeInOutSine: function (x, t, b, c, d) {
    return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
  },
  easeInExpo: function (x, t, b, c, d) {
    return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
  },
  easeOutExpo: function (x, t, b, c, d) {
    return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
  },
  easeInOutExpo: function (x, t, b, c, d) {
    if (t==0) return b;
    if (t==d) return b+c;
    if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
    return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
  },
  easeInCirc: function (x, t, b, c, d) {
    return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
  },
  easeOutCirc: function (x, t, b, c, d) {
    return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
  },
  easeInOutCirc: function (x, t, b, c, d) {
    if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
    return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
  },
  easeInElastic: function (x, t, b, c, d) {
    var s=1.70158;var p=0;var a=c;
    if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
    if (a < Math.abs(c)) { a=c; var s=p/4; }
    else var s = p/(2*Math.PI) * Math.asin (c/a);
    return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
  },
  easeOutElastic: function (x, t, b, c, d) {
    var s=1.70158;var p=0;var a=c;
    if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
    if (a < Math.abs(c)) { a=c; var s=p/4; }
    else var s = p/(2*Math.PI) * Math.asin (c/a);
    return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
  },
  easeInOutElastic: function (x, t, b, c, d) {
    var s=1.70158;var p=0;var a=c;
    if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
    if (a < Math.abs(c)) { a=c; var s=p/4; }
    else var s = p/(2*Math.PI) * Math.asin (c/a);
    if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
    return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
  },
  easeInBack: function (x, t, b, c, d, s) {
    if (s == undefined) s = 1.70158;
    return c*(t/=d)*t*((s+1)*t - s) + b;
  },
  easeOutBack: function (x, t, b, c, d, s) {
    if (s == undefined) s = 1.70158;
    return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
  },
  easeInOutBack: function (x, t, b, c, d, s) {
    if (s == undefined) s = 1.70158;
    if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
    return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
  },
  easeInBounce: function (x, t, b, c, d) {
    return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
  },
  easeOutBounce: function (x, t, b, c, d) {
    if ((t/=d) < (1/2.75)) {
      return c*(7.5625*t*t) + b;
    } else if (t < (2/2.75)) {
      return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
    } else if (t < (2.5/2.75)) {
      return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
    } else {
      return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
    }
  },
  easeInOutBounce: function (x, t, b, c, d) {
    if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
    return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
  }
});


/****************************************************************************************************

end of overstock.js

****************************************************************************************************/

json_parse=(function(){var at,ch,escapee={'"':'"','\\':'\\','/':'/',b:'\b',f:'\f',n:'\n',r:'\r',t:'\t'},text,error=function(m){throw{name:'SyntaxError',message:m,at:at,text:text};},next=function(c){if(c&&c!==ch){error("Expected '"+c+"' instead of '"+ch+"'");};ch=text.charAt(at);at+=1;return ch;},number=function(){var number,string='';if(ch==='-'){string='-';next('-');};while(ch>='0'&&ch<='9'){string+=ch;next();};if(ch==='.'){string+='.';while(next()&&ch>='0'&&ch<='9'){string+=ch;}};if(ch==='e'||ch==='E'){string+=ch;next();if(ch==='-'||ch==='+'){string+=ch;next();};while(ch>='0'&&ch<='9'){string+=ch;next();}};number=+string;if(isNaN(number)){error("Bad number");}else{return number;}},string=function(){var hex,i,string='',uffff;if(ch==='"'){while(next()){if(ch==='"'){next();return string;}else if(ch==='\\'){next();if(ch==='u'){uffff=0;for(i=0;i<4;i+=1){hex=parseInt(next(),16);if(!isFinite(hex)){break;};uffff=uffff*16+hex;};string+=String.fromCharCode(uffff);}else if(typeof escapee[ch]==='string'){string+=escapee[ch];}else{break;}}else{string+=ch;}}};error("Bad string");},white=function(){while(ch&&ch<=' '){next();}},word=function(){switch(ch){case't':next('t');next('r');next('u');next('e');return true;case'f':next('f');next('a');next('l');next('s');next('e');return false;case'n':next('n');next('u');next('l');next('l');return null;};error("Unexpected '"+ch+"'");},value,array=function(){var array=[];if(ch==='['){next('[');white();if(ch===']'){next(']');return array;};while(ch){array.push(value());white();if(ch===']'){next(']');return array;};next(',');white();}};error("Bad array");},object=function(){var key,object={};if(ch==='{'){next('{');white();if(ch==='}'){next('}');return object;};while(ch){key=string();white();next(':');if(Object.hasOwnProperty.call(object,key)){error('Duplicate key "'+key+'"');};object[key]=value();white();if(ch==='}'){next('}');return object;};next(',');white();}};error("Bad object");};value=function(){white();switch(ch){case'{':return object();case'[':return array();case'"':return string();case'-':return number();default:return ch>='0'&&ch<='9'?number():word();}};return function(source,reviver){var result;text=source;at=0;ch=' ';result=value();white();if(ch){error("Syntax error");};return typeof reviver==='function'?(function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==='object'){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v;}else{delete value[k];}}}};return reviver.call(holder,key,value);}({'':result},'')):result;};}());
