/*
Register a function with the onload handler, in a non-destructive way.
Onload calls the requested function, then whatever other function(s)
it was planning to call.
*/

function addOnload(theFunc)
{
  var previous = window.onload;
  if (typeof window.onload != 'function')
  {
    window.onload = theFunc;
  }
  else
  {
    window.onload = function()
	 {
      previous();
      theFunc();
    }
  }
}
var available_colors = { olive_border: "#cc9", dark_gray: "#666", light_gray: "#ddd", dark_light_blue: "#e6e6ef", yellow_background: "#f7f7e7", light_blue: "#f6f6ff" };

function find_home_link()
{
	var anchors = document.getElementsByTagName("a");
	for (i=0; i < anchors.length; i++)
	{
		theAnchor = anchors[i];
		if (theAnchor.href)
		{
			if (theAnchor.href.match(/homepage$/))
			{
				return theAnchor;
			}
		}
	}
}

function make_me_as_wide_as(what, my_id)
{
	var theThing = document.getElementById(what);
	var me = document.getElementById(my_id);

	if (theThing && me)
	{
		if (me.offsetWidth < theThing.offsetWidth)
		{
//			alert("Changing sidebar width from " + me.style.width + " to " + theThing.offsetWidth);
			me.style.width = theThing.offsetWidth + "px";
			me.style.maxWidth = theThing.offsetWidth + "px";
		}
		else
		{
			theThing.style.width = me.offsetWidth + "px";
			theThing.style.maxWidth = me.offsetWidth + "px";
//			alert("Changing sidebar width from " + theThing.style.width + " to " + me.offsetWidth);
		}

//		me.style.backgroundColor = "#ccc";
	}
	else
	{
		if (theThing == null)
		{
//			alert("Couldn't find element with ID " + what);
		}
		if (me == null)
		{
//			alert("Couldn't find element with ID " + my_id);
		}
	}
}

function who_am_i()
{
	var library = new Array();

	library["B19306_01"] = {code:"db102", host:"www.oracle.com"};
	library["10/102"] = {code:"db102", host:"tahiti-stage.us.oracle.com"};
	library["11/111"] = {code:"db111", host:"tahiti-stage.us.oracle.com"};
	library["B25553_01"] = {code:"cs101", host:"www.oracle.com"};
	library["cs/1012"] = {code:"cs101", host:"tahiti-stage.us.oracle.com"};
	library["B14099_19"] = {code:"as1012", host:"www.oracle.com"};
	library["101202fulldoc"] = {code:"as1012", host:"tahiti-stage.us.oracle.com"};
	library["B25221_03"] = {code:"as1013", host:"www.oracle.com"};
	library["101300doc_final"] = {code:"as1013", host:"tahiti-stage.us.oracle.com"};
	library["B28196_01"] = {code:"as1014", host:"www.oracle.com"};
	library["1014im_final"] = {code:"as1014", host:"tahiti-stage.us.oracle.com"};

	var myAddress = window.location.href;
	var partno = myAddress.replace(/.*\/([a-z][0-9]{5})\/.*/, "$1");
	var mylib = myAddress.replace(/.*\/(B19306_01|10\/102|11\/111|B25553_01|cs\/1012|B14099_19|101202fulldoc|B25221_03|101300doc_final|B28196_01|1014im_final)\/.*/, "$1");

	var me = library[mylib];
	me.partno = partno;
	me.dad = me.code;

	var dad = "db111";
	var host = "www.oracle.com";

	if (dad == null || host == null)
	{
		alert("No search URL defined for library " + mylib);
		return;
	}
	else
	{
		;
//		alert("Library: " + mylib + ", search host: " + host + ", search code: " + dad);
	}

	return me;
}

/*
	Make sure any "Home" link has the appropriate parameter at the end to go
	to the correct framed or unframed version of the home page.
	Not needed now that the default is CSS rather than frames.

addOnload(function()
{
	var theAnchor = find_home_link();
	if (theAnchor)
	{
		if (self == top)
		{
			theAnchor.href += "?framed=0";
			theAnchor.target = "_top";
		}
		else
		{
			theAnchor.target = "_top";
		}
	}
});

*/
function set_cookie(value)
{
//	alert(document.cookie);
	if (value.length != 16)
	{
		alert("Can't set preferences to non-16 length string '" + value + "'");
		return;
	}

	var now = new Date();
	var future = new Date();
	var expiry = now.getTime();  //Get the milliseconds since Jan 1, 1970
	expiry += 3600*1000*24*30;  //expires in 1 month(milliseconds)
	future.setTime(expiry);
	document.cookie = 'ORA_TAHITI_PREFS=' + value + '; expires=' + future.toGMTString() + '; path=/; domain=.oracle.com;';
	document.tahiti_prefs = value;
//	alert(document.cookie);
}

function get_prefs(which)
{
	if (! (which >= 0))
	{
		return "";
	}

	var prefs;

	if ((prefs = document.tahiti_prefs) == null)
	{
//		alert("Reading prefs from cookie...");
		prefs = document.cookie;
		prefs = prefs.replace(/.*; *(ORA_TAHITI_PREFS=.*?)(;|$).*/, "$1");
//		alert(prefs);

		if (prefs.length == 0)
		{
			return "";
		}

		if (!prefs.match(/^ORA_TAHITI_PREFS=/))
		{
			return "";
		}

		prefs = prefs.replace(/^ORA_TAHITI_PREFS=(.*)/, "$1");
		document.tahiti_prefs = prefs;
	}
	else
	{
//		alert("Reading prefs from cached value...");
	}

	return prefs.charAt(which);
}

function cookie_exists()
{
	var prefs;

	if ((prefs = document.tahiti_prefs) == null)
	{
//		alert("Reading prefs from cookie...");
		prefs = document.cookie;
		prefs = prefs.replace(/.*; *(ORA_TAHITI_PREFS=.*?)(;|$).*/, "$1");
//		alert(prefs);

		if (prefs.length == 0)
		{
			return false;
		}

		if (!prefs.match(/^ORA_TAHITI_PREFS=/))
		{
			return false;
		}
	}
	else
	{
		return true;
	}
}

function set_prefs(which, value)
{
	if (! (which >= 0))
	{
		return;
	}

	if (value != 0 && value != 1)
	{
		return;
	}

	var prefs;

	if ((prefs = document.tahiti_prefs) == null)
	{
		if (!cookie_exists())
		{
			set_cookie("----------------");
		}

//		alert("Reading prefs from cookie...");
		prefs = document.cookie;
		prefs = prefs.replace(/.*; *(ORA_TAHITI_PREFS=.*?)(;|$).*/, "$1");
//		alert(prefs);

		if (prefs.length == 0)
		{
			return;
		}

		if (!prefs.match(/^ORA_TAHITI_PREFS=/))
		{
			return;
		}

		prefs = prefs.replace(/^ORA_TAHITI_PREFS=(.*)/, "$1");
		document.tahiti_prefs = prefs;
	}
	else
	{
//		alert("Reading prefs from cached value...");
	}

	var new_prefs = prefs.substring(0,which) + value + prefs.substring(which+1,16);
//	alert("Old preferences value = " + prefs + ", new preferences value = " + new_prefs);
	set_cookie(new_prefs);
//	alert("Just to confirm, cached prefs value = " + document.tahiti_prefs + " and cookie = " + document.cookie);
}
/*
	Copyright 2006, 2007 Oracle Corporation.
	Author: John Russell
*/

// Turn Oracle doc tables of contents into expanding/collapsing trees.

var arrow_width = 18;
var arrow_height = 18;
var arrow_style = 'margin: 0px 0px 0px 0px; padding: 0px; /* position: relative; top: 2px; */';
var arrow_side_name = 'blue_med_dark_side.gif';
var arrow_down_name = 'blue_med_dark_down.gif';

var sidearrow = '<img alt="Expand this chapter" width="' + arrow_width + '" height="' + arrow_height + '" style="' + arrow_style + '" src="http://tahiti.oracle.com/images/' + arrow_side_name + '" />';
var downarrow = '<img alt="Collapse this chapter" width="' + arrow_width + '" height="' + arrow_height + '" style="' + arrow_style + '" src="http://tahiti.oracle.com/images/' + arrow_down_name + '" />';

