var newwindow;
function popShippingPolicy() {
  newwindow=window.open('shippingpolicy.php','name','height=600,width=700,scrollbars=yes');
  if (window.focus) {newwindow.focus()}
}

function startFadeMenuHover (hoverId) {
  dojo.query('#'+ hoverId+ '_sub').forEach(function(e) {
    dojo.animateProperty({
      node:e,
      duration: 1000,
      //rate:300,
      properties: {
          opacity: {end:0.00, start:1.00}
      },
      onEnd: function() {
        dojo.style(e,'display','none');
      }
    }).play();
  });
}

var menuHoverTimeoutT= 0;

function menuHover (hoverE) {
  dojo.query('.fadeCell').style('opacity','0.45');
  dojo.query('.siteMenuSubCell').style('display','none');

  if (!hoverE) { return; }
  hoverE= dojo.byId(hoverE);
  dojo.style(hoverE,'opacity','1.00');
  coords= dojo.coords(hoverE);
  left= coords.l - coords.w;
  width= (coords.w * 3) - 0;
  menuWidth= 976;
  if (left < 1) { left= 0; }
  if (left > (menuWidth- width)) { left= menuWidth- width; }
  
  dojo.query('#'+ hoverE.id+ '_sub').style({
    width: width+ 'px',
    left: left+ 'px',
    display: 'block',
    opacity: '0.90'
  });

  clearTimeout(menuHoverTimeoutT);
  menuHoverTimeoutT= 0;
  menuHoverTimeoutT= setTimeout("startFadeMenuHover('"+ hoverE.id+ "');",5000);
}

function catList () {
  menuHover();
  dojo.query('#menu_1a_sub').style({
    width: width+ 'px',
    left: left+ 'px',
    display: 'block',
    opacity: '0.90'
  });

  e= dojo.byId('catList');
  end= 450; start= 0;
  dojo.animateProperty({
        node:e,
        duration: 700,
        //rate:300,
        properties: {
            height: {end:end, start:start}
        },
        onEnd: function() {

        }
  }).play();
}

function initialFadeDown () {
  dojo.query('.fadeCell').forEach(function(e) {
    dojo.animateProperty({
      node:e,
      duration: 1000,
      //rate:300,
      properties: {
          opacity: {end:0.45, start:0.00}
      }
    }).play();

    dojo.style(e, 'display', 'block');
  });
}

function fadePage (outIn) {
  opac= new Array();
  if (outIn) { opac['end']= 1; opac['start']=0; }
  else { opac['end']= 0; opac['start']=1; }
  dojo.query('div.mainBodyDiv').forEach(function(e) {
    dojo.animateProperty({
      node:e,
      duration: 500,
      rate:50,
      properties: {
          opacity: opac
      }
    }).play();
  });
}





function rotator (elementId, index) {
  this.e= dojo.byId(elementId);
  this.images= new Array();
  this.imageIndex= (index==null)? 0: Number(index);
  this.timer= 0;
}

rotator.prototype.addImage= function (src) {
  this.images[this.images.length]= src;
}

rotator.prototype.start= function (rate) {
  this.stop();
  this.handleInterval();
  this.timer= setInterval(dojo.hitch(this, "handleInterval"), Number(rate));
}
rotator.prototype.stop= function () {
  clearInterval(this.timer);
}

rotator.prototype.handleInterval= function () {
  if ((this.e != null) && (this.e.tagName == 'IMG')) {
    this.e.src= this.images[this.imageIndex];
    this.imageIndex++;
    if (this.images[this.imageIndex] == null) {
      this.imageIndex= 0;
    }
  }
}












