﻿var IE=document.all;

/* ------------------------------------------
Functions to open a popup window with custom specs
------------------------------------------
*/

function openPopup(varFilename, leftPos, topPos, intWidth, intHeight, binScroll) {

     winParams = " toolbar=no"         // Icon bar
               + ",location=no"      // Location bar
               + ",directories=no"   //
               + ",status=no"       //Status Bar at bottom of window.
               + ",menubar=no"       //Menubar at top of window.
               + ",resizeable=yes"    //Allow resizing by dragging. (Yes - Does not work with Netscape or IE)
               + ",scrollbars="+binScroll   //Displays scrollbars is document is larger than window.
               + ",titlebar=no"     //Enable/Disable titlebar resize capability.
               + ",left="+leftPos             //Offset of windows left edge from screen.
               + ",top="+topPos              //Offset of windows top edge from screen.
               + ",width="+intWidth    //Standard 640,800/788, 800/788
               + ",height="+intHeight  //Standard 480,600/541, 600/566
               + ";"

 		 		 var popwin;
				 popWindow = window.open(varFilename,popwin,winParams)
}


function openCSSPopup(fileName, fwidth, fheight){
	var _pLayer=document.getElementById('popupWin').style;
	var _pFrame=document.getElementById('frmPopup');
	var _pStatus=_pLayer.visibility;
		// Capture browser window size
		if (IE) {
			screenWidth = (document.body.clientWidth + 20);
			screenHeight = (document.body.clientHeight);
		} else {
			screenWidth = self.innerWidth;
			screenHeight= self.innerHeight;
		}

			// Evaluate left position for the current browser width
			leftPos = (screenWidth/2) -  (fwidth/2);
			topPos  = (screenHeight/2) - (fheight/2);

		if (_pStatus=="hidden") {
			if(IE)
			document.getElementById('container').style.filter="Alpha(Opacity=40)";
			else
			document.getElementById('container').setAttribute("style","-moz-opacity:.4;");
			_pLayer.left=leftPos+'px';
			_pLayer.top=topPos+'px';
			_pFrame.src=fileName;
			_pFrame.width=fwidth;
			_pFrame.height=fheight;
			_pLayer.visibility="visible";
		}else{
			if(IE)
			document.getElementById('container').style.filter="Alpha(Opacity=100)";
			else
			document.getElementById('container').setAttribute("style","-moz-opacity:1;");
			_pLayer.visibility="hidden";
		}
}

/*  CSS windoow and iframe to be used in pages for the popup window*/
cHTML='<div id="popupWin" style="position: absolute; visibility: hidden; background-color: #ffffff; z-index: 20;">\
	<iframe name="frmPopup" id="frmPopup" frameborder="0" src="">Please wait...</iframe><br>\
	<div style="text-align: right;">	\
		<a href="javascript://" onClick="javascript:openCSSPopup(1,1,1);">Close</a>\
	</div>\
</div>'
document.write(cHTML)


