var oldContent;
var oldControl;
var bbTimeOutId;
var aryQuickCal = new Array(3);
var intQuickCal = 0;

// -------------------------
function chooseDate () {
// -------------------------
		document.searchform.Interval.options[0].selected = true;
		document.searchform.Interval.options[document.searchform.Interval.options.length-1].selected = true;
} 	
//---------------------------	
function ResetDate () {
//---------------------------	
 if (document.searchform.Interval.selectedIndex != 0)
 {
  document.searchform.dateselected.value = "";
  document.searchform.mydate.value = document.searchform.Interval.options[document.searchform.Interval.selectedIndex].text;
 }
 if (document.searchform.Interval.selectedIndex != (document.searchform.Interval.options.length-1))
 {
  document.searchform.dateselected.value = "";
 }
}

//---------------------------	
function radioCheck(obj,msg) {
//---------------------------	
 var b = false;
 for(var i=0;i<obj.length;i++)
 {
	if(obj[i].checked==true)
	  b = true;
 }
 if(!b)
	alert(msg); 	
  return b; 	
}

//-------------------
function switchElements(intThisId, strBase, intTotalIds)
//-------------------
{
	document.getElementById(strBase+intThisId).style.display='block';
	for (var i=0; i<=intTotalIds; ++i)
	{
		if (i != intThisId)
		{
			document.getElementById(strBase+i).style.display='none';
		}
	}
}

//---------------------------	
function changeInnerHTML(divId,html)
//---------------------------
{
 if (document.getElementById) {
       document.getElementById(divId).innerHTML= html;
 }else{
     document.layers[divId].document.open();
     document.layers[divId].document.write(html);
     document.layers[divId].document.close();
 }
}

//---------------------------	
function NewWindow(w,h,u) {
//---------------------------	
	window.open(u,"PopUp","menubars=0,scrollbars=1,resizable=1,height="+h+",width="+w);
}

//---------------------------	
function PopIt(nm,url,h,w) {
//---------------------------	
	newwindow=window.open(url,nm,'height='+h+',width='+w);
  if (window.focus) {newwindow.focus()}
	return false;
}

//---------------------------	
function NewWindowGallery(w,h,u) {
//---------------------------	
	window.open(u,"PopUp","menubars=0,scrollbars=1,resizable=1,height="+h+",width="+w);
}

//---------------------------	
function jump(fe){
	//---------------------------	
		var opt_key = fe.selectedIndex;
		var uri_val = fe.options[opt_key].value;
		window.open(uri_val,'_top');
		return true;
}
 	
//-------------------
function ShowHide(id)
//-------------------
 {
    obj = document.getElementsByTagName("div");
    if (obj[id].style.visibility == 'visible'){
    obj[id].style.visibility = 'hidden';
    }
    else {
    obj[id].style.visibility = 'visible';
    }
}

//-------------------
function checkIt(string) {
//-------------------
	var detect = navigator.userAgent.toLowerCase();
	var place,thestring;
	place = detect.indexOf(string) + 1;
	return place;
}

//---------------------------
function submitSearch(textValue)
//---------------------------
{	    
  t = textValue.replace(/ /g,"%20");
	if(t.length>0 && t!="Search%20recordonline.com")
	{	
		h = "http://search.recordonline.com/?q="+t;
		h += "&source=thr";
    window.top.location = h;
	}else
	{
		alert('Please Enter Search Term.');
	}																						
	return false;  	
}

//---------------------------
function submitFacetedSearch(textValue,facetValue)
//---------------------------
{	    
  t = textValue.replace(/ /g,"%20");
  f = facetValue.replace(/ /g,"%20");
	if(t.length>0 && t!="Search%20recordonline.com")
	{	
		h = "http://search.recordonline.com/?q="+t;
		h += "&source=thr";
		if(f.length>0){ 
			h += "&q1="+f+"&x1=t1";
		}
    window.top.location = h;
	}else
	{
		alert('Please Enter Search Term.');
	}																						
	return false;  	
}

//---------------------------
function submitObitDateSearch(dateValue)
//---------------------------
{		
		var stringDate = dateValue;
		var dateArray = new Array();
		dateArray = stringDate.split(/\//g);
		var sMonth = dateArray[0];
		var sDay = dateArray[1];
		var sYear = dateArray[2];
		var sDate = sMonth + "%2F" + sDay + "%2F" + sYear;
		window.top.location = 'http://search.recordonline.com/?from=' + sDate + '&to=' + sDate + '&q=&x1=t1&q1=Obituaries&source=thr&min_month=' + sMonth + '&min_day=' + sDay + '&min_year=' + sYear + '&max_month=' + sMonth + '&max_day=' + sDay + '&max_year=' + sYear;	
}
