
function enlargeImage( image ) {
    var height;
    var width;
    
    if ( self.innerHeight ) {
        height = self.innerHeight;
        width = self.innerWidth;
    } else if ( document.documentElement && document.documentElement.clientHeight ) {
        height = document.documentElement.clientHeight;
        width = document.documentElement.clientWidth;
    } else if ( document.body ) {
        height = document.body.clientHeight;
        width = document.body.clientWidth;
    }
    
    height -= 250;
    width -= 1000;
    
    height /= 2;
    width /= 2;

    var imgEnlarge = document.createElement( "IMG" ) ;
	imgEnlarge.id = "imgEnlarged" ;
	imgEnlarge.src = "../xfiles.aspx?image=" + image + "&wsize=1000&hsize=1000&location=content";
	imgEnlarge.title = "Click to Close";
	
	var imgStyle = "border: solid 2px #000000;" ;
	if ( document.all )
		imgEnlarge.style.setAttribute( "cssText", imgStyle ) ;
	else if ( document.getElementById )
		imgEnlarge.setAttribute( "style", imgStyle ) ;
	
	var divImage = document.createElement( "div" ) ;
	divImage.id = "divImage" ;
	
	var divStyle = "position: absolute; width:1000px; height:550px; top:" + height + "px; left:" + width + "px;z-index:2;text-align:center;" ;
	if ( document.all )
		divImage.style.setAttribute( "cssText", divStyle ) ;
	else if ( document.getElementById )
		divImage.setAttribute( "style", divStyle ) ;
		
	divImage.appendChild( imgEnlarge );
	
	var divBack = document.createElement( "div" ) ;
	divBack.id = "divBack" ;
	
	divStyle = "position:absolute;top:0px;left:0px;background-color:#000000;opacity: .5; filter: alpha(opacity=50);width:100%;height:100%;z-index:1;" ;
	if ( document.all )
		divBack.style.setAttribute( "cssText", divStyle ) ;
	else if ( document.getElementById )
		divBack.setAttribute( "style", divStyle ) ;
	
    document.body.appendChild( divBack ) ;
    document.body.appendChild( divImage ) ;
    
    divImage.attachEvent("onclick", close );
    divBack.attachEvent("onclick", close );
}

function close() {
    document.body.removeChild( document.getElementById('divBack') );
    document.body.removeChild( document.getElementById('divImage') );
}