//
// Confidential and Proprietary for Stellent, Inc.
//
// This computer program contains valuable, confidential, and
// proprietary information.  Disclosure, use, or reproduction
// without the written authorization of Stellent is prohibited.
// This unpublished work by Stellent is protected by the laws
// of the United States and other countries.  If publication
// of this computer program should occur, the following notice
// shall apply:
//
// Copyright (c) 2006 Stellent, Inc.
// All rights reserved.
//
// $Id: idc_base.js 62608 2008-04-22 16:02:41Z swhite $
//


/**
 * Base javascript utility library.   Many of the methods found here take 
 * their inspiration from MochiKit (www.mochikit.org) by Bob Ippolito
 */
 
if (typeof(idc) == 'undefined') {
    idc = {};
}

idc._VERSION = "1.0";
idc._NAME = "idc";

idc._EXPORT_COMPAT =
[
	[ "startsWith", "schemaStartsWith"],
	[ "trim","schemaTrim"],
	[ "toLower","schemaToLower"],
	[ "getOrCreateArray","getOrCreateSchemaArray"]
];

idc._EXPORT =
[
	"startsWith",
	"trim",
	"toLower",
	"getOrCreateArray",
	"padInteger",
	"convertToBool",
	"clone",
	"toHexString",
	"jsFullEncode",
	"jsFilename",
	"isNull",
	"isUndefinedOrNull",
	"trimFunctionDeclaration",
	"createStackTrace"
];

idc.update = function (self, obj/*, ...*/)
{
	if (self == null)
	{
		self = {};
	}
	for (var i = 1; i < arguments.length; i++)
	{
		var o = arguments[i];
		if (typeof(o) != 'undefined' && o != null)
		{
			for (var symbol in o)
			{
				self[symbol] = o[symbol];
			}
		}
	}
}

/** 
 * Wrap 'dumb' built in functions that don't have methods like apply().
 * This method is pretty straight forward -  it just creates a function
 * that passes all the arguments into the wrapped function.  Apply(), etc.
 * can now be called on the wrapper function which get passed into the dumb
 * function.
 */
idc._wrapDumbFunction = function (func) 
{
	return function () 
	{
		// fast path!
		switch (arguments.length) 
		{
			case 0: return func();
			case 1: return func(arguments[0]);
			case 2: return func(arguments[0], arguments[1]);
			case 3: return func(arguments[0], arguments[1], arguments[2]);
		}
		var args = [];
		for (var i = 0; i < arguments.length; i++) 
		{
			args.push("arguments[" + i + "]");
		}
		return eval("(func(" + args.join(",") + "))");
	}
};
	
idc.extend = function _extend(self, obj, /*optional*/ skip)
{
	/**
	*	Mutate an array by extending it with an array-like obj,
	*	starting with the "skip" index of obj.  If null is given
	*	as the initial array, a new one will be created.
	*	
	*	This mutates *and returns* the given array, be warned.
	**/

	if (!skip)
	{
		skip = 0;
	}
	
	if (isUndefinedOrNull(obj))
	{
		return;
	}
	
	var l = obj.length;
	if (typeof(l) != "number")
	{
		// throw exception?
		return;
	}
	if (!self)
	{
		self = new Array();
	}
	for (var i = skip; i < l; i++)
	{
		var item = obj[i];
		self[self.length] = item;
	}
	
	return self;
}

idc.concat = function _concat(/* obj... */)
{
	/**
	*	Concatenates all given array-like arguments and returns
	*	a new array:
	*
	*	var lst = concat(["1","3","5"], ["2","4","6"]);
	*	assert(lst.toString() == "1,3,5,2,4,6");
	**/

	var returnObj = new Array();
	for (var i = 0; i < arguments.length; i++)
	{
		idc.extend(returnObj, arguments[i]);
	}
	return returnObj;
}

idc.bind = function _bind(targetFunction, targetObj /* function arguments*/)
{
	if (typeof(targetFunction) == "string")
	{
		// If passed a string repr. of the function,
		// grab the actual function
		targetFunction = targetObj[targetFunction];
	}
	
	// get any previous values in case targetFunction was 
	// created by a previous bind() call
	var prevFunc = targetFunction.prevFunc;
	var prevArgs = targetFunction.prevArgs;
	var prevObj = targetFunction.prevObj;
	
	if (typeof(targetFunction) == "function" && 
		typeof(targetFunction.apply) == "undefined")
	{
		// M: this is for cases where JavaScript sucks and gives you a
		// really dumb built-in function like alert() that doesn't have
		// an apply()
		func = idc._wrapDumbFunction(func);
	}
	
	if (typeof(prevFunc) != 'function')
	{
		prevFunc = targetFunction;
	}
	if (typeof(targetObj) != 'undefined' && targetObj != null)
	{
		prevObj = targetObj;
	}
	if (typeof(prevArgs) == 'undefined')
	{
		prevArgs = [];
	}
	else
	{
		prevArgs = prevArgs.slice();
	}
	idc.extend(prevArgs, arguments, 2); // skip 'targetFunction' & 'targetObj'
	var newFunc = function ()
	{
		var args = arguments;
		var me = arguments.callee;
		if (me.prevArgs.length > 0)
		{
			// make sure old args come before new ones...
			args = idc.concat(me.prevArgs, args); 
		}
		var self = me.prevObj;
		if (!self)
		{
			self = this;
		}
		return me.prevFunc.apply(self, args);
	}
	newFunc.prevObj = prevObj;
	newFunc.prevFunc = prevFunc;
	newFunc.prevArgs = prevArgs;
	
	return newFunc;
}

