function obj(id) { return document.getElementById(id) }

var ie = ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4 ))
var ns = ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) >= 5))


function hideit(){


  obj('theimg').style.display = 'none'
}

function toggleimg( img1,img2,img3,img4,info){
    var w=280, h=280
    var imgs = "<span align='justify' style='height:100px;width:600px;background:#ffffff;padding:2px' class=fifthheaderB >"+info+"</span><br><br><img src=../../images/whip/"+img1+" onclick=hideit()>&nbsp;&nbsp;&nbsp;<img src=../../images/whip/"+img2+" onclick=hideit()><br><br><img src=../../images/whip/"+img3+" onclick=hideit() >&nbsp;&nbsp;&nbsp;<img src=../../images/whip/"+img4+" onclick=hideit() >"
    obj('theimg').innerHTML = imgs
    obj('theimg').style.display = "block"
}

function tog(aStr){
    var obj = document.getElementById(aStr)
    if(obj.style.display == "none") obj.style.display =""
    else obj.style.display = "none"
}

//Display of Halter Horses
SpecialHTTP = function(method, URL, values, callback) {
  index_default.HTTP(method, URL, values, callback);
};

function ponyShow(v){
  obj('ponyShow').style.display = "";
  var showPonys = function (data){
    var disc, disc2, file, img1, img2, img3, img4;
    file = "horseinfo";
    data = data.replace(/'/g, "`");
    data = data.replace(/"/g, "``");
    var horseInfo = data.split("|");

    if (v == "halter") var introText = "Halter trained animals are available for adoption at the Canon City, CO Training Facility.  These horses can be caught in a small pen, will lead, lunge, stand tied, pick up all four feet, and load into a stock trailer.  They have been worked in a round pen, and outside the corrals in open areas.  Most are older and were gathered from the wild between the ages of 4 - 6 years old, so they are shy around strangers and will require an experienced adopter. ";
    else introText = "Saddle trained mustangs are hand-picked for disposition, confirmation, age, and soundness and are offered for adoption when training is complete.  Potential adopters must have an approved application on file or obtain an application for adoption and have it approved by a Bureau of Land Management office.&nbsp;&nbsp;&nbsp;<span class=\"sideBarPDFLinks\" onClick=\"index_default.popUpPDFWin('../../bin-pdf/4442/BLM_4710-010.pdf', 'ADOPTION APPLICATION')\" onmouseOver=\"this.style.color='#c8b24d'\" onmouseOut=\"this.style.color='#0f3e5b'\"><img src='../../images/pdf_logo.gif'> <strong>Adoption Application</strong></span>";

    var textInfo = "<table cellpadding=5 style='width: 610'>";
    textInfo += "<tr><th height=10></th></tr>";
    textInfo += "<tr><td><p align=justify>"+introText+"</td></tr>";
    textInfo += "<tr><td align=center width=610 valign=top >";
    textInfo += "<span id=theimg title='Click to remove...' style='position:absolute;top:80;left:0;background-color:#396e8e;padding:5px;border:double 3px #0f3e5b;cursor:pointer; display: none;' onclick=hideit()></span>";
    if (horseInfo.length >= 2) var colspan = 2;
    //if (horseInfo.length < 4) colspan = horseInfo.length;
    var cellcount = 1;
    textInfo += "<table cellpadding=0 cellspacing=0   style='border:solid 0px #396e8e' width=98% cols="+colspan +"><tr>";
    horseInfo = horseInfo.sort();
  
    for (var i = 0; i < horseInfo.length; i++) {
      if (cellcount == 1)  textInfo += "</tr><tr>";
      var tmp = horseInfo[i].split("~")[1];
      if (!tmp) continue;
  
      var horse_info = tmp.split(":");
      img1 = (horse_info[1]) ? horse_info[1] : "coming.jpg";
      img2 = (horse_info[2]) ? horse_info[2] : "coming.jpg";
      img3 = (horse_info[3]) ? horse_info[3] : "coming.jpg";
      img4 = (horse_info[4]) ? horse_info[4] : "coming.jpg";
      disc = (horse_info[5]) ? horse_info[5] : "Sorry no info at this time.";
      disc2 = (horse_info[6]) ? horse_info[6] : "Sorry no info at this time.";
      //horsetype = (horse_info[7]) ? horse_info[7] : "";
      var doclick = "onclick=\"toggleimg('"+img1+"','"+img2+"','"+img3+"','"+img4+"','"+disc2+"')\"";
      //if (horsetype == "halter") {
        textInfo += "<td colspan"+colspan+" width=90 align=center class=sixthheaderB style='border:solid 1px #396e8e;cursor:pointer;'>";
        textInfo += "<img width=90  src=\"../../images/whip/"+img1+"\"  "+doclick+"><br>"+horse_info[0]+"</td>";
        textInfo += "<td width=210 class=sixthheaderB style='border:solid 1px #396e8e' align=center>"+ horse_info[5] +"</td>";
  
        if (cellcount < 3) cellcount++;
        if (cellcount == 3) cellcount = 1;
    }//end for loop
  
    textInfo += "</tr></table></td></tr></table>";
    obj('ponyShow').innerHTML = textInfo;

  }

  var values = {"action":v+"~horseinfo"}
  SpecialHTTP('POST', docRoot+'serviceproviders/puppy/bin-cgi/showDogs.cgi', values, showPonys);

}

function trainFaqs(v,url){
    v = v.replace(/'/g, "`");
    v = v.replace(/"/g, "``");
    var trainString = v.split(/\r|\n/);
    var printString = "<div id=trainfaq><span style=height:420><table style='width:610;' cellpadding=3 cellspacing=0 border=0>";
        printString += "  <tr><th colspan=2 >&nbsp;</th></tr>";
        printString += "  <tr><th colspan=2 class=mainheader valign=top>Frequently Asked Questions <hr width=400 color=#ffcc33></th></tr>";
        trainString = trainString.sort()

    for (var i = 0; i < trainString.length; i++) {
      var tmp = trainString[i].split("~");
      var Q_A = tmp[1].split(":");
      printString += "  <tr><td><table border=0 width=610><tr>";
      printString += "      <td width=30px style='font:bold 11pt verdana;color:#0f3e5b;'>"+tmp[0]+".</td>";
      printString += "      <td><span style='cursor:hand;font:bold 10pt verdana;color:396e8e;' onclick=toggleDisplay('"+tmp[0]+"') onmouseover=this.style.color='#ffcc33' onmouseout=this.style.color='#396e8e' >"+Q_A[0]+"</span></td>";
      printString += "  </tr>";
      printString += "  <tr><td></td><td><div id='"+tmp[0]+"' style='display:none;font:normal 11pt verdana;'>"+Q_A[1]+"</div></td></tr></td></tr></table>";
    }
    printString += "</table></span></div>"

    obj('a_innerhtml').innerHTML = printString;
}

