/**
 *
 * 
 */

function init(){
/*
   roundCorners('loginBoxWrapper',1, 1);
   roundCorners('searchBoxWrapper',1, 1);
   roundCorners('relatedLinksBoxWrapper',1, 1);
   roundCorners('internBoxWrapper',1, 1);
   roundCornersWhide('mainContent',0, 1);
   roundCornersWhide('footer',1, 0);
*/
   setMainColumnHeight();
   window.onresize = setMainColumnHeight;
}

function roundCorners(objId, top, bottom){

try{
   var obj = document.getElementById(objId);

   if(top){
      var dTop = document.createElement('div');
      dTopLeft = document.createElement('div');
      var dTopRight = document.createElement('div');
      dTop.className = 'roundCornerTop';
      dTopLeft.className = 'roundCornerTopLeft';
      dTopRight.className = 'roundCornerTopRight';
      dTop.appendChild(dTopRight);
      dTop.appendChild(dTopLeft);
      obj.appendChild(dTop);
   }
   if(bottom){
      var dBottom = document.createElement('div');
      dBottomLeft = document.createElement('div');
      var dBottomRight = document.createElement('div');
      dBottom.className = 'roundCornerBottom';
      dBottomLeft.className = 'roundCornerBottomLeft';
      dBottomRight.className = 'roundCornerBottomRight';
      dBottom.appendChild(dBottomRight);
      dBottom.appendChild(dBottomLeft);
      obj.appendChild(dBottom);
   }
}catch (e) {
}
}


function roundCornersWhide(objId, top, bottom){
try{
   var obj = document.getElementById(objId);
   if(top){
      var dTop = document.createElement('div');
      dTopLeft = document.createElement('div');
      var dTopRight = document.createElement('div');
      dTop.className = 'roundCornerTop';
      dTopLeft.className = 'roundCornerTopLeftWhide';
      dTopRight.className = 'roundCornerTopRight';
      dTop.appendChild(dTopRight);
      dTop.appendChild(dTopLeft);
      obj.appendChild(dTop);
   }
   if(bottom){
      var dBottom = document.createElement('div');
      dBottomLeft = document.createElement('div');
      var dBottomRight = document.createElement('div');
      dBottom.className = 'roundCornerBottom';
      dBottomLeft.className = 'roundCornerBottomLeftWhide';
      dBottomRight.className = 'roundCornerBottomRight';
      dBottom.appendChild(dBottomRight);
      dBottom.appendChild(dBottomLeft);
      obj.appendChild(dBottom);
   }
} catch (e) {
}
}


function getPageHeight() {
    var pageY
    var test1 = document.body.scrollHeight;
    var test2 = document.body.offsetHeight
    if (test1 > test2) // all but Explorer Mac
    {
        //x = document.body.scrollWidth;
        pageY= document.body.scrollHeight;
    }
    else // Explorer Mac;
         //would also work in Explorer 6 Strict, Mozilla and Safari
    {
        //x = document.body.offsetWidth;
        pageY= document.body.offsetHeight;
    }
    return pageY;
}

function getWindowHeight() {
    var winY;
    if (self.innerHeight) // all except Explorer
    {
        //x = self.innerWidth;
        winY = self.innerHeight;
    }
    else if (document.documentElement && document.documentElement.clientHeight)
        // Explorer 6 Strict Mode
    {
        //x = document.documentElement.clientWidth;
        winY = document.documentElement.clientHeight;
    }
    else if (document.body) // other Explorers
    {
        //x = document.body.clientWidth;
        winY = document.body.clientHeight;
    }
    return winY;
}

function setMainColumnHeight() {
    var footerTag = document.getElementById('footer');
    footerTag.style.bottom = '0px';
    if (window.innerHeight) {
      if(document.height < window.innerHeight) {
         var ffHeight = window.innerHeight + 1;
         document.getElementById('mainColumnWrapper').style.height = ffHeight + 'px';
      }
   } else {
        if(getWindowHeight() > getPageHeight()-24) {
            document.getElementById('mainColumnWrapper').style.height = getWindowHeight()+'px';
            document.getElementById('mainColumn').style.height = getWindowHeight()+'px';
        }
   }
}


 

