// /prod/webdocs/htdocs/amednews/scripts/amnehs.js
// amednews e-HS ad processing routines



// specific specialty extractor for e-HS targeting
function getSpecialty(cookieStr) {
  var index1 = cookieStr.indexOf("s:");
  if (index1 == -1) {
    return "";
  }
  var index2 = cookieStr.indexOf(":", index1+2);
  if (index2 == -1) {
    return "";
  }
  return(cookieStr.substring(index1+2, index2));
}

// e-HS unchanging vars
var oas='http://ads.digitalhealthcare.com/RealMedia/ads/';
var RN = new String (Math.random());
var RNS = RN.substring (2, 11);

// callout to DisplayAds at ea ad position 
// *** NOTE the sitepage is hardcoded on ea page but this function is in a central script file 
// "query" is the filter var
function DisplayAds (position, width, height) {
  var oaspage= sitepage + '/1' + RNS + '@' + position;
  if (_version < 11) {
    document.write ('<A HREF="' + oas + 'click_nx.ads/'+ oaspage + '" TARGET="_top" ><IMG SRC="' + oas + 'adstream_nx.ads/' + oaspage + query + '" BORDER="0" WIDTH="' + width + '" HEIGHT="' + height + '"></A>');
  } else {
    document.write ('<SCRIPT LANGUAGE="JavaScript1.1" SRC="' + oas + 'adstream_jx.ads/' + oaspage + query + '">');
    document.write ('\<\!-- --\>');
    document.write ('\<\/SCRIPT\>');
    document.write ('\<\!-- --\>');
  }
}
