var topNavigation_selected = "none";
var NS4 = (document.layers)?1:0;
var SF = (navigator.appVersion.toString().indexOf('Safari')!=-1)?1:0;

var cacheArray=new Array(0);

function imageGroup() 
{ 

    if (this.total==null) 
    { 

        this.add=imageGroup; 

        if (!document.images) 
            return; 
    
        this.total = this.cached = this.rollovers = (SF?1:0); 
        this.names = new Array(0); 
        this.urls = new Array(0); 
        this.count = new Array(0); 
        this.i = new Object(); 
        this.index = cacheArray.length; 
        cacheArray[this.index] = this; 
        this.defURL = ''; 
        
    } 
    
    var a, j, k, args = arguments; 
    
    for (j = 0; j < args.length; j++) 
    { 
    
        k = this.total; 
        a = args[j].split('|'); 
        this.names[k] = a[0]; 
        this.urls[k] = this.defURL+a[1];
        this.total++; 
        
    } 
}

function loadImages() 
{ 

    if (document.images) 
    { 
    
        var j, c = cacheArray; 
        
        for (j=0; j<c.length; j++) loadGroup(c[j]);
        
    } 
}

function loadGroup(obj, pre) 
{ 

    if (obj.loaded) 
        return; 
        
    obj.loaded = 1; 
    var k, img, stuff = ''; 
    
    for (k = 0; k < obj.total; k++) 
    { 
    
        img = obj.i[ obj.names[k] ] = new Image(); 
        
        if (!NS4) 
        { 
        
            img.group = obj.index; 
            img.num = k; 
            img.onload = countImg; 
            
        } 
        
        if (NS4) 
        { 
        
            stuff += '<img src="' + obj.urls[k] 
                + '" onload="countImg('
                + obj.index+','+k+');" /><br />'; 
        
        } 
        
        img.src = obj.urls[k]; 
        
    } 
    
    if (NS4) 
    { 
    
        if (pre) 
        { 
        
            document.newLayer('cacher'+obj.index,stuff,0); 
            
        } 
        else 
        { 
        
            var cacher = new Layer(0), c = cacher.document; 
            c.write(stuff); 
            c.close(); 
        
        }        
    } 
}

function countImg(n, k) 
{ 

    if (!NS4) 
    {
    
        n = this.group; 
        k = this.num;
        
    } 
    
    var obj = cacheArray[n]; 
    
    if (obj.count[k]!=1) 
    {
    
        obj.count[k] = 1; 
        obj.cached++; 
        
        if (obj.cached==obj.total) 
        {
        
            obj.rollovers = 1; 
            if (obj.onload) eval(obj.onload);
            
        }
    }
}

function swapImg(obj, who, n) 
{ 

    var img = findObj(who + '_bttn');
    
    if(directorySelected() == who)
        n = '1';
    
    if (img)
        img.src = obj.i[ who + ( (n) ? '_on' : '_off' ) ].src;
        
}

function swapArrow(obj, who, n) 
{ 

    var img = findObj(who + '_bttn'); 
    
    if ((obj.rollovers) && (img))     
        img.src = obj.i['arrow'+((n)?'_on':'_off')].src;
     
}
