var popUpDiv
var opaqueBackground

function transparent(elementID){
	popUpDiv = document.getElementById(elementID)
	opaqueBackground = document.getElementById('transparentBox')
	
	opaqueBackground.style.height = Math.round(document.documentElement.clientHeight) + 'px';
    opaqueBackground.style.width = Math.round(document.documentElement.clientWidth) + 'px';
	
	opaqueBackground.style.top = Math.round(getScrollRight())+'px';
	popUpDiv.style.top = Math.round((getWindowHeight()/2)-(popUpDiv.style.height/2)+getScrollRight())+'px';
	popUpDiv.style.left = Math.round((getWindowWidth()/2)-(popUpDiv.style.width/2))+"px";

	if (popUpDiv.style.display == 'none') {
		popUpDiv.style.display = 'block';
		opaqueBackground.style.display = 'block';
		ScrollFreeze.on();
	}
	else {
		popUpDiv.style.display = 'none';
		opaqueBackground.style.display = 'none';
		ScrollFreeze.off();
	}
}

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 getWindowWidth() {
	var windowWidth = 0;
    if (typeof(window.innerWidth) == 'number') {
        windowWidth = window.innerWidth;
    } 
	else {
    	if (document.documentElement && document.documentElement.clientWidth) {
        	windowWidth = document.documentElement.clientWidth;
		} 
		else {
			if (document.body && document.body.clientWidth) {
	    		windowWidth = document.body.clientWidth;
			}
    	}
    }
    return windowWidth;
}

function getScrollLeft() {
	var left = 0;
	if(typeof(window.pageYOffset) == 'number') {
    	//Netscape compliant
    	left = window.pageXOffset;
	} 
	else if( document.body && document.body.scrollLeft) {
    	//DOM compliant
    	left = document.body.scrollLeft;
	} 
	else if( document.documentElement && document.documentElement.scrollLeft) {
    	//IE6 standards compliant mode
    	left = document.documentElement.scrollLeft;
	}
	return left;
}

function getScrollRight() {
	var right = 0;
	if(typeof(window.pageYOffset) == 'number') {
    	//Netscape compliant
    	right = window.pageYOffset;
	} 
	else if( document.body && document.body.scrollTop) {
    	//DOM compliant
    	right = document.body.scrollTop;
	} 
	else if( document.documentElement && document.documentElement.scrollTop) {
    	//IE6 standards compliant mode
    	right = document.documentElement.scrollTop;
	}
	return right;
}

ScrollFreeze = /*2843293230303620532E4368616C6D657273*/ {
	propFlag : true,
	Ydisp : 0,
	Xdisp : 0,

	on : function(){
		if(this.getProp()){
			window.onscroll = function(){ ScrollFreeze.setXY(); }
		}
	},

	off : function(){window.onscroll=null;},

	getProp : function(){
		if(typeof(window.pageYOffset) != 'undefined'){
			this.Ydisp=window.pageYOffset;
			this.Xdisp=window.pageXOffset;
		}
		else if(document.documentElement){
			this.Ydisp=document.documentElement.scrollTop;
			this.Xdisp=document.documentElement.scrollLeft;
		}
		else if(document.body && (typeof(document.body.scrollTop) != 'undefined')){
			this.Ydisp=document.body.scrollTop;
			this.Xdisp=document.body.scrollLeft;
		}
		else
			this.propFlag=false;

		return this.propFlag;
	},

	setXY : function(){
		window.scrollTo( this.Xdisp, this.Ydisp );
	}
}