// Use "schema" as prefix for function name to avoid function global name collisions.
//function schemaStartsWith(str, value)
idc.startsWith = function _startsWith(str, value)
{
	return (str.indexOf(value) == 0);
}

//function schemaTrim(value)
idc.trim = function _trim(value)
{
	if (typeof value == "string")
	{
		var i = 0;
		if (value.length > 0)
		{
	 		for (i = 0; value.charAt(i) <= " "; i++);
	 		value = value.substring(i,value.length);
	 	}
	 	if (value.length > 0)
	 	{
	 		for (i = value.length-1; value.charAt(i) <= " "; i--);
	 		value = value.substring(0, i + 1);
	 	}
	}
	return value;
}

//function schemaToLower(value)
idc.toLower = function _toLower(value)
{
	if (typeof value == "string")
	{
		value = value.toLowerCase();
	}
	return value;
}

//function getOrCreateSchemaArray(container, name, nameField)
idc.getOrCreateArray = function _getOrCreateArray(container, name, nameField)
{
	var key = name;
	if (nameField)
	{
		key = idc.jsFilename(name);
	}
	var obj = container[key];
	if (typeof obj == "undefined")
	{
		obj = container[key] = new Array();
		if (nameField)
		{
			obj[nameField] = name;
		}
	}
	return obj;
}

//function padInteger(intValue, length)
idc.padInteger = function _padInteger(intValue, length)
{
	var rc = "" + intValue;
	while (rc.length < length)
	{
		rc = "0" + rc;
	}
	return rc;
}

//function convertToBool(value, defaultValue)
idc.convertToBool = function _convertToBool(value, defaultValue)
{
	if (typeof value == "undefined")
	{
		return defaultValue;
	}

	if (typeof value == "string")
	{
		value = this.trim(value.toLowerCase());
		if (value.length == 0)
		{
			return defaultValue;
		}
		if (defaultValue)
		{
			return !(this.startsWith(value,"0") || this.startsWith(value, "f") 
				|| this.startsWith(value, "n"));
		}
		return (this.startsWith(value, "1") || this.startsWith(value, "t") || 
			this.startsWith(value, "y") || this.startsWith(value, "-1"));
	}
	
	return value;
}

//function clone(obj)
idc.clone = function _clone(obj)
{
	var rc = new Array();
	for (member in obj)
	{
		rc[member] = obj[member];
	}
	return rc;
}

//function toHexString(v, padTo)
idc.toHexString = function _toHexString(v, padTo)
{
	var hexString = "";
	var zeroCharCode = "0".charCodeAt(0);
	var aCharCode = "a".charCodeAt(0);
	var r = "";
	for (var j = 0; v > 0 || j < padTo; j++)
	{
		var tmp = v & 15;
		if (tmp >= 10) tmp = aCharCode + tmp - 10;
		else tmp = zeroCharCode + tmp;
		r = String.fromCharCode(tmp) + r;
		v = (v >> 4);
	}
	return r;
}

//function jsFullEncode(arg)
idc.jsFullEncode = function(arg)
{
	if (!arg)
	{
		//idctrace("jsFullEncode() called with null argument");
		return "";
	}
	
	var rc = "";
	var length = arg.length;
	for (var i = 0; i < length; i++)
	{
		var theChar = arg.charAt(i);
		var c = arg.charCodeAt(i);
		switch (c)
		{
		case '/'.charCodeAt(0):
		case '\\'.charCodeAt(0):
		case '\''.charCodeAt(0):
		case ':'.charCodeAt(0):
		case '#'.charCodeAt(0):
		case '@'.charCodeAt(0):
		case '?'.charCodeAt(0):
		case '"'.charCodeAt(0):
		case ' '.charCodeAt(0):
		case '*'.charCodeAt(0):
		case '<'.charCodeAt(0):
		case '>'.charCodeAt(0):
		case '|'.charCodeAt(0):
			rc += "@";
			rc += this.toHexString(c, 4);
			break;
		default:
			if (c > 32 && c < 128) rc += theChar;
			else rc += "@" + this.toHexString(c, 4);
		}
	}
	
	return rc;
}

