function links (ident, array) {
    
    this.ident = ident;
    this.linkArray = array;
    
    this.splitArray = Array();
    
    this.maxChars = 80;
    
    this.position = 0;
    
    this.target = document.getElementById(this.ident + "content");
    
    this.init = function () {
        
        var link = document.getElementById(this.ident + "link").getElementsByTagName("a")[0];
        
        link.jObject = this;
		link.onclick = function () { this.jObject.chooseNext(); return false; }
        //link.setAttribute("onclick", this.ident + ".chooseNext(); return false;");
        link.href = "#";
        
        var counter = 0;
        var y = 0;
        this.splitArray[0] = Array();
        
        for (x = 0; x < this.linkArray.length; x++) {
            this.linkArray[x].tt = x;
	    
            if (counter + this.linkArray[x].name.length < this.maxChars) {
                
                this.splitArray[y][this.splitArray[y].length] = this.linkArray[x];
                counter += this.linkArray[x].name.length;
                
            }
            else {
                
                y++;
                this.splitArray[y] = Array();
                this.splitArray[y][0] = this.linkArray[x];
                counter = this.linkArray[x].name.length;
            }
	    	if (this.linkArray[x].image != '') {
	    	
				var tt = document.createElement("div");
				tt.className = "tooltipLink";
				
				//tt.setAttribute("class", "tooltipLink");
				
				tt.id = this.ident + "TT" + x;
	    	
				var img = document.createElement("img");
				img.src = this.linkArray[x].image;
				tt.appendChild(img);
				document.body.appendChild(tt);
	   		 }
   		}
        
	
	
	    
	    
        this.display(this.position);
        
        
        
	}
    
    this.display = function (id) {
        
        this.clearElement(this.ident + "content");
        
        var array = this.splitArray[id];
        
        for (x = 0; x < array.length; x++) {
            
            var a = document.createElement("a");
            a.href = array[x].link;
            a.innerHTML = array[x].name;
            
	    if (array[x].image != '') {
	    	
	    	a.jObject = this;
	    	a.toolTip = array[x].tt;
	    	
			a.onmouseover = function (event) { this.jObject.showToolTip(this.toolTip, event); }
			a.onmouseout = function (event) { this.jObject.hideToolTip(this.toolTip, event); }
			a.onmousemove = function (event) { this.jObject.showToolTip(this.toolTip, event); }

	    }
	    
        this.target.appendChild(a);
	    
	    
	    this.ttnumber++;
	    
        }
        
        
    }
    
      this.showToolTip = function(id, e) {
        var e = (window.event) ? window.event : e;
	
        var tooltip = document.getElementById(this.ident + "TT" + id);
	
        var mouseX;
		var mouseY;
	
		if('undefined'!=typeof e.pageX) {
	    
	    	mouseX = e.pageX;
	    	mouseY = e.pageY;
	    
		}	
		else{
	    
	 	   mouseX = e.clientX + document.documentElement.scrollLeft;
	 	   mouseY = e.clientY + document.documentElement.scrollTop;
		}
	
        tooltip.style.left = "" + (mouseX - 10) + "px";
        tooltip.style.top = "" + (mouseY - 100) + "px";
        
        tooltip.style.display = "block";
        tooltip.style.visibility = "visible";
        
        
        
    }
    
    this.hideToolTip = function(id) {
        
        var tooltip = document.getElementById(this.ident + "TT" + id);
        
        tooltip.style.display = "none";
        tooltip.style.visibility = "hidden";
        
    }
    this.chooseNext = function () {
        
        if (this.position + 1 == this.splitArray.length) {
            this.position = 0;
            this.display(0);
        }
        else
        {
            this.position++;
            this.display(this.position);
        }
    }
    
    this.clearElement = function (element) {
	var content = document.getElementById(element);

        if ( content.hasChildNodes() )
        {
  	    while ( content.childNodes.length >= 1 )
            {
    			content.removeChild( content.firstChild );       
    	    } 
		}
	
        
    }
}