//########################################################################
// H. Tracy Hall site main javascript file

// preload the bubble stuff
		if (document.images) {
		}



//////////////////////////////////////////////////////////////////////////////////
// cookies... 
		function setCookie(keyOf,valueSet,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 = keyOf+"="+valueSet+expires+"; path=/";
		}
		
		function readCookie(keyOf) {
			var nameEQ = keyOf + "=";
			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 '';
		}
		
		function eraseCookie(keyOf) {
			createCookie(keyOf,"",-1);
		}
		
//////////////////////////////////////////////////////////////////////////////////




//////////////////////////////////////////////////////////////////////////////////
// general utility
		function urldecode(str) {
		    var ret = str;
		    ret = ret.replace(/\+/g, '%20');
		    ret = decodeURIComponent(ret);
		    ret = ret.toString();
		    return ret;
		}
		function urlencode(clearString) {
		  var output = '';
		  var x = 0;
		  clearString = clearString.toString();
		  var regex = /(^[a-zA-Z0-9_.]*)/;
		  while (x < clearString.length) {
		    var match = regex.exec(clearString.substr(x));
		    if (match != null && match.length > 1 && match[1] != '') {
		    	output += match[1];
		      x += match[1].length;
		    } else {
		      if (clearString[x] == ' ')
		        output += '+';
		      else {
		        var charCode = clearString.charCodeAt(x);
		        var hexVal = charCode.toString(16);
		        output += '%' + ( hexVal.length < 2 ? '0' : '' ) + hexVal.toUpperCase();
		      }
		      x++;
		    }
		  }
		  return output;
		}
		function addslashes(str) {
			return str.replace('/(["\'\])/g', "\\$1").replace('/\0/g', "\\0");
		}
		function stripslashes(str) {
			return str.replace('/\0/g', '0').replace('/\(.)/g', '$1');
		}


		function in_array(needle, haystack)	{
			for (h in haystack) {
				if (haystack[h] == needle) {
				  return h;
				}
			}
			return false;
		}

		function strstr(haystack,needle,bool) {
		    var pos = 0;
		    pos = haystack.indexOf( needle );
		    if(pos == -1) {
		        return false;
		    } else {
		        if(bool) {
		            return haystack.substr(0,pos);
		        } else{
		            return haystack.slice(pos);
		        }
		    }
		}


		function setOptions(selBox, dataArr, dispArr) {
		   //alert("Setting: "+dispArr[0]);
			selBox.options.length = 1; // 0 to overwrite the first default option 
			//if (chosenOne != "") {
			  //dataArr = dataArr[chosenOne];
			  //dispArr = dispArr[chosenOne];
			//}
			//alert("num: "+dataArr.length);
			if (dataArr) {
				for(var i=0;i < dataArr.length;i++) {
					  selBox.options[selBox.options.length] = new Option(urldecode(dispArr[i]),dataArr[i]);
				}
			}
			// chooseWhich
		}



//////////////////////////////////////////////////////////////////////////////////




//////////////////////////////////////////////////////////////////////////////////
// application specific functions... 

var homeHtmlStr = '<p align="center" class="regstrSans">The H. Tracy Hall Foundation is devoted to information and studies in high pressure/high temperature<br \>processes and to the "Superhard Materials" created by these processes.</p>'+
'<p class="regSans" style="width: 700px; margin-left: 100px;">We maintain a <a href="javascript:openArticlesSearch()" class="regSans" style="text-decoration: underline;">searchable database</a> of bibliographic references on high pressure science (from the year 1900), a <a href="javascript:openPeoplePlaces()" class="regSans" style="text-decoration: underline;">list of scientists</a> specializing in high pressure/high temperature, a <a href="javascript:openPeoplePlaces()" class="regSans" style="text-decoration: underline;">list of laboratories</a> involved in high pressure/high temperature research and applications, <a href="javascript:openNews()" class="regSans" style="text-decoration: underline;">news</a> relating to the discipline of high pressure/high temperature science, and a <a href="javascript:openNews()" class="regSans" style="text-decoration: underline;">calendar</a> of upcoming conferences and events relating to the study and technological application of high pressure/high temperature.</p>'+
'<p class="regSans" style="width: 700px; margin-left: 100px;">High pressure/high temperature has astounding transformative capacity.  It can convert everyday substances into useful and spectacular crystals or turn common gases such as oxygen into exotic metals. It can also convert coal into diamonds.</p>'+
'<p class="tinySans" style="width: 700px; margin-left: 100px;"><br \><br \><br \><br \>On a winter morning in December of 1954, Dr. H. Tracy Hall, a 35 year old scientist working in the Knolls GE research laboratory in Schenectady, NY, broke open a sample cell from the latest experiment in his three-year long efforts to make diamond from graphite.  As he held the  fragments up to the windows of the laboratory, his eyes caught the glint of sunlight reflecting off many tiny triangular faces.  Tracy\'s heart began to beat wildly and his hands began to tremble.  His legs grew weak and he had to find a place to sit down; Tracy realized that he had finally succeeded in making diamonds.</p>';

