function focusFirst() {
  element = document.getElementById('firstFocus');
  if (element!= null) { element.focus(); }
}

function trim(s) {

  while (s.substring(0,1) == " ") {
    s = s.substring(1, s.length);
  }

  while (s.substring(s.length-1, s.length) == " ") {
    s = s.substring(0,s.length-1);
  }

  return s;

}

// Some versions of Netscape, and seemingly all versions of Firefox, don't support the modal dialog.
// This var will be used to control the behavior when we need to pop a window.
var useModalDialog = true;
var browser = navigator.userAgent.toLowerCase();
if (browser.indexOf("firefox") > -1 || browser.indexOf("netscape") > -1) {
  useModalDialog = false;
}


function windowOpen(gothere, params) {
  myWindow = window.open("","windowRef",params);
  myWindow.location.href = gothere;
  if (!myWindow.opener) myWindow.opener = self;
}

function requestMeeting(companyID) {

  var url = "request.asp?cid="+companyID;
 
  if (useModalDialog) {
    window.showModalDialog(url, "", "dialogHeight:250px;dialogWidth:500px;edge:raised;center:yes;status:no;help:yes;scroll:no;resizable:no;");
  } else {
    window.open(url, "", "width=500,height=250,toolbar=no,menubar=no,alwaysRaised=yes,resizable=yes,top=0,left=0,scrollbars=no,location=no,status=no,");
  }

}

function cancelMeeting(meetingID) {

  var url = "cancel.asp?m="+meetingID;
  window.open(url, "", "width=500,height=300,toolbar=no,menubar=no,alwaysRaised=yes,resizable=yes,top=0,left=0,scrollbars=no,location=no,status=no,");
  
}

function rescheduleMeeting(meetingID) {

  var url = "reschedule.asp?m="+meetingID;
  window.open(url, "", "width=500,height=450,toolbar=no,menubar=no,alwaysRaised=yes,resizable=yes,top=0,left=0,scrollbars=no,location=no,status=no,");
  
}


function focusSearch() {
  button = document.getElementById('firstFocus');
  if (button != null) { button.focus(); }
}
      
function keyPress(keyCode) {
  if(keyCode == 13) {
    form = document.searchForm;
    if (form != null) { form.submit(); }
  }
}

function windowOpen(gothere, params) {
  myWindow = window.open("","windowRef",params);
  myWindow.location.href = gothere;
  if (!myWindow.opener) myWindow.opener = self;
}

function addToShoppingCart(ss,cid,pid) {

  var url = "/bioasia/2007/partnering/addToCart.asp?ss="+ss+"&cid="+cid;
  if (pid != null && pid.length > 0) { url = url+"&pid="+pid }
  if (useModalDialog) {
    window.showModalDialog(url, "", "dialogHeight:210px;dialogWidth:500px;edge:raised;center:yes;status:no;help:yes;scroll:no;resizable:no;");
  } else {
    window.open(url, "", "width=500,height=250,toolbar=no,menubar=no,alwaysRaised=yes,resizable=yes,top=0,left=0,scrollbars=no,location=no,status=no,");
  }

}