var mnc = (document.all || document.layers || document.getElementById) ? true : false;
var ie = (navigator.appName.indexOf('Microsoft') != -1) ? true : false;
var isIE;
isIE = ie;
var ie4 = (ie && document.all && !document.getElementById) ? true : false;
var ie5 = (ie && document.getElementById && navigator.userAgent.indexOf('MSIE 6.0') == -1) ? true : false;
var ie6 = (ie && document.getElementById && !ie5) ? true : false;
var ie4Min = (ie4 || ie5 || ie6) ? true : false;
var ie5Min = (ie5 || ie6) ? true : false;
var ie6Min = ie6;

var ns = (navigator.appName.indexOf('Netscape') != -1) ? true : false;
var ns4 = (ns && document.layers) ? true : false;
var ns6 = (ns && document.getElementById) ? true : false;
var ns4Min = (ns4 || ns6) ? true : false;
var ns6Min = ns6;
var isNS=((ns)||(ns4)||(ns6))?1:0;

var cursorPageX, cursorPageY;
var cursorWinX, cursorWinY;

function captureCursor() {
   if (mnc && !cursorCaptured) {
      if (ns) document.captureEvents(Event.MOUSEMOVE);
      document.onmousemove = updateCursorPos;
      cursorCaptured = true;
      }
   }

var cursorCaptured = false;

function updateCursorPos(EVENT) {
   if (mnc) {
      if (ie) {
         cursorWinX = event.clientX - 2;
         cursorWinY = event.clientY - 2;
         cursorPageX = cursorWinX + document.body.scrollLeft;
         cursorPageY = cursorWinY + document.body.scrollTop;
         }
      else {
         cursorPageX = EVENT.pageX;
         cursorPageY = EVENT.pageY;
         cursorWinX = cursorPageX - window.pageXOffset;
         cursorWinY = cursorPageY - window.pageYOffset;
         }
      if (dragLayerObj.isDragging) {
         moveLayerTo(dragLayerObj.layerObj,cursorPageX - dragLayerObj.cursorOffsetX,cursorPageY - dragLayerObj.cursorOffsetY);
         return false;
         }
      }
   }

function getDocHeight() {
   if (ie4Min) return (document.body.scrollHeight > document.body.clientHeight) ? document.body.scrollHeight : document.body.clientHeight;
   else if (ns4Min) return (document.height > window.innerHeight) ? document.height : window.innerHeight;
   }

function getDocWidth() {
   if (ie4Min) return (document.body.scrollWidth > document.body.clientWidth) ? document.body.scrollWidth : document.body.clientWidth;
   else if (ns4Min) return (document.width > window.innerWidth) ? document.width : window.innerWidth;
   }

function getDocScrollLeft()
{if (ie4Min) return document.body.scrollLeft; else if (ns4Min) return window.pageXOffset;}

function getDocScrollTop() {if (ie4Min) return document.body.scrollTop; else if (ns4Min) return window.pageYOffset;}

     function addObjEvent(OBJ,EVENT,FUNC)
{
   if (mnc)
   {
      if (EVENT == 'click')
      {if (ns4) OBJ.captureEvents(Event.CLICK); OBJ.onclick = new Function(FUNC);}
      else if (EVENT == 'mousedown')
      {if (ns4) OBJ.captureEvents(Event.MOUSEDOWN); OBJ.onmousedown = new Function(FUNC);}
      else if (EVENT == 'mouseup')
      {if (ns4) OBJ.captureEvents(Event.MOUSEUP); OBJ.onmouseup = new Function(FUNC);}
      else if (EVENT == 'mouseover')
      {if (ns4) OBJ.captureEvents(Event.MOUSEOVER); OBJ.onmouseover = new Function(FUNC);}
      else if (EVENT == 'mouseout')
      {if (ns4) OBJ.captureEvents(Event.MOUSEOUT); OBJ.onmouseout = new Function(FUNC);}
	}
}

function removeObjEvent(OBJ,EVENT)
{
   if (mnc)
   {
      if (EVENT == 'click') {if (ns4) OBJ.releaseEvents(Event.CLICK); OBJ.onclick = null;}
      else if (EVENT == 'mousedown') { if (ns4) OBJ.releaseEvents(Event.MOUSEDOWN);OBJ.onmousedown = null;}
      else if (EVENT == 'mouseup') {if (ns4) OBJ.releaseEvents(Event.MOUSEUP); OBJ.onmouseup = null;}
      else if (EVENT == 'mouseover') {if (ns4) OBJ.releaseEvents(Event.MOUSEOVER); OBJ.onmouseover = null;}
      else if (EVENT == 'mouseout') {if (ns4) OBJ.releaseEvents(Event.MOUSEOUT); OBJ.onmouseout = null;}
	}
}

