var firstRequest=true;var maxResults=-1;var pageBoxServerPath;var currentPage=-1;var currentCategoryId=-1;var menuCategoryId=-1;var currentAlphaSelect='';var currentStartDate='';var currentEndDate='';var currentFilterType=0;var listType;var sortTypeFromAnchor=null;var sortType;var displayMethod;var formatType;var personId;var userSearchText;var lastSelectionHref;var lastAlphaHref;var pbCookieHost;var ddlPageSizeInstances=new Array();var enableEvents=true;var tabs=new Array();var hasHeaderRow=0;var hasFooterRow=0;var numItemsRemoved=0;var ddlSavedText=new Array();var pagePanel;var activeTab=null;var delayLoad=false;var txtRanks=[];var TAB_ELEMENTID=0;var TAB_PANELID=1;var DEFAULT_COLUMNS=5;function PagedBoxDelayLoad(){this.delayLoad=true;}
function PagedBoxInit(ajaxServerPath,wsCookieHost,wsListType,wsSortType,wsDefaultCategoryId,wsPersonId,wsSearchText,wsPagePanel,wsFormatType,wsDisplayMethod,wsMenuCategoryId){this.currentPage=0;this.currentCategoryId=wsDefaultCategoryId;this.listType=wsListType;PagedBoxRestoreFromAnchors();PagedBoxRestoreDisplayMethod(wsDisplayMethod);PagedBoxRestoreSort(wsSortType);PagedBoxRestoreFormat(wsFormatType);this.pageSize=GetLastTablePageSize();this.pbCookieHost=wsCookieHost;this.pageBoxServerPath=ajaxServerPath;this.personId=wsPersonId;this.userSearchText=wsSearchText;this.pagePanel=wsPagePanel;if(wsMenuCategoryId!=null){if(SafeInt(wsMenuCategoryId)>0){this.menuCategoryId=SafeInt(wsMenuCategoryId);}
else{this.menuCategoryId=this.currentCategoryId;}}
PagedBoxUpdatePageSizeDDL();if(this.delayLoad){return;}
AjaxFillGrid_Request();}
function SortVarName(){return"sort"+listType+"_"+CleanedUri(true).length;}
function PagedBoxRestoreSort(defaultSort){var persistedSort=null!=sortTypeFromAnchor?SafeInt(sortTypeFromAnchor):SafeInt(ZipVar(SortVarName()));this.sortType=SafeInt(defaultSort);if(persistedSort<1){return;}
$("select[id$=ddlSort]").each(function(){var findDDL=$(this).find("option[value="+persistedSort+"]");if(findDDL.length<1){return;}
$(this).val(findDDL.val());sortType=persistedSort;});if(window.location.pathname.toLowerCase().match("recommendations.aspx$")){$('#pageBoxSubTitle').html(4==sortType?text_top_ziprated_recommendations:5==sortType?text_recently_released_recommendations:'&nbsp;');};}
function PagedBoxRestoreFormat(defaultFormat){var persistedFormat=SafeInt(ZipVar("formatFilter"));this.formatType=SafeInt(defaultFormat);$("select[id$=ddlFormat]").each(function(){var findDDL=$(this).find("option[value="+persistedFormat+"]");if(findDDL.length<1){return;}
$(this).val(findDDL.val());formatType=persistedFormat;});}
function PagedBoxRestoreDisplayMethod(defaultDisplayMethod){var persistedDisplay=SafeInt(ZipVar("displayMethod"));this.displayMethod=SafeInt(defaultDisplayMethod);if(persistedDisplay<1){persistedDisplay=this.displayMethod;}
$("a.pb-display").each(function(){var relVal=SafeInt($(this).attr("rel"));if(persistedDisplay==relVal){displayMethod=persistedDisplay;$(this).addClass("display-selected");}});PagedBoxReshapeByDisplayMethod(displayMethod);}
function PagedBoxTitleInfo(wsTitleID,wsTableDiv)
{var webServiceRequest;var obj;webServiceRequest="WebServices/Title/wsTitleInfo.aspx";webServiceRequest+="?titleId="+wsTitleID;webServiceRequest+="&divTable="+wsTableDiv;webServiceRequest+="&nocache="+Math.random();obj=new AJAXRequest(pageBoxServerPath,webServiceRequest,'AjaxFillTitleInfo_CallBack');obj.sendRequest();}
function AjaxFillTitleInfo_CallBack()
{var i;if(xhttp.responseXML==null)
{ShowErrorMessage();return;}
nodeRoot=xhttp.responseXML.getElementsByTagName("Result");if(nodeRoot[0]==null)
{return;}
nodeDivTable=nodeRoot[0].getElementsByTagName("divTable");if(nodeDivTable[0]==null)
{return;}
divTable=document.getElementById(nodeDivTable[0].firstChild.nodeValue);nodeTitle=nodeRoot[0].getElementsByTagName("Title");if(nodeTitle[0]==null)
{return;}
divTable.innerHTML=nodeTitle[0].firstChild.nodeValue;}
function GetMaxAllowedPageSize(){var largestSize=0;$("select[id$=ddlPerPage] option").not($("select[id^=hidden] option")).each(function(){var ddlValue=$(this).val();if(isInteger(ddlValue)&&ddlValue>largestSize){largestSize=parseInt(ddlValue);}});return largestSize;}
function showTitles(){PagedBoxClearAnchors();this.maxResults=-1;PagedBoxInit(this.pageBoxServerPath,this.pbCookieHost,14,this.sortType,this.currentCategoryId,this.personId,this.userSearchText,this.pagePanel,this.formatType,this.displayMethod);highlightTitles();return false;}
function highlightPeople()
{document.getElementById('people_lt').className='ltOn';document.getElementById('people_mid').className='mtOn';document.getElementById('people_rt').className='rtOn';document.getElementById('titles_lt').className='ltOff';document.getElementById('titles_mid').className='mtOff';document.getElementById('titles_rt').className='rtOff';}
function showPeople(){PagedBoxClearAnchors();this.maxResults=-1;PagedBoxInit(this.pageBoxServerPath,this.pbCookieHost,15,this.sortType,this.currentCategoryId,this.personId,this.userSearchText,this.pagePanel,this.formatType,this.displayMethod);highlightPeople();return false;}
function highlightTitles()
{document.getElementById('titles_lt').className='ltOn';document.getElementById('titles_mid').className='mtOn';document.getElementById('titles_rt').className='rtOn';document.getElementById('people_lt').className='ltOff';document.getElementById('people_mid').className='mtOff';document.getElementById('people_rt').className='rtOff';}
function toggleZipListShowAllLink(visible){toggleShippableVisibility(visible);toggleSaveChanges(visible);toggleShippableLink(false);}
function toggleZipListShippableOnlyLink(visible){toggleShippableVisibility(visible);toggleSaveChanges(visible);toggleShippableLink(true);}
function toggleShippableVisibility(visible){$("a[id$=hlShowShippableTitles],a[id$=imgShippableTitlesHelp]").css("visibility",(visible?"visible":"hidden"));}
function toggleSaveChanges(visible){if(visible){$("div[id$=divPbUpdate]").show();}
else{$("div[id$=divPbUpdate]").hide();}}
function toggleShippableLink(showShippable){$("a."+(showShippable?"ziplist-showall":"ziplist-showshippable")).each(function(){var oldAltText=$(this).attr('title');$(this).attr('title',$(this).html()).html(oldAltText);$(this).attr('class',(showShippable?"ziplist-showshippable":"ziplist-showall"));ZipVar("showShippable",(showShippable?"true":"false"));});}
function showZipList(lbl,keepAnchors,toggle){var zlSearchTypeId;var showShippable=false;if($("a.ziplist-showall").length>0){showShippable=(toggle?true:false);}
else if($("a.ziplist-showshippable").length>0){showShippable=(toggle?false:true);}
if(!keepAnchors){PagedBoxClearAnchors();}
highlightZipList();zlSetTab('ZLQ');this.maxResults=-1;SwitchViewAllDDL(true,activeTab);if(showShippable){zlSearchTypeId=23;toggleZipListShippableOnlyLink(true);}
else{zlSearchTypeId=16;toggleZipListShowAllLink(true);}
PagedBoxInit(this.pageBoxServerPath,this.pbCookieHost,zlSearchTypeId,this.sortType,this.currentCategoryId,this.personId,this.userSearchText,this.pagePanel,this.formatType,this.displayMethod);return false;}
function highlightZipList()
{document.getElementById('ziplist_lt').className='ltOn';document.getElementById('ziplist_mid').className='mtOn';document.getElementById('ziplist_rt').className='rtOn';document.getElementById('parked_lt').className='ltOff';document.getElementById('parked_mid').className='mtOff';document.getElementById('parked_rt').className='rtOff';document.getElementById('history_lt').className='ltOff';document.getElementById('history_mid').className='mtOff';document.getElementById('history_rt').className='rtOff';}
function showParkedTitles(lbl){PagedBoxClearAnchors();highlightParkedTitles();zlSetTab('PKI');SwitchViewAllDDL(true,activeTab);this.maxResults=-1;PagedBoxInit(this.pageBoxServerPath,this.pbCookieHost,18,this.sortType,this.currentCategoryId,this.personId,this.userSearchText,this.pagePanel,this.formatType,this.displayMethod);if(numParkTokens!=null&&numParkTokens!=undefined){numParkTokens=maxResults;if(numParkTokens>0)
PagedBoxShowParked();else
PagedBoxHideParked();}
toggleShippableVisibility(false);toggleSaveChanges(false);return false;}
function zlTabRefByName(tabName){switch(tabName.toLowerCase())
{case'zlq':return $(".TabLink[id$=ziplist]");case'pki':return $(".TabLink[id$=parked]");case'rlh':return $(".TabLink[id$=history]");default:return $(".TabLink[id$=ziplist]");}}
function zlSetTab(tabName){zlTabRefByName(activeTab).removeClass("zl-hl-loading");activeTab=tabName;zlTabRefByName(activeTab).each(function(){$(this).addClass("zl-hl-loading");$(this).text($(this).text().replace(/\([^\)]+\)/i,''));});}
function zlClearTabLoading(){zlTabRefByName(activeTab).removeClass("zl-hl-loading");}
function highlightParkedTitles(){document.getElementById('ziplist_lt').className='ltOff';document.getElementById('ziplist_mid').className='mtOff';document.getElementById('ziplist_rt').className='rtOff';document.getElementById('parked_lt').className='ltOn';document.getElementById('parked_mid').className='mtOn';document.getElementById('parked_rt').className='rtOn';document.getElementById('history_lt').className='ltOff';document.getElementById('history_mid').className='mtOff';document.getElementById('history_rt').className='rtOff';}
function showRentalHistory(lbl){PagedBoxClearAnchors();zlSetTab('RLH');highlightRentalHistory();SwitchViewAllDDL(false,activeTab);this.maxResults=-1;PagedBoxInit(this.pageBoxServerPath,this.pbCookieHost,19,this.sortType,this.currentCategoryId,this.personId,this.userSearchText,this.pagePanel,this.formatType,this.displayMethod);toggleShippableVisibility(false);toggleSaveChanges(false);return false;}
function highlightRentalHistory()
{document.getElementById('ziplist_lt').className='ltOff';document.getElementById('ziplist_mid').className='mtOff';document.getElementById('ziplist_rt').className='rtOff';document.getElementById('parked_lt').className='ltOff';document.getElementById('parked_mid').className='mtOff';document.getElementById('parked_rt').className='rtOff';document.getElementById('history_lt').className='ltOn';document.getElementById('history_mid').className='mtOn';document.getElementById('history_rt').className='rtOn';}
function SwitchViewAllDDL(swap,searchType){if(ddlPageSizeInstances.length<1)return;this.enableEvents=false;if(swap){if(ddlPageSizeInstances[0].value>50){this.pageSize=50;}
for(var ddl=0;ddl<ddlPageSizeInstances.length;ddl++){var currentDDL=ddlPageSizeInstances[ddl];if(currentDDL.length==3){addOption(currentDDL,ddlSavedText[0],'100');addOption(currentDDL,ddlSavedText[1],'250');addOption(currentDDL,ddlSavedText[2],'800');}}}
else{for(var ddl=0;ddl<ddlPageSizeInstances.length;ddl++){var currentDDL=ddlPageSizeInstances[ddl];for(var optionIndex=0;optionIndex<currentDDL.options.length;optionIndex++){if(currentDDL.options[optionIndex].value==100){ddlSavedText[0]=currentDDL.options[optionIndex].innerHTML;}
else if(currentDDL.options[optionIndex].value==250){ddlSavedText[1]=currentDDL.options[optionIndex].innerHTML;}
else if(currentDDL.options[optionIndex].value==800){ddlSavedText[2]=currentDDL.options[optionIndex].innerHTML;}}
currentDDL.length=3;}
if(ddlPageSizeInstances[0].value>50&&searchType!='ZLQ'){this.pageSize=50;}
else{this.pageSize=GetLastTablePageSize();}}
this.enableEvents=true;}
function addOption(selectbox,text,value){var optn=document.createElement("OPTION");optn.text=text;optn.value=value;selectbox.options.add(optn);}
function SetTabVars(){if(arguments.length%3||!arguments.length)return;for(var i=0;i<arguments.length;i+=3){var searchType=arguments[i+1];this.tabs[searchType]=new Array();this.tabs[searchType][TAB_ELEMENTID]=arguments[i];this.tabs[searchType][TAB_PANELID]=arguments[i+2];if(i==0)activeTab=searchType;}}
function PagedBoxNext()
{if(this.currentPage+1<PagedBoxMaxPages())
{this.currentPage++;ShowTableGridLoading();AjaxFillGrid_Request();}}
function PagedBoxPrev()
{if(this.currentPage>0)
{this.currentPage--;ShowTableGridLoading();AjaxFillGrid_Request();}
return false;}
function PagedBoxUpdateAnchors(){var docLoc=document.location.href;if(docLoc.indexOf("#")>=0){docLoc=docLoc.substr(0,docLoc.indexOf("#"));}
docLoc="#p="+(this.currentPage*this.pageSize);if(this.currentCategoryId>0)
docLoc+="&c="+this.currentCategoryId;if(this.currentAlphaSelect!='')
docLoc+="&a="+this.currentAlphaSelect;document.location.href=docLoc;}
function PagedBoxClearAnchors(){var docLoc=document.location.href;if(docLoc.indexOf("#")>=0){document.location.href=docLoc.substr(0,docLoc.indexOf("#"))+"#";}}
function PagedBoxRestoreFromAnchors(){var docLoc=document.location.href;if(docLoc.indexOf("#")>=0){docLoc=docLoc.substr(docLoc.indexOf("#")+1,docLoc.length-1);}
else{return;}
tmpVars=docLoc.split("&");for(varNum=0;varNum<tmpVars.length;varNum++){currentVar=tmpVars[varNum].split("=");try
{switch(currentVar[0]){case'p':if(currentVar[1].length>0&&isInteger(currentVar[1])){this.currentPage=parseInt(parseInt(currentVar[1])/this.pageSize);}
break;case'c':if(currentVar[1].length>0&&isInteger(currentVar[1])){this.currentCategoryId=parseInt(currentVar[1]);$(document).ready(function(){PagedBoxHighlightCategory();});}
break;case'a':if(currentVar[1].length>0){this.currentAlphaSelect=currentVar[1];}
break;case's':if(currentVar[1].length>0&&isInteger(currentVar[1])){this.sortTypeFromAnchor=currentVar[1];};break;}}catch(e){}}}
function PagedBoxJump()
{var newPageNum;try
{newPageNum=parseInt(GetInputValueByName("inputPageJump"));}
catch(e)
{newPageNum=1;}
newPageNum--;if(newPageNum+1<=PagedBoxMaxPages()&&newPageNum>=0)
{this.currentPage=newPageNum;ShowTableGridLoading();AjaxFillGrid_Request();}}
function PagedBoxPageJumpKeyPress(e)
{var key=e.keyCode||e.which;if(key==13)
{PagedBoxJump();return false;}
else
{return true;}}
function PagedBoxAddDDLPageSizeInstanceByName(ddlName,bHeaderRow,bFooterRow)
{ddlInstance=document.getElementById(ddlName);if(bHeaderRow!=null){hasHeaderRow=bHeaderRow;}
if(bFooterRow!=null){hasFooterRow=bFooterRow;}
this.ddlPageSizeInstances[this.ddlPageSizeInstances.length]=ddlInstance;}
function PagedBoxUpdatePageSizeDDL(){this.enableEvents=false;for(var ddl=0;ddl<ddlPageSizeInstances.length;ddl++)
{var currentDDL=ddlPageSizeInstances[ddl];for(var optionIndex=0;optionIndex<currentDDL.options.length;optionIndex++)
{if(currentDDL.options[optionIndex].value==this.pageSize)
{currentDDL.selectedIndex=optionIndex;}}}
this.enableEvents=true;}
function PagedBoxChangePageSize(ddlSender)
{var ddlValue;if(this.enableEvents)
{ddlValue=parseInt(ddlSender.options[ddlSender.selectedIndex].value);RebuildTableGrid(gridCols,ddlValue/gridCols);PagedBoxRestoreFromAnchors();if(this.currentPage+1>PagedBoxMaxPages())
{this.currentPage=PagedBoxMaxPages()-1;}
PagedBoxUpdatePageSizeDDL();AjaxFillGrid_Request();}}
function PagedBoxChangeOrder(ddlSender)
{var ddlValue;ddlValue=parseInt(ddlSender.options[ddlSender.selectedIndex].value);this.sortType=ddlValue;ZipVar(SortVarName(),this.sortType);ShowTableGridLoading();AjaxFillGrid_Request();}
function PagedBoxReshapeByDisplayMethod(displayMethodType){switch(SafeInt(displayMethodType)){case DISPLAY_SIMPLE:RebuildTableGrid(DEFAULT_COLUMNS,GetLastTablePageSize()/DEFAULT_COLUMNS);break;case DISPLAY_LISTDETAIL:RebuildTableGrid(1,GetLastTablePageSize());break;}}
function PagedBoxChangeDisplay(displayMethodType){PagedBoxRemoveFocus();if(parseInt(displayMethodType)==this.displayMethod){return false;}
this.displayMethod=parseInt(displayMethodType);ZipVar("displayMethod",this.displayMethod);$("a.pb-display").each(function(){var relVal=SafeInt($(this).attr("rel"));$(this).removeClass("display-selected");if(displayMethod==relVal){$(this).addClass("display-selected");}});PagedBoxReshapeByDisplayMethod(displayMethodType);ShowTableGridLoading();AjaxFillGrid_Request();}
function PagedBoxChangeFormat(ddlSender){var ddlValue;this.currentPage=0;this.maxResults=-1;ddlValue=parseInt(ddlSender.options[ddlSender.selectedIndex].value);this.formatType=ddlValue;ZipVar("formatFilter",this.formatType);ShowTableGridLoading();AjaxFillGrid_Request();}
function PagedBoxResetSelections(){this.currentCategoryId=-1;this.currentStartDate='';this.currentEndDate='';this.currentFilterType=0;if(this.lastSelectionHref!=null){$(this.lastSelectionHref).removeClass("list-selected");}}
function PagedBoxHighlightCategory(){var activeCat=this.currentCategoryId;PagedBoxResetSelections();$("#side_menu a[rel="+activeCat+"]").each(function(){$(this).addClass("list-selected");$('#pageBoxSubTitle').html($(this).html().replace(/\(.*\)/,''));lastSelectionHref=$(this).get(0);});this.currentCategoryId=activeCat;}
function PagedBoxChangeCategory(hrefRef,newCategoryId,categoryName){if($(hrefRef).hasClass(".nohover")){return false;}
PagedBoxResetSelections();hrefRef.className+=" list-selected";this.lastSelectionHref=hrefRef;this.currentCategoryId=parseInt(newCategoryId);this.maxResults=categoryResults[this.currentCategoryId];this.currentPage=0;ShowTableGridLoading();AjaxFillGrid_Request();PagedBoxRemoveFocus();var pageBoxTitleObj=document.getElementById("pageBoxSubTitle");if(pageBoxTitleObj!=null&&categoryName!=null){pageBoxTitleObj.innerHTML=categoryName;}}
function PagedBoxChangeFilter(hrefRef,newFilter){PagedBoxResetSelections();this.currentFilterType=newFilter;this.maxResults=-1;this.currentPage=0;hrefRef.className+=" list-selected";this.lastSelectionHref=hrefRef;ShowTableGridLoading();AjaxFillGrid_Request();PagedBoxRemoveFocus();}
function PagedBoxChangeDateSpan(hrefRef,newStartDate,newEndDate){PagedBoxResetSelections();this.currentStartDate=newStartDate;this.currentEndDate=newEndDate;this.maxResults=-1;this.currentPage=0;hrefRef.className+=" list-selected";this.lastSelectionHref=hrefRef;ShowTableGridLoading();AjaxFillGrid_Request();PagedBoxRemoveFocus();}
function PagedBoxChangeAlphaSelect(hrefRef,newAlpha){this.currentAlphaSelect=newAlpha;this.currentPage=0;if(this.lastAlphaHref!=null)
{this.lastAlphaHref.className=this.lastAlphaHref.className.replace(" alpha-selected","");}
hrefRef.className+=" alpha-selected";this.lastAlphaHref=hrefRef;ShowTableGridLoading();this.maxResults=-1;AjaxFillGrid_Request();PagedBoxRemoveFocus();}
function PagedBoxAlphaDefault(alphaChar)
{var hrefRef=document.getElementById("linkAlpha"+alphaChar);hrefRef.className+=" alpha-selected";this.lastAlphaHref=hrefRef;this.currentAlphaSelect=alphaChar;}
function PagedBoxDateDefault(monthNum,dateStart,dateEnd)
{var hrefRef=document.getElementById("linkMonth"+monthNum);hrefRef.className+=" alpha-selected";this.lastAlphaHref=hrefRef;this.currentStartDate=dateStart;this.currentEndDate=dateEnd;}
function PagedBoxChangeDateFilter(hrefRef,newDateStart,newDateEnd){this.currentStartDate=newDateStart;this.currentEndDate=newDateEnd;this.currentPage=0;if(this.lastAlphaHref!=null){this.lastAlphaHref.className=this.lastAlphaHref.className.replace(" alpha-selected","");}
hrefRef.className+=" alpha-selected";this.lastAlphaHref=hrefRef;ShowTableGridLoading();this.maxResults=-1;AjaxFillGrid_Request();PagedBoxRemoveFocus();}
function PagedBoxRemoveFocus(){$("#fauxFocus").each(function(){try{this.focus();}catch(e){}});}
function AjaxZipListUpdate_Request(btnObj){jQuery.ajax({type:"POST",url:zipGlobal.ServerPath+"WebServices/ZipList/wsZipListFeatures.asmx/RankZipList",data:SerializeParams({rankchanges:document.getElementById("zipList_hdRankChanges").value,listType:this.listType}),dataType:"xml",success:function(xml){AjaxFillZipListUpdate_CallBack(xml,btnObj);}});m_arrEntries=new Array();document.getElementById("zipList_hdRankChanges").value=null;}
function AjaxFillZipListUpdate_CallBack(xml,btnObj){$(xml).find('ListType').each(function(){switch($(this).text()){case'16':case'23':if(typeof btnObj!="undefined"&&btnObj!=null){CompleteButtonLoading(btnObj);}
showZipList(null,true,false);}});}
function AjaxFillGrid_Request()
{var today=new Date();var webServiceRequest;var obj;if(activeTab){this.pagePanel=this.tabs[activeTab][TAB_PANELID];}
if(!this.firstRequest){PagedBoxUpdateAnchors();}
this.firstRequest=false;webServiceRequest="WebServices/Title/wsTitleList.aspx";webServiceRequest+="?listType="+this.listType;webServiceRequest+="&sortType="+this.sortType;webServiceRequest+="&displayMethod="+this.displayMethod;webServiceRequest+="&formatType="+this.formatType;webServiceRequest+="&returnMaxResults="+(this.maxResults<0?"true":"false");webServiceRequest+="&pageNum="+this.currentPage;webServiceRequest+="&numResults="+this.pageSize;webServiceRequest+="&categoryId="+this.currentCategoryId;webServiceRequest+="&menuCategoryId="+this.menuCategoryId;webServiceRequest+="&personId="+this.personId;webServiceRequest+="&alphaSelect="+this.currentAlphaSelect;webServiceRequest+="&startDate="+this.currentStartDate;webServiceRequest+="&endDate="+this.currentEndDate;webServiceRequest+="&filterType="+this.currentFilterType;webServiceRequest+="&searchText="+this.userSearchText;webServiceRequest+="&pagePanel="+this.pagePanel;webServiceRequest+="&nocache="+Math.random();clearPopups();obj=new AJAXRequest(pageBoxServerPath,webServiceRequest,'AjaxFillGrid_CallBack');obj.sendRequest();};function ParseWsTitleListXml(xmlString)
{var xmlDocument=null;try{xmlDocument=eval('new Ac'+'tiv'+'eXO'+'bje'+'ct(\'Microsoft.XMLDOM\')');xmlDocument.async='false';xmlDocument.loadXML(xmlString);}
catch(e){try{var parser=new DOMParser();xmlDocument=parser.parseFromString(xmlString,'text/xml');}
catch(e){ShowErrorMessage();return(null);}}
return(xmlDocument);};function AjaxFillGrid_CallBack()
{var i;numItemsRemoved=0;ShowNavBars();var n=xhttp.responseText.indexOf("<Success />");if(n>=0)
{i=0;while(i<(pageSize+hasHeaderRow+hasFooterRow)){SetTableCell(i," ");i++;}
PagedBoxContentFallback();return;}
var xmlDocument=null;if(xhttp.responseXML==null){if(null!=xhttp.responseText){xmlDocument=ParseWsTitleListXml(xhttp.responseText);if(null==xmlDocument){ShowErrorMessage();return;}
nodeRoot=xmlDocument.getElementsByTagName("Titles");}
else{ShowErrorMessage();return;}}
else{nodeRoot=xhttp.responseXML.getElementsByTagName("Titles");}
if(nodeRoot[0]==null){ShowErrorMessage();return;}
nodeFallBack=nodeRoot[0].getElementsByTagName("FallBack");if(nodeFallBack[0]!=null){if(nodeFallBack[0].firstChild.nodeValue.toLowerCase()=="true")
PagedBoxContentFallback();}
nodeSearchType=nodeRoot[0].getElementsByTagName("SearchType");nodeMaxResults=nodeRoot[0].getElementsByTagName("MaxResults");if(nodeMaxResults[0]!=null){maxResults=parseInt(nodeMaxResults[0].firstChild.nodeValue);}
nodeMaxTitles=nodeRoot[0].getElementsByTagName("TotalTitles");nodeMaxPeople=nodeRoot[0].getElementsByTagName("TotalPeople");if(nodeMaxTitles[0]!=null){document.getElementById(this.tabs['UTS'][TAB_ELEMENTID]).innerHTML=nodeMaxTitles[0].firstChild.nodeValue;if(nodeMaxTitles[0].firstChild.nodeValue.substring(0,2)=='(0'){highlightPeople();}}
if(nodeMaxPeople[0]!=null){document.getElementById(this.tabs['UPS'][TAB_ELEMENTID]).innerHTML=nodeMaxPeople[0].firstChild.nodeValue;if(nodeMaxPeople[0].firstChild.nodeValue.substring(0,2)=='(0'){highlightTitles();}}
if(nodeSearchType[0]!=null){switch(nodeSearchType[0].firstChild.nodeValue){case'ZLQ':case'ZLP':case'PKI':case'RLH':zlClearTabLoading();}
if(nodeSearchType[0].firstChild.nodeValue=='ZLQ'||nodeSearchType[0].firstChild.nodeValue=='ZLP'){if(numParkTokens!=null&&numParkTokens!=undefined){numParkTokens=maxResults-20;if(numParkTokens>0){PagedBoxShowParked();}
else{PagedBoxHideParked();}}}
else if(nodeSearchType[0].firstChild.nodeValue=='PKI'){if(numParkTokens!=null&&numParkTokens!=undefined){numParkTokens=maxResults;if(numParkTokens>0){PagedBoxShowParked();}
else{PagedBoxHideParked();}}}}
nodeZipListSize=nodeRoot[0].getElementsByTagName("ZipListSize");nodeParkedTitlesSize=nodeRoot[0].getElementsByTagName("ParkedTitlesSize");nodeRentalHistorySize=nodeRoot[0].getElementsByTagName("RentalHistorySize");nodeZipListHeader=nodeRoot[0].getElementsByTagName("ZipListHeader");if(nodeZipListHeader[0]!=null&&document.getElementById('zipListPageBox_lblTitle')!=null)
{if(nodeZipListHeader[0].firstChild.nodeValue.indexOf('ZipList')>=0||nodeZipListHeader[0].firstChild.nodeValue.indexOf('ListeZip')>=0){numParkTokens=maxResults-20;}
else{numParkTokens=maxResults;}
document.getElementById('zipListPageBox_lblTitle').innerHTML=nodeZipListHeader[0].firstChild.nodeValue;}
if(nodeZipListSize[0]!=null){document.getElementById(this.tabs['ZLQ'][TAB_ELEMENTID]).innerHTML=nodeZipListSize[0].firstChild.nodeValue;}
if(nodeParkedTitlesSize[0]!=null){document.getElementById(this.tabs['PKI'][TAB_ELEMENTID]).innerHTML=nodeParkedTitlesSize[0].firstChild.nodeValue;}
if(nodeRentalHistorySize[0]!=null){document.getElementById(this.tabs['RLH'][TAB_ELEMENTID]).innerHTML=nodeRentalHistorySize[0].firstChild.nodeValue;}
nodeCategories=nodeRoot[0].getElementsByTagName("results");if(nodeCategories[0]!=null){nodeCat=nodeCategories[0].getElementsByTagName("category");categoryResults=new Array();for(i=0;i<nodeCat.length;i++){var catId,catResults;catId=parseInt(nodeCat[i].attributes.getNamedItem("id").value);catResults=parseInt(nodeCat[i].attributes.getNamedItem("results").value);spanCatResults=document.getElementById("catResults"+catId);if(spanCatResults!=null){spanCatResults.innerHTML=catResults;}
categoryResults[catId]=catResults;}
HideEmptyCategories();if(this.maxResults<=0){PagedBoxContentFallback();}}
nodeTitle=nodeRoot[0].getElementsByTagName("Title");RebuildTableGrid(gridCols,Math.ceil(nodeTitle.length/gridCols),true);for(i=0;i<nodeTitle.length;i++){var childBulder="";for(children=0;children<nodeTitle[i].childNodes.length;children++){childBulder+=nodeTitle[i].childNodes[children].nodeValue;}
var nodeInnerHTML=childBulder;var startIndex;var endIndex;SetTableCell(i,nodeInnerHTML);}
while(i<(pageSize+hasHeaderRow+hasFooterRow)){HideTableCell(i++);}
PagedBoxUpdateInfo();}
function PagedBoxContentFallback(){switch(parseInt(listType))
{case 3:if(currentCategoryId<1){PageDescNoResults();PagedBoxTitleNoResults();HideCategoryMenu();}
else{this.maxResults=0;PagedBoxUpdateInfo();}
break;case 13:case 14:HideNavBars();break;case 6:if(20==pagePanel||27==pagePanel){var menuItems=$('#filterMenu_divBoxContent').children();if(null!=menuItems&&menuItems.length>0){var selectedMenuItem=null;for(var index=0;index<menuItems.length;index++){var menuItem=$(menuItems[index]);if(null!=selectedMenuItem){selectedMenuItem.hide();menuItem.click();break;}
else{selectedMenuItem=menuItem.hasClass("list-selected")?menuItem:null;};};};};break;default:this.maxResults=0;PagedBoxUpdateInfo();}}
function HidePagedBox()
{document.getElementById("tablePagedBox").style.display="none";}
function ResizePagedBox(width)
{document.getElementById("tablePagedBox").style.width=width;}
function HideEmptyCategories(){var i;var onRecommendationPage=-1!=window.location.toString().toLowerCase().indexOf("recommendations");for(i=0;i<visibleCats.length;i++)
{var visibleCatResults=categoryResults[visibleCats[i]];if(visibleCatResults!=null)
{if(visibleCatResults<=0){$("#catResults"+visibleCats[i]).html(0).parent().addClass("nohover");}
else{$("#catResults"+visibleCats[i]).parent().removeClass("nohover");}}
else{if(onRecommendationPage){$("#catResults"+visibleCats[i]).parent().hide();}
else{$("#catResults"+visibleCats[i]).html(0).parent().addClass("nohover");}}}}
function HideCategoryMenu(){$("div[name=categoryMenu]").hide();}
function HideNavBars(){$("#divPagedNavTop").hide();$("#divPagedNavBottom").hide();}
function ShowNavBars(){$("#divPagedNavTop").show();$("#divPagedNavBottom").show();}
function PagedBoxMaxPages(){return parseInt((this.maxResults-1)/this.pageSize)+1;}
function PagedBoxUpdateInfo(){var pagedBoxMaxPages=PagedBoxMaxPages();$("span[name=spanCurrentPage]").html(this.currentPage+1);$("span[name=spanMaxPage]").html(pagedBoxMaxPages);$("span[name=spanPages]").css("visibility","visible");$("span[name=spanPagePrev]").css("visibility",(this.currentPage>0?"visible":"hidden"));$("span[name=spanPageNext]").css("visibility",(this.currentPage+1<pagedBoxMaxPages?"visible":"hidden"));var maxResults=this.maxResults;$("select[id$=ddlPerPage]").each(function(){if(maxResults<=15){$(this).attr("disabled",true);}
else{$(this).removeAttr("disabled");};});$("span[name=spanNumResults]").html(this.maxResults);$("div[name=divPageJump]").css("visibility",(pagedBoxMaxPages<=1?"hidden":"visible"));if(typeof numParkTokens!="undefined")
{if(numParkTokens>0){PagedBoxShowParked();}
else{PagedBoxHideParked();}}
if(typeof ZiplistInitDnD!="undefined"){ZiplistInitDnD();}
if(typeof toggleShippableVisibility!="undefined"){switch(SafeInt(listType)){case 16:toggleShippableVisibility(this.maxResults>0);}}}
function PagedBoxNumItemsUpdate(){if(maxResults<=currentPage*pageSize&&currentPage>0){this.currentPage--;ShowTableGridLoading();AjaxFillGrid_Request();}
else if(numItemsRemoved>=pageSize||maxResults<=0){this.maxResults=-1;log("Refreshing empty Paged Box","numItemsRemoved",numItemsRemoved,"maxResults",maxResults);ShowTableGridLoading();AjaxFillGrid_Request();}
else{PagedBoxUpdateInfo();}}
function PagedBoxDecreaseResults()
{maxResults--;numItemsRemoved++;PagedBoxNumItemsUpdate();}
function PagedBoxIncreaseResults()
{maxResults++;numItemsRemoved--;PagedBoxNumItemsUpdate();}
function GetInputValueByName(elementName)
{var allElements=$("input[name="+elementName+"]");var i;var returnValue;for(i=0;i<allElements.length;i++)
{returnValue=allElements[i].value;if(typeof returnValue!="undefined"&&returnValue!=null&&returnValue!='')
{allElements[i].value='';return returnValue;}}
return'';}
function ShowErrorMessage()
{i=0;while(i<(pageSize+hasHeaderRow+hasFooterRow)){SetTableCell(i," ");i++;}
HideNavBars();ErrorMsgStr1="An Error Has Occured";ErrorMsgStr2="We're sorry but we cannot process your request at this time.";ErrorMsgStr3="Please try again.";ErrorMsgElement1=document.getElementById("HiddenErrorMsg1");ErrorMsgElement2=document.getElementById("HiddenErrorMsg2");ErrorMsgElement3=document.getElementById("HiddenErrorMsg3");if(ErrorMsgElement1!=null){ErrorMsgStr1=ErrorMsgElement1.value;}
if(ErrorMsgElement2!=null){ErrorMsgStr2=ErrorMsgElement2.value;}
if(ErrorMsgElement3!=null){ErrorMsgStr3=ErrorMsgElement3.value;}
errorMessage="<p class='textheader'>"+ErrorMsgStr1+".</p><p>"+ErrorMsgStr2+"  <a href=javascript:__doPostBack('','')>"+ErrorMsgStr3+"</a></p>";SetTableCell(0,errorMessage);}
function PagedBoxHideParked(){$("td input[id$=btnPark]").parent().hide();}
function PagedBoxShowParked(){$("td input[id$=btnPark]").parent().show();}
function PagedBoxHideShowDDL(show){var ie55=(navigator.appName=="Microsoft Internet Explorer"&&parseInt(navigator.appVersion)==4&&navigator.appVersion.indexOf("MSIE 5.5")!=-1);var ie6=(navigator.appName=="Microsoft Internet Explorer"&&parseInt(navigator.appVersion)==4&&navigator.appVersion.indexOf("MSIE 6.0")!=-1);if(!ie55&&!ie6){return;}
$("select[name$=ddlPerPage]").css("visibility",(show?"visible":"hidden"));$("select[name$=ddlFormat]").css("visibility",(show?"visible":"hidden"));}