var i_activesponsor = 0;
var t;

function scaleImage(imageId, maxWidth, maxHeight) {
    var img = document.getElementById(imageId);
    
    if(img.height > maxHeight || img.width > maxWidth) {
        // Find which dimension is scaled the most
        var scaleH = maxHeight / img.height;
        var scaleW = maxWidth / img.width;

        // Scale the image
        if (scaleH < scaleW) {
            img.style.height = maxHeight;
        } else {
            img.style.width = maxWidth;
        }
    }
}

function switchsponsor()
{
    var currentRow = 'partnerTable:' + i_activesponsor;
    clearTimeout(t);
    if(document.getElementById(currentRow) != null) {
        if(i_activesponsor == 0){
            document.getElementById(currentRow).className = '';
            i_activesponsor++;
        } else {
            prevRow = 'partnerTable:' + (i_activesponsor - 1);
            document.getElementById(prevRow).className = 'hidden';
            currentRow = 'partnerTable:' + i_activesponsor;
            document.getElementById(currentRow).className = '';
            i_activesponsor++;
        }
    } else if(document.getElementById(currentRow) == null) {
        prevRow = 'partnerTable:' + (i_activesponsor - 1)
        document.getElementById(prevRow).className = 'hidden';
        i_activesponsor = 0;
        currentRow = 'partnerTable:' + i_activesponsor;
        document.getElementById(currentRow).className = '';
        i_activesponsor++;
    }
    
    
    t=setTimeout("switchsponsor()", 3000);
}



