// jscript voor popups

function LaunchPopup( sURL , sWidth, sHeight, sPopupName, bToolbars) {
  var dPerc;
  var sToolbars;

  sToolbars = ""
 
  if (!sPopupName)
	  sPopupName = 'wndPopup'

  if (!sWidth)
	sWidth = "400"
  else
	sWidth = sWidth.toString()
  if (!sHeight)
	sHeight = "300"
  else
	sHeight = sHeight.toString()

  if (bToolbars)
	sToolbars = ",location=yes,menubar=yes,status=yes,titlebar=yes,toolbar=yes"


  // % must be the last character if a percentage of the screen must be show
  if (sHeight.indexOf('%') == sHeight.length-1) {
		// Calculate relative height of screen with screensize as maximum
		dPerc = sHeight.substr(0,sHeight.length-1).valueOf() / 100.0;
		sHeight = window.screen.availHeight * dPerc;
  }
  if (sWidth.indexOf('%') == sWidth.length-1) {
		// Calculate relative width of screen with screensize as maximum
		dPerc = sWidth.substr(0,sWidth.length-1).valueOf() / 100.0;
		sWidth = window.screen.availWidth * dPerc;
  }
  //Centreer de offerte op het scherm
  var iTop, iLeft
  iLeft = (window.screen.availWidth - sWidth.valueOf()) / 2
  iTop = (window.screen.availHeight - sHeight.valueOf()) / 2
  
  window.open( sURL, sPopupName,'resizable=yes,scrollbars=yes,top=' + iTop +',left=' + iLeft +',width=' + sWidth + ',height=' + sHeight + sToolbars);
}

// E.Smalley 2/8/2001
// Univeral popup-script with several features, including scroll, resize, aligning
// Example: openPopup('index.html','yes','no','300','200','center','top');

function openPopup(pURL,pScroll,pResize,pWidth,pHeight,pAlign,pValign) {
	var pLeft;
	var pTop;
	var pOptions;

	// Should the window have scrollbars if necessary?
	if (!pScroll) { 
		pScroll	= 'no';
	}

	// Should the window be resizeable?
	if (!pResize) {
		pResize	= 'no';
	}

	// How should the window be aligned horizontally?
	// Keywords right, center and left apply, but also a number in pixels
	if (pAlign.toLowerCase() == 'right') {
		pLeft	= window.screen.availWidth - pWidth - 10;
	}
	else if (pAlign.toLowerCase() == 'center') {
		pLeft	= (window.screen.availWidth - pWidth) / 2;
	}
	else if (pAlign.toLowerCase() == 'left') {
		pLeft	= '0';
	}
	else {
		pLeft	= pAlign;
	}
	
	// How should the window be aligned vertically?
	// Keywords bottom, center and top apply, but also a number in pixels
	if (pValign.toLowerCase() == 'bottom') {
		pTop	= (window.screen.availHeight - pHeight) - 45;
	}
	else if (pValign.toLowerCase() == 'center') {
		pTop	= (window.screen.availHeight - pHeight) / 2;
	}
	else if (pValign.toLowerCase() == 'top') {
		pTop	= '0';
	}
	else {
		pTop	= pValign;
	}

	// Put all the values in an option string
	var pOptions	= 'scrollbars=' + pScroll + ',resizable=' + pResize + ',left=' + pLeft + ',top=' + pTop + ',width=' + pWidth + ',height=' + pHeight;

	// And open the window with the specified URL and options
	window.open(pURL, '', pOptions);
}