function getWindowHeight() {
    var windowHeight = 0;
    if (typeof(window.innerHeight) == 'number') {
        windowHeight = window.innerHeight;
    }
    else {
        if (document.documentElement && document.documentElement.clientHeight) {
            windowHeight = document.documentElement.clientHeight;
        }
        else {
            if (document.body && document.body.clientHeight) {
                windowHeight = document.body.clientHeight;
            }
        }
    }
    return windowHeight;
}

function mymax(a,b){
    if (a>b){
        return a;
    }else{
        return b;
    }
}

function setFooter(){
    if (document.getElementById){
        padding = 10;
        ms = document.getElementById('mainSection');
        if (ms){
            wh = getWindowHeight();
            msh = ms.offsetHeight;
            mst = ms.offsetTop;
            foot = document.getElementById('footer');
            fh = foot.offsetHeight;
            tp = mymax((wh-fh),(msh + mst + padding));
            //            alert(top);
            foot.style.top =  tp + 'px';
            foot.style.position='absolute';
        }else{
            alert('Main Section was not found');
        }
    }
}

    function setTab(){
	if (!document.getElementById){return;}
	var tabs = new Array();
	tabs['civilpage']    = 'civil';
	tabs['homepage']     = 'home';
	tabs['criminalpage'] = 'criminal';
	tabs['custompage']   = 'custom';
	tabs['contactpage']  = 'contact';
	for (var i in tabs){
	    if (document.getElementById(i)){
		ct = document.getElementById(tabs[i]);
		ct.style.backgroundColor = '#ffffff';
	    }
	}
    }

    function pageLoad(){
	setFooter();
	setTab();
    }


// function setFooter() {
//     if (document.getElementById) {
//      var windowHeight=getWindowHeight();
//      if (windowHeight>0) {
//          var contentHeight=
//              document.getElementById('mainSection').offsetHeight;
//          var headerHeight =
//              document.getElementById('header').offsetHeight;
//          var footerElement=
//              document.getElementById('footer');
//          var footerHeight=footerElement.offsetHeight;
//          if ((windowHeight-footerHeight)>=0) {
//              footerElement.style.position='absolute';
//              if (contentHeight > windowHeight){
//                  footerElement.style.top= contentHeight + 'px';

//              }
//              else{
//                  footerElement.style.top= (windowHeight - footerHeight)+ 'px';
//              }


//          }
//          else {
//              footerElement.style.position='static';
//          }
//      }
//     }
// }