function centerObject(id,width,height)
{
	var dWidth = 0, dHeight = 0;
	
	if( typeof( window.innerWidth ) == 'number' ) {
    	dWidth = window.innerWidth;
    	dHeight = window.innerHeight;
	} else {
    	if( document.documentElement &&
        	( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
			dWidth = document.documentElement.clientWidth;
      		dHeight = document.documentElement.clientHeight;
    	} else {
    		if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
				dWidth = document.body.clientWidth;
   		     	dHeight = document.body.clientHeight;
			}
		}
	}

	x = ( dWidth - width ) / 2;
	y = ( dHeight - height ) / 2;
	
	obj = document.getElementById(id);
	obj.style.left = x + "px";
	obj.style.top = y + "px";
}

function getDocWidth()
{
	var dWidth = 0, dHeight = 0;
	
	if( typeof( window.innerWidth ) == 'number' ) {
    	dWidth = window.innerWidth;
    	dHeight = window.innerHeight;
	} else {
    	if( document.documentElement &&
        	( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
			dWidth = document.documentElement.clientWidth;
      		dHeight = document.documentElement.clientHeight;
    	} else {
    		if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
				dWidth = document.body.clientWidth;
   		     	dHeight = document.body.clientHeight;
			}
		}
	}
	
//	alert(window.innerWidth + ", " + document.documentElement.clientWidth + ", " + document.body.clientWidth);
	
	return dWidth;
}

function getDocHeight()
{
	var dWidth = 0, dHeight = 0;
	
	if( typeof( window.innerWidth ) == 'number' ) {
    	dWidth = window.innerWidth;
    	dHeight = window.innerHeight;
	} else {
    	if( document.documentElement &&
        	( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
			dWidth = document.documentElement.clientWidth;
      		dHeight = document.documentElement.clientHeight;
    	} else {
    		if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
				dWidth = document.body.clientWidth;
   		     	dHeight = document.body.clientHeight;
			}
		}
	}
	
	return dHeight;
}

// added by TK

function centerAlertObject()
{
 	var obj;
	
	obj = document.getElementById("AlertPopUp");
	obj.style.left = (getDocWidth()-parseInt(obj.style.width))/2 + "px";
	obj.style.top = (getDocHeight()-parseInt(obj.style.height))/2 + "px";
}

function closeAlert()
{
	var obj;
	
	obj = document.getElementById("AlertPopUp");
	obj.style.visibility = "hidden";
	// correcting for firefox on mac bug where scrollbars dont hide
	obj.style.left = "-1000px";
	
	obj = document.getElementById("AlertPopUpMain");
	obj.style.visibility = "hidden";
	
}

function showAlert()
{
	var obj;
	
	centerAlertObject();
	obj = document.getElementById("AlertPopUp");
	obj.style.visibility = "visible";
	
}

