
// Check whether string s is empty.
function isEmpty(s) {return ((s == null) || (s.length == 0))}

// Returns true if all characters in string s are numbers.
function isInteger (s) {
	var reInteger = /^\d+$/;
	var i;
    if (isEmpty(s))
       if (isInteger.arguments.length == 1) return false;
       else return (isInteger.arguments[1] == true);
    return reInteger.test(s);
}

// isYear (STRING s [, BOOLEAN emptyOK])
function isYear (s) {
	if (isEmpty(s))
		if (isYear.arguments.length == 1) return false;
		else return (isYear.arguments[1] == true);
    if (!isNonnegativeInteger(s)) return false;
    return ((s.length == 2) || (s.length == 4));
}

// isNonnegativeInteger (STRING s [, BOOLEAN emptyOK])
function isNonnegativeInteger (s) {
	var secondArg = false;
    if (isNonnegativeInteger.arguments.length > 1) secondArg = isNonnegativeInteger.arguments[1];
    return (isSignedInteger(s, secondArg) && ( (isEmpty(s) && secondArg)  || (parseInt (s) >= 0) ) );
}

// isSignedInteger (STRING s [, BOOLEAN emptyOK])
// Returns true if all characters are numbers; first character is allowed to be + or - as well.
function isSignedInteger (s) {
	var reSignedInteger = /^(\+|-)?\d+$/;
	if (isEmpty(s))
       if (isSignedInteger.arguments.length == 1) return false;
       else return (isSignedInteger.arguments[1] == true);
    else {return reSignedInteger.test(s);}
}

//makearray(12);
var daysInMonth = new Array();
daysInMonth[0] = 0;
daysInMonth[1] = 31;
daysInMonth[2] = 29;
daysInMonth[3] = 31;
daysInMonth[4] = 30;
daysInMonth[5] = 31;
daysInMonth[6] = 30;
daysInMonth[7] = 31;
daysInMonth[8] = 31;
daysInMonth[9] = 30;
daysInMonth[10] = 31;
daysInMonth[11] = 30;
daysInMonth[12] = 31;

// daysInFebruary (INTEGER year)
function daysInFebruary (year) {
	// February has 29 days in any year evenly divisible by four,
    return (  ((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0) ) ) ? 29 : 28 );
}

function MM_openBrWindow(theURL,winName,features,w,h){
	LeftPosition = (screen.width)?(screen.width-w)/2:0;
	TopPosition = (screen.height)?(screen.height-h)/2:0;
	settings = 'height='+h+',width='+w+','+features+',top='+TopPosition+',left='+LeftPosition+'';
	var blurThis = (theURL.indexOf("BLURTHISINSTANCE") !== -1);
	if(blurThis){
		theURL = theURL.replace(/&BLURTHISINSTANCE=true/gi,"");
	}
	win = window.open(theURL,winName,settings);
	if(win.opener == null){window.opener = self;};
	//if(win.window.focus){win.window.focus();}
	if(blurThis){
		win.blur();
		win.opener.focus();
	}
}

// Expand Item
function expandItem(theitem){
	opentable = document.getElementById(theitem);
	Tree_ExpanderID = "Tree_Expander_" + theitem;
	Tree_Expander = document.getElementById(Tree_ExpanderID);
	Tree_ExpanderSource = Tree_Expander.src.toLowerCase();
	if(opentable.style.display == "none") {
		if(GetBrowser() == "ie") {
			opentable.style.display = "block";
		} else {
			opentable.style.display = "table-row";
		}
		Tree_Expander.src = Tree_ExpanderSource.replace("expand","collapse");
	}else{
		opentable.style.display = "none";
		Tree_Expander.src = Tree_ExpanderSource.replace("collapse","expand");
	}
}

// Check Browser
function GetBrowser(){
	if (document.all) {
		return "ie";
	} else if (document.getElementById && !document.all) {
		return "ff";
	} else if (document.layers) {
		return "ns4";
	} else if (window.opera) {
		return "op";
	} else {
		return "unknown";
	}
}

redirTimeoutId = window.setTimeout("loginRedirect()",1680000);
function loginRedirect(){
	window.clearTimeout(redirTimeoutId);
	parent.document.location.href = "/index.cfm";
}

//v1.0
//Copyright 2006 Adobe Systems, Inc. All rights reserved.
function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?');
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs)
{
  var str = '<object ';
  for (var i in objAttrs)
    str += i + '="' + objAttrs[i] + '" ';
  str += '>';
  for (var i in params)
    str += '<param name="' + i + '" value="' + params[i] + '" /> ';
  str += '<embed ';
  for (var i in embedAttrs)
    str += i + '="' + embedAttrs[i] + '" ';
  str += ' ></embed></object>';

  document.write(str);
}

function AC_FL_RunContent(){
  var ret =
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_SW_RunContent(){
  var ret =
    AC_GetArgs
    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();

    switch (currArg){
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace":
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "id":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}

function submitFormNoVal(frm) {
	frm.submit();
}



