/*
 * This class where use in the js-Files from Weka to display Links
 */
function mabLink(displayImage,displayText,linkDoc,linkActive)
{
    this.sImage = displayImage;
    this.sText  = displayText;
    this.linkDoc   = linkDoc;
    this.active = linkActive;
    
    this.currentEntryStyle = "";
    this.filePathIcon = "./weka/images/IconsWeka/";
    this.isFirst = 0;
    this.isLast = 0;
    
    /**
    * Return the begin Element of a List of Entrys
    * @author rm
    * @return String returnValue
    */
    this.displayBegin = function(isFirst)
    {
    	if(isFirst == undefined)
    		isFirst = true;
        this.isFirst = isFirst ? 1 : 0;
        return "<table class=\"marginalLinkTablePopup bg-color7\" border=\"0\" cellspacing=\"0px\" cellpadding=\"0px\" >";
    }
    
    /**
    * Return the current Entry in a Table Row
    * @author rm
    * @return String returnValue
    */
    this.display = function()
    {
        var textClass = "marginalLinkText";
        var textOverClass = "marginalActiveLinkText";
        var returnValue = "";
        var tdClass = "marginalLinkTd";
	var trClass = "marginalLinkTr";
        if(this.active==1){
            textClass = "marginalActiveLinkText";
            tdClass = "marginalActiveLinkTd";
	    trClass = "marginalActiveLinkTr";
        }
        if(this.isFirst==1){
            if(this.active==1){
                tdClass = "marginalActiveLinkTdFirst";
            }
            else{
                tdClass = "marginalLinkTdFirst";
            }
        }
        returnValue += "<tr class=\"" + trClass + "\" onmouseover=\"this.className='marginalLinkTrHover';\" onmouseout=\"this.className='" + trClass + "'\">";
        returnValue += "<td width=\"16px\"  class=\"" + tdClass + "\" " + this.currentEntryStyle +" style=\"padding-left:5px;\">";
        if(this.sImage!=''){
            returnValue += "<img src=\""+ this.filePathIcon + this.sImage + "\" border=\"0\"/>";
        }else{
            returnValue += ".";
        }
        returnValue += " </td>";
        if(this.linkDoc.search(/^www\./i) > -1)
        	this.linkDoc = "http://" + this.linkDoc;
        
        var isExternLink = this.linkDoc.search(/^(?:(?:https{0,1}|ftp):\/\/)|mailto:/) > -1;
        
        if(isExternLink){
        	returnValue += "<td class=\"" + tdClass + " text\" " + this.currentEntryStyle +"><a href=\"" + this.linkDoc +"\" class=\"" + textClass +"\" target=\"_blank\">"+ this.sText +"</a></td>";
        } else {
        	returnValue += "<td class=\"" + tdClass + " text\" " + this.currentEntryStyle +"><a href=\"javascript:doWekaWebLink('" + this.linkDoc +"');\" class=\"" + textClass +"\">"+ this.sText +"</a></td>";
        }
        returnValue += "</tr>";
        return returnValue;
    }
    
    /**
    * Return the End Element of a List of Entrys
    * @author rm
    * @return String returnValue
    */
    this.displayEnd = function()
    {
        this.isLast = 1;
        return "</table>";
    }
    
    this.setCurrentEntryStyle = function(newStyle)
    {
        this.currentEntryStyle = newStyle;
    }
    
    this.setDisplayText = function(newText)
    {
    	this.sText = newText;
    }
    
}


/*
 * This Class 
 */
function mabTwoColList(leftText,rightText)
{
    this.sLeftText = leftText;
    this.sRightText = rightText;
    
    this.displayBegin = function()
    {
        return "<span style=\"margin-left: 20px; display: block;\">";
    }
    
    this.display = function()
    {
        var returnValue = "";
        returnValue += "<div>";
        returnValue += "<span class=\"fontStandard10Bold\" >" + leftText + ": </span>";
        returnValue += "<span class=\"fontStandard10\" >" + rightText + "</span>";
        returnValue += "</div>";
        return returnValue;
    }
    
    this.displayEnd = function()
    {
        return "</span>";
    }
        
}

