try {document.execCommand('BackgroundImageCache', false, true);} catch(e) {}

/*
 * Similar to the built in getElementById
 * Returns an array of all items that have the specified class
 *	searchClass - the class to search for
 *	node - specify a parent element to search in, default is document
 *	tag	- only search specific tags
 */
function getElementsByClass(searchClass,node,tag) {
	var classElements = new Array();
	if ( node == null ) node = document;
	if ( tag == null ) tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}

/*
 * Adds an element to the DOM
 *	container - parent to add an element to
 *	elName - id to be given to the new element
 *	elType - type of element (span, p, div, etc)
 *	elContent - innerHTML added to the created element
 */
function addElement(container, elName, elType, elContent) {
  var container = document.getElementById(container);
  var newEl = document.createElement(elType);
  newEl.setAttribute('id',elName);
  newEl.innerHTML = elContent;
  container.appendChild(newEl);
}

/*
 * Remove an element from the DOM
 *	container - parent of item to be removed
 *	elId - id of element to be removed
 */
function removeElement(container, elId) {
	var container = document.getElementById(container);
  var el = document.getElementById(elId);
  container.removeChild(el);
}

/*
 * Toggles specified class on an element
 *	el - element to target
 *	className - class name to add or remove
 */
function toggleClass(el, className) {
  var curClass = el.className;
  var pattern = new RegExp("(^|\\s)"+className+"(\\s|$)");
  if ( pattern.test(curClass) )
 		el.className = curClass.replace(pattern, "");
	else
		el.className += " " + className;
}

/*
 * Adds specified class to an element if it does not already exists
 *	el - element to target
 *	className - class name to add
 */
function addClass(el, className) {
  var curClass = el.className;
  var pattern = new RegExp("(^|\\s)"+className+"(\\s|$)");
  if (!pattern.test(curClass))
  	el.className += " " + className;
}

/*
 * Removes specified class from an element if it exists
 *	el - element to target
 *	className - class name to remove
 */
function removeClass(el, className) {
  var curClass = el.className;
  var pattern = new RegExp("(^|\\s)"+className+"(\\s|$)");
  if (pattern.test(curClass))
  	el.className = curClass.replace(pattern, "");
}

/*
 * Assigns a class to a container on mouseover and mouseout
 * Used to replicate hover affects on groups of objects
 *	className - all elements with the specified class
 *							will be affected
 */
function hoverBox(className) {
	var boxes = getElementsByClass(className);
  for(var i=0;i<boxes.length;i++) {
    boxes[i].onmouseover = function(){toggleClass(this, "hoverlink");};
    boxes[i].onmouseout = function(){toggleClass(this, "hoverlink");};
    boxes[i].onclick = function(){
	    window.location = this.getElementsByTagName("a")[0].getAttribute("href");
	  };
  }
}

/*
 * Toggle an open/close state for a container
 * Class of "closed" is added or removed from a container
 * If no trigger id is provided a trigger will be dynamiclly created
 *	container - id of element
 *	trigger - id of the element that triggers to event
 *						default = container + _trigger  (contentBox_trigger)
 *	isClosed - boolean, sets whether the default state of the container is open or closed
 *						 default = 1 (closed)
 */
function toggleClosed(container, trigger, isClosed) {
	//set some variables
	var triggerDefined = 1;
	var el = document.getElementById(container);
	var t = document.getElementById(trigger);

	//assign default values if no arguments passed
	isClosed = 	(typeof isClosed == 'undefined') ? 1 : isClosed;
	if (!t) {
		triggerDefined = 0;
		trigger = container + "_trigger";
	}

	//add a trigger if needed
	if(!triggerDefined)	{
		addElement(container, trigger, "span", "open/close");
		t = document.getElementById(trigger);
	}

	//set default state (open or closed)
	if(isClosed)
		addClass(el, "closed");
	else
		removeClass(el, "closed");

	//Open or close the container when the trigger is clicked
	t.onclick = function(){
		toggleClass(el, "closed");
	};
}

/*
 * Creates tabbed effects for the search options
 */
function tabifySearch(className, node, tag) {
	var tabs = getElementsByClass(className, node, tag);
  for(var i=0;i<tabs.length;i++) {
    tabs[i].getElementsByTagName("A")[0].onclick = function() {
	    removeClass(document.getElementById("search-all"), "active");
	    removeClass(document.getElementById("search-books"), "active");
	    removeClass(document.getElementById("search-articles"), "active");
	    removeClass(document.getElementById("search-movies"), "active");
	    addClass(this.parentNode, "active");
	    return false;
	   };
  }
}

/*
 * Used with iframe Thickbox
 * Traps all click events on non-anchor(#) links inside the iframe
 * opens the URL in the parent window instead of the iframe
 */
function externalLinksToParent() {
	var allLinks = document.getElementsByTagName("A");
	for(var i=0;i<allLinks.length;i++) {
		var theLocation = allLinks[i].getAttribute("href");
		if(theLocation && theLocation.indexOf('#') == -1) {
			allLinks[i].onclick = function() {
				parent.window.location = this.getAttribute("href");
				return false;
			};
		}
	}
}

