//<--

// Old school menu to be replaced...
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("http://store.augusthouse.com#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


// Menu preloader
MM_preloadImages('_img/nav_left/nav_left_over_home.gif',
				 '_img/nav_left/nav_left_over_store.gif',
				 '_img/nav_left/nav_left_over_events.gif',
				 '_img/nav_left/nav_left_over_authors_artists.gif',
				 '_img/nav_left/nav_left_over_storytelling.gif',
				 '_img/nav_left/nav_left_over_learning_center.gif',
				 '_img/nav_left/nav_left_over_company_information.gif',
				 '_img/nav_left/nav_left_over_press_room.gif');



/*
	tableruler()
	written by Chris Heilmann for alistapart.
	enables a rollover of rows for each table with the classname "hlrows"
*/

function tableruler(table_name)
{
	if (document.getElementById && document.createTextNode)
	{
		var tables=document.getElementsByTagName('table');
		
		for (var i=0;i<tables.length;i++)
		{
			if(tables[i].className == table_name)
			{
				var trs=tables[i].getElementsByTagName('tr');
				
				for(var j=0;j<trs.length;j++)
				{
					if(trs[j].parentNode.nodeName=='TBODY')
					{
						trs[j].onmouseover=function(){this.className='ruled';return false}
						trs[j].onmouseout=function(){this.className='';return false}
					}
				}
			}
		}
	}
}



function open_win (pop_url, pop_width, pop_height, pop_scrollable, pop_resizeable, pop_status, pop_toolbar, pop_titlebar)
{
	// Window position
	winLeft = Math.floor((screen.width - pop_width) / 2);
	winTop =  Math.floor((screen.height - pop_height) / 2);
	
	
	// Window arguments
	var wargs_a = "width=" + pop_width + ",height=" + pop_height + ",resizable=" + pop_resizeable + ",scrollbars=" + pop_scrollable;
	var wargs_b = ",menubar=" + pop_toolbar + ",status=" + pop_status + ",titlebar=" + pop_titlebar + ",toolbar=" + pop_toolbar + ",z-lock=1,";
	var wargs_c = "location=" + pop_toolbar + ",personalbar=" + pop_titlebar + ",";
	var wargs_d = "screenX=" + winLeft + ",screenY=" + winTop + ",left=" + winLeft + ",top=" + winTop;
	var wargs = wargs_a + wargs_b + wargs_c + wargs_d;
	

	// Random name generator
	var rand_num = Math.floor(Math.random()*10000);
	//alert (rand_num);
	
	// Open the window
	var ext_window = window.open(pop_url, '1b' + rand_num, wargs);
	ext_window.focus()
}


// Form processing
function submit_sorted(sortby)
{
	//alert (sort_key);
	document.forms['doc_lib'].sort_key.value = sortby;
	document.forms['doc_lib'].submit();
}


function clear_form_element(form_id, item_id)
{
	document.forms[form_id][item_id].value="";
}




/*************************************************************************
  This code is from Dynamic Web Coding at http://www.dyn-web.com/
  Copyright 2003-4 by Sharon Paine 
  See Terms of Use at http://www.dyn-web.com/bus/terms.html
  regarding conditions under which you may use this code.
  This notice must be retained in the code as is!
*************************************************************************/

// NOTE: The functions called onmouseover/out plus the message variables need to be included early in the document 
// or errors will be triggered if user hovers over tooltip-activating links before page completely loaded
function doTooltip(e, msg) 
{
	if (typeof Tooltip == "undefined" || !Tooltip.ready) return;
	
	Tooltip.clearTimer();
  	Tooltip.show(e, msg);
}

function hideTip() 
{
	if (typeof Tooltip == "undefined" || !Tooltip.ready) return;
  	Tooltip.timerId = setTimeout("Tooltip.hide()", 300);
}

//-->