//iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
function doTabTableForm($tableId, $show)

//$tableId: of table which holds form  
// Assumes a ONE table form, where different tbody classes are used for different "tabs"  
//$show (and ALL arguments following) represent the list of form tabs to show. 

{ 
var tid = $tableId;
var i= 0;
var n=0;
var showA = new Array();

//Get list of Forms to show
//if I change number args increase the start value for i


for (i = 1; i < doTabTableForm.arguments.length; i++)
 {

   showA[n] = doTabTableForm.arguments[i];
   n++;
 }

//alert ("showA.length=" + showA.length);


//extract table node
var formTab = document.getElementById(tid);

//get list of ALL tr elements in formTab 
// (or do I only want those with formTab as an immediate parent?)

var trList =  formTab.getElementsByTagName("tbody");

var showID;
var thisTR;
var trID;

for (i = 0; i < trList.length; i++)
{
 thisTR = trList[i];
 trID = thisTR.id;

// alert("for i=" + i + "  trID=" + trID);

 thisTR.style.display = "none";

  for (j = 0; j < showA.length; j++)
  { 
    showID = showA[j];

    if (trID == showID)
    {
//      alert (trID + " == " + showID);
        thisTR.style.display = "";
    }
  }
}
}
//iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
function doShowCode($containingDiv, $styleSheetIndex)
{
var containingD = $containingDiv;
var n = $styleSheetIndex;

//alert (containingD + ";" + n);
//var FScodeI = document.getElementById('displayFS').innerHTML; 
var FScodeI = document.getElementById(containingD).innerHTML; 

var FScodeS = doExtractStyle(n);   

var FScode = FScodeI + '\n<style type="text/css">\n' + FScodeS + '</style>';


//does our textArea already exist
var myTextArea = document.getElementById('mySourceId');
//alert ("myTextArea=" +  exists);
if (null == myTextArea)
{ 
//alert ("null == myTextArea") 
var myTextArea= document.createElement('textarea')
myTextArea.id = "mySourceId";
myTextArea.setAttribute("cols", "100");
myTextArea.setAttribute("rows", "10");
document.body.appendChild(myTextArea);
}
myTextArea.value="";
//alert ("text area empty?");
myTextArea.value=FScode;

//srcIframe.document.body.appendChild(myTextArea);

//document.write(FScode);

}
//iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii

function doChangeChildNodeTest1($node)
{
//keep this function, it is good for finding where our nodes reside

// can NOT use childNode[#] because it is NOT the same cross browser.

//getElementById works from the document not the node and I must know the id
//below lines worked as long as I was in div1
//$tempnode = document.getElementById("fnamenn_1");
//$tempnode.style.background="fuchsia";

//to make use of the node I passed in I could not use id but I could use tag
//this worked cross browser
var tnode = $node;
var input_tags = tnode.getElementsByTagName("input");
input_tags[0].style.background='silver'; //friend id
input_tags[1].style.background='yellow';  //update button
input_tags[2].style.background='pink';  //display name
input_tags[3].style.background='lightgreen';//url of image  
input_tags[4].style.background='lavenderBlush'; //url of image 2
input_tags[5].style.background='lightblue';  
input_tags[6].style.background='springgreen'; //url of friend page
input_tags[7].style.background='violet'; //index
input_tags[8].style.background='BurlyWood'; //action
input_tags[9].style.background='Aquamarine'; //del

}

//iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
//return the number of divs of class $class in $node
function doDivClassCnt ($node, $class)
{

 var vnode = $node;
 var vclass = $class;
 var divTags = vnode.getElementsByTagName("div");
 var fdiv_cnt = 0;

//alert (fdiv_cnt);

for (var i = 0; i < divTags.length ; i++)
{
var item=divTags[i];

var nclass = item.getAttribute("className");
//are there multiple classes?  I will assume the class I want is first for now
var nclasses = nclass.split(" ");
var nclass1 = nclasses[0];

if (nclass1 == vclass)
{
fdiv_cnt++;
}  //end if


}  //end for

return fdiv_cnt;

} //end funciton


//iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
//
function doExtractStyle ($s)
//input: list of style rules as defined in rules OR cssRules
//extract individual style from list and create style block 
{
var s = $s  //style sheet we want 1=2nd style sheet in document
var style_s = "";
var selText = "";

var styleRules = new Array();
if (document.styleSheets[s].cssRules)
{
//opera, FF do this
//  alert ('found styleSheets cssrules');
  styleRules = document.styleSheets[s].cssRules;
}
else if (document.styleSheets[s].rules)
{
//IE does this
//  alert ('found styleSheets rules');
  styleRules = document.styleSheets[s].rules;
}


var style_s = "";
var i=0;
//fill an array with the known style attributes


for (i=0; i<styleRules.length; i++)
{
// below line gets selector successfully FF, IE, Opera
  selText= styleRules[i].selectorText;
//  alert ("selText=" + selText);
 
 var  styleObject = styleRules[i].style;

//no way to see what is in my styleObject?  toString did not work
//must I test every known style.  I know which ones I use

//  var position_ss = styleObject.position;
  //below selected background color, however Opera converted to #hex
  //var ss = styleObject.backgroundColor; 

  //below worked but FF had -moz-use-text-color where color not defined
  //do I want to detect and strip this?
  //Opera had color in hex and used #000000 if no color
//var ss = styleObject.borderRight;

  //below might be the best option although opera in hex   
  //will need to strip out the -moz-use-text-color
//var ss = styleObject.borderRightColor;

// var ss = styleObject.borderRightWidth;

//below actually worked well, in order  2px solid color (opera in #hex)
//  var border_s= styleObject.border;

// I got almost all style to work except float was not recognized.
// so I decided to extract the whole string.

//the below worked the best but was messy for Opera for borders.
//best may be to use below and strip out all border stuff, and then use styleObject.border to get border style.
//for now use below where innerHTML fails to get needed style.

var sstext = styleObject.cssText;

//alert ("cssText:" + sstext);

style_s = style_s + selText + "{" + sstext + "}" + "\n";

} //end for 

//alert(style_s);
//return style string.  does NOT have style tags. 

return style_s;


}
//iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
