﻿// JScript File

    var curMenu = new Array();
    var timerID;
    
    function Rect(top,left,width,height) {
        this.top = top;
        this.left = left;
        this.width = width;
        this.height = height;
    }

	function GetElementRect(obj) {
    
        var left = 0;
        var top = 0;
        for(pObj = obj; pObj != null; pObj = pObj.offsetParent) {
            left += pObj.offsetLeft;                
            top += pObj.offsetTop;
        }
        
        var width = obj.offsetWidth;
        var height = obj.offsetHeight;
        
        return new Rect(top,left,width,height);
    
    }

	//English pages only - IMAGE SWAP
    function InitMarketImages() {
        var timeout;
        var i = 1
            
          var img = document.getElementById("img" + i);
          img.imgIndex = 1;

          timeout = 2000;
          self.setTimeout("SwapImage(" + i + ")", timeout);
    }
   
	//English pages only - IMAGE SWAP
    function SwapImage(index) {
        
        var img = document.getElementById("img" + index);
        
        img.imgIndex++;
		//This is the number of images you want to cycle - currently set to 8
        if(img.imgIndex > 8)
            img.imgIndex = 1;
        
        img.swap = false;
		//This is the image folder and name - currently images/market<number>.gif (i.e. market1.gif, market2.gif...)
        TransitionImage(img,"images/market" + (img.imgIndex) + ".gif");    
        self.setTimeout("SwapImage(" + index + ")", 6000);
    }

	//Portuguese pages only - IMAGE SWAP
    function InitMarketImages_PT() {
        var timeout;
        var i = 1
            
          var img = document.getElementById("img" + i);
          img.imgIndex = 1;

          timeout = 2000;
          self.setTimeout("SwapImage_PT(" + i + ")", timeout);
    }

	//Portuguese pages only - IMAGE SWAP
    function SwapImage_PT(index) {
        
        var img = document.getElementById("img" + index);
        
        img.imgIndex++;
		//This is the number of images you want to cycle - currently set to 8
        if(img.imgIndex > 8)
            img.imgIndex = 1;
        
        img.swap = false;
		//This is the image folder and name - currently ../images/market<number>.gif (i.e. market1.gif, market2.gif...)
        TransitionImage(img,"../images/market" + (img.imgIndex) + ".gif");    
        self.setTimeout("SwapImage_PT(" + index + ")", 6000);
    }

	function TransitionImage(img, src) {
    
			try {
				 FadeImage(img.id,2,src);
			}
			catch(e) {
			    img.src = src;
			}
    
    }
