// Function to get document count using XMLHttp/***************************************************************************************************************************/function getDocCount () {if(viewAlias != "vwSearchProceedings"){	var xmlHttp = getXMLHTTP();	if(viewAlias == "vwOtherProceedings")	xmlHttp.open("GET", dbPath + viewAlias + "?ReadViewEntries&count=0");	else	xmlHttp.open("GET", dbPath + viewAlias + "?ReadViewEntries&RestrictToCategory="+ RestrictToCat +"&count=1");		xmlHttp.onreadystatechange = function() {		if (xmlHttp.readyState == 4 && xmlHttp.responseText) {			var resp = xmlHttp.responseText;			var countTag = resp.toLowerCase().indexOf('toplevelentries');			if (countTag > 0) {				resp = resp.substr(resp.indexOf('"', countTag) + 1);				totalDocs = resp.substring(0, resp.indexOf('"'));				setCookie('totaldocs', totalDocs, navCache)			}		}	};	xmlHttp.send(null);  }  else {  		totalDocs = SrchDocs  			setCookie('totaldocs', totalDocs, navCache)		}}/***************************************************************************************************************************/// Get View Navigator HTML/***************************************************************************************************************************/var startDoc = 0;var docsPerPage = 0;var totalPages = 0;var navRange = 0;var navCache = 0;var navDiv1 = "";var navDiv2 = "";var RestrictToCat  = ""var SrchString = ""setCookie('totaldocs', "", "")function initViewNav(range, cache, div1, div2) {	navRange = range;	navCache = cache;	navDiv1 = div1;	navDiv2 = div2;	startDoc = queryString('start');	startDoc = (startDoc == "") ? 1 : parseInt(startDoc);	docsPerPage = queryString('count');			if(viewAlias == "vwMainPage")		RestrictToCat = queryString('RestrictToCategory');	if(viewAlias == "vwSearchProceedings")		SrchString = queryString('Query');	//alert("docsPerPage is " + docsPerPage)	docsPerPage = (docsPerPage == "") ? 25 : parseInt(docsPerPage);	//alert("wait for DocCount")	waitForDocCount()}var checkCookie = true;var totalDocs = "";function waitForDocCount() {	if (checkCookie) {//alert(checkCookie)		totalDocs = getCookie('totaldocs');//		alert(totalDocs)		checkCookie = false;	}	if (totalDocs == "") {//alert("totalDocs is null")		getDocCount();		setTimeout("waitForDocCount()", 100);	} else {//alert("DrawViewNav")		drawViewNav();	}}function drawViewNav() {	// Do all our calculations to find out where we are in the view	partialPages = totalDocs / docsPerPage;	extraPage = (partialPages == Math.floor(partialPages)) ? 0 : 1;	totalPages = Math.floor(partialPages) + extraPage;	curPage = Math.floor(startDoc / docsPerPage) + 1//alert("calculation over")	// Figure out the number of the first and last pages to display on the navigator	startLink = (curPage < (navRange + 1)) ? 1 : curPage - navRange;	endLink = ((curPage + navRange) > totalPages) ? totalPages : curPage + navRange;//alert("figure out over")	// Start writing our menu		navHTML = "<div style='width: 65%' class='nav' align='right'><table class='navtable' cellpadding='0' cellspacing='0'><tr>";	// Write out the "First", "Jump", and "Previous" links when applicable	if (startLink > 1) {		navHTML = navHTML + buildLink(1, "First");		navHTML = navHTML + buildLink(curPage - (navRange + 1), "&lt;&lt;");	}		if (curPage > 1) navHTML = navHTML + buildLink(curPage - 1, "&lt;");//alert("write out the first")	// Generate all the page # links we want to display	for (i = startLink; i <= endLink; i++) {		if (i == curPage) {			navHTML = navHTML + "<td class='navtablecur'>" + i + "</td>"		} else {			navHTML = navHTML + buildLink(i, i);		}	}//alert("Generate all the page links")	// Write out the "End", "Next", and "Jump" links when applicable	if (curPage < totalPages) navHTML = navHTML + buildLink(curPage + 1, "&gt;");	if (endLink < totalPages) {		navHTML = navHTML + buildLink(curPage + (navRange + 1), "&gt;&gt;");		navHTML = navHTML + buildLink(totalPages, "Last");	}//alert("write out the end, next and jump links")	// Close the list of links	navHTML = navHTML + "</td>"//alert("close the list of links")		// Write out the "Page x of y" text and create input box	navHTML = navHTML + "<td class='navpages'>Page ";	navHTML = navHTML + "<input title=\"Click to enter a new page number here\" onKeyUp=\"void(getPage(event, this))\" ";	navHTML = navHTML + "onClick='this.select()' onFocus='this.select()' type='text' value='" + curPage + "' />";	navHTML = navHTML + " of " + totalPages + "</td>";//alert("write out the page x of y text")	// Close out the menu	navHTML = navHTML + "</tr></table></div>";//alert("going to write the navigator")	// Write out the navigator	document.getElementById(navDiv1).innerHTML = navHTML;	if (typeof navDiv2 != "undefined") document.getElementById(navDiv2).innerHTML = navHTML;	var to1 = parseInt(queryString("Start")) + 25;	document.getElementById('view').style.display = 'block';//Newly added by senthil		var lsResultStr		lsResultStr = "<table style='width: 65%' border = 0 cellspacing=0 cellpadding=0>"		lsResultStr = lsResultStr + "<tr>"		lsResultStr = lsResultStr + "<td style='width: 22px'>&nbsp;</td>"		if(totalDocs > 25)			if ((( 1 * startDoc) + 24) <= totalDocs)				lsResultStr = lsResultStr + "<td style='width: 400px' ><b>Displaying " + startDoc +" to " + (( 1 * startDoc) + 24) + " of " + totalDocs + " document(s) </b> </td>"			else				lsResultStr = lsResultStr + "<td style='width: 400px' ><b>Displaying " + startDoc +" to " + totalDocs + " of " + totalDocs + " document(s) </b> </td>"		else			lsResultStr = lsResultStr + "<td style='width: 400px' ><b>Displaying " + startDoc +" to " + totalDocs + " of " + totalDocs + " document(s) </b> </td>"			lsResultStr = lsResultStr + "</tr>"		lsResultStr = lsResultStr + "</table>"			document.getElementById("ShowReport").innerHTML= lsResultStr;}function buildLink(pageNum, text) {	startLinkDoc = (((pageNum - 1) * docsPerPage) + 1);	endDoc = (pageNum == totalPages) ? totalDocs : startLinkDoc + docsPerPage  // Check for last page when creating tooltip range	linkHTML = "<td class='navtablelink' onmouseover=\"this.className='navtablelink_on'\" onmouseout=\"this.className='navtablelink'\" "	linkHTML = linkHTML + "title='Page " + pageNum + " : Documents " + startLinkDoc + " through " + (endDoc - 1) + "' ";			if(viewAlias == "vwMainPage")	linkHTML = linkHTML + "onclick=document.location.href='" + viewAlias + "?OpenView&RestrictToCategory=" + escape(RestrictToCat) + "&Start=" + startLinkDoc + "&Count=" + docsPerPage + "'>" + text + "</td>";	if(viewAlias == "vwOtherProceedings")	linkHTML = linkHTML + "onclick=document.location.href='" + viewAlias + "?OpenView&Start=" + startLinkDoc + "&Count=" + docsPerPage + "&SearchOrder=4'>" + text + "</td>";	if(viewAlias == "vwSearchProceedings")	linkHTML = linkHTML + "onclick=javascript:printProceedings('"+ parseInt(startLinkDoc) +"'," + parseInt(docsPerPage)+ ")" +  ">" + text + "</td>";	//	linkHTML = linkHTML + "onclick=document.location.href='" + viewAlias + "?SearchView&Query=" + escape(SrchString) + "&Key1=" + startLinkDoc + "&Key2=" + docsPerPage + "'>" + text + "</td>";			return linkHTML;}function getPage(event, field) {	var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;	if (keyCode == 13) {		newPage = field.value;		if (newPage > totalPages || newPage < 1) {			field.select();			return false;		}		if(viewAlias == "vwMainPage")		document.location.href = dbPath + viewAlias + "?OpenView&RestrictToCategory=" + escape(RestrictToCat) + "&start=" + (((newPage - 1) * docsPerPage) + 1) + "&count=" + docsPerPage		if(viewAlias == "vwOtherProceedings")		document.location.href = dbPath + viewAlias + "?OpenView&start=" + (((newPage - 1) * docsPerPage) + 1) + "&count=" + docsPerPage		if(viewAlias == "vwSearchProceedings")		document.location.href = dbPath + viewAlias + "?SearchView&Query=" + escape(SrchString) + "&SearchMax=1000&Key1=" + (((newPage - 1) * docsPerPage) + 1) + "&Key2=" + docsPerPage 					}}/***************************************************************************************************************************/