function OpenImg(url, name, w, h)
{
  if (w > 750) {
    w = 750;
  }
  if (h > 750) {
    h = 750;
  }
  
  w += 32;
  h += 96;
  wleft = (screen.width - w) / 2;
  wtop = (screen.height - h) / 2;

  if (wleft < 0) {
    w = screen.width;
    wleft = 0;
  }
  
  if (wtop < 0) {
    h = screen.height;
    wtop = 0;
  }
  
  var win = window.open(url,
    name,
    'width=' + w + ', height=' + h + ', ' +
    'left=' + wleft + ', top=' + wtop + ', ' +
    'location=no, menubar=no, ' +
    'status=no, toolbar=no, scrollbars=no, resizable=no');
    
  //
  win.resizeTo(w, h);
  //
  win.moveTo(wleft, wtop);

  if (window.focus) {win.focus()}
}


function OpenWin(url, name, w, h)
{
  w += 32;
  h += 96;
  wleft = (screen.width - w) / 2;
  wtop = (screen.height - h) / 2;

  var win = window.open(url,
    name,
    'width=' + w + ', height=' + h + ', ' +
    'left=' + wleft + ', top=' + wtop + ', ' +
    'location=no, menubar=no, ' +
    'status=no, toolbar=no, scrollbars=yes, resizable=no');
    
  //
  win.resizeTo(w, h);
  //
  win.moveTo(wleft, wtop);

  if (window.focus) {win.focus()}
}


function winOpen2() {
	var a = arguments;
	var n,f,s,w,h,t,l;
	n = (a[1]) ? a[1] : 'child';
	f = (a[6]) ? a[6].toString() : null;
	s = (f && f.search(/scrollbars=(1|true)/) != -1);
	w = getWidth(a[2],s);
	h = a[3];
	t = (a[4]) ? a[4] : 0;
	l = (a[5]) ? a[5] : 0;
	//alert('a');
	child = window.open(a[0],n,'width='+w+',height='+h+',top='+t+',left='+l+',directories=0,'+f);
	setTimeout('child.focus()',100);
	if(f && f.search(/temp=(1|true)/) != -1) window.onfocus = function(){ if(window.child) child.close(); child = null };
}


function UA(){
	var v = navigator.appVersion.toLowerCase(), u = navigator.userAgent.toLowerCase(), n = navigator.appName;
	this.full = navigator.appVersion.toLowerCase(), u = navigator.userAgent.toLowerCase(), n = navigator.appName;
	this.mac = (v.indexOf("mac")+1);
	this.win = (v.indexOf("win")+1);
	this.safari = (u.indexOf("safari")+1);
	this.nn = (n == "Netscape");
	this.ie = (n == "Microsoft Internet Explorer");
}
var ua = new UA();


function getWidth(w,s) {
	if(s) {
    if(ua.mac) {
    	if(ua.nn) w += 17;
			if(ua.safari)	w -= 4;
    }
    if(ua.win) w += 16;
  } else {
		if(ua.safari)	w -= 2;
  }
return w;
}


function printWindow() {
  if(window.print) {
    window.print();
  } else {
		alert('Your browser doesn\'t support this feature. Please select "Print" from your File menu.');
  }
}