function getATag(HREF,TARGET,ONMOUSEOVER,ONMOUSEOUT,OTHER)
{
   var tempHtmlStr = '<A';
   if (!isBlank(HREF)) tempHtmlStr += ' HREF="' + HREF + '"';
   if (!isBlank(TARGET)) tempHtmlStr += ' TARGET="' + TARGET + '"';
   if (!isBlank(ONMOUSEOVER)) tempHtmlStr += ' onMouseOver="' + ONMOUSEOVER + '"';
   if (!isBlank(ONMOUSEOUT)) tempHtmlStr += ' onMouseOut="' + ONMOUSEOUT + '"';
   if (!isBlank(OTHER)) tempHtmlStr += ' ' + OTHER;
   tempHtmlStr += '>';
   return tempHtmlStr;
}

function getFontTag(COLOR,FACE,SIZE,OTHER) {
   var tempHtmlStr = '<FONT';
   if (!isBlank(COLOR)) tempHtmlStr += ' COLOR="' + COLOR + '"';
   if (!isBlank(FACE)) tempHtmlStr += ' FACE="' + FACE + '"';
   if (!isBlank(SIZE)) tempHtmlStr += ' SIZE="' + SIZE + '"';
   if (!isBlank(OTHER)) tempHtmlStr += ' ' + OTHER;
   tempHtmlStr += '>';
   return tempHtmlStr;
   }

function getImgTag(NAME,SRC,WIDTH,HEIGHT,BORDER,ALIGN,HSPACE,VSPACE,ALT,OTHER) {
   var tempHtmlStr = '<IMG';
   if (!isBlank(NAME)) tempHtmlStr += ' NAME="' + NAME + '"';
   if (!isBlank(SRC)) tempHtmlStr += ' SRC="' + SRC + '"';
   if (!isBlank(WIDTH)) tempHtmlStr += ' WIDTH="' + WIDTH + '"';
   if (!isBlank(HEIGHT)) tempHtmlStr += ' HEIGHT="' + HEIGHT + '"';
   if (!isBlank(BORDER)) tempHtmlStr += ' BORDER="' + BORDER + '"';
   if (!isBlank(ALIGN)) tempHtmlStr += ' ALIGN="' + ALIGN + '"';
   if (!isBlank(HSPACE)) tempHtmlStr += ' HSPACE="' + HSPACE + '"';
   if (!isBlank(VSPACE)) tempHtmlStr += ' VSPACE="' + VSPACE + '"';
   if (!isBlank(ALT)) tempHtmlStr += ' ALT="' + ALT + '"';
   if (!isBlank(OTHER)) tempHtmlStr += ' ' + OTHER;
   tempHtmlStr += '>';
   return tempHtmlStr;
   }

function getTableTag(CELLPADDING,CELLSPACING,BORDER,WIDTH,HEIGHT,OTHER) {
   var tempHtmlStr = '<TABLE';
   if (!isBlank(CELLPADDING)) tempHtmlStr += ' CELLPADDING="' + CELLPADDING + '"';
   if (!isBlank(CELLSPACING)) tempHtmlStr += ' CELLSPACING="' + CELLSPACING + '"';
   if (!isBlank(BORDER)) tempHtmlStr += ' BORDER="' + BORDER + '"';
   if (!isBlank(WIDTH)) tempHtmlStr += ' WIDTH="' + WIDTH + '"';
   if (!isBlank(HEIGHT)) tempHtmlStr += ' HEIGHT="' + HEIGHT + '"';
   if (!isBlank(OTHER)) tempHtmlStr += ' ' + OTHER;
   tempHtmlStr += '>';
   return tempHtmlStr;
   }

function getTdTag(ALIGN,VALIGN,WIDTH,BGCOLOR,BACKGROUND,COLSPAN,ROWSPAN,NOWRAP,OTHER) {
   var tempHtmlStr = '<TD';
   if (!isBlank(ALIGN)) tempHtmlStr += ' ALIGN="' + ALIGN + '"';
   if (!isBlank(VALIGN)) tempHtmlStr += ' VALIGN="' + VALIGN + '"';
   if (!isBlank(WIDTH)) tempHtmlStr += ' WIDTH="' + WIDTH + '"';
   if (!isBlank(BGCOLOR)) tempHtmlStr += ' BGCOLOR="' + BGCOLOR + '"';
   if (!isBlank(BACKGROUND)) tempHtmlStr += ' BACKGROUND="' + BACKGROUND + '"';
   if (!isBlank(COLSPAN)) tempHtmlStr += ' COLSPAN="' + COLSPAN + '"';
   if (!isBlank(ROWSPAN)) tempHtmlStr += ' ROWSPAN="' + ROWSPAN + '"';
   if (NOWRAP == true) tempHtmlStr += ' NOWRAP';
   if (!isBlank(OTHER)) tempHtmlStr += ' ' + OTHER;
   tempHtmlStr += '>';
   return tempHtmlStr;
   }

// ----- 6. IMAGES ----- //

