﻿


//XHConn
function XHConn()
{
  var xmlhttp, bComplete = false;
  try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); }
  catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); }
  catch (e) { try { xmlhttp = new XMLHttpRequest(); }
  catch (e) { xmlhttp = false; }}}
  if (!xmlhttp) return null;
  this.connect = function(sURL, sMethod, sVars, fnDone)
  {
    if (!xmlhttp) return false;
    bComplete = false;
    sMethod = sMethod.toUpperCase();

    try {
      if (sMethod == "GET")
      {
        xmlhttp.open(sMethod, sURL+"?"+sVars, true);
        sVars = "";
      }
      else
      {
        xmlhttp.open(sMethod, sURL, true);
        xmlhttp.setRequestHeader("Method", "POST "+sURL+" HTTP/1.1");
        xmlhttp.setRequestHeader("Content-Type",
          "application/x-www-form-urlencoded");
      }
      xmlhttp.onreadystatechange = function(){
        if (xmlhttp.readyState == 4 && !bComplete)
        {
          bComplete = true;
          fnDone(xmlhttp);
        }};
      xmlhttp.send(sVars);
    }
    catch(z) { return false; }
    return true;
  };
  return this;
 };
//End XHConn



/*** Collection Description ***/

function GetCollectionInfo(colId){
    ModBox_Show("Collection " + colId, "Loading");
    RequestDesc(colId);
    return false;
}//End

function RequestDesc(colId){
    var myConn = new XHConn();

    if (!myConn){ 
        alert("XMLHTTP not available. Sorry but your browser does not support this feature.");
        return true;
    }
    
    var CollectionLinkHTML = '<br /><br /><a href="stamps.aspx?ls=pub&fl=all&st=col&cr=' + colId + '&lsn=Public">Show all items in this collection</a>';

    var fnWhenDone = function (oXML) { UpdateDescHTML(oXML.responseText + CollectionLinkHTML); };

    myConn.connect("xCollectionDesc.aspx", "GET", "colId=" +  colId, fnWhenDone);

    return false;
}//End



/*** Help ***/

function Help_Show(){
    ModBox_Show("Country Lot Description", "Here is an example of a description:<br />" +
    "<img src=\"img/lotDescColor.gif\"><br />" +
    " I then try to list all the stamps or sets that catalog for $1.00 or more to give you an idea of the better stamps included in the lot. (Sets may include minimum value stamps)." +
    " <a href=\"cataloghelp.aspx\" title=\"Country Collections Stamp Catalog Help\">Click here to see additional help</a>");
    return false;
}//End



/*** Mod Box ***/

function ModBox_Show(strTitle, strContent)
{
   document.getElementById("screen").className = 'screen_on';
   document.getElementById("modBox").className = 'modBox_on';
   
   document.getElementById("modBox_title").innerHTML = strTitle;
   document.getElementById("modBox_desc").innerHTML = strContent;
}//End


function UpdateDescHTML(myResponseText){
     document.getElementById('modBox_desc').innerHTML = myResponseText;
}//End UpdateHTML


function ModBoxClose(){
    document.getElementById("screen").className = 'screen_off'; 
    document.getElementById("modBox").className = 'modBox_off'; 
    return false;
}//End



/** Visual Show Hide ***/

function VisShowHide(myId){
 if(document.getElementById("vh_" + myId).className == 'vshow'){
    document.getElementById("vh_" + myId).className = 'vhide';
    document.getElementById("vc_" + myId).className = 'vhide';
 } else {
    document.getElementById("vh_" + myId).className = 'vshow';
    document.getElementById("vc_" + myId).className = 'vshow';
 }//end if
return false;
}//End
