function openLeavingWindow(url){
   var windowUrl = '/htmlpages/u_leaving.htm?' + url;
   window.open(windowUrl,'leaving_BK_popup','toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,height=440,width=440');
}
function openLeavingWindowNewWindow(url){
   var windowUrl = '/htmlpages/u_leaving_new_window.htm?' + url;
   window.open(windowUrl,'leaving_BK_popup','toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,height=440,width=440');
}
function openSpecialLeavingWindow(url, popupPage, width, height){
   var windowUrl = popupPage + '?' + url;
   var attribs = 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,height=' + height + ',width=' + width;
   window.open(windowUrl,'leaving_BK_popup',attribs);
}
function openPopup(popupUrl, popupWidth, popupHeight, popupLeft, popupTop){
   var popupWdw;
   var features = 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,height=' + popupHeight + ',width=' + popupWidth + ',top=' + popupTop + ',left=' + popupLeft;
   popupWdw = window.open(fixURL(popupUrl),'BK_popup',features);
   popupWdw.focus();
}

function fixURL(url)
{
   var newURL = url.replace("amp;", "");
   if (newURL.indexOf("amp;") >= 0)
   {
      newURL = fixURL(newURL);
   }
   return newURL;
}

function openEFWindow(refererURL) {
  var theURL = '/expertfinder/servlet/ExpertFinderServlet/vc';
  //alert(theURL);
  if (refererURL != null)
  {
     theURL = theURL + "?Referer=" + refererURL;
  }
  else
  {
     theURL = theURL + "?Referer=" + window.location.href;
  }
  //alert(theURL);
  openBrWindow(theURL,'','top=10,left=15,width=390,height=500,toolbar=no,scrollbars=yes,resizable=yes');
  return false;
}

function openCRWindow(refererURL)
{
   var theURL = '/contactrouter/cr/intl?Referer=';
   var pathStuff = window.location.pathname;
   var lastDot = 0;
   var lastSlash = 9999;
   //alert(window.location.pathname);
   if (refererURL == null)
   {
      //alert("null");
      //alert(pathStuff);
      lastDot = pathStuff.lastIndexOf(".htm");
      while (lastSlash > lastDot)
      {
         //alert("in while");
         //alert(pathStuff);
         lastSlash = pathStuff.lastIndexOf("/");
         //alert(lastSlash);
         if (lastSlash > lastDot)
         {
            pathStuff = pathStuff.substr(0, lastSlash);
         }
      }
      refererURL = pathStuff.substr(lastSlash + 1, lastDot - lastSlash + 3);
      //alert(lastDot - lastSlash + 3);
      //alert(refererURL);
      //return false;
   }
   theURL = theURL + refererURL;
   openBrWindow(theURL,'','top=10,left=15,width=400,height=525,toolbar=no,scrollbars=no');
   return false;
}