<!--


function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

// **************************************  Get element from top *********************************
function getElementTop(Elem) {
	if (isNS4) {
		var elem = getObjNN4(document, Elem);
		return elem.pageY;
	} else {
		if(document.getElementById) {	
			var elem = document.getElementById(Elem);
		} else if (document.all) {
			var elem = document.all[Elem];
		}
		yPos = (elem.offsetTop);
		tempEl = (elem.offsetParent);
		while (tempEl != null) {
  			yPos += tempEl.offsetTop;
	  		tempEl = tempEl.offsetParent;
  		}
		return yPos;
	}
}

// **************************************  Get element from top *********************************
function getElementLeft(Elem) {
	if (isNS4) {
		var elem = getObjNN4(document, Elem);
		return elem.pageX;
	} else {
		if(document.getElementById) {	
			var elem = document.getElementById(Elem);
		} else if (document.all) {
			var elem = document.all[Elem];
		}
		xPos = (elem.offsetLeft);
		tempEl = (elem.offsetParent);
		while (tempEl != null) {
  			xPos += tempEl.offsetLeft;
	  		tempEl = tempEl.offsetParent;
  		}
		return xPos;
	}
}


// *** CROSS-BROWSER COMPATIBILITY ***

var isDOM = (document.getElementById ? true : false);
var isIE4 = ((document.all && !isDOM) ? true : false);
var isNS4 = (document.layers ? true : false);
var isDyn = (isDOM || isIE4 || isNS4);

function getRef(id)
{
 if (isDOM) return document.getElementById(id);
 if (isIE4) return document.all[id];
 if (isNS4) return document.layers[id];
}

function getSty(id)
{
 return (isNS4 ? getRef(id) : getRef(id).style);
}


// *** LOAD FILES INTO DIV FUNCTIONS ***


function scrFileLoaded() { with (this)
{
 // Stop dragging any scroller while we switch files.
 activeScr = null;

 // Back to top...
 //scrollBy(-100000);

 // And set visibilities now everything's finally ready.
 for (count = 0; count < divs.length; count++)
  getSty(divs[count][0]).visibility = 'visible';
}}


// *** DIV SCROLLING FUNCTION ***

function scrScrollBy(amount) { with (this)
{
	
	 // showInfo(false,'Fetching Data ...',80);   
	     
	 // Because this gets passed fractions sometimes.
	 amount = parseInt(amount);
	 var orginal_amount = amount;
	 	 
	 // Height of div - update here as it may change often. Find it out somehow :).
	 divHeight = document.all ? parseInt(divRef.clientHeight) :
	  (isDOM ? parseInt(divRef.offsetHeight) : parseInt(divRef.document.height));
	 // Stops 'divide by zero'
	 if (divHeight == 0) divHeight = 1;
	
	 // Are we scrolling out of range? If so, return to top/bottom.
	 if ((cBot + amount) > divHeight) amount = divHeight - cBot;
	 if ((cTop + amount) < 0) amount = 0 - cTop;
	
	 // Adjust clipping values & move div up/down... 'scrolling' div.
	 
	 cTop += amount;
	 cBot += amount;
	 if (isDOM || isIE4)
	  divSty.clip = 'rect(' + cTop + 'px ' + cWidth + 'px ' + cBot + 'px ' + 0 + 'px)';
	 else if (isNS4)
	 {
	  // NS4 bug fix, seems to be required, as sometimes these get undefined... why?
	  // I think it's because one onMouseMove gets called before another finishes, and somehow
	  // NS4 must lose track of its variables.
	  if (isNaN(cTop) || isNaN(cBot) || isNaN(amount)) layout();
	
	  // Order of adjustment matters, cannot overlap opposing clips.
	  if (cBot < parseInt(divSty.clip.top)) divSty.clip.top = cTop+'px';
	  divSty.clip.bottom = cBot+'px';
	  divSty.clip.top = cTop+'px';
	 }
	
	 divSty.top = (eval(divs[0][2]) - cTop)+'px';
	 //getRef('top_div').innerHTML=divSty.top;
	 
	 // Define its height as the percentage of the clipping height vs div height.
	 // Best to set it here as divHeight may change as images load etc.
	 thmHeight = Math.ceil(barHeight * ((cBot - cTop) / divHeight));
	
	 // Minimum and maximum heights for thumb...
	 if (thmHeight < minThmHeight) thmHeight = minThmHeight;
	 if (thmHeight > barHeight) thmHeight = barHeight;
	
	 if (isDOM || isIE4) thmSty.height = thmHeight+'px';
	 else if (isNS4) thmSty.clip.height = thmHeight+'px';

	 // checking if we need to fetch or not
	 if((orginal_amount)>0)
		{
		if(!checkResults()) return false;	  	
		}		 
	
	 // Adjust scrollbar thumb position only if we're not already dragging it.
	 if (activeScr) return;
	
	 // What fraction is the div of its total scrolling range? 0=top, 1=bottom.
	 fracDivDown = (cTop / (divHeight - (cBot - cTop)));
	 // Now, multiply that by the available space to move and assign its top.
	 thmSty.top = (parseInt(barSty.top) + fracDivDown * (barHeight - thmHeight))+'px';
	
	 // If we're looping, set a timeout to scroll by amount again.
	 if (loop) setTimeout(myName + '.scrollBy(' + amount + ')', loop);


	 
}
}	
 




