﻿//*******************************************************************************************************************************************
//*******************************************************************************************************************************************
// JQPD-------------FLYOUT COVER/POSITIONING ROUTINE  
//*******************************************************************************************************************************************
//*******************************************************************************************************************************************
//                function Cover(bottom, top, ignoreSize, topOffset, leftOffset) {
//                  var location = Sys.UI.DomElement.getLocation(bottom);
//                  top.style.position = 'absolute';
//                  top.style.top = (location.y + topOffset) + 'px';
//                  top.style.left = (location.x + leftOffset) + 'px';
//                  if (!ignoreSize) {
//                    top.style.height = bottom.offsetHeight + 'px';
//                    top.style.width = bottom.offsetWidth + 'px';
//                  }
//                }

//*******************************************************************************************************************************************
//*******************************************************************************************************************************************
// JQPD-------------FADE CONTROL IN/OUT 
//*******************************************************************************************************************************************
//*******************************************************************************************************************************************
//                function Fade_Control(_control, _direction, _rate) {
//                  document.getElementById(_control).style('opacity') = '0'
//                  document.getElementById(_control).style('display') = 'block'
//                  for (var i = 0; i < 101; i = i + _rate) {
//                    document.getElementById(_control).style('opacity') = i
//                  }
//                }
//**************************
// FUNCTION: LOAD INITIATION
//**************************
function loadInit() {
  _showBase = 3500;
  _show = _showBase;
  _fadeBase = 2500;
  _fade = _fadeBase;
  _increment = 100;
   _steps  = 1 / (_fadeBase / _increment) ;
  _valueIn = 0;
  _valueOut = 1;
  _getFirst = true;
  _imgNumberBefore = 0;
  _imgNumberAfter = 0;
  _images = new Array()
  _imageNumberMax = -1
  for (var x = 0; x < document.images.length; x++) {
    if (document.images[x].parentNode.id == "rollingImageDisplay") {
      _images[x] = document.images[x];
      _name = _images[x].id;
      _imageNumberMax += 1
      if (x == 0) {
      _imgNumberBefore = x
        _oType = setObjectType(_images[x]);
        setImageFade(x, 1, _oType);
      }
      else {
        if (_getFirst) {
          _imgNumberAfter = x
          _getFirst = false
        }
        _images[x].filters.alpha.opacity = 0
        setImageFade(x, 0, _oType);
      }
    }
  }
  _getFirst = true
  setInterval('doImage()', _increment);
}
//*******************************
// FUNCTION: MANAGE IMAGE DISPLAY
//*******************************
function doImage() {
  //SHOW CURRENT IMAGE FOR TIME
  if (_show > _fadeBase) {
    _show -= _increment;
  }
  else {
    //FADE IN NEXT IMAGE
    if (_fade > 0) {
      _fade -= _increment
      if (_oType != 'none') {
        _valueIn += _steps
        _valueOut -= _steps
        if (_valueIn <= 1) {
        }
      }
      else {
        _valueIn = 1;
      }
      setImageFade(_imgNumberAfter, _valueIn, _oType);
      setImageFade(_imgNumberBefore, _valueOut, _oType);
    }
    else {
      //CLEAR LAST IMAGE AND RESET COUNTERS
      setImageFade(_imgNumberBefore, 0, _oType);
      _show = _showBase;
      _fade = _fadeBase;
      _valueIn = 0
      _valueOut = 1
      //INCREMENT/RESET IMAGE COUNTERS
      if (_imgNumberAfter == 0) {
        _imgNumberBefore = 0;
        _imgNumberAfter += 1;
      }
      else if (_imgNumberAfter < _imageNumberMax) {
        _imgNumberBefore += 1;
        _imgNumberAfter += 1;
      }
      else if (_imgNumberAfter == _imageNumberMax) {
        _imgNumberBefore += 1;
        _imgNumberAfter = 0
        setImageFade(0, 1, _oType);
      }
    }
  }
}
//**************************
// FUNCTION: GET NEXT IMAGE
//**************************
function getNextImage() {
  _imgBefore = document.getElementById("rollingImageDisplay").childNodes[_img];
  _imgNumberBefore = _img / 2
    if (_img < 40) {
    _img += 2;
  }
  else {
    _img = 0;
  }
  _imgAfter = document.getElementById("rollingImageDisplay").childNodes[_img];
  _imgNumberAfter = _img / 2
}
//**************************
// FUNCTION: SET OBJECT TYPE
//**************************
function setObjectType(img) {
  var oType
  if (typeof img.style.opacity != 'undefined') {
    oType = 'w3c';
  }
  else if (typeof img.style.MozOpacity != 'undefined') {
  oType = 'moz';
  }
  else if (typeof img.style.KhtmlOpacity != 'undefined') {
  oType = 'khtml';
  }
  else if (typeof img.filters == 'object') {
  oType = (img.filters.length > 0
      && typeof img.filters.alpha == 'object'
      && typeof img.filters.alpha.opacity == 'number')
      ? 'ie' : 'none';
  }
  else {
    oType = 'none';
  }
  return oType
}
//**************************
// FUNCTION: SET IMAGE FADE
//**************************
function setImageFade(i, value, oType) {
  switch (oType) {
    case 'ie':
      document.images[i].filters.alpha.opacity = (value * 100);
      break;
    case 'khtml':
      document.images[i].style.KhtmlOpacity = (value);
      break;
    case 'moz':
      document.images[i].style.MozeOpacity = (value == 1 ? 0.9999999 : value);
      break;
    default:
      document.images[i].style.opacity = (value == 1 ? 0.9999999 : value);
      break;
  }
}
//****************************************************************************************************
// SAVE/GET CONTENT FRAME LOCATION UPPER LEFT CORNER
//****************************************************************************************************
var g_contentFrameLocationXY = new Array(0,0)
function setContentFrameLocationXY(_locationXY) 
{
  ret = WebService.setContentFrameLocationXY(_locationXY, OnComplete, OnTimeOut, OnError);
  return (true)
}
function getContentFrameLocationXY() 
{
  x = WebService.getContentFrameLocationXY(OnComplete, OnTimeOut, OnError);
  return  g_contentFrameLocationXY
}
function OnComplete(_arg) {
  return (true);
}
function OnTimeOut(_arg) {
  alert("Time Out Encountered during Logging!");
}
function OnError(_arg) {
  alert("Error Encountered during Logging!");
}
//************************************************************
//Author: Eric King
//Url: http://redrival.com/eak/index.shtml
//This script is free to use as long as this info is left in
//Featured on Dynamic Drive script library (http://www.dynamicdrive.com)
////***********************************************************
var win = null;
function NewWindow(mypage, myname, w, h, scroll, pos, msg) {
//  alert(event.clientX)
  if (msg == 'yes') {
    alert('When Registration Form appears in browser window, \n use the browser print button to print it on your printer!');
  }
  if (pos == "random") {
    LeftPosition = (screen.width) ? Math.floor(Math.random() * (screen.width - w)) : 100; TopPosition = (screen.height) ? Math.floor(Math.random() * ((screen.height - h) - 75)) : 100;
  }
  if (pos == "center") {
    LeftPosition = (screen.width) ? (screen.width - w) / 2 : 100; TopPosition = (screen.height) ? (screen.height - h) / 2 : 100;
  }
  else if ((pos != "center" && pos != "random") || pos == null) {
    LeftPosition = 0; TopPosition = 20
  }
  settings = 'width=' + w + ',height=' + h + ',top=' + TopPosition + ',left=' + LeftPosition + ',scrollbars=' + scroll + ',location=no,directories=no,status=yes,menubar=yes,toolbar=yes,resizable=yes';
  win = window.open(mypage, myname, settings);
}

function Toggle_ShipTo(_action) {
  if (_action = 'YES') {
    document.getElementById('ShipName').text = document.getElementById('ProfileFName').text;
    
  }
}