var dateNow = new Date();






//###################################################################################################

		function openArticlesSearch() {
			var myYear = dateNow.getYear();
			if (myYear < 2000) {
			  myYear += 1900;
			}
			//alert("yr"+myYear);
		   var mainContentBox = document.getElementById("innerContent");
			var newHTMLstring = 
			"<div id='subContentBox'><form id='searchArticlesForm' onSubmit='return submitSearch(0);'><div id='hdSB' style='position:absolute; left:0px; top:2px; width:900px; text-align: center;' class='regstrSans'><span class='regstrSans'>Search the Articles Database</span><br \><span class='tinySans'>(Updated "+articlesUpDate+")</span>";
			// form here
			newHTMLstring += "";
			newHTMLstring += "<br \><br \><span class='tinystrSans'>Search for: <input type='text' name='keyword' size='40'></span>";
			newHTMLstring += " &nbsp; &nbsp;<span class='tinyeststrSans'><a href='#' onclick='showSearchTips()' class='tinyeststrSans'>Search Tips:</a></span><br \>";
			newHTMLstring += "<div id='hdCB' style='position: absolute; left: 390px; width:200px; text-align: left;'><br \><input type='checkbox' name='inTitle' checked> In Titles";
			newHTMLstring += "<br \><input type='checkbox' name='inJournal'> In Journal Names";
			newHTMLstring += "<br \><input type='checkbox' name='inAuthor'> In Authors</div>";
			newHTMLstring += "<br \><br \><br \><br \><br \><br \>For Articles Published Between:";
			newHTMLstring += "<br \><select name='yrFrom' size='0' class='tinySans'>";
			var i = 1900;
			var selcStr = "";
			for (i=1900; i<= myYear; ++i) {
			  if (i == myYear - 10) {
			    selcStr = " selected";
			  } else {
			    selcStr = "";
			  }
			  newHTMLstring += "<option value='"+i+"'"+selcStr+">"+i+"</option>";
			}
			newHTMLstring += "</select> &nbsp; &nbsp;and &nbsp; &nbsp;";
			newHTMLstring += "<select name='yrTo' size='0' class='tinySans'>";
			var i = 1900;
			var selcStr = "";
			for (i=1900; i<= myYear; ++i) {
			  if (i == myYear) {
			    selcStr = " selected";
			  }
			  newHTMLstring += "<option value='"+i+"'"+selcStr+">"+i+"</option>";
			}
			newHTMLstring += "</select>";
			newHTMLstring += "<br \><br \><br \><input type='submit' name='SubmitForm' class='tinystr' value='Proceed'></form>";
			newHTMLstring += "</div><div id='closerRes' style='position: absolute; left:860px; top:5px; width:14px; height:13px; z-index:7; visibility: hidden;'><a href='javascript:clearSearchResults()'><img src='images/layout/infowindow/close.gif' width='14' height='13' border='0' alt=''></a></div><div id='searchResults' style='position: relative; left:2px; top:4px; width:890px; height:434px; border: 1px dashed #707070; background-color: #fdfdfb; z-index: 6; overflow: auto; visibility: hidden;' class='regSans'></div>";
			newHTMLstring += "<div id='searchTips' style='position: absolute; left:610px; top: 90px; width:270px; height:310px; border: 1px dashed #707070; background-color: #fdfdfb; z-index: 5; padding: 5px; overflow: auto; visibility: hidden;' class='tinySans'><b>A.  Exact search queries</b> can be made using single or composite search terms similar to the following:  '<b>diamond</b>', '<b>carbon</b>', '<b>(carbon atom)</b>', or '<b>carbon-atom</b>'.<br><br>Example: Queries similar to'<b>(carbon atom)</b>' will return results that match the exact configuration of the search terms.  This query without <b>( )</b> will be split at the spaces between terms and run as an <b>OR</b> search. Example: '<b>carbon atom</b>' will match entries that have either carbon or atom.<br><br><b>B.</b>  When creating an advanced query using logical operators ('<b>AND</b>', '<b>OR</b>' or '<b>NOT</b>'), enclose all distinct search terms between <b>(</b> and <b>)</b>.  Without the <b>( )</b> characters, advanced queries will not run.<br><br><b>(carbon)+(atom)</b>:  <b>(AND)</b>  Use the '<b>+</b>' operator between each term in the search query to make an '<b>AND</b>' search.  Example: '<b>(diamond)+(carbon)</b>' will return entries that have both '<b>diamond</b>' AND '<b>carbon</b>' in the requested fields.<br><br><b>(diamond)|(carbon)</b>:  <b>(OR)</b>  Use the '<b>|</b>' operator between each term in the search query to make an '<b>OR</b>' search.  Example: '<b>(diamond)|(carbon)</b>' will return entries that have EITHER '<b>diamond</b>' <b>OR</b> '<b>carbon</b>' in the requested fields.<br><br><b>diamond-(carbon)</b>:  <b>(NOT)</b> Use the '<b>-</b>' operator between the terms in the search query to exclude terms <b>NOT</b> matching '<b>diamond</b>'.  Example: searching for '<b>element -(carbon)</b>' will return results that match '<b>element</b>'  but <b>NOT</b> '<b>carbon</b>'<br><br>Queries that produce more than 1000 hits will not give an output.  It will be necessary to adjust the query parameters to produce and output of less than 1000 hits.  This will allow the search results to be displayed. All results are displayed 50 per page.<br><br></div><div id='tipHider' style='position: absolute; top: 65px; left: 720px; z-index: 5; visibility: hidden;'><span class='tinyeststrSans'><a href='#' onclick='hideSearchTips()' class='tinyeststrSans'>Hide</a></span></div>"+"";
		  mainContentBox.innerHTML = newHTMLstring;
		}
		
		function submitSearch(offset) {
		  if (!offset) offset = 0;
		   //alert("Submitting Query"+offset);
		   var myWait = document.getElementById("oneMoment");
		   myWait.style.visibility = "visible";
		   var myForm = document.getElementById("searchArticlesForm");
		   var myYrFrom = myForm.yrFrom.options[myForm.yrFrom.selectedIndex].value;
		   //alert("myYrFrom "+myYrFrom);
		   var myYrTo = myForm.yrTo.options[myForm.yrTo.selectedIndex].value;
		   if (myYrFrom > myYrTo) {
		     alert("Please choose a valid date range.");
		     return false;
		   }
		   
		   
		   myForm.SubmitForm.value = "Searching...  One Moment";
			try {
			 rqS = new XMLHttpRequest();
			} catch (error) {
			 try {
			   rqS = new ActiveXObject("Microsoft.XMLHTTP");
			 } catch (error) {
			   return false;
			 }
			}
			rqS.onreadystatechange = searchRqHandler;
		   rqS.open("POST", "articlesSearch.php");
			rqS.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
			//var rqVars = null;
			var rqVars = "keyword="+urlencode(myForm.keyword.value)
				+"&myYrFrom="+myYrFrom
				+"&myYrTo="+myYrTo
				+"&inTitle="+myForm.inTitle.checked
				+"&inJournal="+myForm.inJournal.checked
				+"&inAuthor="+myForm.inAuthor.checked
				+"&offset="+offset;
				//+"&comments="+myForm.comments.value;
			rqS.send(rqVars);
		   return false;
		}
		function searchRqHandler() {
		  if (rqS.readyState == 4) {
			 if (rqS.status == 200) {
		   	var myWait = document.getElementById("oneMoment");
		   	myWait.style.visibility = "hidden";
		        var myForm = document.getElementById("searchArticlesForm");
				  var searchResultsTarget = document.getElementById("searchResults");
				  var searchResultsCloser = document.getElementById("closerRes");
				  searchResultsTarget.style.visibility = "visible";
				  searchResultsCloser.style.visibility = "visible";
				  searchResultsTarget.innerHTML = rqS.responseText;
				  searchResultsTarget.scrollTop = 0;
				  myForm.SubmitForm.value = "Proceed";
			 } else {
				  var searchResultsTarget = document.getElementById("searchResults");
				  searchResultsTarget.innerHTML = "an error:";
			 }
		  }
		  return true;
		}
		function clearSearchResults() {
		   var resultsBox = document.getElementById("searchResults");
			resultsBox.innerHTML = "";
			resultsBox.style.visibility = "hidden";
			var searchResultsCloser = document.getElementById("closerRes");
			searchResultsCloser.style.visibility = "hidden";
		}

		function showSearchTips() {
		  var myTips = document.getElementById("searchTips");
		  myTips.style.visibility = "visible";
		  var myHider = document.getElementById("tipHider");
		  myHider.style.visibility = "visible";
		}
		function hideSearchTips() {
		  var myTips = document.getElementById("searchTips");
		  myTips.style.visibility = "hidden";
		  var myHider = document.getElementById("tipHider");
		  myHider.style.visibility = "hidden";
		}