//function jsFilename(arg)
idc.jsFilename = function(arg)
{
	if (!arg)
	{
		//idctrace("jsFilename() called with null argument");
		return "";
	}
	
	var rc = this.jsFullEncode(arg);
	return rc.toLowerCase();
}

idc.isNull = function _isNull(/* args... */)
{
	for (var i = 0; i < arguments.length; i++)
	{
		if (arguments[i] != null)
		{
			return false;
		}
	}
	return true;
}

idc.isUndefinedOrNull = function _isUndefinedOrNull(/* args */)
{
	for (var i = 0; i < arguments.length; i++)
	{
		var elmt = arguments[i];
		if (!(typeof elmt == "undefined" || elmt == null))
		{
			return false;
		}
	}
	return true;
}

idc.contains = function(array, key)
{
	for (var i = 0; i < array.length; i++)
	{
		if (array[i] == key)
		{
			return true;
		}
	}
	
	return false;
}

idc.nameFunctions = function(namespace)
{
	var base = namespace._NAME;
	if (typeof namespace == 'undefined')
	{
            base = '';
    } 
    else
    {
      base = base + '.';
    }
    
    for (var x in namespace) 
    {
	  var obj = namespace[x];
      if (typeof(obj) == 'function' && typeof(obj._NAME) == 'undefined')
      {
      	obj.NAME = base + x;
      }
    }
}

// Trim off declaration part of function string.
idc.trimFunctionDeclaration = function _trimFunctionDeclaration(func) 
{
    var funcName = func.toString();
    var nameArray = funcName.match(/function (\w*)/);
    
    var trimmedFunc = "anonymous";
    if (!isUndefinedOrNull(nameArray) && nameArray.length > 1)
    {
	    var trimmedFunc = nameArray[1]
    }
    if (trimmedFunc == null || trimmedFunc.length == 0)
    {
    	trimmedFunc = "anonymous";
    }
    return trimmedFunc;
}

idc.createStackTrace = function _createStackTrace()
{
	var stackStr = ""; 
	
	// Modern usage is to start with arguments.callee.caller
	var start = arguments.callee;
	if (isUndefinedOrNull(start))
	{
		start = arguments.caller;
	}
	else
	{
		start = start.caller;
	}
	if (isUndefinedOrNull(start))
	{
		return "(no-stack-available)";
	}
    for(var func = start; func != null; func = func.caller) 
    {
    	stackStr += idc.trimFunctionDeclaration(func) + "\n";

        // Navigator 4.0 can have caller have itself as parent.
        if (func.caller == func)
        { 
        	break;
        }
    }
    return stackStr;
}

idc._init = function _init()
{
	idc.nameFunctions(this);
}

idc._exportSymbols = function (targetNS, sourceNS) 
{
	if (typeof sourceNS._EXPORT != 'undefined')
	{
		for (var i = 0; i < sourceNS._EXPORT.length; i++)
		{
			var symbol = sourceNS._EXPORT[i];
			targetNS[symbol] = sourceNS[symbol];	
		}
	}
	
	if (typeof sourceNS._EXPORT_COMPAT != 'undefined')
	{
		for (var i = 0; i < sourceNS._EXPORT_COMPAT.length; i++)
		{
			if (isUndefinedOrNull(sourceNS._EXPORT_COMPAT[i]))
			{
				// workaround for IE bug
				continue;
			}
			var newSymbol = sourceNS._EXPORT_COMPAT[i][0]
			var oldSymbol = sourceNS._EXPORT_COMPAT[i][1];
			targetNS[oldSymbol] = sourceNS[newSymbol];
		}
	}
}

idc._init();
idc._exportSymbols(this, idc);
//
// Confidential and Proprietary for Stellent, Inc.
//
// This computer program contains valuable, confidential, and
// proprietary information.  Disclosure, use, or reproduction
// without the written authorization of Stellent is prohibited.
// This unpublished work by Stellent is protected by the laws
// of the United States and other countries.  If publication
// of this computer program should occur, the following notice
// shall apply:
//
// Copyright (c) 2006 Stellent, Inc.
// All rights reserved.
//
// $Id: idc_log.js 62996 2008-05-02 22:21:34Z kjorisse $
//


if ( typeof(idc) == 'undefined')
{
	throw "script package 'idc.log' requires 'idc'";
}

if (typeof(idc.log) == 'undefined') {
    idc.log = {};
}

idc.log._VERSION = "1.0";
idc.log._NAME = "idc.log";

// Require idc base
idc.log._EXPORT =
[
	"idctrace"
];