// *** SCROLL THUMB DRAGGING EVENT HANDLERS ***

function scrThumbDown(evt)
{

 // Set a variable pointing to the active scroller - this scroller object.
 activeScr = this;

 // Offset of mouse cursor within the scrollbar by browser, first IE then NS 6 then 4...
 if (document.all) scrOffset = event.offsetY;
 else scrOffset = evt.layerY;
 return false;
 
}

function scrThumbMove(evt)
{
if(fetchingData==false)
	{
	  // showInfo(false,'Fetching Data ...',80);   
	 
	 if (isNS4) document.routeEvent(evt);
	
	 // Either return true if no scroller is being dragged (so selections work), or...
	 if (!activeScr) return true;
	 else { with (activeScr)
	 {
	  // Workaround for error in NS...
	  if (isNaN(cTop) || isNaN(cBot)) divLayout();
	
	  // If it's not scrollable, quit.
	  if ((cBot > divHeight) || (thmHeight == barHeight)) return;
	
	  if (document.all) 
	  {
	  newTop = document.body.scrollTop + event.clientY - scrOffset;	  
	  }
	  else 
	  {
	  newTop = evt.pageY - scrOffset;
	  }
	
	  // Test if the thumb is out of range, if so, bring it back, then assign its position.
	  var barTop = parseInt(barSty.top);
	  if (newTop < barTop) newTop = barTop;
	  if (newTop + thmHeight > (barTop + barHeight))
	   newTop = (barTop + barHeight) - thmHeight;
	  thmSty.top = newTop+'px';
	
	  // Fractions of total range moved by the div and scrollbar...
	  fracDivDown = cTop / (divHeight - (cBot - cTop));
	  fracBarDown = (newTop - barTop) / (barHeight - thmHeight);
	
	  // ... then scroll by the required difference to make up.
	  scrollBy((fracBarDown - fracDivDown) * (divHeight - (cBot - cTop)));
	
	  return false;
	 }}
	
	}

}

function scrThumbUp(evt)
{
 if (isNS4) document.routeEvent(evt);
 activeScr = null;
}

/** This is high-level function.
 * It must react to delta being more/less than zero.
 */
function handle(delta) {
  if(fetchingData==false)
	{
        if (delta < 0)
		mainDiv.scrollBy(+50);
        else
		mainDiv.scrollBy(-50);
	}
}


// *** SCROLLBAR BACKGROUND CLICK EVENT HANDLER ***