var sidearrow_regexp = new RegExp("<img.*?" + arrow_side_name + ".*?>","i");
var downarrow_regexp = new RegExp("<img.*?" + arrow_down_name + ".*?>","i");

var flipOne = (function (evt)
{
	var id = this.id.replace(/^[a-z]*/,"");

	var subheads = document.getElementById("list"+id);
	if (subheads == null)
	{
		print("Can't find list of subheadings, id list" + id);
		return false;
	}

	var discloseControl = document.getElementById("disclose"+id);
	if (discloseControl == null)
	{
		print("Can't find list of subheadings, id disclose" + id);
		return false;
	}

	if (!evt)
	{
		evt = window.event;
	}

	var shiftPressed;
//		var altPressed;
//		var ctrlPressed;

	if (evt)
	{
		shiftPressed = evt.shiftKey;
//			altPressed = evt.altKey;
//			ctrlPressed = evt.ctrlKey;
	}

	if (subheads.style.display == "none")
	{
		if (shiftPressed)
		{
			expand();
			return false;
		}

		subheads.style.display = "block";
		discloseControl.innerHTML = discloseControl.innerHTML.replace(sidearrow_regexp,downarrow);
	}
	else
	{
		if (shiftPressed)
		{
			collapse();
			return false;
		}

		subheads.style.display = "none";
		discloseControl.innerHTML = discloseControl.innerHTML.replace(downarrow_regexp,sidearrow);
	}

// Don't want the href="#" part of the link to trigger any scrolling.
	return false;
});