idc.log.TRACE_WINDOW_NAME = "idcTraceWindow";
idc.log.tracingEnabled = 0;
idc.log.tracingLastIndex = -1;

idc.log.trace = function _trace(section, message)
{
	var l = idc.log;
	if (arguments.length == 0)
	{
		return;
	}
	if (arguments.length == 1)
	{
		message = section;
		section = "system";
	}
	if (l.traceExecution)
	{
		var timestamp = new Date();
		var prefix = "(" + section + ")" 
			+ idc.padInteger(timestamp.getHours(), 2) + ":"
			+ idc.padInteger(timestamp.getMinutes(), 2) + ":"
			+ idc.padInteger(timestamp.getSeconds(), 2) + "."
			+ idc.padInteger(timestamp.getTime()%1000, 3) + "\t";
		message = prefix + message;
		l.traceInfo[l.traceInfo.length] = new Array(section, message);
		if (l.tracingEnabled)
		{
			l.appendScriptTraceMessages(
				l.traceInfo.length-1,
				l.traceContainer,
				l.traceInfo);
			if (l.traceWindow)
			{
				l.scrollTraces(l.traceWindow);
			}
		}
	}
}

idc.log.clearScriptTraces = function _clearScriptTraces()
{
	var l = idc.log;
	l.traceInfo = new Array();
    if (l.traceWindow && !l.traceWindow.closed)
	{
		var theWindow = l.traceWindow;
		var body = theWindow.document.body;
		while (body.childNodes.length)
		{
			var node = body.childNodes.item(0);
			body.removeChild(node);
		}
	}
}

idc.log.appendSeparator = function _appendSeparator(traceContainer)
{
	var doc = traceContainer.documentReference;
	var text = doc.createTextNode("\u00A0");// non-breaking space
	if (traceContainer.tracingTable)
	{
		var row = traceContainer.tracingTable.insertRow(-1);
		row.style.background = "red";
		var cell = row.insertCell(-1);
		cell.colSpan = 2;
		cell.appendChild(text);
	}
	else
	{
		var p = doc.createElement("p");
		p.style.background = "red";
		p.appendChild(text);
		traceContainer.appendChild(p);
	}
}

idc.log.setTraceContainer = function _setTraceContainer(traceContainer, doc)
{
	var l = idc.log;
	l.traceContainer = traceContainer;
	l.traceContainer.documentReference = doc;
}

idc.log.displayScriptTraces = function _displayScriptTraces()
{  
	var l = idc.log;
	var theWindow = l.traceWindow;
    if (!l.traceContainer || (l.traceWindow && l.traceWindow.closed))
	{
		if (theWindow && theWindow.document)
		{
			l.appendSeparator(l.traceContainer);
		}
		else
		{
			// By giving explicit dimensions, we force the window to pop up instead of becoming a tab.
			var params = "height=800,width=1000,left=100,top=100,resizable=yes,scrollbars=yes,status=yes";
			theWindow = window.open("", idc.log.TRACE_WINDOW_NAME, params);
			theWindow.document.title = "Idc Debug Trace";
		}
		l.traceWindow = theWindow;
		l.setTraceContainer(theWindow.document.body, theWindow.document);
		l.tracingEnabled = 1;
		l.appendScriptTraceMessages(0, l.traceContainer, idc.log.traceInfo);
		var pauseObj = document.getElementById("pause_script_trace");
		if (pauseObj)
		{
			pauseObj.style.color = "#000000";
		}
	}
	else if (!l.tracingEnabled)
	{
		l.tracingEnabled = 1;
		l.appendScriptTraceMessages(l.tracingLastIndex, 
			l.traceContainer, idc.log.traceInfo);
		l.trace("system", "resumed tracing");
	}
	else
	{
		l.appendSeparator(l.traceContainer);
	}
	if (theWindow)
	{
		l.scrollTraces(theWindow);
	}
}

idc.log.pauseScriptTraces = function _pauseScriptTraces()
{
	var l = idc.log;
	if (l.tracingEnabled)
	{
		l.trace("system", "pausing tracing");
		l.tracingEnabled = 0;
		l.tracingLastIndex = l.traceInfo.length;
		var pauseObj = document.getElementById("pause_script_trace");
		if (pauseObj)
		{
			pauseObj.style.color = "#C0C0C0";
		}
	}
}

idc.log.scrollTraces = function _scrollTraces(theWindow)
{
	if (!theWindow || !theWindow.document)
	{
		alert("There is no tracing window to scroll");
		return;
	}
	if (theWindow.document.body.scrollHeight)
	{
		theWindow.document.body.scrollTop = theWindow.document.body.scrollHeight;
	}
	else if (theWindow.innerHeight)
	{
		try
		{
			theWindow.pageYOffset = theWindow.innerHeight;
		}
		catch (ignore)
		{
		}
	}
	else
	{
		var anchor = theWindow.document.createElement("a");
		theWindow.document.body.appendChild(anchor);
		anchor.focus();
		focus();
	}
}

