function horseFolderBuilder(){
 var doc=document;
 var horseDnoScript=doc.getElementById('horseDescription');
 var horseAnoScript=doc.getElementById('horseAwards');
 var horseVnoScript=doc.getElementById('horseVideos');
 var horseCnoScript=doc.getElementById('horseCertificate');
 var horseTable=doc.createElement('table');
 horseTable.id='wwfHorseDoc';
 horseTable.cellPadding="0";
 horseTable.cellSpacing="0"
 var topRow=horseTable.insertRow(0);
 topRow.id='wwfHorseHead';
 var tabs=0;
 tab=new Array;
 content=new Array;
 if (horseDnoScript){
  content[tabs]=horseDnoScript.cloneNode(true);
  horseDnoScript.parentNode.replaceChild(horseTable,horseDnoScript);
  content[tabs].removeChild(content[tabs].firstChild);
  var cell=topRow.insertCell(tabs);
  var link=doc.createElement('a');
  link.setAttribute('style','border-color:#cc6 #881 #cc6 #cc6');
  link.setAttribute('href','javascript:paneSwap('+tabs+');');
  link.appendChild(document.createTextNode('Description'));
  cell.appendChild(link);
  tabs++;
 }
 if (horseAnoScript){
  content[tabs]=horseAnoScript.cloneNode(true);
  horseAnoScript.parentNode.removeChild(horseAnoScript);
  content[tabs].removeChild(content[tabs].firstChild);
  var cell=topRow.insertCell(tabs);
  var link=doc.createElement('a');
  link.setAttribute('style','border-color:#cc6 #881 #cc6 #cc6');
  link.setAttribute('href','javascript:paneSwap('+tabs+');');
  link.appendChild(document.createTextNode('Awards'));
  cell.appendChild(link);
  tabs++;
 }
 if (horseVnoScript){
  content[tabs]=horseVnoScript.cloneNode(true);
  horseVnoScript.parentNode.removeChild(horseVnoScript);
  content[tabs].removeChild(content[tabs].firstChild);
  var cell=topRow.insertCell(tabs);
  var link=doc.createElement('a');
  link.setAttribute('style','border-color:#cc6 #881 #cc6 #cc6');
  link.setAttribute('href','javascript:paneSwap('+tabs+');');
  link.appendChild(document.createTextNode('Videos'));
  cell.appendChild(link);
  tabs++;
 }
 if (horseCnoScript){
  content[tabs]=horseCnoScript.cloneNode(true);
  horseCnoScript.parentNode.removeChild(horseCnoScript);
  content[tabs].removeChild(content[tabs].firstChild);
  var cell=topRow.insertCell(tabs);
  var link=doc.createElement('a');
  link.setAttribute('style','border-color:#cc6 #881 #cc6 #cc6');
  link.setAttribute('href','javascript:paneSwap('+tabs+');');
  link.appendChild(document.createTextNode('Certificate'));
  cell.appendChild(link);
  tabs++;
 }
 
 for (tabs;tabs<4;tabs++){
  topRow.insertCell(tabs);
 }
 var bottomRow=horseTable.insertRow(1);
 var horseBody=bottomRow.insertCell(0);
 horseBody.id='wwfHorseBody';
 horseBody.colSpan='4';
 var horseContent=doc.createElement('div');
 horseContent.id='wwfHorseContent';
 horseContent.appendChild(doc.createElement('div'));
 horseBody.appendChild(horseContent);
 for(var count=0; count<content.length;count++){
  tab[count]=topRow.cells[count].firstChild;
  tab[count].setAttribute('style','border-color:#cc6 #881 #cc6 #cc6');
 }
 horseContent.replaceChild(content[0],horseContent.firstChild);
 tab[0].style.borderColor='#cc6 #881 #aa3 #cc6';
}
 
function paneSwap(x){
 for (var count=0; count<tab.length; count++){
  tab[count].style.borderColor="#cc6 #881 #cc6 #cc6";
 }
 tab[x].style.borderColor="#cc6 #881 #aa3 #cc6";
 var horseCon=document.getElementById('wwfHorseContent');
 horseCon.replaceChild(content[x],horseCon.firstChild);
}


function picSwap(){
 var doc=document;
 var horseImgP=doc.getElementById('wwfHorseImgP');
 var index=doc.getElementById('wwfPictureSelect').selectedIndex;
 horseImgP.replaceChild(horsePic[index],horseImgP.firstChild);
}

function buildPictureFrame(){
 var doc=document;
 var picTable=document.createElement('table');
 picTable.id='wwfPictureFrame';
 picTable.cellSpacing='0';
 var picTopRow=picTable.insertRow(0);
 var picBotRow=picTable.insertRow(1);
 var picTop=picTopRow.insertCell(0);
 var picBot=picBotRow.insertCell(0);
 picTop.id='wwfHorseImgP';
 picTop.appendChild(doc.createElement('div'));
 var selectDiv=picBot.appendChild(doc.createElement('div'));
 var selectLabel=selectDiv.appendChild(doc.createElement('label'));
 selectLabel.setAttribute('for','wwfPictureSelect');
 selectLabel.appendChild(doc.createTextNode('Change Picture: '));
 picSelect=selectDiv.appendChild(doc.createElement('select'));
 picSelect.id='wwfPictureSelect';
 picSelect.setAttribute('onchange','picSwap()');
 if(picSelect.attachEvent){picSelect.attachEvent('onchange',picSwap);}
 for(count=0;count<horsePic.length;count++){
  var option=doc.createElement('option');
  option.appendChild(doc.createTextNode(horsePic[count].alt));
  picSelect.appendChild(option);
 }
 //doc.getElementById('horseDescription').appendChild(picTable);
 doc.getElementById('horseDescription').insertBefore(picTable,doc.getElementById('horseDescription').childNodes[1]);
 picSwap();
}