function scrBarClick(evt) { with (this)
{
	if(fetchingData==false)
	{
	 if (isNS4) document.routeEvent(evt);
	
	 if (document.all) clickPos = document.body.scrollTop + event.clientY;
	 else clickPos = evt.pageY;
	
	 // Page up, or page down?
	 if (clickPos < parseInt(thmSty.top)) scrollBy(cTop - cBot);
	 if (clickPos > (parseInt(thmSty.top) + thmHeight)) scrollBy(cBot - cTop);
	}
}}


// *** LAYOUT HANDLER FOR WINDOW RESIZE ETC ***

function scrLayout() { with (this)
{
 if (!isDyn) return;
 
   var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
 winWidth=myWidth;
 winHeight=myHeight;
 	
if(getRef('contentContainer'))	  
 resizeContainer();
  
 // Minimum values for window sizes.
 if (winWidth < minWinWidth) winWidth = minWinWidth;
 if (winHeight < minWinHeight) winHeight = minWinHeight;
//	alert(   winWidth+ ' ' +  winHeight) 
	//alert(winWidth+' '+winHeight);
 // Loop through divs array, positioning/sizing controls.
 for (count = 0; count < divs.length; count++)
 {
  var tmpObj = getSty(divs[count][0]);
  if (divs[count][1]) tmpObj.left = eval(divs[count][1])+'px';
  if (divs[count][2]) tmpObj.top = eval(divs[count][2])+'px';
  if (divs[count][3])
  {
   var tmpW = eval(divs[count][3]);
   isNS4 ? tmpObj.clip.width = tmpW+'px' : tmpObj.width = tmpW+'px';
  }
  // Don't set the height of the first scrolling div, we have to pick this up later.
  if (divs[count][4] && count != 0)
  {
   var tmpH = eval(divs[count][4]);
	//   isNS4 ? tmpObj.clip.height = tmpH+'px' : tmpObj.height = tmpH+'px';
	if(tmpObj)
	tmpObj.height = tmpH+'px';
  }
 }

 // Set the top, bottom & width clip variables.
 if ((isDOM || isIE4) && !cTop) cTop = 0;
 // This will fix 'undefined' errors in NS.
 if (isNS4) cTop = parseInt(divSty.clip.top);

 // Bar height and clipping parameters, stored here as accessed often. Set width on-the-fly.
 barHeight = eval(divs[1][4]);
 cBot = cTop + eval(divs[0][4]);
 cWidth = eval(divs[0][3]);
 if (isDOM || isIE4) divSty.width = cWidth+'px';

 // Now, display it using updated variables...
 scrollBy(0);
 	alignLabels();
}}


// *** ON LOAD: CAPTURE EVENTS & MISC. SETUP ***

function scrSetup(defaultFile) { with (this)
{
 if (!isDyn) return;

 // References to document objects' properties, stored in scroller object.
 divRef = getRef(divs[0][0]);
 divSty = getSty(divs[0][0]);
 barSty = getSty(divs[1][0]);
 thmSty = getSty(divs[2][0]);

 // Other variables - references to bar and thumb divs, only used locally.
 barRef = getRef(divs[1][0]);
 thmRef = getRef(divs[2][0]);

 if (isNS4)
 {
  barRef.captureEvents(Event.CLICK);
  thmRef.captureEvents(Event.MOUSEDOWN);
  document.captureEvents(Event.MOUSEMOVE | Event.MOUSEUP);
 }

 // Pass events to specific scrollers.
 barRef.onclick = new Function('evt', 'return ' + myName + '.barClick(evt)');
 thmRef.onmousedown = new Function('evt', 'return ' + myName + '.thumbDown(evt)');
 // The mouseMove and mouseUp events are global.
 document.onmousemove = scrThumbMove;
 document.onmouseup = scrThumbUp;


 // For IE4+/NS6, create a new function that stops selections being made when dragging.
 if (document.all) document.onselectstart = new Function('if (activeScr) return false');
 else if (isDOM) document.onselect = new Function('if (activeScr) return false');


 // It's now ready to go, call resize function to set the positions and variables...
 layout();
 fileLoaded();
}}