//###################################################################################################










//###################################################################################################


		function openCurrentPapers() {
			var myYear = dateNow.getYear();
			if (myYear < 2000) {
			  myYear += 1900;
			}
			//alert("yr"+myYear);
		   var mainContentBox = document.getElementById("innerContent");
			var newHTMLstring = 
			"<div id='subContentBox'><form name='articlesByCatForm' id='articlesByCatForm' onSubmit='return submitPaperCat(0);'><div id='hdSB' style='position:absolute; left:0px; top:2px; width:900px; text-align: center;' class='regstrSans'><span class='regstrSans'>Current Titles in High Pressure Research (Updated "+currentPapersDate+")</span>";
			// form here
			newHTMLstring += "";
			newHTMLstring += " &nbsp; ~ &nbsp;<span class='tinystrSans'>By Category:</span>";
			newHTMLstring += "<select name='categoryID' size='0' class='tinySans' onchange='submitPaperCat(document.articlesByCatForm.categoryID.options[document.articlesByCatForm.categoryID.selectedIndex].value);'>";
			newHTMLstring += "<option value=''>All (Click to Select a Category)</option>";
			newHTMLstring += "</select>";
			newHTMLstring += "</form>";
			newHTMLstring += "</div><!-- <div id='closerRes' style='position: absolute; left:860px; top:45px; width:14px; height:13px; z-index:7; visibility: hidden;'><a href='javascript:clearSearchResults()'><img src='images/layout/infowindow/close.gif' width='14' height='13' border='0' alt=''></a></div> --><div id='searchResults' style='position: relative; left:2px; top:44px; width:890px; height:404px; border: 1px dashed #707070; background-color: #fdfdfb; z-index: 6; overflow: auto; visibility: hidden;' class='regSans'></div>";
			newHTMLstring += "<div id='papersMsg' style='position: absolute; left:610px; top: 90px; width:270px; height:310px; border: 1px dashed #707070; background-color: #fdfdfb; z-index: 5; padding: 5px; overflow: auto; visibility: hidden;' class='tinySans'></div>"+"";
		  mainContentBox.innerHTML = newHTMLstring;
		  setOptions(document.articlesByCatForm.categoryID, myArticleIds, myArticleCats);
		  submitPaperCat(0);
		}
		function submitPaperCat(offset) {
		  //showPaperTips('One Moment...');
		  if (!offset) offset = 0;
		   //alert("Submitting Query"+offset);
		   var myWait = document.getElementById("oneMoment");
		   myWait.style.visibility = "visible";
		   var myForm = document.getElementById("articlesByCatForm");
		   var myCatChosen = myForm.categoryID.options[myForm.categoryID.selectedIndex].value;
		   //alert("myYrFrom "+myYrFrom);
		   //myForm.SubmitForm.value = "Searching...  One Moment";
			try {
			 rqS = new XMLHttpRequest();
			} catch (error) {
			 try {
			   rqS = new ActiveXObject("Microsoft.XMLHTTP");
			 } catch (error) {
			   return false;
			 }
			}
			rqS.onreadystatechange = paperCatRqHandler;
		   rqS.open("POST", "currentPapers.php");
			rqS.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
			//var rqVars = null;
			var rqVars = "categoryID="+myCatChosen
				+"&offset="+offset;
				//+"&comments="+myForm.comments.value;
			rqS.send(rqVars);
		   return false;
		}
		function paperCatRqHandler() {
		  if (rqS.readyState == 4) {
			 if (rqS.status == 200) {
		   	var myWait = document.getElementById("oneMoment");
		   	myWait.style.visibility = "hidden";
		        var myForm = document.getElementById("articlesByCatForm");
				  var searchResultsTarget = document.getElementById("searchResults");
				  //var searchResultsCloser = document.getElementById("closerRes");
				  searchResultsTarget.style.visibility = "visible";
				  //searchResultsCloser.style.visibility = "visible";
				  searchResultsTarget.innerHTML = rqS.responseText;
				  searchResultsTarget.scrollTop = 0;
				  //myForm.SubmitForm.value = "Proceed";
			 } else {
				  var searchResultsTarget = document.getElementById("searchResults");
				  searchResultsTarget.innerHTML = "an error:";
			 }
		  }
		  return true;
		}
		function clearPaperByCatResults() {
		   var resultsBox = document.getElementById("searchResults");
			resultsBox.innerHTML = "";
			resultsBox.style.visibility = "hidden";
			var searchResultsCloser = document.getElementById("closerRes");
			searchResultsCloser.style.visibility = "hidden";
		}
		function showPaperTips(myDisplayCode) {
		
		  var myTips = document.getElementById("papersMsg");
		  myTips.innerHTML = myDisplayCode;
		  myTips.style.visibility = "visible";
		  //var myHider = document.getElementById("tipHider");
		  //myHider.style.visibility = "visible";
		}
		function hidePaperTips() {
		  var myTips = document.getElementById("papersMsg");
		  myTips.innerHTML = "";
		  myTips.style.visibility = "hidden";
		  //var myHider = document.getElementById("tipHider");
		  //myHider.style.visibility = "hidden";
		}