function getImgObj(IMGNAME) {
   if (ns4) {
      var tempImgObj = null;
      var tempParentObj = (arguments.length == 1) ? document : arguments[1];
      if (arguments.length == 1 && document.images[IMGNAME] != null) tempImgObj = document.images[IMGNAME];
      else {
         for (var tempLayerLoop in tempParentObj.layers) {
            var tempObj = tempParentObj.layers[tempLayerLoop];
            var tempConstructor = tempObj.constructor + '';
            if (tempConstructor.indexOf('function Layer()') != -1) {
               if (tempObj.document.images[IMGNAME] != null) return tempObj.document.images[IMGNAME];
               else if (tempObj.document.layers.length > 0) tempImgObj = getImgObj(IMGNAME,tempObj);
               }
            }
         }
      return tempImgObj;
      }
   else if (mnc) return document.images[IMGNAME];
   }

function loadImg(SRC) {
   if (mnc) {
      var tempImgObj = new Image();
      tempImgObj.src = SRC;
      return tempImgObj;
      }
   }

// ----- 7. LAYER ADDING ----- //

function addLayer(LAYERID,PARENTLAYEROBJ) {
   if (ie4Min) {
      if (isBlank(PARENTLAYEROBJ)) PARENTLAYEROBJ = document.body;
      PARENTLAYEROBJ.insertAdjacentHTML('BeforeEnd','<div id="' + LAYERID + '" style="position:absolute;left:0;top:0;width:1;visibility:hidden;"></div>');
      return (document.all) ? document.all[LAYERID] : document.getElementById(LAYERID);
      }
   else if (ns4) {
      if (isBlank(PARENTLAYEROBJ)) {
         document.layers[LAYERID] = new Layer(0);
         return document.layers[LAYERID];
         }
      else {
         PARENTLAYEROBJ.document.layers[LAYERID] = new Layer(0,PARENTLAYEROBJ);
         return PARENTLAYEROBJ.document.layers[LAYERID];
         }
      }
   else if (ns6) {
      if (isBlank(PARENTLAYEROBJ)) PARENTLAYEROBJ = document.body;
      var tempLayer = document.createElement('div');
      tempLayer.setAttribute('id',LAYERID);
      tempLayer.setAttribute('style','position:absolute;left:0;top:0;width:1;visibility:hidden;');
      PARENTLAYEROBJ.appendChild(tempLayer);
      return document.getElementById(LAYERID);
      }
   }

function createlayer(strLayer,LAYERHTML,ZINDEX,strShowFlag,LEFT,TOP,WIDTH,HEIGHT,COLOR,EXTRA)
{
		var LAYEROBJ;
		LAYEROBJ = addLayer(strLayer,'');
		setLayerZIndex(LAYEROBJ,ZINDEX);
		moveLayerTo(LAYEROBJ,LEFT,TOP);
		setLayerSize(LAYEROBJ,WIDTH,HEIGHT);
		if (!isBlank(COLOR)) setLayerBgColor(LAYEROBJ,COLOR);
		showLayer(LAYEROBJ);
}
// ----- 8. LAYER APPEARANCE ----- //

function setLayerBgColor(LAYEROBJ,COLOR) {
   if (ns4) LAYEROBJ.document.bgColor = COLOR;
   else if (mnc) LAYEROBJ.style.backgroundColor = COLOR;
   }


function setLayerBgSrc(LAYEROBJ,SRC) {
   if (ns4) LAYEROBJ.background.src = SRC;
   else if (mnc) LAYEROBJ.style.backgroundImage = 'url(' + SRC + ')';
   }

// ----- 9. LAYER CLIPPING ----- //

function getLayerClipBottom(LAYEROBJ) {
   if (ns4) return LAYEROBJ.clip.bottom;
   else if (mnc) {
      var tempClipArray = LAYEROBJ.style.clip.substring(5,LAYEROBJ.style.clip.length - 3).split('px ');
      return parseInt(tempClipArray[2]);
      }
   }

function getLayerClipLeft(LAYEROBJ) {
   if (ns4) return LAYEROBJ.clip.left;
   else if (mnc) {
      var tempClipArray = LAYEROBJ.style.clip.substring(5,LAYEROBJ.style.clip.length - 3).split('px ');
      return parseInt(tempClipArray[3]);
      }
   }

function getLayerClipRight(LAYEROBJ) {
   if (ns4) return LAYEROBJ.clip.right;
   else if (mnc) {
      var tempClipArray = LAYEROBJ.style.clip.substring(5,LAYEROBJ.style.clip.length - 3).split('px ');
      return parseInt(tempClipArray[1]);
      }
   }

function getLayerClipTop(LAYEROBJ) {
   if (ns4) return LAYEROBJ.clip.top;
   else if (mnc) {
      var tempClipArray = LAYEROBJ.style.clip.substring(5,LAYEROBJ.style.clip.length - 3).split('px ');
      return parseInt(tempClipArray[0]);
      }
   }