// Main object of which instances are created.
function DHTMLScroller(myName)
{
 // Some references to objects that are referred to repeatedly for speed.
 this.divRef = null;
 this.divSty = null;
 this.barSty = null;
 this.thmSty = null;

 // Array of objects to move when the window is resized (e.g. scrollbar, arrows).
 this.divs = new Array();

 // Properties.
 this.myName = myName;

 // A non-zero value for loop will cause a scrollBy call to repeat after that many milliseconds.
 this.loop = 0;
 // Minimum height of scrollbar thumb - defaults to 20, set to something else if you want.
 this.minThmHeight = 50;

 this.divHeight = 0;
 this.barHeight = 0;
 this.thmHeight = 0;
 this.cTop = 0;
 this.cBot = 0;
 this.cWidth = 0;

 // Methods - bind to functions above.
 this.fileLoaded = scrFileLoaded;
 this.scrollBy = scrScrollBy;
 this.thumbDown = scrThumbDown;
 this.barClick = scrBarClick;
 this.setup = scrSetup;
 this.layout = scrLayout;
}

/** Event handler for mouse wheel event.
 */




function wheel(event){
        var delta = 0;
        if (!event) /* For IE. */
                event = window.event;
        if (event.wheelDelta) { /* IE/Opera. */
                delta = event.wheelDelta/120;
                /** In Opera 9, delta differs in sign as compared to IE.
                 */
                if (window.opera)
                        delta = -delta;
        } else if (event.detail) { /** Mozilla case. */
                /** In Mozilla, sign of delta is different than in IE.
                 * Also, delta is multiple of 3.
                 */
                delta = -event.detail/3;
        }
        /** If delta is nonzero, handle it.
         * Basically, delta is now positive if wheel was scrolled up,
         * and negative, if wheel was scrolled down.
         */
        if (delta)
                handle(delta);
        /** Prevent default actions caused by mouse wheel.
         * That might be ugly, but we handle scrolls somehow
         * anyway, so don't bother here..
         */
        if (event.preventDefault)
                event.preventDefault();
	event.returnValue = false;

}

/** Initialization code. 
 * If you use your own event management code, change it as required.
 */
 
if (window.addEventListener)
        /** DOMMouseScroll is for mozilla. */
        window.addEventListener('DOMMouseScroll', wheel, false);
/** IE/Opera. */
window.onmousewheel = document.onmousewheel = wheel;

// up arrow down arrow pressed



document.onkeydown = register ;


function register(e)
{
	if (!e) e = window.event;		 
	var code=parseInt(e.keyCode);
	if(code=='38'||code=='40'||code=='33'||code=='34'||code=='32')
	{
		if(e.preventDefault)
			e.preventDefault(); 
		  
	switch(code)
	{
		case 38:		//arrow up
						mainDiv.scrollBy(-30);	
						break;
		case 40:		//arrow down
						mainDiv.scrollBy(+30);	
						break;
		case 33:		//page up
						mainDiv.scrollBy(-150);	
						break;
		case 34:		//page down
						mainDiv.scrollBy(+150);	
						break;		

		case 32:  		if(e.preventDefault)
						getRef('searchId').value=getRef('searchId').value+' ';
						break;																				
	}
	}

//		window.pageYOffset='0px';
	return true;
}


// end keypressed

function RefreshScrollbar()
{
	// Some global variables for the scroller code - scrFirstWidth is only for NS4 resize bug.
	var activeScr = null, scrOffset = 0, winWidth, winHeight, scrFirstWidth = window.innerWidth;		

 	//mainDiv.fileLoaded();
	mainDiv.setup();
	// Back to top...
	mainDiv.layout();

	mainDiv.scrollBy(-1000000);
	//mainDiv.activeScr = null;
}