//###################################################################################################


		function openPeoplePlaces() {
		   var mainContentBox = document.getElementById("innerContent");
			var newHTMLstring = 
			"<div id='subContentBox'><div id='hdSB' style='position:absolute; left:0px; top:2px; width:900px; height:30px; text-align: center;' class='regstrSans'><span class='regstrSans'>List of Scientists and Facilities involved in High Pressure/High Temperature</span><br><br><span class='regSans'>Coming Soon...<br><br>We are building a new Scientists and Facilities Directory database.<br>Please <a href='javascript:openContactUs()' class='regstrSans'>contact us</a> if you wish to be included in this list,<br>or have contact information you believe should be included in this list.</span>";
			// form here 
			newHTMLstring += "</div>";
		  mainContentBox.innerHTML = newHTMLstring;
		}
		
		function openNews() {
		   var mainContentBox = document.getElementById("innerContent");
			var newHTMLstring = 
			"<div id='subContentBox'><div id='hdSB' style='position:absolute; left:0px; top:0px; width:900px; height:30px; text-align: center;' class='regstrSans'><span class='tinystrSans'>News and Events in the field of High Pressure/High Temperature</span>";
			newHTMLstring += "</div>";
			newHTMLstring += "<div style='text-align: left; width: 300px; height: 20px; background-color: #f8f7e2; border: 1px dotted #8f8f8f; position: absolute; top: 20px; left: 0px; overflow: hidden;'><span class='tinystr'> &nbsp; &nbsp; &nbsp; News:</span></div><div style='text-align: left; width: 290px; height: 390px; border: 1px dotted #8f8f8f; position: absolute; top: 40px; left: 0px; padding: 5px 5px 5px 5px; overflow: auto; overflow-x: hidden;'><div id='newsResults'></div></div>";
			newHTMLstring += "<div style='text-align: left; width: 300px; height: 20px; background-color: #f8f7e2; border: 1px dotted #8f8f8f; position: absolute; top: 20px; left: 300px; overflow: hidden;'><span class='tinystr'> &nbsp; &nbsp; &nbsp; Events:</span></div><div style='text-align: left; width: 290px; height: 390px; border: 1px dotted #8f8f8f; position: absolute; top: 40px; left: 300px; padding: 5px 5px 5px 5px; overflow: auto; overflow-x: hidden;'><div id='eventsResults'></div></div>";
			newHTMLstring += "<div style='text-align: left; width: 298px; height: 20px; background-color: #f8f7e2; border: 1px dotted #8f8f8f; position: absolute; top: 20px; left: 600px; overflow: hidden;'><span class='tinystr'> &nbsp; &nbsp; &nbsp; Links:</span></div><div style='text-align: left; width: 288px; height: 390px; border: 1px dotted #8f8f8f; position: absolute; top: 40px; left: 600px; padding: 5px 5px 5px 5px; overflow: auto; overflow-x: hidden;'><div id='linksResults'></div></div>";
		   mainContentBox.innerHTML = newHTMLstring;
			setTimeout('submitNewsSearch(0)', 100);
			setTimeout('submitEventsSearch(0)', 200);
			setTimeout('submitLinksSearch(0)', 300);
		}


		function submitNewsSearch(offset) {
		  if (!offset) offset = 0;
		   //alert("Submitting News Search"+offset);
		   //var myWait = document.getElementById("oneMoment");
		   //myWait.style.visibility = "visible";
		   //var myForm = document.getElementById("searchArticlesForm");
		   //var myYrFrom = myForm.yrFrom.options[myForm.yrFrom.selectedIndex].value;
		   //alert("myYrFrom "+myYrFrom);
		   //var myYrTo = myForm.yrTo.options[myForm.yrTo.selectedIndex].value;
		   //if (myYrFrom > myYrTo) {
		     //alert("Please choose a valid date range.");
		     //return false;
		   //}
		   
		   
		   //myForm.SubmitForm.value = "Searching...  One Moment";
			try {
			 rqNews = new XMLHttpRequest();
			} catch (error) {
			 try {
			   rqNews = new ActiveXObject("Microsoft.XMLHTTP");
			 } catch (error) {
			   return false;
			 }
			}
			rqNews.onreadystatechange = newsRqHandler;
		   rqNews.open("POST", "newsSearcher.php");
			rqNews.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
			//var rqVars = null;
				//+"&myYrFrom="+myYrFrom
				//+"&myYrTo="+myYrTo
			var rqVars = "keyword="+urlencode("yada")
				+"&newsStatus=Active";
				//+"&comments="+myForm.comments.value;
			rqNews.send(rqVars);
		   return false;
		}
		function newsRqHandler() {
		  if (rqNews.readyState == 4) {
			 if (rqNews.status == 200) {
		   	//var myWait = document.getElementById("oneMoment");
		   	//myWait.style.visibility = "hidden";
		        //var myForm = document.getElementById("searchArticlesForm");
				  var newsResultsTarget = document.getElementById("newsResults");
				  //var searchResultsCloser = document.getElementById("closerRes");
				  newsResultsTarget.style.visibility = "visible";
				  //searchResultsCloser.style.visibility = "visible";
				  newsResultsTarget.innerHTML = rqNews.responseText;
				  newsResultsTarget.scrollTop = 0;
				  //myForm.SubmitForm.value = "Proceed";
			 } else {
				  var newsResultsTarget = document.getElementById("newsResults");
				  newsResultsTarget.innerHTML = "an error:";
			 }
		  }
		  return true;
		}
		function submitEventsSearch(offset) {
		  if (!offset) offset = 0;
			try {
			 rqEvents = new XMLHttpRequest();
			} catch (error) {
			 try {
			   rqEvents = new ActiveXObject("Microsoft.XMLHTTP");
			 } catch (error) {
			   return false;
			 }
			}
			rqEvents.onreadystatechange = eventsRqHandler;
		   rqEvents.open("POST", "eventsSearcher.php");
			rqEvents.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
			//var rqVars = null;
				//+"&myYrFrom="+myYrFrom
				//+"&myYrTo="+myYrTo
			var rqVars = "keyword="+urlencode("yada")
				+"&eventStatus=Active";
				//+"&comments="+myForm.comments.value;
			rqEvents.send(rqVars);
		   return false;
		}
		function eventsRqHandler() {
		  if (rqEvents.readyState == 4) {
			 if (rqEvents.status == 200) {
		   	//var myWait = document.getElementById("oneMoment");
		   	//myWait.style.visibility = "hidden";
		        //var myForm = document.getElementById("searchArticlesForm");
				  var eventsResultsTarget = document.getElementById("eventsResults");
				  //var searchResultsCloser = document.getElementById("closerRes");
				  eventsResultsTarget.style.visibility = "visible";
				  //searchResultsCloser.style.visibility = "visible";
				  eventsResultsTarget.innerHTML = rqEvents.responseText;
				  eventsResultsTarget.scrollTop = 0;
				  //myForm.SubmitForm.value = "Proceed";
			 } else {
				  var eventsResultsTarget = document.getElementById("eventsResults");
				  eventsResultsTarget.innerHTML = "an error:";
			 }
		  }
		  return true;
		}
		function submitLinksSearch(offset) {
		
		  if (!offset) offset = 0;
			try {
			 rqLinks = new XMLHttpRequest();
			} catch (error) {
			 try {
			   rqLinks = new ActiveXObject("Microsoft.XMLHTTP");
			 } catch (error) {
			   return false;
			 }
			}
			rqLinks.onreadystatechange = linksRqHandler;
		   rqLinks.open("POST", "linksSearcher.php");
			rqLinks.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
			var rqVars = "keyword="+urlencode("yada")
				+"&urlStatus=Active";
			rqLinks.send(rqVars);
		   return false;
		}
		function linksRqHandler() {
		  if (rqLinks.readyState == 4) {
			 if (rqLinks.status == 200) {
			 //alert("rec links res"+qLinks.responseText);
				  var linksResultsTarget = document.getElementById("linksResults");
				  linksResultsTarget.style.visibility = "visible";
				  linksResultsTarget.innerHTML = rqLinks.responseText;
				  linksResultsTarget.scrollTop = 0;
			 } else {
				  var linksResultsTarget = document.getElementById("linksResults");
				  linksResultsTarget.innerHTML = "an error:";
			 }
		  }
		  return true;
		}















		function openContactUs() {
		   var mainContentBox = document.getElementById("innerContent");
		   var myCkdEmail = urldecode(readCookie("fromEmail"));
		   var myCkdName = urldecode(readCookie("fromName"));
			var newHTMLstring = 
			"<div id='subContentBox'><div id='hdSB' style='position:absolute; left:50px; top:2px; width:800px; height:30px; text-align: center;' class='regstrSans'><span class='regstrSans'>Contact the H. Tracy Hall Foundation</span>";
			newHTMLstring += "<form name='formSuggest' onSubmit='makeSuggRq(); return false;'>";
			newHTMLstring += "<input type='hidden' name='myMoreInfoID' value=''>";
			newHTMLstring += "<div style='position:absolute; left:140px; top:50px; width:420px; height:20px; text-align: right; z-index:42;'><span class='tinyeststrSans'>Your Name: <span>";
			newHTMLstring += "<span class='tinyestSans'><input name='fromName' class='forMatt1' type='text' value='"+myCkdName+"' size='40' style='width: 300px;'><span></div>";
			newHTMLstring += "<div style='position:absolute; left:140px; top:80px; width:420px; height:20px; text-align: right; z-index:42;'><span class='tinyeststrSans'>Your Email: <span>";
			newHTMLstring += "<span class='tinyestSans'><input name='fromEmail' class='forMatt1' type='text' value='"+myCkdEmail+"' size='40' style='width: 300px;'><span></div>";
			newHTMLstring += "<div style='position:absolute; left:60px; top:110px; width:580px; height:300px; text-align: left; z-index:42;'><span class='tinyeststrSans'>Your Comments: <span><br \>";
			newHTMLstring += "<span class='tinyestSans'><textarea name='comments' cols='20' rows='8' class='forMattTextArea1' style='height: 200px; width: 680px;' wrap='soft'></textarea><span></div>";
			newHTMLstring += "<div style='position:absolute; left:270px; top:355px; width:300px; height:40px; text-align: left; z-index:42;'><span class='tinyeststrSans'><input type='submit' name='SubmitForm' class='tinystr' value='Send Comments'><span> &nbsp; &nbsp; &nbsp;";
			newHTMLstring += "<span class='tinyestSans'><input type='reset' name='ResetForm' class='tinystr' value='Clear Form'><span></div>";
			newHTMLstring += "</form>";
			newHTMLstring += "";
			newHTMLstring += "<div id='messageState' style='position:absolute; left:175px; top:140px; width:430px; height:200px; z-index:43; visibility: hidden;' class='warningBox'></div>";
			newHTMLstring += "<div id='warnXcloser' style='position:absolute; left:590px; top:143px; width:14px; height:13px; z-index:44; visibility: hidden;'><a href='javascript:clearWarningBox()'><img src='images/layout/infowindow/close.gif' width='14' height='13' border='0' alt=''></a></div>";
			//newHTMLstring += "<div id='bkSB' style='position:absolute; left:25px; top:75px; width:630px; height:480px; background-color: #FFFFFF; z-index:41'></div>";
			newHTMLstring += "</div>";
		  mainContentBox.innerHTML = newHTMLstring;
		}
		function openHome() {
		   var mainContentBox = document.getElementById("innerContent");
		   if (mainContentBox.innerHTML.indexOf("devoted to information and studies") > 0) {
		      //alert("Going to Novatek");
		      document.location.href = "http://www.novatek.com";
		   } else {
		   	mainContentBox.innerHTML = homeHtmlStr;
		   }
		}
		//function openHallInfo() {
		   //var mainContentBox = document.getElementById("innerContent");
			//var newHTMLstring = 
			//"<div id='subContentBox'><div id='hdSB' style='position:absolute; left:0px; top:2px; width:900px; height:30px; text-align: center;'><span class='tinystrSans'>";
			//newHTMLstring += "<iframe src='http://67.50.46.175/History/bio.htm' width='870' height='430' scrolling='auto' border='none'></div>";
			//newHTMLstring += "<span></div>";
		  //mainContentBox.innerHTML = newHTMLstring;
		//}
		
		function clearWarningBox() {
		   var warningBubble = document.getElementById("messageState");
			warningBubble.innerHTML = "";
			warningBubble.style.visibility = "hidden";
		   var warningX = document.getElementById("warnXcloser");
			warningX.style.visibility = "hidden";
		}

		function suggHandler() {
		  if (requester.readyState == 4) {
		  //alert("my response:"+requester.readyState)
			 if (requester.status == 200) {
				  //responseXML or responseText
				  //alert("your response:"+requester.responseText);
				  var suggRqTarget = document.getElementById("messageState");
				  var myCloserX = document.getElementById("warnXcloser");
				  suggRqTarget.innerHTML = requester.responseText;
					suggRqTarget.style.visibility = "visible";
					myCloserX.style.visibility = "visible";
					setTimeout('clearWarningBox();', 5000);
					if (!strstr(requester.responseText,"error")) {
					  setTimeout('openHome();', 7000);
					}
			 } else {
				  var suggRqTarget = document.getElementById("messageState");
				  suggRqTarget.innerHTML = "an error:";
			 }
		  }
		  return true;
		}

		function makeSuggRq() {
			try {
			 requester = new XMLHttpRequest();
			} catch (error) {
			 try {
			   requester = new ActiveXObject("Microsoft.XMLHTTP");
			 } catch (error) {
			   return false;
			 }
			}
			requester.onreadystatechange = suggHandler;
		   requester.open("POST", "suggest.php");
			requester.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
			var rqVars = "myMoreInfoID="+document.formSuggest.myMoreInfoID.value
				+"&fromName="+document.formSuggest.fromName.value
				+"&fromEmail="+document.formSuggest.fromEmail.value
				+"&comments="+document.formSuggest.comments.value;
			requester.send(rqVars);
			return false;
		}

		

		function openCredCheck() {
		   var mainContentBox = document.getElementById("innerContent");
		   var myCkdEmail = urldecode(readCookie("fromEmail"));
		   var myCkdName = urldecode(readCookie("fromName"));
			var newHTMLstring = 
			"<div id='subContentBox'><div id='hdSB' style='position:absolute; left:50px; top:2px; width:800px; height:30px; text-align: center;' class='regstrSans'><span class='regstrSans'>Enter Your Credentials:</span>";
			newHTMLstring += "<form name='formCred' onSubmit='makeCredRq(); return false;'>";
			//newHTMLstring += "<input type='hidden' name='myMoreInfoID' value=''>";
			newHTMLstring += "<div style='position:absolute; left:100px; top:50px; width:420px; height:20px; text-align: right; z-index:42;'><span class='tinyeststrSans'>User Name: <span>";
			newHTMLstring += "<span class='tinyestSans'><input name='logInAs' class='forMatt1' type='text' value='' size='20' style='width: 150px;'><span></div>";
			newHTMLstring += "<div style='position:absolute; left:100px; top:80px; width:420px; height:20px; text-align: right; z-index:42;'><span class='tinyeststrSans'>Password: <span>";
			newHTMLstring += "<span class='tinyestSans'><input name='withPassOf' class='forMatt1' type='password' value='' size='20' style='width: 150px;'><span></div>";
			newHTMLstring += "<div style='position:absolute; left:370px; top:155px; width:300px; height:40px; text-align: left; z-index:42;'><span class='tinyeststrSans'><input type='submit' name='SubmitForm' class='tinystr' value='Proceed'><span>";
			//newHTMLstring += "<span class='tinyestSans'><input type='reset' name='ResetForm' class='tinystr' value='Clear Form'><span></div>";
			newHTMLstring += "</form>";
			newHTMLstring += "";
			newHTMLstring += "<div id='messageState' style='position:absolute; left:-170px; top:-30px; width:430px; height:200px; z-index:43; visibility: hidden;' class='warningBox'></div>";
			newHTMLstring += "<div id='warnXcloser' style='position:absolute; left:240px; top:-25px; width:14px; height:13px; z-index:44; visibility: hidden;'><a href='javascript:clearWarningBox()'><img src='images/layout/infowindow/close.gif' width='14' height='13' border='0' alt=''></a></div>";
			//newHTMLstring += "<div id='bkSB' style='position:absolute; left:25px; top:75px; width:630px; height:480px; background-color: #FFFFFF; z-index:41'></div>";
			newHTMLstring += "</div>";
		  mainContentBox.innerHTML = newHTMLstring;
		}
		function credHandler() {
		  if (requester.readyState == 4) {
		  //alert("my response:"+requester.readyState)
			 if (requester.status == 200) {
				  //responseXML or responseText
				  //alert("your response:"+requester.responseText);
				  var credRqTarget = document.getElementById("messageState");
				  var myCloserX = document.getElementById("warnXcloser");
				  //suggRqTarget.innerHTML = requester.responseText;
					credRqTarget.style.visibility = "visible";
					myCloserX.style.visibility = "visible";
					//setTimeout('clearWarningBox();', 5000);
					if (!strstr(requester.responseText,"error")) {
					  credRqTarget.innerHTML = "Forwarding";
					  setTimeout('document.location.href = "'+requester.responseText+'";', 2000);
					} else {
					  credRqTarget.innerHTML = requester.responseText;
					  setTimeout('clearWarningBox();', 5000);
					}
			 } else {
				  var credRqTarget = document.getElementById("messageState");
				  credRqTarget.innerHTML = "an error:";
			 }
		  }
		  return true;
		}

		function makeCredRq() {
			try {
			 requester = new XMLHttpRequest();
			} catch (error) {
			 try {
			   requester = new ActiveXObject("Microsoft.XMLHTTP");
			 } catch (error) {
			   return false;
			 }
			}
			requester.onreadystatechange = credHandler;
		   requester.open("POST", "userAuthenticator.php");
			requester.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
			var rqVars = "logInAs="+document.formCred.logInAs.value
				+"&withPassOf="+document.formCred.withPassOf.value;
			requester.send(rqVars);
			return false;
		}