function setLayerClip(LAYEROBJ,TOP,RIGHT,BOTTOM,LEFT) {
   if (mnc) {
      if (isBlank(TOP)) TOP = getLayerClipTop(LAYEROBJ);
      if (isBlank(RIGHT)) RIGHT = getLayerClipRight(LAYEROBJ);
      if (isBlank(BOTTOM)) BOTTOM = getLayerClipBottom(LAYEROBJ);
      if (isBlank(LEFT)) LEFT = getLayerClipLeft(LAYEROBJ);
      if (ns4) {
         LAYEROBJ.clip.left = LEFT;
         LAYEROBJ.clip.top = TOP;
         LAYEROBJ.clip.right = RIGHT;
         LAYEROBJ.clip.bottom = BOTTOM;
         }
      else LAYEROBJ.style.clip = 'rect(' + TOP + 'px ' +  RIGHT + 'px ' + BOTTOM + 'px '  + LEFT + 'px)';
      }
   }

// ----- 10. LAYER DIMENSIONS ----- //

function getLayerHeight(LAYEROBJ) {
   if (ie4) return LAYEROBJ.clientHeight;
   else if (ns4) return LAYEROBJ.clip.height;
   else if (mnc) return parseInt(LAYEROBJ.style.height);
   }

function getLayerWidth(LAYEROBJ) {
   if (ie4) return LAYEROBJ.clientWidth;
   else if (ns4) return LAYEROBJ.clip.width;
   else if (mnc) return parseInt(LAYEROBJ.style.width);
   }

function setLayerSize(LAYEROBJ,WIDTH,HEIGHT) {
   if (ie4) {
      if (!isBlank(WIDTH)) LAYEROBJ.style.pixelWidth = WIDTH;
      if (!isBlank(HEIGHT)) LAYEROBJ.style.pixelHeight = HEIGHT;
      }
   else if (ns4) {
      if (!isBlank(WIDTH)) LAYEROBJ.clip.right = WIDTH;
      if (!isBlank(HEIGHT)) LAYEROBJ.clip.bottom = HEIGHT;
      }
   else if (mnc) {
      if (!isBlank(WIDTH)) LAYEROBJ.style.width = WIDTH + 'px';
      if (!isBlank(HEIGHT)) LAYEROBJ.style.height = HEIGHT + 'px';
      }
   }

// ----- 11. LAYER DRAGGING ----- //

function addLayerDrag(LAYEROBJ,DRAGLAYEROBJ,DRAGENDFUNC) {
   if (mnc) {
      if (!cursorCaptured) captureCursor();
      LAYEROBJ.drag = new Object();
      LAYEROBJ.drag.layerObj = (!isBlank(DRAGLAYEROBJ)) ? DRAGLAYEROBJ : LAYEROBJ;
      LAYEROBJ.drag.onDragEnd = (!isBlank(DRAGENDFUNC)) ? new Function(DRAGENDFUNC) : null;
      if (ns4) {
         LAYEROBJ.captureEvents(Event.MOUSEDOWN);
         document.captureEvents(Event.MOUSEUP);
         }
      LAYEROBJ.onmousedown = dragLayerStart;
      document.onmouseup = dragLayerStop;
      }
   }

function removeLayerDrag(LAYEROBJ) {
   if (mnc) {
      LAYEROBJ.drag = null;
      LAYEROBJ.onmousedown = null;
      if (ns4) {
         LAYEROBJ.releaseEvents(Event.MOUSEDOWN);
         document.releaseEvents(Event.MOUSEUP);
         }
      }
   }

// Do not use any LAYER DRAGGING code past here.

dragLayerObj = new Object();
dragLayerObj.isDragging = false;

function dragLayerStart() {
   if (!this.isSliding) {
      dragLayerObj.layerObj = this.drag.layerObj;
      dragLayerObj.cursorOffsetX = cursorPageX - getLayerLeft(dragLayerObj.layerObj);
      dragLayerObj.cursorOffsetY = cursorPageY - getLayerTop(dragLayerObj.layerObj);
      dragLayerObj.onDragEnd = this.drag.onDragEnd;
      setLayerOnTop(dragLayerObj.layerObj);
      dragLayerObj.isDragging = true;
      return true;
      }
   }

function dragLayerStop() {
   if (dragLayerObj.isDragging) {
      dragLayerObj.isDragging = false;
      if (dragLayerObj.onDragEnd != null) dragLayerObj.onDragEnd();
      return true;
      }
   }

// ----- 12. LAYER HTML ----- //

function setLayerHTML(LAYEROBJ,STR) {
   if (navigator.userAgent.indexOf('MSIE 5.0') && navigator.userAgent.indexOf('Mac') != -1) STR += '\n';
   if (ns4) {
      LAYEROBJ.document.open();
      LAYEROBJ.document.write(STR);
      LAYEROBJ.document.close();
      }
   else if (mnc) LAYEROBJ.innerHTML = STR;
   }

