
function hglf_getFrameWidth(){
    if(window.innerWidth)
	return window.innerWidth;
    else if(document.documentElement && document.documentElement.clientWidth)
	return document.documentElement.clientWidth;
    else if(document.body && document.body.clientHeight)
	return document.body.clientHeight;
    else
	return 0;
}
function hglf_getFrameHeight(){
    if(window.innerHeight)
	return window.innerHeight;
    else if(document.documentElement && document.documentElement.clientHeight)
	return document.documentElement.clientHeight;
    else if(document.body && document.body.clientHeight)
	return document.body.clientHeight;
    else
	return 0;
}

function hglf_setPositionAbs(e, top, x, pos_x){
    if(!e) return ;
    if(typeof(e.style.posTop)=="number"){
	e.style.posTop= top;
	if(x=="left")
	    e.style.posLeft= pos_x;
	else if(x=="right")
	    e.style.posRight= pos_x;
    }else{
	e.style.top= top + 'px';
	if(x=="left")
	    e.style.left= pos_x + 'px';
	else if(x=="right")
	    e.style.right= pos_x + 'px';
    }
}

function hglf_set_footer_position(id){
    var e= document.getElementById(id);
    if(e){
	var margin= 24;
	var scrollBarMargin= isMSIE()? 18: 39;
	hglf_setStyleProperty(e, 'width', hglf_getFrameWidth()-margin*2+'px');
	var height= e.offsetHeight || 48;
	hglf_setPositionAbs(e, hglf_getFrameHeight()-height-scrollBarMargin,
			    "right", +margin);
    }
}

function isMSIE(){
    var ua= navigator.userAgent;
    return ua.indexOf("MSIE")!=-1? true: false;
}