//////////////////////////////////////////////////////////////////////////////////



//////////////////////////////////////////////////////////////////////////////////
// IE specific junk... 
var arVersion = navigator.appVersion.split("MSIE");
var versionOfIe = parseFloat(arVersion[1]);
if (!versionOfIe) versionOfIe = 0;

		function fixPNG(myImage) { // the IE PNG bug workaround
		    if ((versionOfIe >= 5.5) && (versionOfIe < 7) && (document.body.filters)) {
		       var imgID = (myImage.id) ? "id='" + myImage.id + "' " : ""
			   var imgClass = (myImage.className) ? "class='" + myImage.className + "' " : ""
			   var imgTitle = (myImage.title) ? 
				             "title='" + myImage.title  + "' " : "title='" + myImage.alt + "' "
			   var imgStyle = "display:inline-block;" + myImage.style.cssText
			   //if (myImage.src == "some other image") {
			     //var sizeMethod = "image";
			   //} else {
			     var sizeMethod = "scale";
			   //}
			   //alert(myImage.src);
			   var strNewHTML = "<span " + imgID + imgClass + imgTitle + " style=\"" + "width:" + myImage.width + "px; height:" + myImage.height + "px;" + imgStyle + ";" + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader" + "(src=\'" + myImage.src + "\', sizingMethod=\'"+sizeMethod+"\');\"></span>";
			      myImage.outerHTML = strNewHTML;
		    }
		}

//////////////////////////////////////////////////////////////////////////////////