function printFetchedContent(xmldoc) {
	
	var result_div = getRef('mainContentDiv');       
	var xml_results_count;
	var count_results;

if(FetchBeginningRecord==0)  		//first fetching clear view
   	{    
    result_div.innerHTML='<table id="results_table" class="resultTable" border="0" cellspacing="0" style="margin:1px;"></table>';    
    xml_results_count = xmldoc.getElementsByTagName('count');
    count_results=xml_results_count[0].firstChild.nodeValue;   

    TotalRequestedRecords = count_results;
    if(TotalRequestedRecords>40)
    	{
	   	getSty('mainContentDiv').height=((parseInt(count_results)+1)*(TeoreticalHeight2))+'px'; 
		RefreshScrollbar(); 
		alignLabels();
	    generateColumnLabels(); 	
		}
   	}
   	
   	var xml_results_names = xmldoc.getElementsByTagName('result');   	   
   	var number_of_items = xml_results_names.length;
   
	showInfo(false,'',80);
   	
   	if(number_of_items>0)
	   {	
    	     
       var tmp_divId;  
	   for (var i = 0; i < number_of_items; i++) {		    				
			tmp_divId = FetchBeginningRecord+i;
			
	    var tbl = window.document.getElementById('results_table');
  		var row = tbl.insertRow(tbl.rows.length); 
  		row.className=(tmp_divId%2?'rowStyle':'rowStyle2');
	
	/*
	  	  // text cell (0)
  		  var cellText0 = row.insertCell(0);
		  cellText0.innerHTML='<b>'+(tmp_divId+1)+'</b>'; 
		  cellText0.width="3%";
		  cellText0.className="center";
	*/	  
		  // text cell (1)
		  var cellText0 = row.insertCell(0);
		  cellText0.innerHTML='<a href="/applicationsanddecisions/Decisions/'+xml_results_names[i].getElementsByTagName('dec_year')[0].firstChild.nodeValue+'/'+xml_results_names[i].getElementsByTagName('dec_name')[0].firstChild.nodeValue+'.asp" >'+xml_results_names[i].getElementsByTagName('dec_title')[0].firstChild.nodeValue+'</a>';
		  cellText0.style.height=rowHeight+'px';
		  cellText0.setAttribute('id','row'+tmp_divId); //row id
  		  cellText0.width="10%";
  		  cellText0.className="center";
  		  cellText0.style.verticalAlign='middle';

		  // text cell (2)
  		  var cellText1 = row.insertCell(1);
		  cellText1.innerHTML=(xml_results_names[i].getElementsByTagName('dec_applicant')[0].firstChild?xml_results_names[i].getElementsByTagName('dec_applicant')[0].firstChild.nodeValue:'');
  		  cellText1.width="15%";
		  cellText1.className="center"; 	
		  cellText1.style.verticalAlign='middle';	  
		  // text cell (3)
  		  var cellText2 = row.insertCell(2);
		  cellText2.innerHTML='<a href="/applicationsanddecisions/Decisions/'+xml_results_names[i].getElementsByTagName('dec_year')[0].firstChild.nodeValue+'/'+xml_results_names[i].getElementsByTagName('dec_name')[0].firstChild.nodeValue+'.asp" >'+(xml_results_names[i].getElementsByTagName('dec_authority')[0].firstChild?xml_results_names[i].getElementsByTagName('dec_authority')[0].firstChild.nodeValue:'')+'</a>';
  		  cellText2.width="17%";		  
		  cellText2.className="center";  	
		  cellText2.style.verticalAlign='middle';	  	  
		  // text cell (4)
  		  var cellText3 = row.insertCell(3);
		  cellText3.innerHTML='<a href="/applicationsanddecisions/Decisions/'+xml_results_names[i].getElementsByTagName('dec_year')[0].firstChild.nodeValue+'/'+xml_results_names[i].getElementsByTagName('dec_name')[0].firstChild.nodeValue+'.asp" >'+(xml_results_names[i].getElementsByTagName('dec_description')[0].firstChild?xml_results_names[i].getElementsByTagName('dec_description')[0].firstChild.nodeValue:'')+'</a>';
  		  cellText3.width="35%";		  		  
 		  cellText3.className="description";  
 		  cellText3.style.verticalAlign='middle';	  
		     
		  // text cell (5)
  		  var cellText4 = row.insertCell(4);
		  cellText4.innerHTML=(xml_results_names[i].getElementsByTagName('dec_dateIssued')[0].firstChild?xml_results_names[i].getElementsByTagName('dec_dateIssued')[0].firstChild.nodeValue:'');
  		  cellText4.width="10%";		  		  
		  cellText4.className="center";
		  cellText4.style.verticalAlign='middle';	  
		  // text cell (5)
  		  var cellText5 = row.insertCell(5);
		  cellText5.innerHTML=(xml_results_names[i].getElementsByTagName('dec_link')[0].firstChild?'<a href="/'+xml_results_names[i].getElementsByTagName('dec_link')[0].firstChild.nodeValue+'" ><img src="/web/Templates/decisionsSearch_files/img/pdf.gif" alt="pdf icon" border="0"></a> ':'');
  		  cellText5.width="3%";		  		  
		  cellText5.className="center";
		  cellText5.style.verticalAlign='middle';	  
		  // text cell (6)
  		  var cellText6 = row.insertCell(6);
		  cellText6.innerHTML=(xml_results_names[i].getElementsByTagName('sections')[0].firstChild!=null?xml_results_names[i].getElementsByTagName('sections')[0].firstChild.nodeValue:'');
  		  cellText6.width="10%";		  		  
		  cellText6.className="center";
		  cellText6.style.verticalAlign='middle';	  
 
		
  	
	       }  
		
		if(TotalRequestedRecords<41)
    	{
	   	getSty('mainContentDiv').height=getRef('results_table').offsetHeight+30+'px'; 
		RefreshScrollbar(); 
		alignLabels();
	    generateColumnLabels(); 	
		}
		    
		} 
	else
		{
		  
		  	showInfo(true,'no matching results found... ',80);
		  	 				
	
		}	

	
    FetchEndingRecord=FetchBeginningRecord+number_of_items;
    if(TotalRequestedRecords!=0&&TotalRequestedRecords!=NaN)
    getRef('fetched_info').innerHTML='<div style="border:1px solid #C4B98C;padding:2px;">Result: <b>'+TotalRequestedRecords+'</b></div>';	   
   else
    getRef('fetched_info').innerHTML='<div style="border:1px solid #C4B98C;padding:2px;">No results</div>';	   
    
	if(number_of_items)
	{  
	if(checkResults())
	{
	showInfo(false,'',80); 	
	SearchChanging=false;
    fetchingData=false;	
    }
	}
	else
	{
	showInfo(false,'',80); 	
	showInfo(true,'no matching results found... ',80);
	SearchChanging=false;
    fetchingData=false;	 
	}
}

