    function showHideCommnets(elementid) {
        if (document.getElementById(elementid).style.display == 'none'){
            document.getElementById(elementid).style.display = 'block';
         }else{
            document.getElementById(elementid).style.display = 'none';
         }
    }
    function showHideAllCommnets(){
        var belement = document.getElementById("comment-expand");
        var action = belement.value;
        if(belement.value == "Expand"){
            belement.value = "Collapse";
            action = "block";
        }
        else{
            belement.value = "Expand";
            action = "none";
        }

        var i = 0;
        while(i >= 0){
            var divid = "comment-" + i;
            i = i+1;
            var elmnt = document.getElementById(divid);
            if(elmnt == null){
                i=-1;
                return;
            }
            elmnt.style.display = action;
        }
    }


/*Sorting Table *************Begin******************/

currentCol = 0
previousCol = -1

function CompareAlpha(a, b) {
    if (a[currentCol] < b[currentCol]) { return -1; }
    if (a[currentCol] > b[currentCol]) { return 1; }
    return 0;
}

function CompareAlphaIgnore(a, b) {
    strA = a[currentCol].toLowerCase();
    strB = b[currentCol].toLowerCase();
    if (strA < strB) { return -1; }
    else {
        if (strA > strB) { return 1; }
        else { return 0; }
    }
}

function CompareDate(a, b) {
    // this one works with date formats conforming to Javascript specifications, e.g. m/d/yyyy
    datA = new Date(a[currentCol]);
    datB = new Date(b[currentCol]);
    if (datA < datB) { return -1; }
    else {
        if (datA > datB) { return 1; }
        else { return 0; }
    }
}

function CompareDateEuro(a, b) {
    // this one works with european date formats, e.g. d.m.yyyy
    strA = a[currentCol].split(".");
    strB = b[currentCol].split(".")
    datA = new Date(strA[2], strA[1], strA[0]);
    datB = new Date(strB[2], strB[1], strB[0]);
    if (datA < datB) { return -1; }
    else {
        if (datA > datB) { return 1; }
        else { return 0; }
    }
}

function CompareNumeric(a, b) {
    //window.alert ("CompareNumeric");
    numA = a[currentCol]
    numB = b[currentCol]
    if (isNaN(numA)) { return 0;}
    else {
        if (isNaN(numB)) { return 0; }
        else { return numA - numB; }
    }
}

function TableSort(myTable, myCol, myType) {

    // Create a two-dimensional array and fill it with the table's content
    var mySource = document.all(myTable);
    var myRows = mySource.rows.length;
    var myCols = mySource.rows(0).cells.length;
    currentCol = myCol
    myArray = new Array(myRows)
    for (i=0; i < myRows; i++) {
        myArray[i] = new Array(myCols)
        for (j=0; j < myCols; j++) {
            myArray[i][j] = document.all(myTable).rows(i).cells(j).innerHTML
        }
    }
    if (myCol == previousCol) {
        myArray.reverse(); // clicked the same column as previously - reverse the sort
    }
    else { // clicked on a new column - sort as indicated
        switch (myType) {
            case "a":
                myArray.sort(CompareAlpha);
                break;
            case "ai":
                myArray.sort(CompareAlphaIgnore);
                break;
            case "d":
                myArray.sort(CompareDate);
                break;
            case "de":
                myArray.sort(CompareDateEuro);
                break;
            case "n":
                myArray.sort(CompareNumeric);
                break;
            default:
                myArray.sort()
        }
    }

    // Re-write the table contents
    for (i=0; i < myRows; i++) {
        for (j=0; j < myCols; j++) {
            mySource.rows(i).cells(j).innerHTML = myArray[i][j]
        }
    }

    previousCol = myCol; // remember the current sort column for the next pass
    return 0;
}

/*Sorting Table *************End******************/


function initautocomplete(fullnamearray) {
    //alert(fullnamearray.toString());
    // Instantiate first JS Array DataSource
    this.oACDS = new YAHOO.widget.DS_JSArray(fullnamearray);

    // Instantiate first AutoComplete
    this.oAutoComp = new YAHOO.widget.AutoComplete('assignee','snamecontainer', this.oACDS);
    this.oAutoComp.prehighlightClassName = "yui-ac-prehighlight";
    this.oAutoComp.typeAhead = true;
    this.oAutoComp.useShadow = true;
    this.oAutoComp.minQueryLength = 0;
    this.oAutoComp.delimChar = ",";
    this.oAutoComp.autoHighlight = false;
    //this.oAutoComp.animHoriz = true;
    this.oAutoComp.useIFrame = true;
}
