var isIE = (navigator.appName == "Microsoft Internet Explorer");

Array.prototype.clear=function(){ 
  while(this.length>0) this.pop()
}; 

function winpop(loc, w, h) {
  var win = window.open(loc, "popup", "width="+w+",height="+h+",toolbar=no,status=no,location=no,resizable=yes,scrollbars=yes");
  win.focus();
}

function appendDateSeparator(evt, separator, oText) {
	if (isNumericKey(evt)) {
  	//var e = isIE ? window.event : evt;
  	var c = isIE ? event.keyCode : evt.which;
  	//alert(c);
  	if ((c>=48 && c<=57) || (c>=96 && c<=105)) {
  	  if (oText.value.length == 4 || oText.value.length == 7) oText.value += separator;
  	} else if (!(c==8 || c==9 || c==13 || c==17 || c==35 || c==36 || c==37 || c==38 || c==39 || c==40 || c==46)) {
  	  //e.returnValue = false;
  	  return false;
  	}
  } else {
    return false;
  }
}

function isNumericKey(evt) {
	//var e = isIE ? window.event : evt;
	var c = isIE ? event.keyCode : evt.which;
  return ((c>=48 && c<=57) || (c>=96 && c<=105) || c==8 || c==9 || c==13 || c==17 || c==35 || c==36 || c==37 || c==38 || c==39 || c==40 || c==46);
}

function checkNumericKey(evt) {
	//var e = isIE ? window.event : evt;
	var c = isIE ? event.keyCode : evt.which;
	//alert(c);
  if (!((c>=48 && c<=57) || (c>=96 && c<=105) || c==8 || c==9 || c==13 || c==17 || c==35 || c==36 || c==37 || c==38 || c==39 || c==40 || c==46)) {
	  //e.returnValue = false;
	  return false;
	} 
}

function HtmlEncode(s) {
  s = s.replace(/</g,"&lt;");
  s = s.replace(/>/g,"&gt;");
  s = s.replace(/\"/g,"&quot;");
  s = s.replace(/\n/g,"<br>");
  return s;
}