function makeRequest(url) {
  //getRef('count_info').innerHTML=url;
  //alert(url);
   	fetchingData=true;			
   	   	makeHttpRequest(url, 'printFetchedContent',true);
   
}

function request(init) {
	if(FetchEndingRecord<TotalRequestedRecords||init==true)
	{
		
	var searchforyear='';
	var foryear='';
	var searchforsection='';
	var insection='';
	var searchforstatus='';
	var instatus='';
		
		if(init==true)
			{
			    TotalRequestedRecords=0;
				PageSize=40;
				FetchBeginningRecord=0;
				FetchEndingRecord=FetchBeginningRecord+PageSize;  
				  
				
				RequestSearch=document.getElementById('searchId').value;				
				
				if(document.getElementById('searchYear').value!=0)
				{
				searchforyear='&year='+document.getElementById('searchYear').value;
				foryear=' in year '+document.getElementById('searchYear').value;
				}
				if(document.getElementById('searchExceptions').value!=0)
				{
				searchforsection='&section='+document.getElementById('searchExceptions').value;	
				insection=' in specified section';			
				}
				if(document.getElementById('searchStatus').value!=0)
				{
				searchforstatus='&status='+document.getElementById('searchStatus').value;	
				instatus=' with specified status';			
				}
				
				createCookie('searchYear',document.getElementById('searchYear').value,0);
				createCookie('searchExceptions',document.getElementById('searchExceptions').value,0);
				createCookie('searchStatus',document.getElementById('searchStatus').value,0);
						
				

				showInfo(false,'',80); 
				
				if(RequestSearch)
				showInfo(true,message_loadingNext,80);
				else
				showInfo(true,message_loadingAll,80);
			}  
		else
			{	
				if(FetchEndingRecord<TotalRequestedRecords)
				{    
				FetchBeginningRecord=FetchEndingRecord;
			
				if(TotalRequestedRecords>FetchEndingRecord+PageSize)
					FetchEndingRecord=FetchEndingRecord+PageSize;
					else
					FetchEndingRecord=TotalRequestedRecords;
					
				if(document.getElementById('searchYear').value!=0)
				{
				searchforyear='&year='+document.getElementById('searchYear').value;
				foryear=' in year '+document.getElementById('searchYear').value;
				}
				if(document.getElementById('searchExceptions').value!=0)
				{
				searchforsection='&section='+document.getElementById('searchExceptions').value;		
				insection=' in specified section';		
				}

				if(document.getElementById('searchStatus').value!=0)
				{
				searchforstatus='&status='+document.getElementById('searchStatus').value;	
				instatus=' with specified status';			
				}
				
				createCookie('searchYear',document.getElementById('searchYear').value,0);
				createCookie('searchExceptions',document.getElementById('searchExceptions').value,0);
				createCookie('searchStatus',document.getElementById('searchStatus').value,0);
				
			    showInfo(true,message_loadingNext,80);	
				}
			}
		createCookie('RequestColumn',RequestColumn,0);
		createCookie('RequestOrder',RequestOrder,0);
		
		
		makeRequest('/web/Templates/decisionsSearch_files/request/request_count2.php?fetch=true'+(init?'&count=true':'')+'&start='+(FetchBeginningRecord)+'&stop='+(FetchEndingRecord)+'&sort='+RequestColumn+'&order='+RequestOrder+'&searchText='+RequestSearch+searchforyear+searchforsection+searchforstatus); 	
	}	
}

