function GetXml(id) {
  xmlhttp=null;
  if (window.XMLHttpRequest){// code for all new browsers
    xmlhttp=new XMLHttpRequest();
  }
  else if (window.ActiveXObject){// code for IE5 and IE6
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
  if (xmlhttp!=null){
    var url = "/Services/XmlPictureDataService.ashx?picture=" + id;
    xmlhttp.onreadystatechange=state_Change;
    xmlhttp.open("GET",url,true);
    xmlhttp.send(null);
  }
  else
    alert("Your browser does not support XMLHTTP.");
}
function GetContestXml(id){
  xmlhttp=null;
  if (window.XMLHttpRequest){// code for all new browsers
    xmlhttp=new XMLHttpRequest();
  }
  else if (window.ActiveXObject){// code for IE5 and IE6
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
  if (xmlhttp!=null){
    var url = "/Services/XmlContestPictureDataService.ashx?picture=" + id;
    xmlhttp.onreadystatechange=state_ChangeContest;
    xmlhttp.open("GET",url,true);
    xmlhttp.send(null);
  }
  else
    alert("Your browser does not support XMLHTTP.");
}
function state_Change(){
  if (xmlhttp.readyState==4) {// 4 = "loaded"
    if (xmlhttp.status==200) {// 200 = "OK"
      var x = xmlhttp.responseXML.documentElement.getElementsByTagName("picture");
      if (x != null){
        if (x.length > 0) {
          var t1 = x[0].getElementsByTagName("title");
          if (t1 != null){
            if (t1.length > 0){
              if (t1[0].childNodes != null){
                if (t1[0].childNodes.length > 0)
                  document.getElementById('TitleAuthor').innerHTML = t1[0].firstChild.nodeValue + " - ";
              }
            }
          }
          var t2 = x[0].getElementsByTagName("author");
          if (t2 != null){
            if (t2.length > 0){
              if (t2[0].childNodes != null){
                if (t2[0].childNodes.length > 0){
                  var tlink = x[0].getElementsByTagName("authorlink");
                  var link;
                  if (tlink != null && tlink.length>0 && tlink[0].childNodes != null && tlink[0].childNodes.length>0)
                    link = tlink[0].firstChild.nodeValue;
                  document.getElementById('TitleAuthor').innerHTML += '<a href="' + link  + '">' + t2[0].firstChild.nodeValue + '</a>';
                }
              }
            }
          }
          var t4 = x[0].getElementsByTagName("date");
          if (t4 != null){
            if (t4.length > 0){
              if (t4[0].childNodes != null){
                if (t4[0].childNodes.length > 0)
                  document.getElementById('Date').innerHTML = t4[0].firstChild.nodeValue;
              }
            }
          }
        }
      }
    }
    else
      alert("Problem retrieving data:" + xmlhttp.statusText);
  }
}

function state_ChangeContest(){
  if (xmlhttp.readyState==4) {// 4 = "loaded"
    if (xmlhttp.status==200) {// 200 = "OK"
      var x = xmlhttp.responseXML.documentElement.getElementsByTagName("picture");
      if (x != null){
        if (x.length > 0){
          var t1 = x[0].getElementsByTagName("title");
          if (t1 != null){
            if (t1.length > 0){
              if (t1[0].childNodes != null){
                if (t1[0].childNodes.length > 0) 
                  document.getElementById('TitleAuthor').innerHTML = t1[0].firstChild.nodeValue + " - ";
              }
            }
          }
          var t2 = x[0].getElementsByTagName("author");
          if (t2 != null){
            if (t2.length > 0){
              if (t2[0].childNodes != null){
                if (t2[0].childNodes.length > 0){
                    var tlink = x[0].getElementsByTagName("authorlink");
                    var link;
                    if (tlink != null && tlink.length>0 && tlink[0].childNodes != null && tlink[0].childNodes.length>0)
                        link = tlink[0].firstChild.nodeValue;
                    document.getElementById('TitleAuthor').innerHTML += '<a href="' + link  + '">' + t2[0].firstChild.nodeValue + '</a>';
                }
              }
            }
          }
          var t4 = x[0].getElementsByTagName("date");
          if (t4 != null){
            if (t4.length > 0){
              if (t4[0].childNodes != null){
                if (t4[0].childNodes.length > 0)
                  document.getElementById('Date').innerHTML = t4[0].firstChild.nodeValue;
              }
            }
          }
          var t6 = x[0].getElementsByTagName("lroname");
          if (t6 != null){
            if (t6.length > 0){
              if (t6[0].childNodes != null) {
                if (t6[0].childNodes.length > 0)
                  document.getElementById('LroName').innerHTML = t6[0].firstChild.nodeValue;
              }
            }
          }
        }
      }
    }
    else
      alert("Problem retrieving data:" + xmlhttp.statusText);
  }
}