// ----- 13. LAYER OBJECT ----- //

function getLayerObj(LAYERID) {
   if (ie4) return document.all[LAYERID];
   else if (ns4) {
      var tempLayerObj = null;
      var tempParentObj = (arguments.length == 1) ? document : arguments[1];
      for (var tempLayerLoop in tempParentObj.layers) {
         var tempObj = tempParentObj.layers[tempLayerLoop];
         var tempConstructor = tempObj.constructor + '';
         if (tempConstructor.indexOf('function Layer()') != -1) {
            if (tempLayerLoop == LAYERID) return tempObj;
            else if (tempObj.document.layers.length > 0) tempLayerObj = getLayerObj(LAYERID,tempObj);
            }
         }
      return tempLayerObj;
      }
   else if (mnc) return document.getElementById(LAYERID);
   }

// ----- 14. LAYER POSITIONING ----- //

function getLayerLeft(LAYEROBJ) {
   if (ns4) return LAYEROBJ.left;
   else if (mnc) return parseInt(LAYEROBJ.style.left);
   }

function getLayerTop(LAYEROBJ) {
   if (ns4) return LAYEROBJ.top;
   else if (mnc) return parseInt(LAYEROBJ.style.top);
   }

function moveLayerBy(LAYEROBJ,DISTX,DISTY) {
   if (ns4) {
      if (isBlank(DISTX)) DISTX = 0;
      if (isBlank(DISTY)) DISTY = 0;
      LAYEROBJ.moveBy(DISTX,DISTY);
      }
   else if (mnc) {
      if (!isBlank(DISTX)) LAYEROBJ.style.left = (parseInt(LAYEROBJ.style.left) + DISTX) + 'px';
      if (!isBlank(DISTY)) LAYEROBJ.style.top = (parseInt(LAYEROBJ.style.top) + DISTY) + 'px';
      }
   }

function moveLayerTo(LAYEROBJ,LEFT,TOP) {
   if (ns4) {
      if (isBlank(LEFT)) LEFT = getLayerLeft(LAYEROBJ);
      if (isBlank(TOP)) TOP = getLayerTop(LAYEROBJ);
      LAYEROBJ.moveTo(LEFT,TOP);
      }
   else if (mnc) {
      if (!isBlank(LEFT)) LAYEROBJ.style.left = LEFT + 'px';
      if (!isBlank(TOP)) LAYEROBJ.style.top = TOP + 'px';
      }
   }

function positionlayer(strLayer, TOP, LEFT, HEIGHT, WIDTH) {
			setLayerSize (getLayerObj(strLayer), WIDTH,HEIGHT);
			moveLayerTo(getLayerObj(strLayer),LEFT, TOP);
	}

// ----- 15. LAYER SLIDING ----- //

function slideLayerBy(LAYEROBJ,DISTX,DISTY,INCREMENT,FRAMERATE,SLIDEENDFUNC) {
   if (mnc) {
      var tempSlideId = LAYEROBJ.id;
      if (slideLayerObj[tempSlideId] != null) window.clearTimeout(slideLayerObj[tempSlideId].moveTimeout);
      var tempPosX = getLayerLeft(LAYEROBJ);
      var tempPosY = getLayerTop(LAYEROBJ);
      if (isBlank(DISTX)) DISTX = 0;
      if (isBlank(DISTY)) DISTY = 0;
      var tempEndX = tempPosX + DISTX;
      var tempEndY = tempPosY + DISTY;
      slideLayerObj[tempSlideId] = new slideLayerInit(LAYEROBJ,tempPosX,tempPosY,tempEndX,tempEndY,INCREMENT,FRAMERATE,SLIDEENDFUNC);
      slideLayerObj[tempSlideId].slideLayer();
      }
   }

function slideLayerTo(LAYEROBJ,LEFT,TOP,INCREMENT,FRAMERATE,SLIDEENDFUNC) {
   if (mnc) {
      var tempSlideId = LAYEROBJ.id;
      if (slideLayerObj[tempSlideId] != null) window.clearTimeout(slideLayerObj[tempSlideId].moveTimeout);
      var tempPosX = getLayerLeft(LAYEROBJ);
      var tempPosY = getLayerTop(LAYEROBJ);
      if (isBlank(LEFT)) LEFT = tempPosX;
      if (isBlank(TOP)) TOP = tempPosY;
      slideLayerObj[tempSlideId] = new slideLayerInit(LAYEROBJ,tempPosX,tempPosY,LEFT,TOP,INCREMENT,FRAMERATE,SLIDEENDFUNC);
      slideLayerObj[tempSlideId].slideLayer();
      }
   }

// Do not use any LAYER SLIDING code past here.

slideLayerObj = new Object();