idc.log.appendScriptTraceMessages = function _appendScriptTraceMessages(startIndex, traceContainer, theList)
{
	var l = idc.log;
	var msgCount = 0;
	
    for (var i = startIndex; i < theList.length; i++)
    {
    	if (!l.traceSections[theList[i][0]])
    	{
    		continue;
    	}
		var tstamp;
		var msgText;
        var msg = theList[i][1];
		var index = msg.indexOf("\t");
		if (index > 0)
		{
			tstamp = msg.substring(0, index);
			msgText = msg.substring(index+1);
		}
		else
		{
			msgText = msg;
		}
		var doc = traceContainer.documentReference;
		if (!doc)
		{
			if (traceContainer.document)
			{
				doc = traceContainer.document;
			}
			else
			{
				doc = document;
			}
		}
		var traceEntry;
		if (traceContainer.tracingTable)
		{
			var tableRow = traceEntry =
				traceContainer.tracingTable.insertRow(-1);
			var td1 = tableRow.insertCell(-1);
			td1.style.width = "12em";
			var text;
			if (tstamp)
			{
				text = doc.createTextNode(tstamp);
				td1.appendChild(text);
			}
			var td2 = tableRow.insertCell(-1);
			text = doc.createTextNode(msgText);
			td2.appendChild(text);
		}
		else
		{
			var text;
			text = doc.createTextNode(msgText);
			var d = traceEntry = doc.createElement("div");
			d.appendChild(doc.createTextNode(" "));
			var tstampNode = doc.createElement("span");
			tstampNode.style.position = "absolute";
			tstampNode.style.width = "12em";
			tstampNode.appendChild(doc.createTextNode(tstamp));
			d.appendChild(tstampNode);

			var textNode = doc.createElement("div");
			textNode.style.marginLeft = "12em";
			textNode.appendChild(doc.createTextNode(msgText));
			d.appendChild(textNode);
			traceContainer.appendChild(d);
		}
        if (i%5 == 4)
        {
            traceEntry.style.background = "#C0C0C0";
        }
        msgCount++;
    }
}

idc.log.setTracingSections = function _setTracingSections(sectionList)
{
	if (isUndefinedOrNull(sectionList))
	{
		return;
	}
	idc.log.traceSections = new Object();
	for (var i = 0; i < sectionList.length; i++)
	{
		idc.log.traceSections[idc.trim(sectionList[i])] = true;
	}
}

idc.log.addTracingSection = function _addTracingSection(section)
{
	if (isNullOrUndefined(section))
	{
		return;
	}
	idc.log.traceSections[idc.trim(section)] = true;
}

idc.log.idctrace = function _idctrace(message)
{
	// idc.base.log.deprecated
	idc.log.trace("system", message);
}

idc.log._init = function _init()
{
	// Do existence checks in case of re-sourcing of the js file
	if (isUndefinedOrNull(idc.log.traceExecution))
	{
		idc.log.traceExecution = false;
	}
	if (isUndefinedOrNull(idc.log.traceInfo))
	{
		idc.log.traceInfo = new Array();
	}
	if (isUndefinedOrNull(idc.log.traceSections))
	{
		idc.log.traceSections = new Object();
	}
	
 	for (var i = 0; i < idc.log._EXPORT.length; i++)
	{
		var symbol = idc.log._EXPORT[i];
		window[symbol] = idc.log[symbol];	
	}
	
	idc.nameFunctions(this);
}

idc.log._init();
//
// Confidential and Proprietary for Oracle Corporation
//
// This computer program contains valuable, confidential, and
// proprietary information.  Disclosure, use, or reproduction
// without the written authorization of Oracle is prohibited.
// This unpublished work by Oracle is protected by the laws
// of the United States and other countries.  If publication
// of this computer program should occur, the following notice
// shall apply:
//
// Copyright (c) 2006 Stellent, Inc.
// All rights reserved.
// Copyright (c) 2009 Oracle Corp.
// All rights reserved.
//
// $Id: idc_async.js 78455 2009-10-29 18:43:07Z kjorisse $
//


if (typeof(idc) == 'undefined') {
	idc = {};
}

if (typeof(idc.async) == 'undefined') {
	idc.async = {};
}

idc.async._VERSION = "1.0";
idc.async._NAME = "idc.async";


idc.async._xmlhttp;

idc.async.sendXmlHttpRequest = function(url, callback, errback, isAsync)
{
	idc.async.sendXmlHttpRequestEx(url, null, callback, errback, isAsync);
}

