// Check if browser is DOM complainant
if (document.getElementById){
		// toggle div visibility 
	function toggle( targetId ){
				target = document.getElementById( targetId );
					if (target.style.display == "none"){
						target.style.display = "";
					} else {
						target.style.display = "none";
					}
		}


	function hide( targetId ){
			target = document.getElementById( targetId );
				if (target.style.display == "none"){
					target.style.display = "none";
				} else {
					target.style.display = "none";
				}
	}
	
		function show( targetId ){
			target = document.getElementById( targetId );
				if (target.style.display == "none"){
					target.style.display = "";
				} else {
					target.style.display = "";
				}
	}

	function toggletab( targetId ){
				target = document.getElementById( targetId );
				//target.className = 'selected'

					if (target.className == 'selected'){
						target.className = "";
					} else {
						target.className = 'selected';
					}
		}




// Fix Cleardiv for Mac
		function fixmacie(classname){        
		var divs=document.getElementsByTagName("DIV");   
		  for(var d=0; d < divs.length;d++){     
		 if(divs[d].className.indexOf(classname)==0){    
		 divs[d].innerHTML+= "<div class='mac-clearfix'> </div>"; 
		 } } }
		 
		if( navigator.appVersion.indexOf('Mac')!=-1 && document.all){     
			fixmacie("clearfix");  
		}


	// Replace image - Jacobus van Niekerk Feb 2004
	function replaceimg (id,attribute,value,title) {
			document.getElementById(id).setAttribute(attribute,value)
			document.getElementById(id).setAttribute('title',title)
			document.getElementById(id).setAttribute('alt',title)
		}


	//Reads CSS values
	function getElementStyle(elemID, IEStyleProp, CSSStyleProp) {
		var elem = document.getElementById(elemID);
		if (elem.currentStyle) {
			//return elem.currentStyle[IEStyleProp];
			return elem.offsetHeight;
		} else if (window.getComputedStyle) {
			var compStyle = window.getComputedStyle(elem, "");
			return compStyle.getPropertyValue(CSSStyleProp);
		}
		return "";
	}	

}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function ltrim(value){var re=/\s*((\S+\s*)*)/;return value.replace(re,"$1");}
function rtrim(value){var re=/((\s*\S+)*)\s*/;return value.replace(re,"$1");}
function trim(value){return ltrim(rtrim(value));}

function submitSearch()
{
  if(document.getElementById("type").options[document.getElementById("type").selectedIndex].value!=3){
    var words = trim(document.getElementById("keywordS").value).split(" ");
    for(var i=0;i<words.length;i++){
      if(trim(words[i]).length<3){
	if(words.length > 1) alert("Only words with more than two characters can be used in a PHRASE or WORD search");
	else if(confirm("Only words with more than two characters can be used in a phrase of Word search.  Do you want to do a part of the word search?")) document.getElementById("type").selectedIndex = 2;
	break;
      }//if
    }//for
  }//if
  document.getElementById('keywordS').value=document.getElementById('keywordS').value.toLowerCase();
  return true;
}

