/* Function to handle Window Popups */
	function popup(content,popName,popWidth,popHeight,popLeftLoc,popTopLoc) {
	  var win = window.open(content,popName,'width='+popWidth+',height='+popHeight+',screenX='+popLeftLoc+',screenY='+popTopLoc+',left='+popLeftLoc+',top='+popTopLoc+',toolbar=no,menubar=no,directories=no,location=no,status=no,scrollbars=yes,resizable=no');
	  win.focus();
	}

/* Function to handle navigating to a URL as selected from a HTML SELECT object */
	function aoDropDownNav(oDD)
	{
	  if ((oDD.selectedIndex > 0) & (oDD[oDD.selectedIndex].value != '')) location.href = oDD[oDD.selectedIndex].value;
	}

/* Function to handle navigating to a location within the same page as selected from a HTML SELECT object. */
	function aoBookmarkNav(oDD)
	{
	  document.location.href = oDD[oDD.selectedIndex].value;
	}

//***********  getQueryVariable = Gets a Query String variable *********
function getQueryVariable(variable) {
  var query = window.location.search.substring(1);
  var vars = query.split("&");
  for (var i=0;i<vars.length;i++) {
    var pair = vars[i].split("=");
    if (pair[0].toLowerCase() == variable.toLowerCase()) {
      return pair[1];
    }
  } 
  return "";
}

//***********  getQueryStringCookies = Sets a Cookie for EACH Query String variable *********
function setQueryStringCookies()
{
  var query = window.location.search.substring(1);
  var vars = query.split("&");
  for (var i=0;i<vars.length;i++)
  {
    var pair = vars[i].split("=");
    setCookie(pair[0],pair[1],null);
  } 
}

function getCookie(NameOfCookie)
{
	// First we check to see if there is a cookie stored.
	// Otherwise the length of document.cookie would be zero.
	if (document.cookie.length > 0) 
	{ 
		// Second we check to see if the cookie's name is stored in the
		// "document.cookie" object for the page.
		
		// Since more than one cookie can be set on a
		// single page it is possible that our cookie
		// is not present, even though the "document.cookie" object
		// is not just an empty text.
		// If our cookie name is not present the value -1 is stored
		// in the variable called "begin".
		begin = document.cookie.indexOf(NameOfCookie+"="); 
		if (begin != -1) // Note: != means "is not equal to"
		{ 
			// Our cookie was set. 
			// The value stored in the cookie is returned from the function.
			begin += NameOfCookie.length+1; 
			end = document.cookie.indexOf(";", begin);
			if (end == -1) end = document.cookie.length;
			return unescape(document.cookie.substring(begin, end)); 
		} 
	}
	return null; 	
	// Our cookie was not set. 
	// The value "null" is returned from the function.
} 

function setCookie(NameOfCookie, value, expiredays) 
{
	// Three variables are used to set the new cookie. 
	// The name of the cookie, the value to be stored,
	// and finally the number of days until the cookie expires.
	// The parameter expiredays may be null to create a "session" 
	// cookie which expires with the browser session.
	
	// The first lines in the function convert 
	// the number of days to a valid date.	
	var ExpireDate = new Date ();
	ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));
	// The next line stores the cookie, simply by assigning 
	// the values to the "document.cookie" object.
	// Note the date is converted to Greenwich Mean time using
	// the "toGMTstring()" function.	
	document.cookie = NameOfCookie + "=" + escape(value) + 
	((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString());
}

/* Recursive JS 1.0 function for string replacement
   **   Supports older browsers
   **    s - string to be changed
   **    t - token to find
   **    u - token to replace with
   **    r - fully recursive where each change is evaluated against t for additional replacement
*/
   function replace(s, t, u, r) {
     i = s.indexOf(t);
     str = "";
     if (i == -1) return s;
     if (r) {
         str += s.substring(0,i);
         s = u + s;
     }
     else {
         str += s.substring(0,i) + u;
     }
     if ( i + t.length < s.length)
       str += replace(s.substring(i + t.length, s.length), t, u, r);
     return str;
     }

/* URL Handling Routines
    ** AO doens't like doubled slahses or URLs that don't end in a slash if not
    ** terminated already by "webpage.extension" like index.html.
*/

    /* Replaced doubled forward slashes */
    modified_pathname = replace(window.location.pathname, '//', '/', true);

    if (modified_pathname.length == 0)
        modified_pathname = "/";

    /* If the path doesn't end in a "/" and if we may have a filename specified,
    ** we need to verify that the filename comes after the final slash if one is
    ** present.
    ** Otherwise, we don't need to do anything because there are no slashes at all
    ** or the path is already terminated by one.
    */
    if (    (modified_pathname.charAt(modified_pathname.length - 1) != "/")
         && (modified_pathname.lastIndexOf(".") < modified_pathname.lastIndexOf("/"))) {

        modified_pathname += "/";
    }

    /* Now check to see if made any material changes requiring a client-side redirect.
    ** If so, we need to preserve the original referrer as part of the existing query
    ** string or create a new one, but if a user happened to get here twice,
    ** for some weird reason, then we should keep the first omniReferrer
    ** in the URL query string.
    ** So we only, add omniReferrer if the current href does NOT have it.
    */
    if (modified_pathname != window.location.pathname) {
        modified_search = (window.location.search) ? window.location.search : "";

        if (   document.referrer
            && document.referrer.length > 0
            && modified_search.indexOf("omniReferrer=") == -1) {

            modified_search = (window.location.search.length > 1) ? (window.location.search + "&") : "?";
            modified_search += "omniReferrer=" + escape(document.referrer);
        }
        window.location.href = modified_pathname + modified_search + window.location.hash;
    }

/***********  BEGIN: Fix for Flash "Click to Activate" (IE Only) *********/
//v1.0 - Copyright 2006 Adobe Systems, Inc. All rights reserved.
var AC_FL_RunContent;
//AC_FL_RunContent = 0;
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;
}
/***********  END: Fix for Flash "Click to Activate" (IE Only) ***********/
