function adjustFooter(){ 
    var sideLen, threeColLen, artistLen, albumLen, songLen, e, headerHeight, bannerHeight, 
        flashHomeBannerHeight, bannerTitleHeight, searchResultHeight, getHeight1, getHeight2, getHeight3, helpLen, len;
    headerHeight = 80;
    bannerTitleHeight = xHeight('ctl00_TitleCtrl_pTitle');
    bannerHeight = xHeight('pagebanner');     
    flashHomeBannerHeight = xHeight('homepromo');  
    searchResultHeight = xHeight('searchresultheight');
    getHeight1 = xHeight('getheight1');
    getHeight2 = xHeight('getheight2');
    getHeight3 = xHeight('getheight3');
    helpLen = xHeight('helpFaqContent'); 
    len = headerHeight + bannerTitleHeight + bannerHeight + flashHomeBannerHeight + searchResultHeight + getHeight1 + getHeight2 + getHeight3 + helpLen  + 5;
    sideNavHeight = xHeight('sidenav_wrapper');
    sideLen = headerHeight + sideNavHeight; // - 60
    artistLen = xHeight('topartist');
    albumLen = xHeight('topalbum');
    songLen = xHeight('topsong');       
   
   var downloadHeight;
   downloadHeight = xHeight('DownloadArea');
         
    threeColLen = GetLargestColumn(artistLen,albumLen,songLen); 
    len = len + threeColLen;        
 
    var file = window.location.href;
    var filename = getFilename(file,true);
    filename=filename.toLowerCase();
    

//    alert(filename);
//    if (filename=='register.aspx') // dynamic css (validation error messages), make room for error box, temp fix
//        len = len + 60;     
    if (filename=='album.aspx') // Caculation is not fit for album.aspx page
        len = len + 50;     
    if (filename=='songsofsummer.aspx') // Caculation is not fit for album.aspx page
        len = len + 130;     
       if (sideLen > len)
        len = sideLen;
//    
//    alert('headerHeight:' + headerHeight);
//    alert('bannerTitleHeight:' + bannerTitleHeight);
//    alert('bannerHeight:' + bannerHeight);
//    alert('flashHomeBannerHeight:' + flashHomeBannerHeight);
//    alert('searchResultHeight:' + searchResultHeight);
//    alert('sideNavHeight:' + sideNavHeight); 
//    alert('sideLen:' + sideLen); 
//    alert('getHeight1:' + getHeight1);
//    alert('getHeight2:' + getHeight2);
//    alert('getHeight3:' + getHeight3);
//    alert('artistLen:' + artistLen);
//    alert('albumLen:' + albumLen);
//    alert('songLen:' + songLen); 
//    alert('Len:' + len);
//    
//    alert(document.getElementById('topsong')); 
    
    e = xGetElementById('footer');        
    xTop(e, len);
    e.style.display = ''; 
// e.style.display = 'block';      
}
function getFilename(text,ifLocal) {
    var lastB;
    if (!ifLocal)lastB = text.lastIndexOf("\\");
    else lastB = text.lastIndexOf("/");
    text = text.substr(lastB+1,text.length);
    var paramPos = text.indexOf("?");
    if (paramPos>0) text = text.substr(0,paramPos); 
    var anchorPos = text.indexOf("#");
    if (anchorPos>0) text = text.substr(0,anchorPos);    

    return text;
}

function GetLargestColumn(){

    var largestColumnHeight = 0;

    for (i = 0; i < arguments.length; i++){
        if (arguments[i] > largestColumnHeight){
            largestColumnHeight = arguments[i];
        }
    }
    return largestColumnHeight;
}