﻿// JScript File

function MiniBasketList(){
    this.contentDiv = $("content");
    this.imageDiv = $("eventImage");
    this.messageDiv = $("eventMessage");
    this.mainDiv = $("MCmain");
    this.imageSourceUp = '/orvis_assets/images/MiniMRVup.jpg'; 
    this.imageSourceDown = '/orvis_assets/images/MiniMRVdn.jpg';
};

MiniBasketList.prototype.Toggle = function(){
    var imageSrc;

     if (this.contentDiv.style.display == "none") 
     { 
     if (positionFlag == "True") {
          posArray = this.mainDiv.positionedOffset();
          this.contentDiv.style.top = posArray[1]+this.mainDiv.offsetHeight ;
          this.contentDiv.style.left = posArray[0];
          this.contentDiv.style.position = "absolute";
          this.contentDiv.style.zIndex = 1001;
         }
        
        if ($("contentMRV")) { // If miniMRV is active - blind up
            if ($("contentMRV").style.display != "none") {
                aMiniMRVList = new MiniMRVList();
                Effect.BlindUp(aMiniMRVList.contentDiv); 
                aMiniMRVList.imageSrc = aMiniMRVList.imageSourceDown;
                aMiniMRVList.imageDiv.src = aMiniMRVList.imageSrc;
                }
        }        

         Effect.BlindDown(this.contentDiv, { duration: .5}); 
         imageSrc = this.imageSourceUp;
     }
     else 
     { 
          Effect.BlindUp(this.contentDiv, { duration: .5}); 
          imageSrc = this.imageSourceDown;
     }
 
      this.imageDiv.src = imageSrc;
};
MiniBasketList.prototype.MouseOver = function(){
    this.messageDiv.style.cursor = "pointer";
    this.imageDiv.style.cursor = "pointer";
};

function initMiniCart() {
 
 aMiniBasketList = new MiniBasketList();
 aMiniBasketList.imageDiv.onclick = function(){aMiniBasketList.Toggle();};  //this will attach the click event handler for you outside
 aMiniBasketList.messageDiv.onclick = function(){aMiniBasketList.Toggle();};  //this will attach the click event handler for you outside
 aMiniBasketList.messageDiv.onmouseover = function(){aMiniBasketList.MouseOver();};  //this will attach the click event handler for you outside
 aMiniBasketList.imageDiv.onmouseover = function(){aMiniBasketList.MouseOver();};  //this will attach the click event handler for you outside

}

