var BREADCRUMB_QS_PARAM="search_form_breadcrumbs";var OFFSET_QS_PARAM="offset";var RESUBMITTED_QUERY;function paginate(offset){var loc=UrlWithoutParameter(OFFSET_QS_PARAM);if(typeof(RESUBMITTED_QUERY)=="undefined"){var rq=document.getElementsByName("resubmittedQuery");if(rq.length>0)RESUBMITTED_QUERY=rq[0].value;}if(isLiveSearch){loc=UrlWithoutParameter("lq",loc);loc+=(loc.indexOf("?")<0)?"?":"&";loc+="lq="+escape(document.getElementById(LIVE_SEARCHBOX_ID).value);}loc+="&"+OFFSET_QS_PARAM+"="+offset;if(typeof(RESUBMITTED_QUERY)!="undefined"){loc=UrlWithoutParameter("q");loc+=(loc.indexOf("?")<0)?"?":"&";loc+="q="+RESUBMITTED_QUERY;}if(isLiveSearch)LiveSearch("dummy",timeoutValue,loc);else Browse(loc);}function Browse(url){window.location.href=url;}function GetFormElement(formId){return document.getElementById("aspnetForm");}var forcedSearchLocation="";function UrlWithoutParameter(param,useThisUrl){var loc=window.location.href;if(isLiveSearch&&forcedSearchLocation.length>0)loc=forcedSearchLocation;if(useThisUrl)loc=useThisUrl;if(loc.charAt(loc.length-1)=='&')loc=loc.substring(0,loc.length-1);var crIndex=loc.indexOf(param);if(crIndex>0){var ampAfterCrumb=loc.lastIndexOf("&");var newUrl=loc.substring(0,crIndex-1);if(ampAfterCrumb>crIndex)newUrl+=loc.substring(ampAfterCrumb);loc=newUrl;}return loc;}function SetModifier(breadCrumbs,dontAppendButOverwriteModifier,paramsToRemove,paramAndValueToAdd){var loc=UrlWithoutParameter(BREADCRUMB_QS_PARAM);if(paramsToRemove){var params=paramsToRemove.split(',');for(var i=0;i<params.length;i++)loc=UrlWithoutParameter(params[i],loc);}if(paramAndValueToAdd){if(loc.indexOf("?")>-1)loc+=paramAndValueToAdd;else loc="?"+paramAndValueToAdd;}if(breadCrumbs.length==0)return loc;else return loc+"&"+BREADCRUMB_QS_PARAM+"="+escape(breadCrumbs);}function clearModifiers(){var navigateLoc=window.location.href;if(forcedSearchLocation.length>0)navigateLoc=forcedSearchLocation;navigateLoc=UrlWithoutParameter(BREADCRUMB_QS_PARAM,navigateLoc);if(forcedSearchLocation.length>0)LiveSearch("dummy",timeoutValue,navigateLoc);else window.location.href=navigateLoc;}function navigate(newDrill,dontAppendButOverwriteModifier){if(isLiveSearch&&forcedSearchLocation.length==0)dontAppendButOverwriteModifier=true;var formElement=GetFormElement();var breadcrumbsElement=document.getElementsByName("search_form_breadcrumbs");if(formElement&&breadcrumbsElement){breadcrumbsElement=breadcrumbsElement[0];var breadcrumbsElementOld=document.getElementsByName("search_form_breadcrumbs_old");if(breadcrumbsElementOld){breadcrumbsElementOld=breadcrumbsElementOld[0];breadcrumbsElement.value=breadcrumbsElementOld.value;}if(dontAppendButOverwriteModifier)breadcrumbsElement.value=newDrill;else breadcrumbsElement.value+=newDrill;var paramsToRemove="amid=,offset=,publishyear=";var paramAndValueToAdd=null;if(isLiveSearch&&forcedSearchLocation.length==0){paramsToRemove+=",q=";paramAndValueToAdd="q="+escape(document.getElementById(LIVE_SEARCHBOX_ID).value);}var navigateLoc=SetModifier(breadcrumbsElement.value,dontAppendButOverwriteModifier,paramsToRemove,paramAndValueToAdd);if(isLiveSearch&&forcedSearchLocation.length>0)LiveSearch("dummy",timeoutValue,navigateLoc);else window.location.href=navigateLoc;}}function navigateBack(removeBreadcrumb){var breadcrumbsElementOld=document.getElementsByName("search_form_breadcrumbs_old");var retVal="";if(breadcrumbsElementOld){breadcrumbsElementOld=breadcrumbsElementOld[0];var index=breadcrumbsElementOld.value.indexOf(removeBreadcrumb);if(index>=0){retVal=breadcrumbsElementOld.value.substring(0,index)+breadcrumbsElementOld.value.substring(index+removeBreadcrumb.length);}var navigateLoc=SetModifier(retVal);if(forcedSearchLocation.length>0)LiveSearch("dummy",timeoutValue,navigateLoc);else window.location.href=navigateLoc;}}function applyOldNavigation(){var breadcrumbsElement=byId("search_form_breadcrumbs");var oldBreadcrumbsElement=byId("search_form_old_breadcrumbs");if(breadcrumbsElement&&oldBreadcrumbsElement){breadcrumbsElement.value=oldBreadcrumbsElement.value;return true;}return false;}function toggleMore(id,linkId,more,less){var div=byId(id);var link=byId(linkId);if(div){if(div.style.display=="none"){div.style.display="block";if(link){link.innerHTML=less;}}else{div.style.display="none";if(link){link.innerHTML=more;}}}}var resultObj=null;var resultNavigatorObj=null;var resultPaginationObj=null;var LIVESEARCH_PERFORMED=false;var LAST_QUERY,toBeLastQuery;var LAST_EMPTY_QUERY="";var LAST_QUERY_SEQUENCE_NUMBER=2;var customSearchUrl=null;function RequestContent(searchUrl,searchValue){if(searchValue.length>0){resultObj=document.getElementById("searchResult");var loader=new BackgroundLoader();loader.loadUrl(searchUrl+searchValue);loader.setLoadedCallback(ContentResponse);loader.setErrorCallback(ContentResponseError);}}function ContentResponse(content,sequenceNumber){if(resultObj!=null&&content.length>0)resultObj.innerHTML=content;}function ContentResponseError(errorMessage,sequenceNumber){if(resultObj!=null)resultObj.innerHTML="A problem occured... ["+errorMessage+"]";}function LiveSearch(searchValue,timeoutSequence,overridedSearchUrl){resultObj=document.getElementById("searchResult");resultNavigatorObj=document.getElementById("resultNavigation");resultPaginationObj=document.getElementById("paginationTop");if(searchValue.length>0){LIVESEARCH_PERFORMED=true;LAST_EMPTY_QUERY="";var loader=new BackgroundLoader();toBeLastQuery=searchValue;loader.setLoadedCallback(LiveResponse);loader.setSequenceNumber(timeoutSequence);loader.setErrorCallback(LiveResponseError);if(customSearchUrl!=null)LIVE_SEARCH_URL=customSearchUrl;var searchUrl=LIVE_SEARCH_URL+searchValue;if(forcedSearchLocation.length>0){searchUrl=LIVE_SEARCH_URL+searchValue+"&search_form_breadcrumbs="+document.getElementsByName("search_form_breadcrumbs_old")[0].value;}if(overridedSearchUrl)searchUrl=overridedSearchUrl;loader.loadUrl(searchUrl);}else{resultPaginationObj.innerHTML="";resultObj.innerHTML="";resultNavigatorObj.innerHTML="";}}function LiveResponse(content,sequenceNumber){var searchBox=document.getElementById(LIVE_SEARCHBOX_ID);if(searchBox)if(searchBox.value.length>0)if(resultObj!=null&&resultNavigatorObj!=null&&resultPaginationObj!=null&&content.length>0){if(typeof(sequenceNumber)=="number"){if(sequenceNumber<LAST_QUERY_SEQUENCE_NUMBER){return;}LAST_QUERY_SEQUENCE_NUMBER=sequenceNumber;}var navIndex=content.indexOf("$][[@Navigators]");var pageIndex=content.indexOf("$][[@Pagination]");var jsToEvalIndex=content.indexOf("$][[@JS]");if(navIndex>0&&pageIndex>0&&jsToEvalIndex>0){var result=content.substr(0,navIndex);var navigators=content.substr(navIndex+16,pageIndex-navIndex-16);var pagination=content.substr(pageIndex+16,jsToEvalIndex-pageIndex-16);EvalInlineJavaScript(pagination);resultPaginationObj.innerHTML=pagination;resultObj.innerHTML=result;resultNavigatorObj.innerHTML=navigators;LAST_EMPTY_QUERY="";if(result.indexOf("FAST_ZERO_RESULTS")>-1)LAST_EMPTY_QUERY=toBeLastQuery;var jsToEval=content.substr(jsToEvalIndex+8);eval(jsToEval);}LAST_QUERY=toBeLastQuery;}}var liveSuggestionSpace=0;var liveNavigatorLines=0;function IncreaseSpacing(){if(liveSuggestionSpace>0||liveNavigatorLines>0){var img=document.getElementById("resultSpacer");img.style.height=(liveSuggestionSpace+20*(liveNavigatorLines+1))+"px";liveNavigatorLines=0;liveSuggestionSpace=0;}}function EvalInlineJavaScript(htmlContent){if(htmlContent.length>0){var SCRIPT_START='<script type="text/javascript">';var scriptIndex=htmlContent.indexOf(SCRIPT_START);var scriptEnd=0;if(scriptIndex>=0){scriptEnd=htmlContent.indexOf("</script>");if(scriptEnd>scriptIndex){var scriptContent=htmlContent.substr(scriptIndex+31,scriptEnd-scriptIndex-SCRIPT_START.length);eval(scriptContent);}}var nextEval=htmlContent.substr(scriptEnd+9);}}function LiveResponseError(errorMessage,sequenceNumber){if(resultObj!=null)resultObj.innerHTML="A problem occured... ["+errorMessage+"]";}var timeoutValue=false;var queryTimeout=150;function HandleLiveSearchKeyDown(evt){if(evt.keyCode==13){if(!evt)evt=window.event;evt.cancelBubble=true;if(evt.stopPropagation)evt.stopPropagation();return false;}return true;}function HandleLiveSearchKey(evt,src){var canSearch=false;switch(evt.keyCode){case 9:case 27:case 46:case 16:case 17:case 18:case 20:case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 45:break;default:canSearch=true;break;}if(canSearch){if(timeoutValue!=false){clearTimeout(timeoutValue);}timeoutValue=setTimeout("LiveSearch('"+src.value+"',"+timeoutValue+")",queryTimeout);}}function showHide(content,navbar,elmSuffixId,forceState){var contentElm=document.getElementById(content+elmSuffixId);var navbarElm=document.getElementById(navbar+elmSuffixId);if(contentElm){if(typeof(forceState)=="undefined")forceState="";if(forceState!="none"&&(contentElm.style.display!="block"||forceState=="block")){contentElm.style.display="block";if(navbarElm)navbarElm.className="subHeaderOn";}else{contentElm.style.display="none";if(navbarElm)navbarElm.className="subHeaderOff";}}}function showAndHide(show,hide,elmSuffixId,showId,hideId){var showElm=document.getElementById(show+elmSuffixId);var hideElm=document.getElementById(hide+elmSuffixId);if(showElm)showElm.style.display="block";if(hideElm)hideElm.style.display="none";if(typeof(showId)!="undefined"&&showId.length>0)document.getElementById(showId).style.display='block';if(typeof(hideId)!="undefined"&&hideId.length>0)document.getElementById(hideId).style.display='none';}function setVisibility(objId,show){var obj=document.getElementById(objId);if(obj){if(show)obj.style.visibility="visible";else obj.style.visibility="hidden";}}function SwapImage(objId,originalImage,swapImage,forceImage){var img=document.getElementById(objId);if(typeof(forceImage)!="undefined")img.setAttribute("src",forceImage);else{if(img.getAttribute("src").indexOf(originalImage)<0)img.setAttribute("src",originalImage);else img.setAttribute("src",swapImage);}}