
function setOpenMenu(){	
  var aIdName = 'a' + readCookie('menuCookie');
  var menuAnchor = document.getElementById(aIdName);
  if(menuAnchor!=null){
    document.getElementById('aLaboratories').className ='kwick Close';
    menuAnchor.className='kwick Launch';
  }
}

function attachSubmitHandler(){
 if(document.qSearchForm){
  if(document.addEventListener){
   document.qSearchForm.addEventListener('submit',searchValidate,false);
 }
 else{document.qSearchForm.attachEvent('onsubmit',searchValidate)}
 }
}

function OnLoadCalls(){
 setOpenMenu();
 attachSubmitHandler();	
}


if (window.addEventListener){window.addEventListener("load",OnLoadCalls,false)}
else{window.attachEvent('onload',OnLoadCalls);}


function hail(nod,sub,cap){
  document.write('<a href="mailto:'+nod+String.fromCharCode(64)+'quadax.com');
  if(sub!=''){document.write('?Subject='+sub);}
  document.write('">'+cap+'</a>');
}

function linkout(lnk,cap){
  if(lnk==''){lnk=cap;}
  document.write('<a href="http://www.quadax.com/bye.asp?url='+lnk+'" target="_blank">'+cap+' <img src="/shared/offsite.gif" border="0" alt="This link opens a non-Quadax  site in a new browser window"></a>')
}

function emailthispage(){
  str='&nbsp;<cite><a href="mailto:';
  str+='?subject=Interesting web page';
  str+='&body=Thought you ought to check out this page. Its title is \'';
  str+=document.title + '\': '+location.href;
  str+='"><img src="/shared/email.gif" border="0" width="13" height="14" alt="E-mail this page"> E-mail this page</a></cite>'
  document.write(str);
}

function chngSearch(obj){	
  str = obj.value.replace(/^\s*|\s*$/,"");
  if(str=='' || str=='Search'){
    document.getElementById('search_box').style.backgroundImage='url(http://www.quadax.com/images-new/searchDark.png)';	
    obj.value='Search';
    document.getElementById('searchButton').style.cursor='default';  	    	
  }   
}

function clkSearch(obj){
  if(obj.value=='Search') {obj.value='';}	
  document.getElementById('search_box').style.backgroundImage='url(http://www.quadax.com/images-new/searchL.png)'; 		 
  document.getElementById('searchButton').style.cursor='pointer';  
}

function searchValidate(){
  str = document.qSearchForm.CiRestriction.value.replace(/^\s*|\s*$/,"");
  if(str=='' || str=='Search'){(arguments[0].preventDefault)? arguments[0].preventDefault(): arguments[0].returnValue = false;}
  else{document.qSearchForm.submit();}
}

function showmenu(elmnt){
  document.getElementById(elmnt).style.visibility="visible"
}  

function hidemenu(elmnt){
  document.getElementById(elmnt).style.visibility="hidden"
}  

function goto(hRow){
  if(hRow.childNodes==null){websrc = hRow}
  else{
    var hDesc = hRow.childNodes[0].innerHTML;
    var websrc = '';
    var tlinks = document.getElementById('leftLinks');
    var tnum = tlinks.getElementsByTagName('tr').length;
    for (i=0;i<tnum;i++){       	
      var lDesc = tlinks.rows[i].cells[0].childNodes[0].innerHTML;  
      if(lDesc==hDesc){websrc = tlinks.rows[i].cells[0].childNodes[0].href; break;}         	 	  
    }
  }

  eraseCookie('menuCookie');
  createCookie('menuCookie',hRow.parentNode.parentNode.id,30);

  window.location.href = websrc;  	
}


function createCookie(Cname, Cvalue, Cdays){
  if (Cdays) {
    var date = new Date();
    date.setTime(date.getTime()+(Cdays*24*60*60*1000));
    var Cexpires = "; expires="+date.toGMTString();
  }
  else var Cexpires = "";
  document.cookie = Cname+"="+Cvalue+Cexpires+"; javahere=yes; path=/";
}

function readCookie(name){
  var ca = document.cookie.split(';');
  var nameEQ = name + "=";
  for(var i=0; i < ca.length; i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1, c.length); //delete spaces
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
  }
  return null;
}

function eraseCookie(name){
  createCookie(name, "", -1);
}




  
function onHover(obj){
  obj.style.backgroundColor='#0c3669';obj.style.color='#fff';
}

function outHover(obj){
  obj.style.backgroundColor='';obj.style.color='#0c3669';	
}	