function showText(id){
	if(!document.getElementById)
		return;
	var div=document.getElementById(id);	
	var buttonimg=document.getElementById("b"+id);
	
	if(div.style.display == "inline"){
		div.style.display = "none";
		if (buttonimg != null) {
			buttonimg.src = "images/show.png";
		}
	}
	else{
		div.style.display = "inline";
		if (buttonimg != null) {
			buttonimg.src = "images/hide.png";
		}
	}
}

function checkAll(formname){
	for (var i=0;i<document.forms[formname].elements.length;i++) {
		var e=document.forms[formname].elements[i];
		if ((e.name != 'allbox') && (e.name != 'quicksearch') && (e.type=='checkbox') && (!e.disabled)){
			e.checked=document.forms[formname].allbox.checked;
		} 
	}
}

function showSearchingMessage(id) {
	if (!document.getElementById) {
		return;
	}
	if (id != "searching" || document.getElementById("chemsearchradio").checked) {
		document.getElementById(id).style.display = "block";
	}
}

function showElement(id) {
  if (!document.getElementById)
    return;
  if (document.getElementById(id) != null) {
    document.getElementById(id).style.display = "inline";
  }
}

function hideElement(id) {
  if (!document.getElementById)
    return;
  if (document.getElementById(id) != null) {
    document.getElementById(id).style.display = "none";
  }
}

function show_hide(id) {
  var myDiv = document.getElementById(id);	
  if (myDiv.style.display == 'none') {
    myDiv.style.display = 'block';
  } else {
    myDiv.style.display = 'none';
  }
}

function PDFconfirm(url) {
  var r=confirm("Are you sure you wish to download this PDF?");
  if (r==true) {
    window.location=url;
  }
}