function checkResults(){
  
if(getRef('row'+(FetchEndingRecord-1)))
{
	   if(getElementTop('row'+(FetchEndingRecord-1))<winHeight&&TotalRequestedRecords!=FetchEndingRecord)	
	   {		    
	   request(false); 	
	   return false;
	   }
		else
	   {
	     return true;
	   }	
}
request(false); 
return false;
  
}

function showInfo(show,message,offset)
{
  if(show)
  {
  	if(getSty('info_message').display!='block')
	{	 
	currentWindowWidth=winWidth;
	currentWindowHeight=winHeight;

  	getSty('info_message').left=parseInt(currentWindowWidth/2-offset-20)+'px';
  	getSty('info_message').top=parseInt(currentWindowHeight/2+50)+'px';
  	getSty('info_message').display='block';
  	getRef('info_message').innerHTML=message;
  	}
  }
	else
	getSty('info_message').display='none';	
}

function alignLabels(){												// scrollbar left right changes
getSty('table_labels').top=(innerDivY-12)+'px';
getSty('table_labels').left=(innerDivX+correction)+'px';						// remove 20 if scrollbar is on right
getSty('table_labels').width=(innerDivWidth-5-correction)+'px';
}

function getQueryVariable(variable) {
  var query = window.location.search.substring(1);
  var vars = query.split("&");
  for (var i=0;i<vars.length;i++) {
    var pair = vars[i].split("=");
    if (pair[0] == variable) {
      return pair[1];
    }
  } 
  return false;
}


-->
