function OpenPopup(sUrl, sWindowName, iWidth, iHeight, sStyle) {
	sUrl = sUrl + "&__vwa_bNoTopBar=1";
	if (sStyle=='') {
		sStyle='dependent=yes,resizable=yes,scrollbars=yes,width=' + iWidth + ',height=' + iHeight;
		sStyle = sStyle + ',screenX=' + (window.pageXOffset + window.outerWidth/2 - iWidth/2);
	}
	oWnd=window.open(sUrl,sWindowName, sStyle);
	oWnd.focus();
}

function ClosePopup(bReloadOpener) {
	if (bReloadOpener)
		opener.document.location.reload();
	opener.focus();
  	self.close();
}

function ResizeWindow(w, iWidth, iHeight) {
	var bOk=true;
  	if(w.innerWidth) {
		//Non-IE
		w.innerWidth=iWidth;
		w.innerHeight=iHeight;
	} else if( w.document.documentElement  && (w.document.documentElement.clientWidth || w.document.documentElement.clientHeight) ) { 
		//IE 6+ in 'standards compliant mode'
		try {
			w.document.documentElement.clientWidth=iWidth;
			w.document.documentElement.clientHeight=iHeight;
		} catch(err) {
			bOk=false;
		}
	} else if( w.document.body && ( w.document.body.clientWidth || w.document.body.clientHeight ) ) {
		//IE 4 compatible
		try {
			w.document.body.clientWidth=iWidth;
			w.document.body.clientHeight=iHeight;
		} catch(err) {
			bOk=false;
		}
	}
	if (!bOk) {
		try {
			if (w.document.body) {
				w.resizeTo(iWidth+5,iHeight+40);		
			} else {
				w.resizeTo(iWidth+2,iHeight+30);
			}
		} catch(err) {}
	}
}

function resizeAndCenterWindow(width, height) {
  ResizeWindow (window,width,height);
  window.moveTo((screen.availWidth-width)/2, (screen.availHeight-height)/2);
}