function slideLayerInit(LAYEROBJ,POSX,POSY,ENDX,ENDY,INCREMENT,FRAMERATE,SLIDEENDFUNC) {
   dragLayerObj.isDragging = false;
   LAYEROBJ.isSliding = true;
   this.layerId = LAYEROBJ.id;
   this.layerObj = LAYEROBJ;
   this.posX = POSX;
   this.posY = POSY;
   this.posZ = 0;
   this.endX = ENDX;
   this.endY = ENDY;
   this.incZ = (!isBlank(INCREMENT)) ? INCREMENT : 3;
   this.frameRate = (!isBlank(FRAMERATE)) ? FRAMERATE : 50;
   this.onSlideEnd = (!isBlank(SLIDEENDFUNC)) ? new Function(SLIDEENDFUNC) : null;
   this.moveTimeout = null;
   this.slideLayer = slideLayerMove;
   this.distX = this.endX - this.posX;
   this.dirX = (this.distX >= 0) ? 'right' : 'left';
   if (this.distX < 0) this.distX *= -1;
   this.distY = this.endY - this.posY;
   this.dirY = (this.distY >= 0) ? 'down' : 'up';
   if (this.distY < 0) this.distY *= -1;
   this.distZ = Math.sqrt(Math.pow(this.distX,2) + Math.pow(this.distY,2));
   this.slideAngle = Math.atan(this.distX / this.distY);
   this.incX = Math.sin(this.slideAngle) * this.incZ;
   this.incY = Math.cos(this.slideAngle) * this.incZ;
   }

function slideLayerMove() {
   if (this.posZ + this.incZ < this.distZ) {
      this.posX += (this.dirX == 'right') ? this.incX : this.incX * -1;
      this.posY += (this.dirY == 'down') ? this.incY : this.incY * -1;
      this.posZ += this.incZ;
      moveLayerTo(this.layerObj,Math.round(this.posX),Math.round(this.posY));
      slideLayerObj[this.layerId].moveTimeout = setTimeout('slideLayerObj[\'' + this.layerId + '\'].slideLayer()',this.frameRate);
      }
   else {
      this.posX = this.endX;
      this.posY = this.endY;
      moveLayerTo(this.layerObj,this.endX,this.endY);
      if (this.onSlideEnd != null) this.onSlideEnd();
      this.layerObj.isSliding = false;
      }
   }

// ----- 16. LAYER STACKING ----- //

function setLayerOnBottom(LAYEROBJ) {
   if (mnc) setLayerZIndex(LAYEROBJ,getLayerStack('<') - 1);
   }

function setLayerOnTop(LAYEROBJ) {
   if (mnc) setLayerZIndex(LAYEROBJ,getLayerStack('>') + 1);
   }

// Do not use any LAYER STACKING code past here.

function getLayerStack(TYPE) {
   if (ie4) {
      var tempLayerZIndex = null;
      for (var tempLayerLoop in document.all) {
         if (typeof(document.all[tempLayerLoop]) == 'object' && (document.all[tempLayerLoop].tagName == 'DIV' || document.all[tempLayerLoop].tagName == 'SPAN')) {
            if (tempLayerZIndex == null || eval('document.all[tempLayerLoop].style.zIndex ' + TYPE + ' tempLayerZIndex')) {
               tempLayerZIndex = document.all[tempLayerLoop].style.zIndex;
               }
            }
         }
      }
   else if (ns4) {
      var tempParentObj = (arguments.length == 1) ? document : arguments[1];
      var tempLayerZIndex = (arguments.length == 1) ? null : arguments[2];
      for (var tempLayerLoop in tempParentObj.layers) {
         var tempConstructor = tempParentObj.layers[tempLayerLoop].constructor + '';
         if (tempConstructor.indexOf('function Layer()') != -1) {
            if (tempLayerZIndex == null || eval('tempParentObj.layers[tempLayerLoop].zIndex ' + TYPE + ' tempLayerZIndex')) {
               tempLayerZIndex = tempParentObj.layers[tempLayerLoop].zIndex;
               }
            if (tempParentObj.layers[tempLayerLoop].layers.length > 0) {
               tempLayerZIndex = getLayerStack(TYPE,tempParentObj.layers[tempLayerLoop].document,tempLayerZIndex);
               }
            }
         }
      }
   else if (mnc) {
      var tempLayerZIndex = null;
      var tempLayersObj = document.getElementsByTagName('div');
      for (var tempLayerLoop = 0; tempLayerLoop < tempLayersObj.length; tempLayerLoop++) {
         if (tempLayerZIndex == null || eval('tempLayersObj[tempLayerLoop].style.zIndex ' + TYPE + ' tempLayerZIndex')) {
            tempLayerZIndex = tempLayersObj[tempLayerLoop].style.zIndex;
            }
         }
      }
   return tempLayerZIndex;
   }

// ----- 17. LAYER VISIBILITY ----- //

function hideLayer(LAYEROBJ) {
   if (ns4) LAYEROBJ.visibility = 'hide';
   else if (mnc) LAYEROBJ.style.visibility = 'hidden';
   }