idc.async.sendXmlHttpPostRequest = function(form, callback, errback)
{
	// build the query string
	var queryString;
	var paramCount = 0;
	var numElmts = form.elements.length;
	for (var i = 0; i < numElmts; i++)
	{
		var name = form.elements[i].name;
		if (isUndefinedOrNull(name) || name.length == 0)
		{
			continue;
		}

		name = encodeURIComponent(name);
		value = encodeURIComponent(form.elements[i].value);

		if (paramCount > 0)
		{
			queryString += "&" + name + "=" + value;
		}
		else
		{
			queryString = name + "=" + value;
		}
		paramCount++;
	}
	idc.async.sendXmlHttpRequestEx(form.action, queryString, callback, errback);
}

idc.async.sendXmlHttpRequestEx = function(url, queryString, callback, errback, isAsync)
{
	var newCallback = 
		idc.bind(idc.async.xmlHttpStatusMonitor, idc.async, callback, errback);
	
	// get the form action
	var isPost = true;
	if (isUndefinedOrNull(queryString))
	{
		isPost = false;
		queryString = null;
	}
	
	var action = (isPost) ? "POST" : "GET";
	
	var isIE = false;
	if (window.XMLHttpRequest)
	{
		// code for Mozilla, etc.
		idc.async._xmlhttp=new XMLHttpRequest()
	}
	else if (window.ActiveXObject)
	{
		// code for IE
		idc.async._xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
		isIE = true;
	}
 		
	if (idc.async._xmlhttp)
	{
		var asyncReq = true;
		if (!isUndefinedOrNull(isAsync))
		{
			asyncReq = isAsync;
		}
		idc.async._xmlhttp.onreadystatechange=newCallback;
		idc.async._xmlhttp.open(action, url, asyncReq);
		if (isPost)
		{
			idc.async._xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
			idc.async._xmlhttp.send(queryString);
		}
		else
		{
			if (isIE)
			{
   				idc.async._xmlhttp.send();
   			}
   			else
 			{
 				idc.async._xmlhttp.send(null);
 			}
   		}
	}
}

idc.async.xmlHttpStatusMonitor = function(callback, errback)
{
	if (idc.async._xmlhttp.readyState==4)
 	{
 		if (idc.async._xmlhttp.status==200 || idc.async._xmlhttp.status==304)
   		{
			callback(idc.async._xmlhttp);
   		}
   		else 
   		{
   			errback(idc.async._xmlhttp);
   		}
	}
}	

idc.async._init = function ()
{
	idc.nameFunctions(this);
}

idc.async._init();
//
// Confidential and Proprietary for Stellent, Inc.
//
// This computer program contains valuable, confidential, and
// proprietary information.  Disclosure, use, or reproduction
// without the written authorization of Stellent is prohibited.
// This unpublished work by Stellent is protected by the laws
// of the United States and other countries.  If publication
// of this computer program should occur, the following notice
// shall apply:
//
// Copyright (c) 2006 Stellent, Inc.
// All rights reserved.
//
// $Id: idc_dom.js 47857 2006-08-03 18:08:56Z rpetty $
//


if (typeof(idc.dom) == 'undefined') {
    idc.dom = {};
}

idc.dom._VERSION = "1.0";
idc.dom._NAME = "idc.dom";
idc.dom._USE_STANDARDS_COMPLIANT_OPTION_ADD = true;

idc.dom.addOptionToSelect = function(optionObject, select)
{
	if (typeof(select) == "string")
	{
		select = document.getElementById(select);
	}
	
	if (!idc.dom._USE_STANDARDS_COMPLIANT_OPTION_ADD)
	{
		select.add(optionObject); // IE only
	}
	else
	{
		try
		{
			select.add(optionObject, null); // standards compliant; doesn't work in IE
		}
		catch(ex)
		{
			idc.dom._USE_STANDARDS_COMPLIANT_OPTION_ADD = false;
			select.add(optionObject); // IE only
		}
	}
}

idc.dom.deselectAllSelectOptions = function(select)
{
	if (typeof(select) == "string")
	{
		select = document.getElementById(select);
	}
	
	for (var i = 0; i < select.options.length; i++)
	{
		select.options[i].selected = false;
	}
}

idc.dom.selectAllSelectOptions = function(select)
{
	if (typeof(select) == "string")
	{
		select = document.getElementById(select);
	}
	
	for (var i = 0; i < select.options.length; i++)
	{
		select.options[i].selected = true;
	}
}

idc.dom.removeAllOptions = function(select)
{
	if (typeof(select) == "string")
	{
		select = document.getElementById(select);
	}
	
	while (select.options.length > 0)
	{
		select.remove(0);
	}
}

