//
// AUTO-GENERATED FILE - DO NOT EDIT!!!
//  9:11:08, Tue Oct 20, 2009 (GMT)
//
function clearFindInGrid(){figFlag=false;figObjectID=0;figProgramID=0;figTimestamp=null;figChannel="";figIndex=-1;figRow=-1;figOffsetFudge=0;}function sclk(sidx){countGridAction("Search", "ObjectPage Link");var alink="/detail/generic.aspx?programid="+objSearchData[sidx][srchcolProgramID];document.location=alink;}function isSearchTarget(objOneRow){if(objOneRow[colTVObjectID]!=figObjectID){return false;}if(objOneRow[colProgramID]!=figProgramID){return false;}if((objOneRow[colCallLetters]+objOneRow[colChannelNumber])!=figChannel){return false;}return true;}function dilg(sidx){var dt=new Date();dt.setTime(objSearchData[sidx][srchcolDateTime]);paramGridYear=dt.getFullYear();paramGridMonth=dt.getMonth()+1;paramGridDay=dt.getDate();paramGridHour=dt.getHours();paramGridMinute=dt.getMinutes();figFlag=true;figObjectID=parseInt(objSearchData[sidx][srchcolObjectID],10);figProgramID=parseInt(objSearchData[sidx][srchcolProgramID],10);figTimestamp=objSearchData[sidx][srchcolDateTime];figChannel=objSearchData[sidx][srchcolCallLetter];if(objSearchData[sidx][srchcolChannelNum]>0){figChannel+=""+objSearchData[sidx][srchcolChannelNum];}countGridAction("Search", "Display In Grid");tabClick(null,0);reloadGrid();}function closeSearchResults(){divSearchResults.style.display="none";showSearchTab(false);tabClick(null,iLastGenreValue);}function srchPage(idx){iCurrentSearchPage=idx;if(iCurrentSearchPage<0){iCurrentSearchPage=0;}if(iCurrentSearchPage>=iTotalSearchPages){iCurrentSearchPage=iTotalSearchPages-1;}countGridAction("Search", "Change Page");processSearchResults();}function getPageSelect(){var str="";var cnt=3;if(iTotalSearchPages<=1){return "";}for(var x=0;x<iTotalSearchPages;x++){if((x==0)||(x==iTotalSearchPages-1)||((x>=(iCurrentSearchPage-cnt))&&(x<=(iCurrentSearchPage+cnt)))){if(x!=iCurrentSearchPage){if(str.length>0){str+="&nbsp;|&nbsp;";}str+="<a style='font-weight:bold;text-decoration:underline;' href='javascript:srchPage("+x+")'>"+(x+1)+"</a>";}else{if(str.length>0){str+="&nbsp;|&nbsp;";}str+="<b>"+(x+1)+"</b>";}}else{if((x==1)||(x==iTotalSearchPages-2)){str+="&nbsp;|&nbsp;...";}}}if(iCurrentSearchPage>0){str="<a href='javascript:srchPage("+(iCurrentSearchPage-1)+")' style='font-size:11px;font-weight:bold;text-decoration:underline;'>back</a>&nbsp;&nbsp;<a href='javascript:srchPage("+(iCurrentSearchPage-1)+")'><img src='/images/global/red_back.jpg'></a>&nbsp;&nbsp;"+str;}if(iCurrentSearchPage<(iTotalSearchPages-1)){str+="&nbsp;&nbsp;<a href='javascript:srchPage("+(iCurrentSearchPage+1)+")'><img src='/images/global/red_forward.jpg'></a>&nbsp;&nbsp;<a href='javascript:srchPage("+(iCurrentSearchPage+1)+")' style='font-size:11px;font-weight:bold;text-decoration:underline;'>next</a>";}return str;}function processNoResults(){var tmpObj=document.getElementById("tdSearchResultsHeader");if(tmpObj!=null){tmpObj.innerHTML="<div><a href='javascript:closeSearchResults()' style='font-size:10px;'>close search results&nbsp;<span style='background-color:#0000CC;color:#FFFFFF;font-weight:bold;'>&nbsp;X&nbsp;</span></a></div>";}tmpObj=document.getElementById("tdSearchResultsFooter");if(tmpObj!=null){tmpObj.innerHTML=""}tmpObj=document.getElementById("spnSearchTerm");if(tmpObj!=null){tmpObj.innerHTML=divSearchTextBox.value;}tmpObj=document.getElementById("spnSearchCount");if(tmpObj!=null){tmpObj.innerHTML="0";}tmpObj=document.getElementById("tdSearchResultsList");if(tmpObj!=null){tmpObj.innerHTML="<br><center><font style='font-weight:bold;'>Search TVGuide.com for: <a style='font-weight:bold;' href='/search/index.aspx?keyword="+escape(divSearchTextBox.value)+"'>"+divSearchTextBox.value+"</a></font></center>";}divSearchResults.style.display="block";showSearchTab(true);tabClick(null,7);}function processSearchResults(){var cols=6;if(divSearchResults==null){return;}if(divSearchTextBox!=null){divSearchTextBox.disabled=false;divSearchTextBox.blur();}var gb=document.getElementById("imgSearchGoButton");if(gb!=null){gb.src="/listings/images/v2/search.gif";}iSearchResultCount=objSearchData.length;var a=(iCurrentSearchPage*iResultsPerPage);var b=a+iResultsPerPage;if(b>iSearchResultCount){b=iSearchResultCount;}iTotalSearchPages=parseInt((iSearchResultCount/iResultsPerPage));if((iSearchResultCount % iResultsPerPage)>0){iTotalSearchPages++;}var strNav="";strNav+="<div><a href='javascript:closeSearchResults()' style='font-size:10px;'>close search results&nbsp;<span style='background-color:#0000CC;color:#FFFFFF;font-weight:bold;'>&nbsp;X&nbsp;</span></a></div>";var tmpObj=document.getElementById("tdSearchResultsHeader");if(tmpObj!=null){tmpObj.innerHTML=strNav;}strNav="<center><font style='font-weight:bold;'>Search TVGuide.com for: <a style='font-weight:bold;' href='/search/index.aspx?keyword="+escape(divSearchTextBox.value)+"'>"+divSearchTextBox.value+"</a></font></center>";strNav+="<div style='padding-top:8px;'>"+getPageSelect()+"</div>";tmpObj=document.getElementById("tdSearchResultsFooter");if(tmpObj!=null){tmpObj.innerHTML=strNav;}tmpObj=document.getElementById("spnSearchTerm");if(tmpObj!=null){tmpObj.innerHTML=strSearchTerm;}tmpObj=document.getElementById("spnSearchCount");if(tmpObj!=null){tmpObj.innerHTML=iSearchResultCount;}var sortImage="";if(sortAscending){sortImage="/listings/images/v2/sort0.gif";}else{sortImage="/listings/images/v2/sort1.gif";}var strList="<table style='width:740px;' cellpadding='0' cellspacing='0'>";/*START SPACER ROW*/ strList+="<tr>";strList+="<td style='width:18px;'><img src='/images/space.gif' style='height:1px;width:18px;'></td>";strList+="<td style='width:402px;'><img src='/images/space.gif' style='height:1px;width:402px;'></td>";strList+="<td style='width:75px;'><img src='/images/space.gif' style='height:1px;width:75px;'/></td>";strList+="<td style='width:45px;'><img src='/images/space.gif' style='height:1px;width:45px;'/></td>";strList+="<td style='width:110px;><img src='/images/space.gif' style='height:1px;width:110px;'/></td>";strList+="<td style='width:90px;'><img src='/images/space.gif' style='height:1px;width:90px;'/></td>";strList+="</tr>";/*END SPACER ROW*//*START COLUMN HEADERS ROW*/ strList+="<tr>";strList+="<td> </td>";strList+="<td style='vertical-align:bottom'><a href='javascript:sortResults(0,true)' style='font-size:11px;font-weight:bold;color:#CC0000;'>Program</a>";if(sortColumn==0){strList+="&nbsp;<img src='"+sortImage+"'>";}strList+="</td>";strList+="<td style='text-align:left;vertical-align:bottom;'><a href='javascript:sortResults(1,true)' style='font-size:11px;font-weight:bold;color:#CC0000;'>Network</a>";if(sortColumn==1){strList+="&nbsp;<img src='"+sortImage+"'>";}strList+="</td><td style='text-align:left;vertical-align:bottom'>";if(!isNationalGrid){strList+="<a href='javascript:sortResults(2,true)' style='font-size:11px;font-weight:bold;color:#CC0000;'>Ch</a>";if(sortColumn==2){strList+="&nbsp;<img src='"+sortImage+"'>";}}strList+="</td>";strList+="<td style='text-align:left;vertical-align:bottom'><nobr><a href='javascript:sortResults(3,true)' style='font-size:11px;font-weight:bold;color:#CC0000;'>Date & Time</a>";if(sortColumn==3){strList+="&nbsp;<img src='"+sortImage+"'>";}strList+="</nobr></td>";strList+="<td> </td>";strList+="</tr>";/*END COLUMN HEADERS ROW*/ strList+="<tr style='height:1px;'><td colspan='"+cols+"' style='height:1px;background-color:#AAAAAA;'></td></tr>";strList+="<tr style='height:4px;'><td colspan='"+cols+"' style='height:4px;'></td></tr>";for(var x=a;x<b;x++){if(x>a){strList+="<tr style='height:1px;'><td colspan='"+cols+"' style='height:1px;background-color:#AAAAAA;'></td></tr>";strList+="<tr style='height:4px;'><td colspan='"+cols+"' style='height:4px;'></td></tr>";}var alink="<a onclick='sclk("+x+")' style='cursor:pointer;font-size:11px;'>";if(objSearchData[x][srchcolObjectID]=="0"){alink="";}strList+="<tr>";strList+="<td style='height:16px;width:10px;overflow:visible;vertical-align:bottom;'>";if(objSearchData[x][srchcolDescription]!=null){if(objSearchData[x][srchcolDescription].length>0){strList+="<nobr><span style='font-size:11px;color:#CC0000;cursor:pointer;padding-right:4px;font-weight:bold;' onclick='javascript:tglMore(this,"+x+")'>";if(objSearchData[x][srchcolIsDescOpen]){strList+="<img src='/listings/images/v2/minus.gif'>";}else{strList+="<img src='/listings/images/v2/plus.gif'>";}strList+="</span></nobr>";}}strList+="</td>";strList+="<td style='text-align:left;overflow:hidden;color:#0066CC;font-size:11px;'>";strList+=alink+"<b>"+objSearchData[x][srchcolProgramTitle]+"</b>";var isNew=(objSearchData[x][srchcolIsNew]!="0");var isLive=(objSearchData[x][srchcolIsLive]!="0");var eptitle=objSearchData[x][srchcolEpisodeTitle];if(eptitle.length>0){var epmax=72-(objSearchData[x][srchcolProgramTitle].length*1.4);if(isNew){epmax-=3;}if(isLive){epmax-=4;}if(eptitle.length<epmax){strList+="&nbsp;-&nbsp;"+eptitle;}else{strList+="&nbsp;-&nbsp;"+eptitle.substring(0,epmax)+"...";}}if(alink.length>0){strList+="</a>";}if(isNew){strList+="&nbsp;&nbsp;<b style='color:#CC0000;font-size:11px;'>NEW</b>";}if(isLive){strList+="&nbsp;&nbsp;<b style='color:#CC0000;font-size:11px;'>LIVE</b>";}strList+="</td>";var chnum=objSearchData[x][srchcolChannelNum];if(chnum=="0"){chnum="";}var dt=new Date();dt.setTime(objSearchData[x][srchcolDateTime]);var ts=strDays[dt.getDay()]+", "+strLongMonths[dt.getMonth()].substring(0,3)+" "+dt.getDate()+" "+formatTime(dt);strList+="<td style='font-size:11px;'>"+objSearchData[x][srchcolCallLetter]+"</td><td style='font-size:11px;'>"+chnum+"</td>";strList+="<td style='text-align:left;font-size:11px;'><nobr>"+ts+"</nobr></td>";strList+="<td style='text-align:right;'><nobr><a onclick='dilg("+x+")' style='cursor:pointer;font-size:10px;'>display in grid</a></nobr></td>";strList+="</tr>";if(isIE){if(objSearchData[x][srchcolIsDescOpen]){strList+="<tr id='srchtr"+x+"' style='display:block;'><td colspan='"+cols+"' id='srchtd"+x+"' style='padding-top:2px;font-size:11px;width:740px;'>"+objSearchData[x][srchcolDescription]+"</td></tr>";}else{strList+="<tr id='srchtr"+x+"' style='display:none;'><td colspan='"+cols+"' id='srchtd"+x+"' style='padding-top:2px;font-size:11px;width:740px;'></td></tr>";}}else{if(objSearchData[x][srchcolIsDescOpen]){strList+="<tr id='srchtr"+x+"' style='visibility:visible;border-collapse:collapse;overflow:hidden;'><td colspan='"+cols+"' id='srchtd"+x+"' style='padding-top:2px;font-size:11px;width:740px;'>"+objSearchData[x][srchcolDescription]+"</td></tr>";}else{strList+="<tr id='srchtr"+x+"' style='visibility:collapse;border-collapse:collapse;overflow:hidden;'><td colspan='"+cols+"' id='srchtd"+x+"' style='padding-top:2px;font-size:11px;width:740px;'></td></tr>";}}}strList+="<tr style='height:1px;'><td colspan='"+cols+"' style='height:1px;background-color:#AAAAAA;'></td></tr>";strList+="</table>";tmpObj=document.getElementById("tdSearchResultsList");if(tmpObj!=null){tmpObj.innerHTML=strList;}divSearchResults.style.display="block";showSearchTab(true);tabClick(null,7);}function tglMore(href, idx){var objTR=document.getElementById("srchtr"+idx);var objTD=document.getElementById("srchtd"+idx);var pls="<img src='/listings/images/v2/plus.gif'>";var mns="<img src='/listings/images/v2/minus.gif'>";if(objTR!=null){if(isIE){if(objTR.style.display!="block"){objTD.innerHTML=objSearchData[idx][srchcolDescription];objTR.style.display="block";href.innerHTML=mns;objSearchData[idx][srchcolIsDescOpen]=true;}else{objTD.innerHTML="";objTR.style.display="none";href.innerHTML=pls;objSearchData[idx][srchcolIsDescOpen]=false;}}else{if(objTR.style.visibility!="visible"){objTD.innerHTML=objSearchData[idx][srchcolDescription];objTR.style.visibility="visible";href.innerHTML=mns;objSearchData[idx][srchcolIsDescOpen]=true;}else{objTD.innerHTML="";objTR.style.visibility="collapse";href.innerHTML=pls;objSearchData[idx][srchcolIsDescOpen]=false;}}}countGridAction("Search", "Toggle Synopsis");}function extractSearchDate(strDate){var dt=strDate.match(/(\d+)[\-\/](\d+)[\-\/](\d+)\s+(\d+):(\d+)/);if(dt!=null){var yr=parseInt(dt[1],10);var mo=parseInt(dt[2],10)-1;var dy=parseInt(dt[3],10);var hr=parseInt(dt[4],10);var mn=parseInt(dt[5],10);var d=new Date(yr,mo,dy,hr,mn,0,0);return d.getTime();}return 0;}function getChannelValue(strChan){var val=0;try{val=parseInt(strChan,10);}catch(e){val=strChan;}return val;}function sortResults(colIdx, bCount){if(colIdx==sortColumn){sortAscending=!sortAscending;}sortColumn=colIdx;if(bCount){countGridAction("Search", "Column Sort");}var iterations=0;var dt1=new Date();if(sortAscending){switch(colIdx){case 0: objSearchData.sort(titleSortUp);break;case 1: objSearchData.sort(networkSortUp);break;case 2: objSearchData.sort(channelSortUp);break;case 3: objSearchData.sort(dateSortUp);break;}}else{switch(colIdx){case 0: objSearchData.sort(titleSortDn);break;case 1: objSearchData.sort(networkSortDn);break;case 2: objSearchData.sort(channelSortDn);break;case 3: objSearchData.sort(dateSortDn);break;}}var dt2=new Date();msecsSort=dt2.getTime()-dt1.getTime();if(bDebug){document.title="Process: "+msecsProcess+"ms Sort: "+msecsSort+"ms";}iCurrentSearchPage=0;processSearchResults();}function titleSortUp(a,b){if(a[srchcolProgramTitle] !=b[srchcolProgramTitle]){if(a[srchcolProgramTitle] > b[srchcolProgramTitle]){return 1;}else{return-1;}}if(a[srchcolEpisodeTitle] !=b[srchcolEpisodeTitle]){if(a[srchcolEpisodeTitle] > b[srchcolEpisodeTitle]){return 1;}else{return-1;}}return dateSortUp(a,b);}function titleSortDn(a,b){if(b[srchcolProgramTitle] !=a[srchcolProgramTitle]){if(b[srchcolProgramTitle] > a[srchcolProgramTitle]){return 1;}else{return-1;}}if(b[srchcolEpisodeTitle] !=a[srchcolEpisodeTitle]){if(b[srchcolEpisodeTitle] > a[srchcolEpisodeTitle]){return 1;}else{return-1;}}return dateSortDn(a,b);}function dateSortUp(a,b){if(a[srchcolDateTime]!=b[srchcolDateTime]){return a[srchcolDateTime]-b[srchcolDateTime];}return channelSortUp(a,b);}function dateSortDn(a,b){if(a[srchcolDateTime]!=b[srchcolDateTime]){return b[srchcolDateTime]-a[srchcolDateTime];}return channelSortDn(a,b);}function channelSortUp(a,b){if(a[srchcolChannelNum] !=b[srchcolChannelNum]){return a[srchcolChannelNum]-b[srchcolChannelNum];}return networkSortUp(a,b);}function channelSortDn(a,b){if(a[srchcolChannelNum] !=b[srchcolChannelNum]){return b[srchcolChannelNum]-a[srchcolChannelNum];}return networkSortDn(a,b);}function networkSortUp(a,b){if(a[srchcolCallLetter] !=b[srchcolCallLetter]){if(a[srchcolCallLetter] > b[srchcolCallLetter]){return 1;}else{return-1;}}return dateSortUp(a,b);}function networkSortDn(a,b){if(b[srchcolCallLetter] !=a[srchcolCallLetter]){if(b[srchcolCallLetter] > a[srchcolCallLetter]){return 1;}else{return-1;}}return dateSortDn(a,b);}function doListingsSearchButton(){if(divSearchTextBox==null){return;}divSearchTextBox.blur();divSearchTextBox.disabled=true;var gb=document.getElementById("imgSearchGoButton");if(gb!=null){gb.src="/images/search/loading_15x15.gif";}countGridAction("Search", "Search Button");doListingsSearch(divSearchTextBox.value);}function searchCallback(){if(xmlSearchData.readyState==4 || xmlSearchData.readyState=="complete"){var dt1=new Date();if(xmlSearchData.responseText.split("\n").length<=1){divSearchTextBox.disabled=false;divSearchTextBox.blur();var gb=document.getElementById("imgSearchGoButton");if(gb!=null){gb.src="/listings/images/v2/search.gif";}processNoResults();return;}var data=xmlSearchData.responseText;var fnl=data.indexOf("\n");var objSpan=document.getElementById("spanProviderName");if(objSpan!=null){objSpan.innerHTML=data.substring(0,fnl);}objSearchData=data.substring(fnl+1).split('\n');searchSortOrder=new Array(objSearchData.length);searchSortOrder[0]=0;for(var x=0;x<objSearchData.length;x++){objSearchData[x]=objSearchData[x].split('\t');objSearchData[x][srchcolDateTime]=extractSearchDate(objSearchData[x][srchcolDateTime]);objSearchData[x][srchcolChannelNum]=parseInt(objSearchData[x][srchcolChannelNum]);objSearchData[x][srchcolIsDescOpen]=false;searchSortOrder[x]=x;}strSearchTerm=divSearchTextBox.value;iCurrentSearchPage=0;sortAscending=true;sortColumn=-1;var dt2=new Date();msecsProcess=dt2.getTime()-dt1.getTime();sortResults(3,false);}}function doListingsSearch(strKeyword){var urlData="/listings/data/ajaxsearchproxy.ashx";var qparams="";if(bhasGridData){qparams+="serviceid="+iServiceID;}else{var tmpID=readCookie("ServiceID");if(tmpID!=null){qparams+="serviceid="+tmpID;}else{qparams+="serviceid="+iServiceID;}}qparams+="&providername=1";qparams+="&keyword="+escape(strKeyword);xmlSearchData=GetXmlHttpObject(searchCallback);if(xmlSearchData!=null){xmlSearchData.open("GET", urlData+"?"+qparams , true);xmlSearchData.send(null);}}function showSearchTab(bTrue){var tmpObj=document.getElementById("gtabimg7");if(tmpObj!=null){if(bTrue){tmpObj.style.display="block";}else{tmpObj.style.display="none";}}}function toggleSearch(showResults){var optsDiv=document.getElementById("GridOptsDiv");var othrDiv=document.getElementById("FavChansDiv");var theGrid=document.getElementById("gridDiv");var theTBar=document.getElementById("timebarDiv");var grdtabs=document.getElementById("gridtabdiv");var legend=document.getElementById("gridLegendDiv");if(showResults){if(optsDiv!=null){optsDiv.style.display="none"};if(othrDiv!=null){othrDiv.style.display="none"};if(theGrid!=null){theGrid.style.display="none"};if(theTBar!=null){theTBar.style.display="none"};if(legend!=null){legend.style.display="none"};if(divSearchResults!=null){divSearchResults.style.display="block"};optionGenreFilter=7;}else{if(divSearchResults!=null){divSearchResults.style.display="none"};if(theGrid!=null){theGrid.style.display="block"};if(theTBar!=null){theTBar.style.display="block"};if(legend!=null){legend.style.display="block"};}}
