function loadCaseStudy(id)
{
  var sel = document.getElementById("selCaseStudyID");
  for(var i=0;i<sel.options.length;i++)
  {
    if(sel.options[i].value == id)
    {
      sel.selectedIndex = i;
      break;
    }
  }
  CaseStudiesService.CaseStudies.GetCaseStudy(id, onGetCaseStudy, onGetCaseStudyError);
}

function onGetCaseStudy(result)
{
  var divHtml = document.getElementById("divHtmlInsert");
  var doc = ""
  if(result.Document != null && result.Document.length > 0)
    doc = "<p><table><tr><td><img src='/Image registry/Image web/004735.png' /></td><td><a href='" + result.Document + "'>Click here to download this case study as a PDF </a></td></tr></table></p>";
  var divImage = "<div style='float: left; margin: 5px; border: 1px solid black;'><img src='image registry/image web/" + result.Photo + "'/></div>";
  divHtml.innerHTML = "<div style='text-align: justify; width: 502px; padding-top: 10px;'>" + divImage + result.Description + doc + "</div>";
}

function onGetCaseStudyError(arg)
{
  //alert(arg);
}