idc.dom.moveOptions = function(select1, select2, deleteOutgoing, createIncoming)
{
	if (typeof(select1) == "string")
	{
		select1 = document.getElementById(select1);
	}
	
	if (typeof(select2) == "string")
	{
		select2 = document.getElementById(select2);
	}

	idc.dom.deselectAllSelectOptions(select2);

	for (var i = 0; i < select1.options.length; i++)
	{
		var option1 = select1.options[i];
		if (option1.selected)
		{
			idc.dom.moveOption(select1, select2, i, deleteOutgoing, createIncoming);
			if (deleteOutgoing)
			{
				i--;
			}
		}
	}
}

idc.dom.moveOptionsInList = function(select1, select2, deleteOutgoing, createIncoming, list)
{
	if (typeof(select1) == "string")
	{
		select1 = document.getElementById(select1);
	}
	
	if (typeof(select2) == "string")
	{
		select2 = document.getElementById(select2);
	}

	idc.dom.deselectAllSelectOptions(select2);

	for (var i = 0; i < list.length; i++)
	{
		var key = list[i];
		
		for (var j = 0; j < select1.options.length; j++)
		{
			var option1 = select1.options[j];
			if (option1.value == key)
			{
				idc.dom.moveOption(select1, select2, j, deleteOutgoing, createIncoming);
				break;
			}
		}
	}
}

idc.dom.moveOption = function(select1, select2, i, deleteOutgoing, createIncoming)
{
	var option1 = select1.options[i];
	if (createIncoming)
	{
		var option2 = document.createElement('option');
		option2.text = option1.text;
		option2.value = option1.value;
		option2.selected = true;
		
		idc.dom.addOptionToSelect(option2, select2);
	}
	else
	{
		for (var j = 0; j < select2.options.length; j++)
		{
			var option2 = select2.options[j];
			if (option2.value == option1.value)
			{
				option2.disabled = "";
				option2.style.color = "#000000";
				option2.selected = true;
				break;
			}
		}
	}
	
	if (!deleteOutgoing)
	{
		option1.disabled = "disabled";
		option1.style.color = "#b0b0b0";
		option1.selected = false;
	}
	else
	{
		select1.remove(i);
	}
}

idc.dom.deselectDisabledOptions = function(select)
{
	if (typeof(select) == "string")
	{
		select = document.getElementById(select);
	}

	for (var i = 0; i < select.options.length; i++)
	{
		var option = select.options[i];
		if (option.selected && option.disabled)
		{
			option.selected = false;
		}
	}
}

idc.dom.enableDisabledOptions = function(select)
{
	if (typeof(select) == "string")
	{
		select = document.getElementById(select);
	}

	for (var i = 0; i < select.options.length; i++)
	{
		var option = select.options[i];
		if (option.disabled)
		{
			option.disabled = "";
			option.style.color = "#000000";
		}
	}
}

idc.dom.disableOptions = function(select, optionValues)
{
	if (typeof(select) == "string")
	{
		select = document.getElementById(select);
	}
	
	for (var i = 0; i < select.options.length; i++)
	{
		var option = select.options[i];
		if (!option.disabled)
		{
			for (var j = 0; j < optionValues.length; j++)
			{
				if (optionValues[j] == option.value)
				{
					option.disabled = "disabled";
					option.style.color = "#b0b0b0";
					option.selected = false;
					break;
				}
			}
		}
	}
}

idc.dom.moveOptionsUp = function(select)
{
	if (typeof(select) == "string")
	{
		select = document.getElementById(select);
	}
	
	for (var i = 1; i < select.options.length; i++)
	{
		var option = select.options[i];
		if (option.selected)
		{
			var prevOption = select.options[i - 1];
			if (!prevOption.selected)
			{
				var text = prevOption.text;
				var value = prevOption.value;
				prevOption.text = option.text;
				prevOption.value = option.value;
				option.text = text;
				option.value = value;
				prevOption.selected = !prevOption.selected;
				option.selected = !option.selected;
			}
		}
	}
}

idc.dom.moveOptionsDown = function(select)
{
	if (typeof(select) == "string")
	{
		select = document.getElementById(select);
	}

	for (var i = select.length - 2; i >= 0; i--)
	{
		var option = select.options[i];
		if (option.selected)
		{
			var nextOption = select.options[i + 1];
			if (!nextOption.selected)
			{
				var text = nextOption.text;
				var value = nextOption.value;
				nextOption.text = option.text;
				nextOption.value = option.value;
				option.text = text;
				option.value = value;
				nextOption.selected = !nextOption.selected;
				option.selected = !option.selected;
			}
		}
	}
}

idc.dom.selectOptions = function(select, optionIds)
{
	if (typeof(select) == "string")
	{
		select = document.getElementById(select);
	}
	
	for (var i = 0; i < select.length; i++)
	{
		for (var j = 0; j < optionIds.length; j++)
		{
			var option = select.options[i];
			if (option.value == optionIds[j])
			{
				option.selected = true;
			}
		}
	}
}

