/***************************
**    classic version     **
***************************/

function loadwindow(name,url,width,height,title,template,params) {
  var lw = window.open(url, name, 'height=' + height + ',width=' + width);
}

function loadimgwindow(name,url,width,height,title,template,params) {
  var lw = window.open('', name, 'height=' + height + ',width=' + width + ',status=yes,resizable=yes,dependent,alwaysRaised');
  lw.document.write('<html><head><style type="text/css">body {padding: 0px; margin: 0px;}</style>');
  lw.document.write('<scr' + 'ipt language="javascript" type="text/javascript">');

  lw.document.writeln('var ie5=document.all&&document.getElementById;');
  lw.document.writeln('var ns6=document.getElementById&&!document.all;');
  lw.document.writeln('function iecompattest(){');
  lw.document.writeln('  return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;');
  lw.document.writeln('}');

  lw.document.writeln('function resizewindow(width, height) {');
  lw.document.writeln('    var new_width=(ie5? (width+5): width);');
  lw.document.writeln('    var new_height=(ns6? (height) : height);');
  lw.document.writeln('    self.resizeTo(new_width, new_height);');
  lw.document.writeln('    self.resizeTo(new_width, new_height-15);');
  lw.document.writeln('    var new_left= ns6? Math.round((self.screen.width - self.outerWidth)/2) : Math.round((self.screen.width - (iecompattest().clientWidth))/2);');
  lw.document.writeln('    var new_top = ns6? ((self.screen.height - self.outerHeight) / 2) : ((self.screen.height - (iecompattest().clientHeight))/2);');
  lw.document.writeln('    if (new_top < 0) new_top = 0;');
  lw.document.writeln('    self.moveTo(new_left, new_top);');
  lw.document.writeln('}');
  lw.document.writeln('window.onblur = steelfocus;');
  lw.document.writeln('function steelfocus() {');
  lw.document.writeln('    this.focus();');
  lw.document.writeln('}');
  lw.document.write('</scr' + 'ipt>');
  lw.document.write('</head><body>');
  lw.document.write('<img src="' + url + '" onload="resizewindow(this.width+6,this.height+63);" border="0"></img>');
  lw.document.write('</body></html>');
  lw.document.close();
}

function loadhtmlwindow(name, content, width, height, title, template, params) {
  var lw = window.open('', name, 'height=' + height + ',width=' + width + ',status=no');
  lw.document.write('<html><head><style type="text/css">body {padding: 0px; margin: 0px;}</style></head><body>');
  lw.document.write(content);
  lw.document.write('</body></html>');
  lw.document.close();
}

function loadalertwindow(name, content, width, height, title, template, params) {
	alert(content);
}

function loadconfirmwindow(name, content, width, height, title, template, params) {
  return (confirm(content));
}

function displayErrors() {
	if (form_errors.length > 0) {
		var errortext = '';
		for (i = 0; i < form_errors.length; i++) {
			if (form_errors[i].length > 0) {
				errortext += ' - ' + form_errors[i] + '\n'; 
			}
		}
		if (errortext.length > 0) {
			errortext = errortitle + ':\n' + errortext; 
		} else {
			errortext = errortitle;
		}
		//Empty array to prevent loading twice ;)
		form_errors = new Array();
		loadalertwindow('Error', errortext, 320, 100, 'Terror', '', '');
	}
}

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

var form_errors = new Array();
