// FoodRisk.org Javascript library

// <![CDATA[
var myMenu;
window.onload = function() {
	myMenu = new SDMenu("my_menu");
	myMenu.init();
};
// ]]>

function clearDefaultandCSS(el){
	if (el.defaultValue==el.value) el.value=""
	if (el.style) el.style.cssText=""
}

// Expand/Collapse script
function expand(thistag, tag) {
   styleObj=document.getElementById(thistag).style;
   if (styleObj.display=='none')
   {
	styleObj.display='';
	tag.innerHTML = "less";
   }
   else {
	styleObj.display='none';
	tag.innerHTML = "more";
   }
}

//Javascript Print function modified by Kyle McKillop 11/19/2007
function printPage(id, title)
{ 
  var disp_setting="toolbar=no,location=no,directories=no,menubar=yes,"; 
      disp_setting+="scrollbars=no,width=650, height=600, left=100, top=25"; 
  var content = document.getElementById(id).innerHTML; 
  
  var docprint=window.open("","",disp_setting); 
   docprint.document.open(); 
   docprint.document.write('<html><head><title>' + title + '</title>'); 
   docprint.document.write('<style type="text/css"> h1 {color:#7a8a2d;} </style>');   
   docprint.document.write('</head><body onLoad="self.print()">');
   docprint.document.write('<img src="../images/template/foodrisk_logo.jpg" alt="FoodRisk.org" width="270" height="58"/>');
   docprint.document.write(content);          
   docprint.document.write('</body></html>'); 
   docprint.document.close(); 
   docprint.focus(); 
}

//This set of Javascript includes a combination of functions used in connection with making pop-up windows

//written by Kyle McKillop 11/9/2007

function setKeyword(keyword){
if (opener && !opener.closed && opener.refreshKeyword){
opener.refreshKeyword(keyword);
}
if(!opener || opener.closed) {
window.open("/search/index.cfm?Search=" + keyword);
}
window.close();
}

var URL = unescape(window.location.pathname);
var keyword = null;

function openID(id){
var w = window.open('/search/popup.cfm?ID=' + id,'popup','width=610,height=550,scrollbars=1'); //updated path to popup.cfm, jgaldamez 11/29/2007
w.focus();
return false;
}

function refreshKeyword(keyword){
if (keyword){
window.location.href = "/search/index.cfm?Search=" + keyword; //updated path to "search/index.cfm?Search=" before it was URL + "?Search=", jgaldamez 11/29/2007
}
window.focus();
}

function replacetext(tag, text) {
   tag.innerHTML = text;
}

//standard Dreamweaver pop-up function

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