idc.dom.selectListToString = function(select)
{
	if (typeof(select) == "string")
	{
		select = document.getElementById(select);
	}
	
	var str = "";
	
	if (select.options.length > 0)
	{
		str = select.options[0].value;
	}

	for (var i = 1; i < select.options.length; i++)
	{
		str += "," + select.options[i].value;
	}
	
	return str;
}

idc.dom._init = function()
{
	idc.nameFunctions(this);
}

idc.dom._init();
//
// Confidential and Proprietary for Stellent, Inc.
//
// This computer program contains valuable, confidential, and
// proprietary information.  Disclosure, use, or reproduction
// without the written authorization of Stellent is prohibited.
// This unpublished work by Stellent is protected by the laws
// of the United States and other countries.  If publication
// of this computer program should occur, the following notice
// shall apply:
//
// Copyright (c) 2007-2007 Stellent, Inc.
// All rights reserved.
//
// $Id: idc_schema.js 52917 2007-02-15 17:42:29Z scelis $
//

if (typeof(idc.schema) == 'undefined') {
    idc.schema = {};
}

idc.schema._VERSION = "1.0";
idc.schema._NAME = "idc.schema";
idc.schema._FIELD_CAPTION_MAP = {};

idc.schema.getFieldCaption = function(fieldName)
{
	var caption = idc.schema._FIELD_CAPTION_MAP[fieldName];
	if (typeof(caption) == "undefined")
	{
		var fieldDef = getFieldDefinition(fieldName);
		caption = lc(fieldDef.caption);
	}
	
	return caption;
}

idc.schema._init = function()
{
	idc.nameFunctions(this);
}

idc.schema._init();
//
// Confidential and Proprietary for Stellent, Inc.
//
// This computer program contains valuable, confidential, and
// proprietary information.  Disclosure, use, or reproduction
// without the written authorization of Stellent is prohibited.
// This unpublished work by Stellent is protected by the laws
// of the United States and other countries.  If publication
// of this computer program should occur, the following notice
// shall apply:
//
// Copyright (c) 2007 Oracle, Inc.
// All rights reserved.
//
// $Id: idc_soap.js 55887 2007-07-16 21:08:20Z dmiller $
//

if (typeof(idc.soap) == 'undefined') {
    idc.soap = {};
}

idc.soap._VERSION = "1.0";
idc.soap._NAME = "idc.soap";

idc.soap.getElementsByTagName = function(xml, tagName, namespace)
{
	if (typeof(namespace) == 'undefined')
	{
		namespace = 'idc';
	}
	
	var elements = xml.getElementsByTagName(namespace + ":" + tagName);
	if (elements.length == 0)
	{
		elements = xml.getElementsByTagName(tagName);
	}
	
	return elements;
}

idc.soap.getFieldValue = function(xml, fieldName, namespace)
{
	if (typeof(namespace) == 'undefined')
	{
		namespace = 'idc';
	}
	var tagName = 'field';
	var fields = idc.soap.getElementsByTagName(xml, tagName, namespace);
	
	var value = null;
	for (var i = 0; i < fields.length; i++)
	{
		var field = fields[i];
		if (field.prefix == namespace)
		{
			if (field.getAttribute('name') == fieldName)
			{
				value = field.firstChild.nodeValue;
				break;
			}
		}
	}
	
	return value;
}

idc.soap.resultSetToArray = function(xml, rsetName, columns, namespace)
{
	if (typeof(namespace) == 'undefined')
	{
		namespace = 'idc';
	}

	var rsets = idc.soap.getElementsByTagName(xml, 'resultset');

	var rset = null;
	for (var i = 0; i < rsets.length; i++)
	{
		var tmpRset = rsets[i];
		if (tmpRset.prefix == namespace)
		{
			if (tmpRset.getAttribute('name') == rsetName)
			{
				rset = tmpRset;
				break;
			}
		}
	}
	
	if (typeof(rset) != "undefined" && rset != null)
	{	
		var arr = new Array();
		var row = rset.firstChild;
		while (row)
		{
			if (typeof(row.tagName) != "undefined")
			{
				if (row.tagName == "row" || row.tagName == namespace + ":row")
				{
					var arrayRow = new Array();
					for (var i = 0; i < columns.length; i++)
					{
						var colName = columns[i];
						var column = row.firstChild;
						while (column)
						{
							if (column.nodeType == 1 && 
								column.getAttribute('name') == colName)
							{
								arrayRow[arrayRow.length] = column.firstChild.nodeValue;
								break;
							}
							
							column = column.nextSibling;
						}
					}
					
					arr[arr.length] = arrayRow;
				}
			}
			row = row.nextSibling;
		}
	}
	
	return arr;
}

idc.soap._init = function()
{
	idc.nameFunctions(this);
}

idc.soap._init();