function showLayer(LAYEROBJ) {
   if (ns4) LAYEROBJ.visibility = 'show';
   else if (mnc) LAYEROBJ.style.visibility = 'visible';
   }

// ----- 18. LAYER Z-INDEX ----- //

function getLayerZIndex(LAYEROBJ) {
   if (ns4) return LAYEROBJ.zIndex;
   else if (mnc) return LAYEROBJ.style.zIndex;
   }

function setLayerZIndex(LAYEROBJ,ZINDEX) {
   if (ns4) LAYEROBJ.zIndex = ZINDEX;
   else if (mnc) LAYEROBJ.style.zIndex = ZINDEX;
   }

// ----- 19. WINDOW ----- //

function getWinHeight() {
   if (ie4Min) return document.body.clientHeight;
   else if (ns4Min) return window.innerHeight;
   }

function getWinWidth() {
   if (ie4Min) return document.body.clientWidth;
   else if (ns4Min) return window.innerWidth;
   }

// ----- 20. OTHER CODE ----- //

function isBlank(STR) {
   if (mnc) {
      if (STR == null) STR = '';
      STR += '';
      STR = STR.replace(/^\s+|\s+$/g,'');
      return (STR == '') ? true : false;
      }
   }

function MM_reloadPage(init) {  //reloads the window if Nav4 resized

}

function chgimg(image, imgname)
{var currimage, stdimage, imgobj, slashpos; stdimage = image + ".gif"; imgobj = eval ("document.all." + imgname); 	currimage = imgobj.src; slashpos = currimage.lastIndexOf("/",currimage.length); currimage = currimage.substring(slashpos + 1,currimage.length); if (currimage == stdimage) {imgobj.src="images/" + image + "_o.gif"; } else {imgobj.src = "images/" + image + ".gif";}}

//function doThemes(objThemesDD)
//{if (objThemesDD.value != 0) {doPage(objThemesDD.value, "");}}

function doThemes(objThemesDD)
{if (objThemesDD.value != 0) {doPage(objThemesDD.value, "");}}


function doTripPlanner(objTripPlannerDD)
{
	switch (objTripPlannerDD.value)
	{
		case '0' : break;

		case '1' : doPage(2781, "");
						break;
		case '2' : doPage(393, "");
						break;
		case '3' : popupwin("http://www.fhrai.com/hotelsrch.asp","toolbars=yes,menubar=yes,maximize=yes,resizable=1,scrollbars=yes");
						break;
		case '4' : document.frmMain.action = "http://www.tourismofindia.com/newsite/requestpackage.asp"; document.frmMain.submit(); break;
		case '5' :  popupwin("http://www.indianrail.gov.in/ ","toolbars=yes,menubar=yes,maximize=yes,resizable=1,scrollbars=yes");
						break;
		case '6' : doPage(804, "");
						break;
		case '7' :  popupwin("http://www.fhrai.com/restsrch.asp","toolbars=yes,menubar=yes,maximize=yes,resizable=1,scrollbars=yes");
						break;
		case '8' : doPage(2782, "");
						break;
		//popupwin("http://www.tourismofindia.com/newsite/requestpackage.asp","popup","toolbar=no,menubar=no,statusbar=no,width=600,height=500");

	}

	//if ((objTripPlannerDD.value != '0') && (objTripPlannerDD.value != '1') && (objTripPlannerDD.value != '3')&& (objTripPlannerDD.value != '4')&& (objTripPlannerDD.value != '4')&& (objTripPlannerDD.value != '4'))
	//{doPage(objTripPlannerDD.value, "");}
	objTripPlannerDD.selectedIndex = 0;

}

function doKnowIndia(objKnowIndiaDD)
{if (objKnowIndiaDD.value != 0) 	{doPage(objKnowIndiaDD.value, "");}}

//Function for Wallpapers
function dispwall(imgname)
		{strmsg="<html><head><title>Tourism of India - Wallpapers</title></head><body onload=window.focus()><img src=/siteimages/" + imgname + "  border=0><br></body><?html>"; window.open("result.htm","WallPaper","scrollbars=yes,toolbars=no, menubar=no,resizable=yes,width=400,height=400,left=100,top=100"); }

