
var _POPUP_FEATURES = 'scrollbars=no,toolbar=0,status=0,location=0';
var w=0;
function raw_popup(url, target, x, y, features) {
  if (isUndef(features)) features = _POPUP_FEATURES;
  url += (url.indexOf('?')) ? '&popup=1' : '?popup=1';
  target = (isUndef(target)) ? '_blank' : target + '_popup';
  xresnow = x; yresnow = y;
  if (navigator.appVersion.indexOf("Mac")!=-1 && document.all) {
	xresnow-=0; yresnow-=0;
  }
  xl = (screen.availWidth/2)-(xresnow/2); tt = (screen.availHeight/2)-(yresnow/2);
  if (document.all) {
	xresnow += 10;
    w=window.open(url, target, 'width='+xresnow+',height='+yresnow+',left='+xl+',top='+tt + ',' + features);
  } else {
	w=window.open(url, target, 'left='+xl+',top='+tt+',width='+x+',height='+y + ',' + features);
  }
  w.focus();
  return false;
}

function link_popup(src, x, y, features) {
    return raw_popup(src.getAttribute('href'), src.getAttribute('target') || '_blank', x, y, features);
}

function isUndef(v) {
    var undef;
    return v===undef;
}

function wFix(ll,tt,ww,hh) {
  ow=window.outerWidth-window.innerWidth;
  oh=window.outerHeight-window.innerHeight;
  w.resizeTo(ww-ow,hh);
  w.moveTo(ll,tt);
}

function confirmAction(msg) { 
  var msg = (!msg) ? 'Are you sure?' : msg; 
  if (confirm(msg)) {
    return true;
  }
  return false;
}