/*
 * Uses javascript to replicate hover functionality on elements
 * other than <a> in IE
 * Not needed for standards complaint browsers which can use CSS
 */
function jsHover() {
	var items = getElementsByClass("dropdown");
  for(var i=0;i<items.length;i++) {
    items[i].onmouseover = function() {addClass(this, "jshover");};
    items[i].onmouseout = function() {removeClass(this, "jshover");};
  }
}

$(document).ready(function(){tabifySearch("tab")});

//Only target IE.   Firefox, Safari, and Opera do not need
//MUST come at end of document
if (document.all&&document.getElementById) $(document).ready(function(){jsHover()});


/*
 * Thickbox 3 - One Box To Rule Them All.
 * By Cody Lindley (http://www.codylindley.com)
 * Copyright (c) 2007 cody lindley
 * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
 */
var tb_pathToImage = "/styles/images/library/loadingAnimation.gif";
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('$(9).2t(8(){1o(\'a.15, 3a.15, 33.15\');1r=1s 1x();1r.P=2p});8 1o(b){$(b).o(8(){6 t=T.R||T.1U||I;6 a=T.q||T.1P;6 g=T.1F||O;1c(t,a,g);T.2l();L O})}8 1c(d,f,g){38{3(1y 9.r.J.20==="1t"){$("r","K").p({C:"1V%",v:"1V%"});$("K").p("2i","2A");3(9.1Z("1A")===I){$("r").z("<18 5=\'1A\'></18><4 5=\'F\'></4><4 5=\'7\'></4>");$("#F").o(A)}}n{3(9.1Z("F")===I){$("r").z("<4 5=\'F\'></4><4 5=\'7\'>");$("#F").o(A)}}3(d===I){d=""}$("r").z("<4 5=\'G\'><1C P=\'"+1r.P+"\' /></4>");$(\'#G\').2k();6 h;3(f.W("?")!==-1){h=f.2j(0,f.W("?"))}n{h=f}6 i=/\\.2f|\\.2d|\\.2b|\\.28|\\.26/g;6 j=h.25().24(i);3(j==\'.2f\'||j==\'.2d\'||j==\'.2b\'||j==\'.28\'||j==\'.26\'){1h="";1v="";Y="";1u="";1m="";Q="";1l="";1q=O;3(g){B=$("a[@1F="+g+"]").2Q();1T(u=0;((u<B.1b)&&(Q===""));u++){6 k=B[u].q.25().24(i);3(!(B[u].q==f)){3(1q){1u=B[u].R;1m=B[u].q;Q="<1a 5=\'1W\'>&19;&19;<a q=\'#\'>2C &2z;</a></1a>"}n{1h=B[u].R;1v=B[u].q;Y="<1a 5=\'21\'>&19;&19;<a q=\'#\'>&2w; 2u</a></1a>"}}n{1q=1O;1l="1x "+(u+1)+" 2s "+(B.1b)}}}V=1s 1x();V.1j=8(){V.1j=I;6 a=1I();6 x=a[0]-1H;6 y=a[1]-1H;6 b=V.v;6 c=V.C;3(b>x){c=c*(x/b);b=x;3(c>y){b=b*(y/c);c=y}}n 3(c>y){b=b*(y/c);c=y;3(b>x){c=c*(x/b);b=x}}Z=b+30;16=c+2r;$("#7").z("<a q=\'\' 5=\'1E\' R=\'1i\'><1C 5=\'2q\' P=\'"+f+"\' v=\'"+b+"\' C=\'"+c+"\' 1P=\'"+d+"\'/></a>"+"<4 5=\'2o\'>"+d+"<4 5=\'2n\'>"+1l+Y+Q+"</4></4><4 5=\'2m\'><a q=\'#\' 5=\'M\' R=\'1i\'>1g</a> 1f 1e 1n</4>");$("#M").o(A);3(!(Y==="")){8 X(){3($(9).S("o",X)){$(9).S("o",X)}$("#7").D();$("r").z("<4 5=\'7\'></4>");1c(1h,1v,g);L O}$("#21").o(X)}3(!(Q==="")){8 1d(){$("#7").D();$("r").z("<4 5=\'7\'></4>");1c(1u,1m,g);L O}$("#1W").o(1d)}9.14=8(e){3(e==I){E=1B.1z}n{E=e.2g}3(E==27){A()}n 3(E==39){3(!(Q=="")){9.14="";1d()}}n 3(E==37){3(!(Y=="")){9.14="";X()}}};13();$("#G").D();$("#1E").o(A);$("#7").p({N:"U"})};V.P=f}n{6 l=f.2a(/^[^\\?]+\\??/,\'\');6 m=2e(l);Z=(m[\'v\']*1)+30||36;16=(m[\'C\']*1)+35||34;12=Z-30;11=16-32;3(f.W(\'23\')!=-1){1D=f.1w(\'2Z\');$("#7").z("<4 5=\'22\'><4 5=\'1k\'>"+d+"</4><4 5=\'1G\'><a q=\'#\' 5=\'M\' R=\'1i\'>1g</a> 1f 1e 1n</4></4><18 2Y=\'0\' 2W=\'0\' P=\'"+1D[0]+"\' 5=\'1p\' 1U=\'1p\' J=\'v:"+(12+29)+"s;C:"+(11+17)+"s;\' 1j=\'1Q()\'> </18>")}n{3($("#7").p("N")!="U"){3(m[\'1X\']!="1O"){$("#7").z("<4 5=\'22\'><4 5=\'1k\'>"+d+"</4><4 5=\'1G\'><a q=\'#\' 5=\'M\'>1g</a> 1f 1e 1n</4></4><4 5=\'H\' J=\'v:"+12+"s;C:"+11+"s\'></4>")}n{$("#F").S();$("#7").z("<4 5=\'H\' 2U=\'2T\' J=\'v:"+12+"s;C:"+11+"s;\'></4>")}}n{$("#H")[0].J.v=12+"s";$("#H")[0].J.C=11+"s";$("#H")[0].2S=0;$("#1k").K(d)}}$("#M").o(A);3(f.W(\'2R\')!=-1){$("#H").K($(\'#\'+m[\'2P\']).K());13();$("#G").D();$("#7").p({N:"U"})}n 3(f.W(\'23\')!=-1){13();3(2O[\'1p\']===1t){$("#G").D();$("#7").p({N:"U"});$(9).2L(8(e){6 a=e.1z;3(a==27){A()}})}}n{$("#H").2K(f+="&2J="+(1s 2I().2H()),8(){13();$("#G").D();1o("#H a.15");$("#7").p({N:"U"})})}}3(!m[\'1X\']){9.2G=8(e){3(e==I){E=1B.1z}n{E=e.2g}3(E==27){A()}}}}2M(e){}}8 1Q(){$("#G").D();$("#7").p({N:"U"})}8 A(){$("#2N").S("o");$("#F").S("o");$("#M").S("o");$("#7").2F("2E",8(){$(\'#7,#F,#1A\').D()});$("#G").D();3(1y 9.r.J.20=="1t"){$("r","K").p({C:"1S",v:"1S"});$("K").p("2i","")}9.14="";L O}8 13(){$("#7").p({2D:\'-\'+1R((Z/2),10)+\'s\',v:Z+\'s\'});3(!(2B.2y.2V&&1y 2x==\'8\')){$("#7").p({2X:\'-\'+1R((16/2),10)+\'s\'})}}8 2e(a){6 b={};3(!a){L b}6 c=a.1w(/[;&]/);1T(6 i=0;i<c.1b;i++){6 d=c[i].1w(\'=\');3(!d||d.1b!=2){2v}6 e=1Y(d[0]);6 f=1Y(d[1]);f=f.2a(/\\+/g,\' \');b[e]=f}L b}8 1I(){6 a=9.31;6 w=1N.1M||1L.1M||(a&&a.2c)||9.r.2c;6 h=1N.1K||1L.1K||(a&&a.1J)||9.r.1J;2h=[w,h];L 2h}',62,197,'|||if|div|id|var|TB_window|function|document||||||||||||||else|click|css|href|body|px||TB_Counter|width||||append|tb_remove|TB_TempArray|height|remove|keycode|TB_overlay|TB_load|TB_ajaxContent|null|style|html|return|TB_closeWindowButton|display|false|src|TB_NextHTML|title|unbind|this|block|imgPreloader|indexOf|goPrev|TB_PrevHTML|TB_WIDTH||ajaxContentH|ajaxContentW|tb_position|onkeydown|thickbox|TB_HEIGHT||iframe|nbsp|span|length|tb_show|goNext|Esc|or|close|TB_PrevCaption|Close|onload|TB_ajaxWindowTitle|TB_imageCount|TB_NextURL|Key|tb_init|TB_iframeContent|TB_FoundURL|imgLoader|new|undefined|TB_NextCaption|TB_PrevURL|split|Image|typeof|keyCode|TB_HideSelect|event|img|urlNoQuery|TB_ImageOff|rel|TB_closeAjaxWindow|150|tb_getPageSize|clientHeight|innerHeight|self|innerWidth|window|true|alt|tb_showIframe|parseInt|auto|for|name|100|TB_next|modal|unescape|getElementById|maxHeight|TB_prev|TB_title|TB_iframe|match|toLowerCase|bmp||gif||replace|png|clientWidth|jpeg|tb_parseQuery|jpg|which|arrayPageSize|overflow|substr|show|blur|TB_closeWindow|TB_secondLine|TB_caption|tb_pathToImage|TB_Image|60|of|ready|Prev|continue|lt|XMLHttpRequest|browser|gt|hidden|jQuery|Next|marginLeft|fast|fadeOut|onkeyup|getTime|Date|random|load|keyup|catch|TB_imageOff|frames|inlineId|get|TB_inline|scrollTop|TB_modal|class|msie|hspace|marginTop|frameborder|TB_||documentElement|45|input|440|40|630|188|try|190|area'.split('|'),0,{}))
//end Thickbox