//Function for Videos
function dispmpg(mpgname)
  {
  	strmsg="<html><head><title>Tourism of India - Video Gallery</title></head><body onload=window.focus();>";
  	strmsg= strmsg + '<object ID="WMP" STANDBY="Loading Microsoft Windows Media Player components..."><param NAME="AutoSize" VALUE=1><param NAME="AutoStart" VALUE=1><param NAME="AnimationAtStart" VALUE=0><param NAME="FileName" VALUE="/mpeg/' + mpgname + '.mpg"><param NAME="PLUGINSPAGE" VALUE="http://www.microsoft.com/Windows/MediaPlayer/"><param NAME="ShowControls" VALUE=1><param NAME="ShowStatusBar" VALUE=1><embed ANIMATIONATSTART=0 AUTOSIZE=0 width=320 height=312  AUTOSTART=1 DISPLAYBACKCOLOR=000000 NAME="WMP" PLUGINSPAGE="http://www.microsoft.com/Windows/MediaPlayer/" SHOWCONTROLS=1 SHOWDISPLAY=0 SHOWSTATUSBAR=1 SRC="/mpeg/' + mpgname + '.mpg" TYPE="video/x-ms-asf-plugin"><noembed></noembed></embed></object><br></body></html>';
  	//strmsg= strmsg + "<a href=/mpeg/" + mpgname + ".mpg width=400 height=300></a><br></body></html>";
  	//alert(strmsg);
  	window.open("result.htm","WallPaper","scrollbar=no,toolbars=no, menubar=no,resizable=no,width=500,height=500,left=1,top=1");
  }

function doPage(intPageId, strPageName)
{
	//doPage(123,"");
	//<a class=qqq href=javascript:doPage(123,"");>jccsdd</a>

	if (intPageId == 0 ) return;
	if (intPageId == '0' ) return;
	var strUrl;
	strUrl = "cms_Page.asp";
	document.frmMain.PageId.value = intPageId;
	document.frmMain.PageName.value = strPageName;
	document.frmMain.action = strUrl;
	document.frmMain.submit();
}

function popupwin(strUrl,strParam)
{
	window.open(strUrl,"popup",strParam);
}

//functions specific to fairs & festivals
			function populateSecond()
			{

				var frm = document.frmMain;
				var arrFestivals = new Array("Amarnath Yatra","Baisakhi","Bihu","Bikaner Festival","Buddha Purnima","Champakkulam Boat Race","Chapchar Kut","Chennai Dance & Music Festival","Christmas","Deccan Festival","Desert Festival","Durga Puja","Dussehra","Eid-Milad-ul-Nabi","Elephant Festival","Elephanta Festival","Ellora Festival","Float Festival","Ganesh Chaturthi","Ganga Dussehra","Gangaur Festival","Garden Festival","Goa Carnival","Good Friday & Easter","Gudi Padwa Or Ugadi","Guru Gobind Singh's Birthday","Guru Parab","Guru Purnima","Hampi Festival","Hemis Festival","Holi","Hoysala Mahotsava","Id-ul-Fittr","Id-ul-Zuha (Bakr-Id)","Independence Day","International Flower Festival","International Mango Festival","International Yoga Week","Island Tourism Festival","Janmashtami","Ka Pomblang Nongkrem","Kerala Village Fair","Khajuraho Dance Festival","Konark Dance Festival","Kurushetra Festival","Lohri","Lucknow Festival","Mahashivratri","Mahavir Jayanthi","Makar Sankranti","Mamallapuram Dance festival","Marwar Festival","Mewar Festival","Modhera Dance Festival","Muharram","Nag Panchami","Nagaur Fair","National Kite Festival","Natyanjali Festival","Navaratri","Nehru Trophy Boat Race","Nishagandhi Dance Festival","Onam","Pattadakkal Dance Festival","Pongal","Pooram","Pushkar Fair","Rajgir Dance Festival","Raksha Bandhan","Ramnavami","Rathyatra","Republic Day","Rose Festival","Sindhu Darshan Festival","Sonepur Mela","Surajkund Crafts Mela","Taj Mahotsav","Tarnetar Mela","Teej","Thai Pusam","Urs","Vasant Panchami","Vishu");
				var intCount1 = 0;
				var intCount2 = 0;
				var intCount3 = 47;



				frm.Festival.options.length = 0;
				//add default value
				frm.Festival.options[intCount2++] = new Option("---Select A Festival ---",0)

				for (intCount1=0; intCount1<arrFestivals.length; intCount1++)
				{

					if (arrFestivals[intCount1].charAt(0).toUpperCase() == frm.Alpha[frm.Alpha.selectedIndex].value)
					{
							frm.Festival.options[intCount2++] = new Option(arrFestivals[intCount1],intCount3);
					}
					intCount3 = intCount3 + 1;
				}
			}

function doNavigate()
{
	var frm = document.frmMain;
	var strUrl;
	strUrl = frm.Festival[frm.Festival.selectedIndex].value;
	if (strUrl == 0)
	{}
	else
	{doPage(strUrl,"");}
}

//var strWebSite = "www.cry.org/home/crynew";
var strWebSite = "192.192.192.128/newtoi";
//var strWebSite = "www.tourismofindia";

function dosearch()
{
	alert ("ok");
	var fld;
	var fldvalue;

	fld = document.frmMain.search;
	fldvalue = fld.value;

	if (chkblanks(fldvalue) == '')
	{alert('Please enter search text and click on Go button');}
	else
	{
		document.frmMain.action = "http://" + strWebSite + "/search.asp";
		document.frmMain.method = "Post";
		document.frmMain.submit();
	}


}
//end of functions for fairs & festivals

