
function imagescale(filename,wid_x,wid_y){
  document.filename.width = wid_x;
  document.filename.height = wid_y;
}

function popupImage(filepath, width, height, pos_x, pos_y){
  
    if (!popupImage.imgNode) {
	if (document.all) {
	    def_x = 0;
	    def_y = 0;
            y = def_y + pos_y;
            x = def_x + pos_x;
            popupImage.imgNode = document.createElement('img');
		
        } else if (document.implementation) {
	    def_x = 0;
	    def_y = 0;
            y = def_y + pos_y;
            x = def_x + pos_x;
            popupImage.imgNode = document.createElement('img');
           

        } else {
            return;
        }
    }

    with(popupImage){
        imgNode.setAttribute('src', filepath );
        if (width && height) {
            imgNode.setAttribute('width', width );
            imgNode.setAttribute('height', height );
        }
        imgNode.style.position = 'absolute';
        imgNode.style.left = x + 'px';
        imgNode.style.top = y + 'px';
        imgNode.style.borderColor = '#0099ff';
        imgNode.style.borderWidth = '0px';
        imgNode.style.borderStyle = 'solid';
        imgNode.style.margin = '0';
        document.body.appendChild(imgNode);
    }
}

    function closeImage(){
        if (popupImage.imgNode) {
            document.body.removeChild(popupImage.imgNode);
            delete popupImage.imgNode;
        }
    }