addOnload(function()
{
	var converterLevel = (function()
	{
		var allmeta = document.getElementsByTagName("meta");
		var theLevel;

		for (i=0; i < allmeta.length; i++)
		{

			if (allmeta[i].name == "generator")
			{
				theLevel = allmeta[i].content;
//				alert("xhtml Converter Level = " + theLevel);
				return theLevel;
			}
		}
//		alert("Can't find xhtml Converter Level");
		return null;
	});

	var findSubheadTag = (function()
	{
		var potential = "ul";
		var subheads = document.getElementsByTagName(potential);
		if (subheads != null && subheads.length > 0)
		{
			return potential;
		}

		potential = "dl";
		subheads = document.getElementsByTagName(potential);
		if (subheads != null && subheads.length > 0)
		{
//			alert("This TOC page has some tags of type " + potential);
			return potential;
		}

		return null;
	});

	var eligibleToc = (function()
	{
		var myAddress = window.location.href;

		if (!myAddress.match(/\/[a-z]+\.[0-9]+\//))
		{
			return false;
		}

		if (myAddress.match(/\/mix.[0-9]{3}\//))
		{
			return false;
		}

		var head1s = document.getElementsByTagName("h1");
		if (head1s == null || head1s.length == 0)
		{
			return false;
		}

		var conflict = document.getElementById("expandlink");
		if (conflict)
		{
			return false;
		}
		conflict = document.getElementById("collapselink");
		if (conflict)
		{
			return false;
		}

		var firstHead1 = head1s[0];
		if (! firstHead1.innerHTML.match(/\bContents\b/))
		{
			return false;
		}

		if (converterLevel() == null)
		{
			return false;
		}

		if (findSubheadTag() == null)
		{
			return false;
		}

		return true;
	});

	if (eligibleToc() == false)
	{
		return;
	}

	var head1s = document.getElementsByTagName("h1");
	var firstHead1 = head1s[0];

	var head2s = document.getElementsByTagName("h2");

	var subheadTag = findSubheadTag();
	var subheads = document.getElementsByTagName(subheadTag);

	var listCounter = 0;
	var firstLevel = {};

	var print = (function (what)
	{
		alert(what);
		return;

		var msgArea = document.getElementById("message");
		var msgBackup = document.getElementById("footer");
		if (msgArea != null)
		{
			msgArea.innerHTML += what + "<br />";
		}
		else if (msgBackup != null)
		{
			msgBackup.innerHTML += what + "<br />";
		}
	});

	var analyze = (function()
	{
		var subheadTag = findSubheadTag();

		var subheads = document.getElementsByTagName(subheadTag);
		var head2s = document.getElementsByTagName("h2");
		var counter = 0;
		for (i = 0; i < subheads.length; i++)
		{
			currentList = subheads[i];
//			print("Found ul #" + i + " of " + subheads.length);
			var previousHead = currentList.previousSibling;
			if ((previousHead != null) && (previousHead.nodeName != "H2"))
			{
				previousHead = previousHead.previousSibling;
			}
			else
			{
			}

			if (previousHead == null)
			{
//				print("Previous head is null");
			}
			else if (previousHead.nodeName != "H2")
			{
//				print("Found previous head but the node name was " + previousHead.nodeName);
			}
			else
			{
//				var disclosureControl = '<a id="disclose' + counter + '">&gt;</a> ';
				var disclosureControl = '<a href="#" id="disclose' + counter + '">' + sidearrow + '</a> ';

				firstLevel[counter] = previousHead;
//				print("Found previous head OK");
//				previousHead.style.backgroundColor = "yellow";
				previousHead.id = "head" + counter;
				previousHead.innerHTML = disclosureControl + previousHead.innerHTML;

// Internet Explorer sometimes doesn't recognize the new element instantly.
// Might have to set a timer to act on it after it becomes part of the
// DOM tree.

				var justCreated = document.getElementById("disclose" + counter);
				if (justCreated != null)
				{
					justCreated.numericID = counter;
					justCreated.title = "Expand or Collapse";

/*
					if (justCreated.addEventListener)
					{
						justCreated.addEventListener('click',flipOne,false);
					}
					else
					{
*/
						justCreated.onclick = flipOne;
//					}
				}
				else
				{
//					print("Failed to create and find disclosure control...");
				}

				currentList.id =  "list" + counter;
				currentList.style.marginLeft = '32px';
				counter++;
			}
		}

		for (i = 0; i < head2s.length; i++)
		{
			currentHead = head2s[i];
			if (currentHead.innerHTML.match(/>Part (I|V|X)/))
			{
// Applying style to a Part heading
				currentHead.style.textAlign = "center";
				currentHead.style.borderTop = "medium solid #039";
				currentHead.style.marginTop = "10px";
				currentHead.style.paddingTop = "10px";
			}
			else if (!currentHead.innerHTML.match(/id="disclose/))
			{
				currentHead.innerHTML = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + currentHead.innerHTML;
			}
			else
			{
// Found non-Part head2
			}
		}
	});

	var expand = (function()
	{
		var subheads = document.getElementsByTagName(findSubheadTag());
		var head2s = document.getElementsByTagName("h2");

		for (i = 0; i < subheads.length; i++)
		{
			var theList = subheads[i];
			theList.style.display = "block";
			theList.style.marginTop = "1px";
			theList.style.marginBottom = "1px";
		}

		for (i = 0; i < head2s.length; i++)
		{
			var theHead = head2s[i];
			if (!currentHead.innerHTML.match(/>Part (I|V|X)/))
			{
				theHead.style.marginTop = "5px";
			}
			if (currentHead.innerHTML.match(/>Part (I|V|X)/))
			{
				theHead.style.marginBottom = "1px";
			}
			var discloseControl = document.getElementById("disclose"+i);
			if (discloseControl != null)
			{
				discloseControl.innerHTML = discloseControl.innerHTML.replace(sidearrow_regexp,downarrow);
			}
		}
		return false;
	});

	var collapse = (function()
	{
		var subheads = document.getElementsByTagName(findSubheadTag());
		var head2s = document.getElementsByTagName("h2");

// This code to condense the lower-level heads listed beneath a chapter
// needs to be adapted for the older style of TOC markup with
// <dd> inside <dl>.  The <dd>s are spaced out too much.
		for (i = 0; i < subheads.length; i++)
		{
			var theList = subheads[i];
			var previousHead = theList.previousSibling;
			if ((previousHead != null) && (previousHead.nodeName != "H2"))
			{
				previousHead = previousHead.previousSibling;
			}
			else
			{
			}

			if ((previousHead != null) && (previousHead.nodeName == "H2"))
			{
				theList.style.display = "none";
// Need to adjust this a little bit depending on margins and padding of
// the preceding heading and/or size of the arrow graphic.
				theList.style.paddingLeft = "18px";
			}
			theList.style.marginTop = "1px";
			theList.style.marginBottom = "1px";
		}

		for (i = 0; i < head2s.length; i++)
		{
			var theHead = head2s[i];
			if (!currentHead.innerHTML.match(/>Part (I|V|X)/))
			{
				theHead.style.marginTop = "5px";
			}
			theHead.style.marginBottom = "1px";

			theHead.style.marginLeft = "0px";
			theHead.style.paddingLeft = "0px";

			var discloseControl = document.getElementById("disclose"+i);
			if (discloseControl != null)
			{
				discloseControl.innerHTML = discloseControl.innerHTML.replace(downarrow_regexp,sidearrow);
				discloseControl.style.padding = "0px 6px";
				if (discloseControl.addEventListener == null)
				{
					discloseControl.onclick = flipOne;
				}
			}
		}
		return false;
	});

	analyze();
	collapse();

	var toolbar = document.createElement('div');
	var toolbarContent = document.createTextNode('');
	var fontsize = "120%";

//	var expand_all = 'Expand All';
//	var collapse_all = 'Collapse All';
	var button_style = '/* position: relative; top: 4px; */';
	var expand_all = '<img id="expand_all_button" style="' + button_style + '" alt="Expand All" src="http://tahiti.oracle.com/images/expand_hlight_button.gif" />';
	var collapse_all = '<img id="collapse_all_button" style="' + button_style + '" alt="Collapse All" src="http://tahiti.oracle.com/images/collapse_hlight_butt.gif" />';

	toolbar.appendChild(toolbarContent);
	toolbar.innerHTML = '<a style="font-size: 120%; border: none /* 1px solid #cc9 */; padding: 4px 6px 4px 6px; " href="#" id="expandlink">' + expand_all + '</a><span style="font-size: 120%;"> | </span><a style="font-size: 120%; border: none /* 1px solid #cc9 */; padding: 4px 6px 4px 6px; " href="#" id="collapselink">' + collapse_all + '</a> (Or click any <span id="expand_collapse_icon">' + sidearrow + '</span> icon to expand that chapter.) <small><a href="http://www.oracle.com/admin/account/index.html">Sign in or register for a free Oracle Web account, to enable personalized documentation features</a></small>';

	firstHead1.parentNode.insertBefore(toolbar, firstHead1.nextSibling);
//	toolbar.style.lineHeight = "225%";

	var expandLink = document.getElementById('expandlink');
	var collapseLink = document.getElementById('collapselink');

	expandLink.onclick = expand;
	collapseLink.onclick = collapse;

	var always_link = document.getElementById("collapse_preference_expanded");
	var always_expand;
	var always_collapse;

	var bumpDown = (function(id)
	{
		var theItem = document.getElementById(id);
		if (theItem)
		{
			try
			{
				theItem.style.position = "inherit";
				theItem.style.position = "relative";
				theItem.style.top = "4px";
			}
			catch (err) {}
		}

	});

	bumpDown("expand_all_button");
	bumpDown("collapse_all_button");
	bumpDown("expand_collapse_icon");

	always_expand = (function()
	{
		expand();
// At this point, would like to change the appearance and behaviour of
// this link to the opposite.
		var me = document.getElementById("collapse_preference_expanded");
		if (me)
		{
			me.innerHTML = "Always collapse all";
			me.id = "collapse_preference_collapsed";
			if (me.href)
			{
				me.href = me.href.replace(/_collapsed/,"_expanded");
			}
			me.onclick = always_collapse;
		}
		else
		{
// Couldn't find link to switch text.
		}
// Now we've switched where the link points to.
// Return true so the click activates the new link.
		return true;
	});

	always_collapse = (function()
	{
		collapse();
// At this point, would like to change the appearance and behaviour of
// this link to the opposite.
//		self.innerHTML = "Always expand all";
		var me = document.getElementById("collapse_preference_collapsed");
		if (me)
		{
			me.innerHTML = "Always expand all";
			me.id = "collapse_preference_expanded";
			if (me.href)
			{
				me.href = me.href.replace(/_expanded/,"_collapsed");
			}
			me.onclick = always_expand;
		}
		else
		{
// Couldn't find link to switch text.
		}
		return true;
	});

	if (always_link)
	{
		always_link.onclick = always_expand;
	}
	else
	{
		always_link = document.getElementById("collapse_preference_collapsed");
		if (always_link)
		{
			always_link.onclick = always_collapse;
		}
	}

});
/*
function print(what)
{
//	alert(what);
}
*/

function showPlatform(what)
{
	var platform_name = new RegExp(what,"i");

	var head1s = document.getElementsByTagName("h1");

	for (i = 0; i < head1s.length; i++)
	{
		theHead = head1s[i];
		theText = theHead.innerHTML;

		if (what == null)
		{
//			print("Showing heading " + theText + " because asked to display all platforms...");
			theHead.style.display = "block";
			if (theHead.className.match(/libportletheader/))
			{
				var para = theHead.nextSibling;
//				alert(para.nodeName);
				while (para && ((para.nodeName == 'P') || (para.nodeName == '#text')))
				{
					if (para.nodeName == 'P')
					{
//						alert("Showing extra embedded paragraph: " + para.innerHTML);
						para.style.display = "block";
					}
					para = para.nextSibling;
				}
			}
		}
		else if (theHead.className == null)
		{
//			print("Showing heading " + theText + " because has no class...");
			theHead.style.display = "block";
		}
		else if (!theHead.className.match(/libportletheader/))
		{
//			print("Showing heading " + theText + " because not a portlet header...");
			theHead.style.display = "block";
		}
		else if (theHead.id.match(platform_name))
		{
//			print("Showing heading " + theText + " because matches search term...");
			theHead.style.display = "block";
			var para = theHead.nextSibling;
//			alert(para.nodeName);
			while (para && ((para.nodeName == 'P') || (para.nodeName == '#text')))
			{
				if (para.nodeName == 'P')
				{
//					alert("Showing extra embedded paragraph: " + para.innerHTML);
					para.style.display = "block";
				}
				para = para.nextSibling;
			}
		}
		else if (!theText.match(/Installation Guides/i))
		{
//			print("Showing heading " + theText + " because not an Installation Guides portlet...");
			theHead.style.display = "block";
		}
		else
		{
//			print("Hiding heading " + theText + " because doesn't match search term...");
			theHead.style.display = "none";

// Now the hidden heading might be followed by some paragraphs, so look ahead
// and hide them too if necessary.

			var para = theHead.nextSibling;
//			alert(para.nodeName);
			while (para && ((para.nodeName == 'P') || (para.nodeName == '#text')))
			{
				if (para.nodeName == 'P')
				{
//					alert("Hiding extra embedded paragraph: " + para.innerHTML);
					para.style.display = "none";
				}
				para = para.nextSibling;
			}
		}
	}

	var tables = document.getElementsByTagName("table");

	for (i = 0; i < tables.length; i++)
	{
		theTable = tables[i];

		if (what == null)
		{
//			print("Showing table because asked to display all platforms...");
			theTable.style.display = "block";
		}
		else if (theTable.className == null)
		{
//			print("Showing table because has no class...");
			theTable.style.display = "block";
		}
		else if (!theTable.className.match(/libdoclist/))
		{
//			print("Showing table because not a list of books...");
			theTable.style.display = "block";
		}
		else if (theTable.id.match(platform_name))
		{
//			print("Showing table because matches search term...");
			theTable.style.display = "block";
		}
		else if (!theTable.id.match(/install/i))
		{
//			print("Showing table because not a list of install books...");
			theTable.style.display = "block";
		}
		else
		{
//			print("Hiding table because doesn't match search term...");
			theTable.style.display = "none";
		}
	}

}
/*
	Copyright 2006, 2007 Oracle Corporation.
	Author: John Russell
*/

// Display optional navigation tree inside book files.

addOnload(function()
{
	var needs_absolute_position = (function()
	{
//				if (typeof document.body.style.maxHeight != "undefined")
		if (window.XMLHttpRequest)
		{
//			alert("Browser needs fixed positioning");
			return false;
		}
//		alert("Browser needs absolute positioning");
		return true;
	});

	var converterLevel = (function()
	{
		var allmeta = document.getElementsByTagName("meta");
		var theLevel;

		for (i=0; i < allmeta.length; i++)
		{
//			alert("Found meta tag, name = " + allmeta[i].name + ", content = " + allmeta[i].content);

			if (allmeta[i].name == "generator")
			{
				theLevel = allmeta[i].content;
//				alert("xhtml Converter Level = " + theLevel);
				return theLevel;
			}
		}
//		alert("Can't find xhtml Converter Level");
		return null;
	});

	var eligibleBookNav = (function()
	{
		var myAddress = window.location.href;
		try
		{
			var myParams = window.location.search.substring(1);

			if (myParams.match(/type=popup/))
			{
				return false;
			}
		}
		catch (err)
		{
		}

		if (!myAddress.match(/\/[a-z]+\.[0-9]+\//))
		{
			return false;
		}

		if (myAddress.match(/\/mix.[0-9]{3}\//))
		{
			return false;
		}

		if (top != self)
		{
			return false;
		}

		var head1s = document.getElementsByTagName("h1");
		if (head1s == null || head1s.length == 0)
		{
			return false;
		}

		var conflict = document.getElementById("nav");
		if (conflict)
		{
			return false;
		}

		if (converterLevel() == null)
		{
			return false;
		}

		return true;
	});

	if (eligibleBookNav() == false)
	{
		return;
	}

	var rememberLayout = (function()
	{
		if (document.oldlayout == null)
		{
			var bodyTags = document.getElementsByTagName("body");
			var htmlTags = document.getElementsByTagName("html");
			var layout = {};

			if (bodyTags && htmlTags)
			{
				var theBody = bodyTags[0];
				var theHTML = htmlTags[0];

				layout.htmlOverflowY = theHTML.style.overflowY;
				layout.bodyOverflowY = theBody.style.overflowY;

				layout.bodyPaddingLeft = theBody.style.paddingLeft;

				layout.bodyOverflowX = theBody.style.overflowX;
				layout.bodyOverflowY = theBody.style.overflowY;
				layout.bodyHeight = theBody.style.height;

				layout.htmlOverflowY = theHTML.style.overflowY;
				layout.htmlHeight = theHTML.style.height;

				document.oldlayout = layout;
			}
		}
	});

	var restoreLayout = (function()
	{
		if (document.oldlayout)
		{
			var bodyTags = document.getElementsByTagName("body");
			var htmlTags = document.getElementsByTagName("html");
			var layout = {};

			if (bodyTags && htmlTags)
			{
				var theBody = bodyTags[0];
				var theHTML = htmlTags[0];
				var layout = {};

				if (layout = document.oldlayout)
				{

					if (layout.htmlOverflowY != theHTML.style.overflowY)
					{
						theHTML.style.overflowY = layout.htmlOverflowY;
					}

					if (layout.bodyOverflowY != theBody.style.overflowY)
					{
						theBody.style.overflowY = layout.bodyOverflowY;
					}

					if (layout.bodyPaddingLeft != theBody.style.paddingLeft)
					{
						layout.bodyPaddingLeft = theBody.style.paddingLeft;
					}

					if (layout.bodyOverflowX != theBody.style.overflowX)
					{
						layout.bodyOverflowX = theBody.style.overflowX;
					}

					if (layout.bodyOverflowY != theBody.style.overflowY)
					{
						layout.bodyOverflowY = theBody.style.overflowY;
					}

					if (layout.bodyHeight != theBody.style.height)
					{
						layout.bodyHeight = theBody.style.height;
					}

					if (layout.htmlOverflowY != theHTML.style.overflowY)
					{
						layout.htmlOverflowY = theHTML.style.overflowY;
					}

					if (layout.htmlHeight != theHTML.style.height)
					{
						layout.htmlHeight = theHTML.style.height;
					}
				}
			}
		}
	});

	var makeNav = (function()
	{
		var bookTitle = (function()
		{
			var allmeta = document.getElementsByTagName("meta");

			for (i=0; i < allmeta.length; i++)
			{
// <meta name="doctitle" content="Oracle&reg; Database 2 Day Developer's Guide, 11g Release 1 (11.1)" />
				if (allmeta[i].name == "doctitle")
				{
					return '\
<h1 id="nav_this_book" style="font-size: 110%; margin-bottom: 0px; padding-bottom: 0px;">This Book</h1>\
<p style="margin-top: 0px; padding-top: 4px; padding-left: 0.5em;"><a href="toc.htm">' + allmeta[i].content + '</a></p>';
				}
			}
			return ''; // '<h1>This Book</h1><p>Title unknown.</p>';
		});

		rememberLayout();

// !! Should change variable names if no longer inserting the navigation
// before the first head1, but instead before the first div.
// It's possible that doing so may fix a couple of tiny IE glitches
// where the search box is a couple of pixels too high and a couple
// of pixels at the top of the window don't scroll.
// Hmmm, guess moving it didn't help. Perhaps it should actually go
// slightly later in the DOM tree.

		var head1s = document.getElementsByTagName("div");
		if (head1s)
		{
			var firstHead1 = head1s[0];
			var myAddress = window.location.href;
			var partno = myAddress.replace(/.*\/([a-z][0-9]{5})\/.*/, "$1");
			var navDiv = document.createElement('div');
			var navContent = document.createTextNode('');
			navDiv.appendChild(navContent);
			navDiv.innerHTML = '\
<div id="flipNav_container" style="margin-top: 20px; clear: both;">\
</div>\
<div class="simple_search_form_container" style="padding-bottom: 5px; padding-left: 8px; padding-top: 0px;">\
<div style="margin-top: 6px;">\
<form class="simple_search_form" style="margin-bottom: 6px;" action="http://www.oracle.com/pls/db111/search" method="get">\
<input type="hidden" name="remark" value="quick_search" />\
<span style=" display: none; "><label for="search_field_navbar">Search:</label></span>\
<span>\
<input style="margin-bottom: 3px;" type="text" name="word" value="" class="search_field" id="search_field_navbar" />\
</span>\
<span class="text">\
<input style="margin-bottom: 3px; margin-left: 4px;" type="submit" value="Search" class="text" />\
<div>\
<input type="radio" value="' + partno + '" name="partno" id="search_single_book_navbar" /><label for="search_single_book_navbar">This book</label> \
<input type="radio" value="" name="partno" checked="checked" id="search_entire_library_navbar" /><label for="search_entire_library_navbar">Entire library</label>\
</div>\
</span>\
</form>\
</div>\
\
<h1 style="font-size: 110%; margin-bottom: 0px; padding-bottom: 0px;">Quick Lookup</h1>\
<div class="shortcut_links">\
<a href="http://www.oracle.com/pls/db111/ranked?advanced=1" target="_top">Advanced Search</a> &#149; \
<a href="http://www.oracle.com/pls/db111/portal.all_books" target="_top">Master Book List</a> &#149; \
<a href="http://www.oracle.com/pls/db111/lookup?id=MINDX" target="_top">Master Index</a> &#149; \
<a href="http://www.oracle.com/pls/db111/lookup?id=MGLOS" target="_top">Master Glossary</a> &#149; \
<a href="http://www.oracle.com/pls/db111/lookup?id=ERRMG" target="_top">Error Messages</a>\
</div>\
</div>\
<div>\
</div>\
\
<div style="margin-right: 8px;">\
<h1 style="font-size: 110%; margin-bottom: 0px; padding-bottom: 0px;">Main Categories</h1>\
<ul style="list-style: none; margin-top: 0px; padding-top: 0px; margin-left: 0em; padding-left: 0.5em;">\
<li><a href="http://www.oracle.com/pls/db111/portal.portal_db?selected=11&frame=">Installation</a></li>\
<li><a href="http://www.oracle.com/pls/db111/portal.portal_db?selected=1&frame=">Getting Started</a></li>\
<li><a href="http://www.oracle.com/pls/db111/portal.portal_db?selected=4&frame=">Administration</a></li>\
<li><a href="http://www.oracle.com/pls/db111/portal.portal_db?selected=5&frame=">Application Development</a></li>\
<li><a href="http://www.oracle.com/pls/db111/portal.portal_db?selected=16&frame=">Grid Computing</a></li>\
<li><a href="http://www.oracle.com/pls/db111/portal.portal_db?selected=14&frame=">High Availability</a></li>\
<li><a href="http://www.oracle.com/pls/db111/portal.portal_db?selected=6&frame=">Data Warehousing</a></li>\
<li><a href="http://www.oracle.com/pls/db111/portal.portal_db?selected=7&frame=">Content Management and Unstructured Data</a></li>\
<li><a href="http://www.oracle.com/pls/db111/portal.portal_db?selected=15&frame=">Information Integration</a></li>\
<li><a href="http://www.oracle.com/pls/db111/portal.portal_db?selected=25&frame=">Security</a></li>\
<li><a href="http://www.oracle.com/pls/db111/portal.portal_db?selected=99&frame=">Favorites</a></li>\
</ul>' +
bookTitle() +
'<h1 id="nav_this_page" style="font-size: 110%; margin-bottom: 4px; padding-bottom: 0px;">This Page</h1>\
<div style="margin-right: 8px; margin-left: 0.5em;">\
';

// Now we list the first heading on this page, and its major subheadings.

			var divCounter = 0;

			var allHead1s = document.getElementsByTagName("h1");
			if (allHead1s)
			{
				var theHead1 = allHead1s[0];
				if (theHead1.id == null || theHead1.id.length == 0)
				{
					theHead1.id = "insertedID" + divCounter++;
//					alert("Setting Head1 ID to " + theHead1.id);
				}
				else
				{
//					alert("Head1 ID was already " + theHead1.id);
				}

				var innerText = theHead1.innerHTML.replace(/<.*?>/g,"");
				navDiv.innerHTML += '<div style="margin-left: 0.5em; margin-right: 8px;"><a href="#' + theHead1.id + '">' + innerText + '</a></div>';

				if (theHead1.className != null && theHead1.className == "glossary")
				{
//					alert("I'm in a glossary...");
					var allParas = document.getElementsByTagName("p");
					if (allParas)
					{
						for (i=0; i < allParas.length; i++)
						{
							var thePara = allParas[i];
							if (thePara.className != null && thePara.className == "glossterm")
							{
								if (thePara.id == null || thePara.id.length == 0)
								{
									thePara.id = "insertedID" + divCounter++;
								}
								var innerText = thePara.innerHTML.replace(/<.*?>/g,"");
								navDiv.innerHTML += '<div style="padding-left: 1.5em; padding-right: 8px;"><a href="#' + thePara.id + '">' + innerText + '</a></div>';
							}
						}
					}
				}
//				else if (theHead1.className != null && theHead1.className == "toc")
				else if ((theHead1.className != null && theHead1.className == "toc") || theHead1.innerHTML == "Contents")
				{
// Don't repeat all the TOC entries, just looks strange.
// Perhaps something else can go here, e.g. Part headings.
				}
				else
				{
//					alert("I'm not in a glossary because h1 " + theHead1.innerHTML + "'s class is " + theHead1.className + "...");
					var allHead2s = document.getElementsByTagName("h2");
					for (i=0; i < allHead2s.length; i++)
					{
						var theHead2 = allHead2s[i];
						if (theHead2.id == null || theHead2.id.length == 0)
						{
							theHead2.id = "insertedID" + divCounter++;
						}
						var innerText = theHead2.innerHTML.replace(/<.*?>/g,"");
						innerText = innerText.replace(/&nbsp;/g,"");
						navDiv.innerHTML += '<div style="padding-right: 8px; padding-left: 1.5em;"><a href="#' + theHead2.id + '">' + innerText + '</a></div>';
					}
				}
			}

			navDiv.innerHTML += '</div><div id="docid_history"></div>';
			navDiv.innerHTML += '\
<div id="keyboard_shortcut_controls" style="display: none">\
<h1 style="font-size: 110%; margin-bottom: 4px; padding-bottom: 0px;">Keyboard Shortcuts</h1>\
<form>\
<input type="radio" name="shortcut_radio" value="on" checked="checked" onclick="/* alert(\'Turning on shortcuts\'); */ if (document.shortcuts_enable) { document.shortcuts_enable(); /* alert(\'Yes!\'); */ } return true;" /> Enable shortcuts\
<input type="radio" name="shortcut_radio" value="off" onclick="/* alert(\'Turning off shortcuts\'); */ if (document.shortcuts_disable) { document.shortcuts_disable(); /* alert(\'No!\'); */ } return true;" /> Disable shortcuts\
</form>\
</div>\
';

			firstHead1.parentNode.insertBefore(navDiv, firstHead1.nextSibling);
//			alert("About to hide navigation div...");
			navDiv.style.display = "none";
			navDiv.id = "nav";
/* Style the div to look like this:
div#nav
{
	position: absolute;
	top: 0px;
	left: 0px;
	width: 19em;
	height: 100%;
	overflow: auto;
	padding: 0px;
	margin: 0px;
}
*/
			navDiv.style.top = "0";
			navDiv.style.left = "0";
			navDiv.style.width = "19.5em";

// Find a way to represent the IE conditional comments to
// distinguish between fixed and absolute, rather than catching
// an exception.

// IE 6 requires position: absolute; to give the navigation div a
// fixed position. All other, more-modern browsers require position: fixed;.
// So need a function to pick out just IE 6, not Firefox, Opera, Safari,
// or even IE 7.

			navDiv.style.position = "fixed";

			try
			{
// Throwaway assignment, done just to raise an IE exception.
				navDiv.style.marginLeft = "1em;"
			}
			catch(err)
			{
				navDiv.style.position = "absolute";
			}

			navDiv.style.overflowX = "hidden";
			navDiv.style.overflowY = "auto";
			navDiv.style.padding = "0px 0px 0px 0px";
			navDiv.style.margin = "0px 0px 0px 4px";
			navDiv.style.height = "100%";
			navDiv.style.borderRight = "solid 2px #ccc";
			navDiv.style.zOrder = "100";
			navDiv.style.backgroundColor = "white";
		}

		var toolbar = document.getElementById('flipNav_container');

		if (toolbar != null)
		{
			toolbar.innerHTML = '<a id="flipNavInline" style="float: right; clear: both; margin-top: 4px;" href="#"><img src="http://tahiti.oracle.com/images/show_nav.gif" border="0" alt="Show Navigation" /></a><br />';
		}
		else
		{
	//		alert("flipNav_container does not exist");
		}

	});

	var showNav = (function()
	{
//		alert("About to show navigation");
		var navToggle = document.getElementById("flipNav");
		var navToggleInline = document.getElementById("flipNavInline");
		var bodyTags = document.getElementsByTagName("body");
		var htmlTags = document.getElementsByTagName("html");
		var navDiv = document.getElementById("nav");
		if (bodyTags && htmlTags)
		{
			var theBody = bodyTags[0];
			var theHTML = htmlTags[0];
			theBody.id = "left-nav-present";
/* Make the style match these CSS rules:
body#left-nav-present
{
  margin: 0px;
  padding: 0 0 0 20em;
  overflow-x: hidden;
}
*/
//			theBody.margin = "0px";
//			var before = theBody.style.paddingLeft;
			theBody.style.paddingLeft = "20em";
//			var after = theBody.style.paddingLeft;
//			alert("Padding before = " + before + ", padding after = " + after);

// Commenting out to fix ALTER TABLE cutoff problem.
//			theBody.style.overflowX = "hidden";
//			theBody.style.overflowY = "auto";
//			theBody.style.height = "100%";

// Throws an exception in IE 6 and 7.
			try
			{
				theHTML.style.overflowY = "inherit";
				theHTML.style.overflowY = "auto";
			}
			catch (err)
			{
//				if (needs_absolute_position())
//				{
//					theHTML.style.overflowY = "auto";
//				}
//				else
				{
// Transferred these lines from earlier to fix the ALTER TABLE problem
// in Firefox without messing up scrollbars in IE.
					theBody.style.overflowX = "hidden";
					theBody.style.overflowY = "auto";
					theBody.style.height = "100%";

					theHTML.style.overflowY = "hidden";
					theHTML.style.height = "100%";

// Prevent slight cutoff around the edges for IE.
					theHTML.style.paddingTop = "16px";
					theHTML.style.paddingBottom = "3em";
					theBody.style.paddingRight = "2em";
					theHTML.style.marginRight = "0";
					theHTML.style.paddingRight = "0";
					theBody.style.width = "75%";

					if (window.onresize)
					{
//						alert("Setting up resize handler for window");
						window.onresize();
					}
				}
			}

		}
		else
		{
			alert("Couldn't find body element");
		}

		if (navToggle)
		{
			navToggle.onclick = navToggle.hideFunction;
			navToggle.innerHTML = navToggle.innerHTML.replace(/Show Navigation/,"Hide Navigation");
			navToggle.innerHTML = navToggle.innerHTML.replace(/show_nav/,"hide_nav");
			if (navDiv)
			{
				navDiv.style.display = "block";
				set_prefs(1,0);
			}
		}
		else
		{
			alert("Couldn't find flipNav element");
		}

		if (navToggleInline)
		{
			navToggleInline.onclick = navToggleInline.hideFunction;
			navToggleInline.innerHTML = navToggleInline.innerHTML.replace(/Show Navigation/,"Hide Navigation");
			navToggleInline.innerHTML = navToggleInline.innerHTML.replace(/show_nav/,"hide_nav");
		}

		return false;
	});

	var hideNav = (function()
	{
//		alert("About to hide navigation");

		restoreLayout();

		var navToggle = document.getElementById("flipNav");
		var navToggleInline = document.getElementById("flipNavInline");
		var bodyTags = document.getElementsByTagName("body");
		var htmlTags = document.getElementsByTagName("html");
		var navDiv = document.getElementById("nav");

		if (bodyTags)
		{
			var theBody = bodyTags[0];
			theBody.id = "";
// Undo the styles applied by showNav
//			var before = theBody.style.paddingLeft;
			theBody.style.paddingLeft = "0px";
//			var after = theBody.style.paddingLeft;
//			alert("Padding before = " + before + ", padding after = " + after);
		}

		if (navToggle)
		{
			navToggle.onclick = navToggle.showFunction;
			navToggle.innerHTML = navToggle.innerHTML.replace(/Hide Navigation/,"Show Navigation");
			navToggle.innerHTML = navToggle.innerHTML.replace(/hide_nav/,"show_nav");
			if (navDiv)
			{
//			alert("About to hide navigation div...");
				navDiv.style.display = "none";
				set_prefs(1,1);
			}
		}
		if (navToggleInline)
		{
			navToggleInline.onclick = navToggleInline.showFunction;
			navToggleInline.innerHTML = navToggleInline.innerHTML.replace(/Hide Navigation/,"Show Navigation");
			navToggleInline.innerHTML = navToggleInline.innerHTML.replace(/hide_nav/,"show_nav");
			if (navDiv)
			{
//			alert("About to hide navigation div...");
				navDiv.style.display = "none";
				set_prefs(1,1);
			}
		}

		return false;
	});

	var head1s = document.getElementsByTagName("h1");
	var firstHead1 = head1s[0];

	var toolbar = document.createElement('div');
	var toolbarContent = document.createTextNode('');
	toolbar.appendChild(toolbarContent);
//	toolbar.innerHTML = '<a id="flipNav" style="float: left; clear: left;" href="#">Show Navigation</a><br />';
	toolbar.innerHTML = '<a id="flipNav" style="float: left; clear: left; margin-top: 4px;" href="#"><img src="http://tahiti.oracle.com/images/show_nav.gif" border="0" alt="Show Navigation" /></a><br />';

	firstHead1.parentNode.insertBefore(toolbar, firstHead1);

	makeNav();

	var navToggle = document.getElementById("flipNav");
	if (navToggle)
	{
		navToggle.onclick = showNav;
		navToggle.showFunction = showNav;
		navToggle.hideFunction = hideNav;
	}
	else
	{
		alert("Can't find flipNav element");
	}

	var navToggleInline = document.getElementById("flipNavInline");
	if (navToggleInline)
	{
		navToggleInline.onclick = showNav;
		navToggleInline.showFunction = showNav;
		navToggleInline.hideFunction = hideNav;
	}
	else
	{
//		alert("Can't find flipNavInline element");
	}


	var should_hide_nav = get_prefs(1);
	if (should_hide_nav != "1")
	{
		showNav();
	}
});
/*
	Copyright 2006, 2007 Oracle Corporation.
	Author: John Russell
*/

// Display comment-related controls on page.

addOnload(function()
{

	var addCommentForm = (function()
	{
		var myAddress = window.location.href;
		var myPath = myAddress.replace(/.*\/([a-z]+\.[0-9]+\/[a-z][0-9]{5}\/.*.htm).*/, "$1");

		var comment_form = '\
<div id="comment_form" class="comments">\
<h1>User Comments</h1>\
<form method="post" action="http://www.oracle.com/pls/db111/add_comment">\
<input type="hidden" name="path" value="' + myPath + '" />\
<label for="user_comments_title"><b>Title:</b></label> \
<input type="text" name="title" size="40" id="user_comments_title" />\
<div style="margin-top: 4px; margin-left: 3em;">\
<input type="radio" checked="checked" name="submitter" id="post_public" value="Not logged in" /> <label for="post_public"><a href=\"http://www.oracle.com/admin/account/index.html\">Please log in or register first</a></label> \
<input type="radio" name="submitter" id="post_anonymous" value="" /> <label for="post_anonymous">Post anonymously</label>\
</div>\
<label for="user_comments_body"><span style="display: none;">Comment body:</span></label>\
<textarea rows="10" cols="80" name="comment_text" id="user_comments_body" style="width: 40em; overflow-x: auto; margin-top: 4px;">\
</textarea>\
<div>\
<div style="margin-bottom: 4px; margin-top: 2px;">\
By submitting a comment, you confirm that you have read and agreed to \
the <a id="comment_ts_and_cs" href="http://www.oracle.com/pls/db111/comment_disclaimer">terms and conditions</a>.\
</div>\
<input type="submit" value="Submit a new comment" />\
<span style="font-size: 90%; margin-left: 20px;">(Comments are moderated and will not appear immediately.)</span>\
</div>\
</form>\
</div>';

		var allDivs = document.getElementsByTagName("div");
//		for (i = 0; i < allDivs.length; i++)
// Counting down to find the footer div, since it's near the end of the file.
		for (i = allDivs.length-1; i >= 0; i--)
		{
			if (allDivs[i].className == "footer")
			{
				var footer = allDivs[i];
				footer.id = "comment_block";
				footer.innerHTML = comment_form + footer.innerHTML;
			}
		}
});

	var comment_counter = 0;

	var addComment = (function(theComment)
	{
		var allDivs = document.getElementsByTagName("div");
//		for (i = 0; i < allDivs.length; i++)
// Counting down to find the footer div, since it's near the end of the file.
		for (i = allDivs.length-1; i >= 0; i--)
		{
			if (allDivs[i].className == "footer")
			{
				var footer = allDivs[i];
//				var comment_block = document.createElement('div');
//				var comment_text = document.createTextNode('');
//				comment_block.appendChild(comment_text);
//				comment_text.innerHTML = '<div style="border: 1px solid #ccc; padding: 5px; margin-top: 8px;">' + theComment.text + '</div>';
				footer.innerHTML = '<div id="comment' + ++comment_counter + '" style="border: 1px solid #ccc; padding: 5px; margin-top: 8px;"><div><b>From:</b> ' + theComment.name + '</div>' + '<div><b>Title: </b>' + theComment.title + '</div>' + '<div><b>Date: </b>' + theComment.submitted + '</div>' + '<div>' + theComment.text + '</div>' + '</div>' + footer.innerHTML;
			}
		}
	});

	var converterLevel = (function()
	{
		var allmeta = document.getElementsByTagName("meta");
		var theLevel;

		for (i=0; i < allmeta.length; i++)
		{

			if (allmeta[i].name == "generator")
			{
				theLevel = allmeta[i].content;
				return theLevel;
			}
		}
		return null;
	});

	var eligibleComments = (function()
	{
		var myAddress = window.location.href;

		if (!myAddress.match(/\/[a-z]+\.[0-9]+\//))
		{
			return false;
		}

		if (myAddress.match(/\/mix.[0-9]{3}\//))
		{
			return false;
		}

		if (myAddress.match(/\/nav\//))
		{
			return false;
		}

		if (!myAddress.match(/\.htm(#.*){0,1}$/))
		{
			return false;
		}

		if (converterLevel() == null)
		{
			return false;
		}

		var conflict = document.getElementById("comment_form");
		if (conflict)
		{
			return false;
		}
		conflict = document.getElementById("comment_block");
		if (conflict)
		{
			return false;
		}
		conflict = document.getElementById("comment_announcement");
		if (conflict)
		{
			return false;
		}

		return true;
	});

	if (eligibleComments() == false)
	{
		return;
	}

	var head1s = document.getElementsByTagName("h1");
	var firstHead1 = head1s[0];

	var print = (function (what)
	{
		alert(what);
		return;

		var msgArea = document.getElementById("message");
		var msgBackup = document.getElementById("footer");
		if (msgArea != null)
		{
			msgArea.innerHTML += what + "<br />";
		}
		else if (msgBackup != null)
		{
			msgBackup.innerHTML += what + "<br />";
		}
	});

/*
	var announcement = document.createElement('div');
	var announce_text = document.createTextNode('');
	announcement.appendChild(announce_text);
	announcement.innerHTML = '<div style="border: 1px solid #ccc; padding: 5px; margin-top: 8px; background-color: white;">This page has no user comments. <p style="margin-top: 0px; margin-bottom: 0px;"><a href="#comment_form">Leave your own comments.</a></p></div>';
	firstHead1.parentNode.insertBefore(announcement, firstHead1.nextSibling);
	announcement.style.cssFloat = "right";
	announcement.style.styleFloat = "right";
	announcement.style.clear = "right";
	announcement.id = "comment_announcement";
*/

	var this_page = document.getElementById("nav_this_page");
	if (this_page)
	{
		this_page.innerHTML += ' <span style="font-size: 80%; font-weight: normal;">[<a href="#comment_block">0 comments</a>, <a href="#comment_form">Leave a comment</a>]</p>';
	}

	var comment = new Object();

/*
	comment.name = "john.russell@oracle.com";
	comment.submitted = "12-MAR-2007";
	comment.title = "Sample Comment";
	comment.text = "This is a dummy comment for testing.";
	addComment(comment);
*/

	 

	var showTerms = (function()
	{
		var newwindow = window.open('http://www.oracle.com/pls/db111/comment_disclaimer','TermsWindow','scrollbars=yes,width=500,height=400,screenx=50,screeny=50,location=no,toolbar=no,directories=no');
		return false;
	});

	addCommentForm();
	var terms_link = document.getElementById("comment_ts_and_cs");
	if (terms_link)
	{
		terms_link.onclick = showTerms;
	}

});
addOnload(function() { make_me_as_wide_as("search_this_book","comment_announcement"); });
/*
Figure out what part(s) of the TOC tree should be expanded by default.
*/

addOnload(function()
{
	var myAddress = window.location.href;
	var anchor;
	var tab;

/*
	if (myAddress.match(/\bframe=[a-z]+\b/)
	{
		return;
	}
*/

	if (myAddress.match(/#/))
	{
		anchor = myAddress.replace(/.*#(.*)/,"$1");
//		alert("Anchor = " + anchor);
	}

	if (myAddress.match(/\bselected=[0-9]+\b/))
	{
		tab = myAddress.replace(/.*\bselected=([0-9]+)\b.*/,"$1")
//		alert("Portal page = " + tab);
	}

/*
The Favorites tab is linked differently from the navigation tree than all
the others. Blindly using the same code as the others causes the whole
navigation div to be hidden. For the moment, don't auto-highlight it.
*/
	if (tab == 99)
	{
		return;
	}

	var anchors = document.getElementsByTagName("a");
	var theAnchor;

	var progress = "";
	var portal_id = new RegExp("\\bselected=" + tab + "\\b");
	var anchor_id = new RegExp("#" + anchor + "$");

	for (i=0; i < anchors.length; i++)
	{
		theAnchor = anchors[i];
		if (theAnchor.className == "linkanchor")
		{
			progress += "+";
			if (theAnchor.href.match(portal_id))
			{
//				alert("Found link to tab " + tab + ": " + theAnchor.innerHTML);
				if
				(
					(
						(anchor == null)
						&&
						(theAnchor.href.match(/#/) == false)
					)
					|| 					theAnchor.href.match(anchor_id)
				)
				{
					var id = theAnchor.id;
					var numeric = id.replace(/^a/,"");
					var theDiv = document.getElementById("div" + numeric);

//					alert("Found link to tab " + tab + " and anchor " + anchor + ": " + theAnchor.innerHTML + ", " + id + ", " + numeric);

					if (id != null)
					{
						theDiv = document.getElementById("div" + numeric);
//						alert("Starting on the path of righteousness...");
					}
					else
					{
//						alert("foo");
						theDiv = theAnchor;
						alert("Starting at node with ID " + theDiv.id);
						theDiv = theDiv.parentNode;
						alert("Walking up the DOM to node with ID " + theDiv.id);
						theDiv = theDiv.parentNode;
						alert("Walking up the DOM to node with ID " + theDiv.id);
//						theDiv.style.backgroundColor = "#f7f7e7";
						theDiv.style.backgroundColor = "#e6e6ef";
						alert("Changing color of div with ID " + theDiv.id);
						theDiv = null;
					}

					if (theDiv != null)
					{
//						theDiv.style.backgroundColor = "#f7f7e7";
						theDiv.style.backgroundColor = "#e6e6ef";
						theDiv = theDiv.parentNode;
						if (theDiv != null)
						{
							theDiv = theDiv.parentNode;
							if (theDiv != null)
							{
//								alert("Found grandparent node with id " + theDiv.id);
//								theDiv.style.display = "block";
//								alert("About to flip ID " + theDiv.id);
								flipEntry(theDiv.id);
							}
							else
							{
//								alert("Couldn't find grandparent of div corresponding to anchor " + id);
							}
						}
						else
						{
//							alert("Couldn't find parent of div corresponding to anchor " + id);
						}
					}
					else
					{
//						alert("Couldn't find div corresponding to anchor " + id);
					}
				}
			}
		}
		else
		{
			progress += "-" + theAnchor.className;
		}
	}
//	alert("Found this many LINKANCHOR anchors: " + anchors.length + "; symbols: " + progress);

});
// Functions to handle scrollbar placement for browsers that don't handle fixed positioning nicely
// (in practice, just IE 6).

addOnload(function()
{
	var bodyTags = document.getElementsByTagName("body");
	var htmlTags = document.getElementsByTagName("html");
	var examine;

	var eligibleScrollbars = (function()
	{
		var theBody = bodyTags[0];
		var theHTML = htmlTags[0];

		if (theBody == null)
		{
			return false;
		}

		if (theHTML == null)
		{
			return false;
		}

		var needs_absolute_position = (function()
		{
//			if (typeof document.body.style.maxHeight != "undefined")
			if (window.XMLHttpRequest)
			{
				return false;
			}
			return true;
		});

/*
		if (!needs_absolute_position())
		{
			return false;
		}
*/

		var hcw = theHTML.clientWidth;
		var how = theHTML.offsetWidth;
		var hsw = theHTML.scrollWidth;

		var bcw = theBody.clientWidth;
		var bow = theBody.offsetWidth;
		var bsw = theBody.scrollWidth;

		if ((bcw != bow) && (bsw != bow) && (bcw == bsw))
		{
			return true;
		}

		return false;
	});

/*
	if (bodyTags && htmlTags)
	{
		examine = htmlTags[0];

//		alert("HTML: clientLeft="+examine.clientLeft+", clientTop="+examine.clientTop+", clientWidth="+examine.clientWidth+", clientHeight="+examine.clientHeight+", offsetWidth="+examine.offsetWidth+", offsetHeight="+examine.offsetHeight+", offsetLeft="+examine.offsetLeft+", offsetTop="+examine.offsetTop+", offsetParent="+examine.offsetParent+", scrollWidth="+examine.scrollWidth+", scrollHeight="+examine.scrollHeight+", scrollLeft="+examine.scrollLeft+", scrollTop="+examine.scrollTop);
		alert("HTML: clientWidth="+examine.clientWidth+", offsetWidth="+examine.offsetWidth+", scrollWidth="+examine.scrollWidth);

		var w1 = examine.clientWidth;
		var w2 = examine.offSetWidth;

		examine = bodyTags[0];

//		alert("Body: clientLeft="+examine.clientLeft+", clientTop="+examine.clientTop+", clientWidth="+examine.clientWidth+", clientHeight="+examine.clientHeight+", offsetWidth="+examine.offsetWidth+", offsetHeight="+examine.offsetHeight+", offsetLeft="+examine.offsetLeft+", offsetTop="+examine.offsetTop+", offsetParent="+examine.offsetParent+", scrollWidth="+examine.scrollWidth+", scrollHeight="+examine.scrollHeight+", scrollLeft="+examine.scrollLeft+", scrollTop="+examine.scrollTop);
		alert("Body: clientWidth="+examine.clientWidth+", offsetWidth="+examine.offsetWidth+", scrollWidth="+examine.scrollWidth);

		var delta = htmlTags[0].scrollWidth - bodyTags[0].scrollWidth;
	}
*/

	if (eligibleScrollbars())
	{
//		alert("Applying size/position changes...");

		try
		{
			bodyTags[0].style.width = (htmlTags[0].offsetWidth - 280) + "px";
		}
		catch(err) {}

		htmlTags[0].style.overflowY = "hidden";


		var resize_handler = (function()
		{
			var bodyTags = document.getElementsByTagName("body");
			var htmlTags = document.getElementsByTagName("html");
			if (bodyTags && htmlTags)
			{
//				alert("Window resized...");
				try
				{
					bodyTags[0].style.width = (htmlTags[0].offsetWidth - 280) + "px";
				}
				catch(err) {}
			}
		});

		window.onresize = resize_handler;
	}

});
// If the page was loaded at a specified anchor,
// when all else is said and done,
// refresh the page at that anchor
// to fix any "jump to top" or "jump to wrong spot" behaviour.
// Such glitches are seen sometimes when jumping through
// search results into a file.
// Might be due to changing the width of the body after the page is loaded,
// or inserting the "User Comments" section after the page is loaded.

addOnload(function()
{

	var eligibleSynch = (function()
	{
		var vendor = navigator.vendor;
		if (vendor)
		{
			var is_safari = vendor.match(/Apple/);
			if (is_safari)
			{
				return false;
			}
		}

		var myAddress = window.location.href;

// !! Add check to make sure the REFERER CGI variable is different
// from the current address, i.e. we aren't just re-loading the same page.
// Although there might be cases where we want to run this code on a page
// reload, for the moment it's too dangerous in case it produces an
// infinite loop of reloading.

		if (myAddress.match(/\.htm#.+/))
		{
			return true;
		}
		return false;
	});

    if (eligibleSynch() == true)
    {
        var anchor =  window.location.href.replace(/.*#/,"");
        var el = document.getElementById(anchor);
        if (el)
        {
            var scroll_position = findPosY(el);
            window.scrollTo(0,scroll_position);
        }
//      window.location.href = window.location.href;
    }
});

// IE 6 has a problem displaying div#nav on portal pages when the Back button is used.
// Have to ping the visibility setting so that this div appears properly.
addOnload(function()
{
	var navDiv = document.getElementById("nav");
	if (navDiv)
	{
		navDiv.style.visibility = "visible";
	}
});

function findPosY(obj)
{
    var curtop = 0;
    if(obj.offsetParent)
    while(1)
    {
      curtop += obj.offsetTop;
      if(!obj.offsetParent)
        break;
      obj = obj.offsetParent;
    }
    else if(obj.y)
    curtop += obj.y;
    return curtop;
}

// Some small topics have a problem with overlapping because a table near the
// top is set to width="100%", which conflicts with the right-floating
// "search this book" box.
// Disabling this page mod as both of the right sidebar items have been folded
// into the left sidebar.
/*
addOnload(function()
{
	var tables = document.getElementsByTagName('table');
	for (i=0; i < tables.length; i++)
	{
		if (tables[i].className == "InformalWideMax")
		{
//			alert("Potential problem with overlapping table");
			tables[i].style.width = "auto";
// Enable the next line to make the change apply only to the first such table on the page.
//			return;
		}
	}

});
*/
/*
	Copyright 2006, 2007 Oracle Corporation.
	Author: John Russell
*/
// @description Automatically link all references to Oracle Database error messages, to the right spot in the Error Messages book.

addOnload(function()
{
	var eligibleErrorFile = (function()
	{
		var myAddress = window.location.href;
		if (myAddress.match(/\/mix.[0-9]{3}\//))
		{
			return false;
		}
		if (myAddress.match(/toc.htm$/))
		{
			return false;
		}
		if (myAddress.match(/index.htm$/))
		{
			return false;
		}
		if (myAddress.match(/\/nav\//))
		{
			return false;
		}
		if (myAddress.match(/\/pls\//))
		{
			return false;
		}


/*
<meta name="doctitle" content="Oracle&reg; Database Error Messages 11g Release 1 (11.1)" />
*/
		var allmeta = document.getElementsByTagName("meta");

		for (i=0; i < allmeta.length; i++)
		{
			if (allmeta[i].name == "doctitle")
			{
				if (allmeta[i].content.match(/Error Messages/))
				{
					return false;
				}
			}
		}

		return true;
	});

	if (eligibleErrorFile() == false)
	{
		return;
	}

	var myAddress = window.location.href;
	var mylib = myAddress.replace(/.*\/(B19306_01|10\/102|11\/111|B25553_01|cs\/1012|B14099_19|101202fulldoc|B25221_03|101300doc_final|B28196_01|1014im_final)\/.*/, "$1");
	var library = new Array();
	library["10/102"] = {code:"db102", host:"tahiti-stage.us.oracle.com"};
	library["B19306_01"] = {code:"db102", host:"www.oracle.com"};
	library["11/111"] = {code:"db111", host:"tahiti-stage.us.oracle.com"};

	var dad = "db111";
	var host = "www.oracle.com";

/*
	var host = library[mylib].host;
	var dad = library[mylib].code;
*/

	if (dad == null || host == null)
	{
		alert("No search URL defined for library " + mylib);
		return;
	}
	else
	{
		;
//		alert("Library: " + mylib + ", search host: " + host + ", search code: " + dad);
	}

	var errors = document.body.innerHTML.match(/(ORA|SQL|EXP|IMP|KUP|UDE|UDI|DBV|NID|DGM|LCD|QSM|OCI|RMAN|LRM|LFI|PLS|PLW|AMD|CLSR|CLSS|PROC|PROT|TNS|NNC|NNO|NNL|NPL|NNF|NMP|NCR|NZE|O2F|O2I|O2U|PCB|PCC|AUD|IMG|VID|DRG|LPX|LSX)-\d{3,5}/g);
	var errorstring;

	if (errors != null)
	{
//		document.body.innerHTML = document.body.innerHTML.replace( /((ORA|SQL|EXP|IMP|KUP|UDE|UDI|DBV|NID|DGM|LCD|QSM|OCI|RMAN|LRM|LFI|PLS|PLW|AMD|CLSR|CLSS|PROC|PROT|TNS|NNC|NNO|NNL|NPL|NNF|NMP|NCR|NZE|O2F|O2I|O2U|PCB|PCC|AUD|IMG|VID|DRG|LPX|LSX)-\d{3,5})/g ,'<a href="http://' + host + '/pls/' + dad + '/lookup?id=$1\">$1</a>');
		document.body.innerHTML = document.body.innerHTML.replace( /((ORA|SQL|EXP|IMP|KUP|UDE|UDI|DBV|NID|DGM|LCD|QSM|OCI|RMAN|LRM|LFI|PLS|PLW|AMD|CLSR|CLSS|PROC|PROT|TNS|NNC|NNO|NNL|NPL|NNF|NMP|NCR|NZE|O2F|O2I|O2U|PCB|PCC|AUD|IMG|VID|DRG|LPX|LSX)-\d{3,5})/g ,'<a href="http://www.oracle.com/pls/db111/lookup?id=$1">$1</a>');
	}
});
