function openTagInfo(contextPath, id) {
    window.open(contextPath+"/admin/info.jsp?ID="+id,"tag_info","width=335,height=190,status=no,resizable=yes,top=10,left=10,scrollbars=yes");
 }

function strip_tags(s) {
  var re = /<([^>]|\n)*>/
  while (re.test(s)) {
      s = s.replace(re, "")
  }	
  return s
}

function encode_html(pSource, ignoreCrlf) {
	key = new Array ("&","<",">","\"");
        val = new Array ("&amp;","&lt;","&gt;","&quot;");
        result = pSource;
        if (pSource == null)
                return "";
        for (i=0; i<key.length; i++) {
	    re = new RegExp(key[i],"gi")
            result = result.replace(re,val[i]);
        }
        result = result.replace(/\r\n|\n\r/gi,ignoreCrlf?" ":"<br>");                    
        return result;
}

function is_email_valid(inputFld,make_focus,status_message)
{ 
   var re = /[0-9A-Za-z._-]+@[0-9A-Za-z._-]+\.[A-Za-z]{2,}/
   
   if (re.test(inputFld.value)) return true;
   else {
   	if (status_message!="") alert(status_message);
   	if (make_focus&&inputFld) {
   		inputFld.select();
   		inputFld.focus();
   	}
   	return false;
   }
}

function field_contains(inputFld,chars) {
	var re = new RegExp("["+chars+"]","g")
	return re.test(inputFld.value)
}

function escape_url(_value) {
  var protocol = _value.split(":");
  var rest = "";
  var schema = protocol[0]
  if (protocol[1]) {
     protocol[0] = ""
     rest = protocol.join(":").substring(1);
  }
  return schema + ":" + (rest.indexOf("?")==-1 ? escape(rest) : rest);
}	