var popUpWin=0;
function openWin(wineryURL)
{
  if(popUpWin)
  {
  if (popUpWin && popUpWin.open && !popUpWin.closed) popUpWin.close();
  }
	var w = 700, h = 400; // default sizes
	var x = 190, y = 250; // default sizes
    var w1 = 190, h1 = 80;
	if (window.screen) {
	  if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		w1 = window.innerWidth;
		h1 = window.innerHeight;
	  } else if( document.documentElement &&
		  ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		w1 = document.documentElement.clientWidth;
		h1 = document.documentElement.clientHeight;
	  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		w1 = document.body.clientWidth;
		h1 = document.body.clientHeight;
	  }
	  w = w1 -180;
	  h = h1 - 120;
	  x = window.screen.availWidth - w1 + 190;
	  y = window.screen.availHeight - h1 + 80;
	  x2 = window.screen.availWidth - w1 + 190;
	  y2 = window.screen.availHeight - h1 + 80;
	}
  //window.alert( 'w1 = ' + w1 + 'h1=' + h1 + 'availw=' + window.screen.availWidth + 'availh=' + window.screen.availHeight );
  //window.alert( 'Width = ' + w + 'h=' + h + 'x=' + x + 'y=' + y );
  popUpWin = window.open(wineryURL, 'winerysite', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width='+w+',height='+h+',left='+x+',top='+y+',screenX='+x2+',screenY='+y2);
  bringToTop = popUpWin.focus();
}
function closeWin() {
  if (popUpWin && popUpWin.open && !popUpWin.closed) popUpWin.close();
}
