

	var publishTable="<b>JAVASCRIPT EXAMPLES : SVG MATRIX TRANSFORMATION REFERENCE</b><table>"

var basicTable
function writeBasicTable()
{

	var lastUpdate=document.lastModified
	var lastSplit=lastUpdate.split(" ")

	lastUpdateSpan.innerText=lastSplit[0]
	


	 basicTable="<center>"+
	"<input disabled title='reduce examples' type=checkbox id=reduceExampleCheck  checked onclick='reduceExample()' >"+
	"<input title='expand examples'  type=checkbox id=expandExampleCheck  style='width:25;height:25'  onclick='expandExample()' >"+
	"<span style='width:30'> </span><b>SVG MATRIX TRANSFORMATION BASICS</B>"+
	"</center>"

	basicTable+="<TABLE cellpadding=5 class=medium id='tablebasic' border=0 cellpadding=3 cellspacing=1 style='font-family:arial;width:"+(890*FactorW)+";background-color:blue'>"
	var reSp=/ /g //--replaces space with underscore---
	for(i=0;i<basicArray.length;i++)
	{
		basicSplit=basicArray[i].split("@")
		basic=basicSplit[0]
		file=basic.replace(reSp,"_")
	   	format=basicSplit[1]
		dwgDescr=basicSplit[2]
		sourceDescr=basicSplit[3]

 		var bgColor="style='background-color:#FFFFCC'"
		bgFlag=(i+1)/2
		bgFlag=bgFlag+""
		if(bgFlag.indexOf(".")==-1)
		bgColor="style='background-color:#FFFF99'"

		 basicFunct="<a href=javascript:resetMatrix();importBasic('"+file+"');hiliteRow('"+file+"') title='show this example'>"+basic+"</a><br>"+format+"</td>"

		basicTable+="<TR valign=top  id="+file+"Row "+bgColor+">"+
			"<TD onClick=scrollMoveDiv() style='width:"+(300*FactorW)+"'>"+
				basicFunct+
			"</TD>"+
			"<TD style='width:"+(300*FactorW)+"'>"+dwgDescr+"</TD>"+
			"<TD style='width:"+(300*FactorW)+"'>"+sourceDescr+"</TD>"+
		"</TR>"


		publishTable+="<tr><td><a href='http://www.mobiusPortal.com/Methods/"+file+".htm'>Javascript XML/SVG Spiral example:  "+basic+"</a></td><td>"+format+"</td><td>"+dwgDescr+"</td><td>"+sourceDescr+"</td></tr>"
	}

	basicTable+="</table>"

}

function writeExampleTable()
{
	//---publish utility---
	publishTable+="<b>DYNAMIC SVG/XML EXAMPLES</b>"
	publishTable+="<table>"

	
	var exampleTable=""

	 exampleTable+="<TABLE cellpadding=5 class=medium id='tableExample' border=0 cellpadding=3 cellspacing=1 style='font-family:arial;width:"+(890*FactorW)+";background-color:blue'>"


	for(i=1;i<exampleArray.length;i++)
	{
		exampleSplit=exampleArray[i].split("@")
		exampleDescr=exampleSplit[0]
		dwgDescr=exampleSplit[1]
		sourceDescr=exampleSplit[2]
		

		exampleId="example"+i
		
		var bgColor="style='background-color:#CCFFCC'"
		bgFlag=(i+1)/2
		bgFlag=bgFlag+""
		if(bgFlag.indexOf(".")==-1)
		bgColor="style='background-color:#99FF99'"



		exampleTable+="<tr id="+exampleId+"Row "+bgColor+">"+
			"<TD valign=top onClick=scrollMoveDiv() style='width:"+(300*FactorW)+"'>"+
			"<a style='text-decoration:none;color:purple;font-weight:bold' href=javascript:resetMatrix();importExample('"+exampleId+"');hiliteRow('"+exampleId+"')  title='show this example'>"+i+".  "+exampleDescr+"</a></td>"+
			"<TD style='text-align:justify;width:"+(300*FactorW)+"'>"+dwgDescr+"</TD>"+
			"<TD style='text-align:justify;width:"+(300*FactorW)+"'>"+sourceDescr+"</TD>"+
		"</TR>"

				//---publish utility---
					publishTable+="<tr><td><b><a href='http://www.mobiusPortal.com/Examples/example"+i+".htm'>XML / SVG DOM Javascript Example : "+exampleDescr+"</b></a></td><td>"+dwgDescr+"</td><td>"+sourceDescr+"</td></tr>"

	}


		publishTable+="</table>"
		var reBut=/<button/g
		var reeBut=/<\/button>/g
		var reIn=/<input/g
		var reSpan=/<span/g
		var reSpanE=/<\/span>/g
		var reId=/id=/g
		publishTable=publishTable.replace(reBut,"")
		publishTable=publishTable.replace(reeBut,"")
		publishTable=publishTable.replace(reIn,"")
		publishTable=publishTable.replace(reSpan,"")
		publishTable=publishTable.replace(reSpanE,"")
		publishTable=publishTable.replace(reId,"")



	//---provide vertical 'spacer' to allow the bottommost examples to scroll umder the drawing.---
	exampleTable+="<tr><td class=medium valign=top align=center colspan=3 style='background-color:lemonchiffon;height:"+(250*FactorW)+";'>- - - - - - END - - - - - - </td></tr>"
					
	exampleTable+="</table>"
	
	exampleDiv.innerHTML=basicTable+exampleTable
}

var basicArray=new Array();
basicArray[0]='Matrix Values'+
'@Each matrix value is associated with one or more transformations'+
'@<center>Place mouse over:<br>'+
'<span style="cursor:hand" id=Matrix_ValuesSpan disabled>'+
'<span style="background-color:linen;padding:3" onmouseover=if(CurrentActiveView=="Matrix_Values"){this.style.color="blue";Imp.showTransValue()} onmouseout=if(CurrentActiveView=="Matrix_Values"){this.style.color="";Imp.returnChildrenValue()}>&nbsp;translate&nbsp;</span>'+
' <span style="background-color:linen;padding:3"  onmouseover=if(CurrentActiveView=="Matrix_Values"){this.style.color="blue";Imp.showRotateValue()} onmouseout=if(CurrentActiveView=="Matrix_Values"){this.style.color="";Imp.returnChildrenValue()}>&nbsp;rotate&nbsp;</span>'+
' <span style="background-color:linen;padding:3"  onmouseover=if(CurrentActiveView=="Matrix_Values"){this.style.color="blue";Imp.showScaleValue()} onmouseout=if(CurrentActiveView=="Matrix_Values"){this.style.color="";Imp.returnChildrenValue()}>&nbsp;scale&nbsp;</span>'+
' <span style="background-color:linen;padding:3"  onmouseover=if(CurrentActiveView=="Matrix_Values"){this.style.color="blue";Imp.showSkewValue()} onmouseout=if(CurrentActiveView=="Matrix_Values"){this.style.color="";Imp.returnChildrenValue()}>&nbsp;skew&nbsp;</span></center></span>'+
'@'

basicArray[1]='The 4 Transformations'+
'@The matrix changes following each transformation'+
'@<center>Place mouse over:<br>'+
'<span style="cursor:hand" id=The_4_TransformationsSpan disabled>'+
'<span style="background-color:linen;padding:3" onmouseover=if(CurrentActiveView=="The_4_Transformations"){this.style.color="blue";Imp.showTransMatrix()} onmouseout=if(CurrentActiveView=="The_4_Transformations"){this.style.color="";Imp.returnChildrenMatrix()}>&nbsp;translate&nbsp;</span>'+
' <span style="background-color:linen;padding:3"  onmouseover=if(CurrentActiveView=="The_4_Transformations"){this.style.color="blue";Imp.showRotateMatrix()} onmouseout=if(CurrentActiveView=="The_4_Transformations"){this.style.color="";Imp.returnChildrenMatrix()}>&nbsp;rotate&nbsp;</span>'+
' <span style="background-color:linen;padding:3"  onmouseover=if(CurrentActiveView=="The_4_Transformations"){this.style.color="blue";Imp.showScaleMatrix()} onmouseout=if(CurrentActiveView=="The_4_Transformations"){this.style.color="";Imp.returnChildrenMatrix()}>&nbsp;scale&nbsp;</span>'+
' <span style="background-color:linen;padding:3"  onmouseover=if(CurrentActiveView=="The_4_Transformations"){this.style.color="blue";Imp.showSkewMatrix()} onmouseout=if(CurrentActiveView=="The_4_Transformations"){this.style.color="";Imp.returnChildrenMatrix()}>&nbsp;skew&nbsp;</span></center></span>'+
'<span class=small>Following each transformation, getCTM() returns the resulting matrix, as displayed above</span>'+
'@Rotate, scale and skew are about the element center point. First translate the element coordinates to its center, then translate back.'
basicArray[2]='getCTM'+
'@myCTM=element.getCTM()<p>'+
'<span class=small>The kids have been rotated by 45 degrees about the center of their bounding box</span>'+
'@Following transformations, this returns the current transformation matrix object for an element.'+
'@The a-f values are extracted: a=myCTM.a, b=myCTM.b, c=myCTM.c, d=myCTM.d, e=myCTM.e, f=myCTM.f'


basicArray[3]='Bounding Box'+
'@A rectangle that encloses an element. Our Ghost element, the kids bounding box in white  is shown, with its center point in red'+
'@<center>Click to move the kids<br><button id=Bounding_BoxButton disabled onClick=Imp.translateKids()>translate</button></center>'+
'<span class=small>The kids are translated. Its bounding box is then requested, but does not follow their translation.</span>'+
'@When an element is created, its bounding box is born and locked at its origin and size, no matter what transformations may occur to the element.'

basicArray[4]='SVG Wrapper'+
'@Provides a bounding box for transformed elements. Tracks the element through transformations.'+
'@<center>Click for svg wrapper:<br>'+
'<button disabled id=SVG_WrapperButton style="color:blue" onClick=Imp.wrapMe()>wrap me!</button></center>'+
'<span class=small>The wrapper bounding box, Oracle, is shown in blue, with its  center point. It has followed the kid\'s translation.</span>'+
'@After an element is transformed its bounding box is not valid in the current coordinate system. The SVG wrapper, however does track the element\'s current width, height, and x,y values. '






basicArray[5]='Appending Transforms'+
'@Transforms are \'additive\'. Each transform request is appended to the current transform  matrix. This append then is set as the element\'s transform attribute value, thereby creating a new transform matrix.'+
'@<center>Add a transform<br>'+
'<span id=Appending_TransformsSpan disabled>'+
'<table class=medium>'+
'<tr><td>Translate:</td>'+
'<td>'+
'<select onChange=Imp.goAppendingTransforms() style="width:100"  id=Appending_TransformsTranslateSelect>'+
'<option value="translate">translate</option>'+
'<option selected value="0,0">0,0</option>'+
'<option value="20,30">20,30</option>'+
'<option value="20,-30">20,-30</option>'+
'<option value="10,10">10,10</option>'+
'<option value="-20,-10">-20,-10</option>'+
'</select>'+
'</td></tr>'+
'<tr><td>Rotate:</td>'+
'<td>'+
'<select onChange=Imp.goAppendingTransforms()  style="width:100"    id=Appending_TransformsRotateSelect>'+
'<option value="rotate">rotate</option>'+
'<option selected value="0">0</option>'+
'<option value="20">20</option>'+
'<option value="30">30</option>'+
'<option value="45">45</option>'+
'<option value="-20">-20</option>'+
'<option value="-30">-30</option>'+
'<option value="-45">-45</option>'+
'</select>'+
'</td></tr>'+
'<tr><td>Scale:</td>'+
'<td>'+
'<select onChange=Imp.goAppendingTransforms()  style="width:100"  id=Appending_TransformsScaleSelect>'+
'<option value="scale">scale</option>'+
'<option value=".2">.2</option>'+
'<option value=".5">.5</option>'+
'<option selected value="1">1</option>'+
'<option value="1.1">1.1</option>'+
'<option value="1.25">1.25</option>'+
'<option value="1.5">1.5</option>'+
'</select>'+
'</td></tr>'+
'<tr><td>Skew(x,y):</td>'+
'<td>'+
'<select onChange=Imp.goAppendingTransforms()  style="width:100"   id=Appending_TransformsSkewSelect>'+
'<option value="skew">skew</option>'+
'<option selected value="0,0">0,0</option>'+
'<option value="20,30">20,30</option>'+
'<option value="20,-30">20,-30</option>'+
'<option value="10,10">10,10</option>'+
'<option value="-20,10">-20,10</option>'+
'<option value="-20,10">-20,-30</option>'+
'</select>'+
'</td></tr>'+
'<tr><td colspan=2 align=center>'+
'<button onClick=Imp.resetAppendingTransforms()>reset</button>'+
'</td></tr></table>'+
'</span></center>'+
'@The appended transforms, and evolving matrix are displayed in the Source textarea above.'

basicArray[6]='Translation Changes'+
'@After an element has been transformed, further translations to  other locations are accomplished by adding the values to the <b>e</b> &amp; <b>f</b> values of the matrix.'+
'@<span class=small>The kids have been scaled, rotated, skewed, each from the original bounding box center point, plus it was translated. </span><center>'+
'<button disabled id=translateByButton style="width:180;" onClick=Imp.translateBy2030()>translate By:(20 30)</button><br><button id=goToButton disabled style="font-weight:bold;width:180;color:darkorchid" title="go to a specific location" onClick=Imp.goTo150150()>go to:(150 150)</button></center>'+
'@The SVG wrapper center point is used as the reference point for translations to a specific point. '

basicArray[7]='Transform History'+
'@Resetting the rotation, scale, and skew transforms to  their default values employs a transform history attribute. Each transformation is recorded within this attribute for the element.'+
'@<span class=small>The kids have been scaled, rotated, skewed, each from the  original bounding box  center point, plus it was translated. </span><center>'+
'<button disabled id=resetRotate0Button style="font-weight:bold;width:180;" onClick=Imp.resetRotate0()>reset rotate:(0)</button><br>'+
'<button  disabled id=resetScale1Button  style="font-weight:bold;width:180;"  onClick=Imp.resetScale1()>reset scale:(1)</button><br>'+
'<button  disabled id=resetSkew0Button  style="font-weight:bold;width:180;"   onClick=Imp.resetSkew0()>reset skew:(0)</button>'+
'</center>'+
'@The history attribute is played back, extracting the specified transform without disturbing the others or the element\'s location. That specific transform can then be re-applied.'



basicArray[8]='Rotation Changes'+
'@After an element has been transformed, further rotations can be added, and/or rotation can be reset to (0) then re-applied.'+
'@<span class=small>The kids have been scaled, rotated, skewed, each from the  original bounding box  center point, plus it was translated. </span><center>'+
'<button disabled    id=rotateByButton style="font-weight:bold;width:180;" onClick=Imp.rotateBy30()>rotate By:(30)</button><br>'+
'<button disabled  id=rotateToButton   style="font-weight:bold;width:180;" title="rotate to a fixed value" onClick=Imp.rotateTo45()>rotate to:(45)</button></center>'+
'@The original bounding box center point is used as the reference to add rotation. '

basicArray[9]='Scaling Changes'+
'@After an element has been transformed, further scaling can be added, and/or scale can be reset to (1) then re-applied.'+
'@<span class=small>The kids have been scaled, rotated, skewed, each from the  original bounding box  center point, plus it was translated. </span><center>'+
'<button  disabled   id=scaleByButton style="font-weight:bold;width:180;" onClick=Imp.scaleBy11()>scale By:(1.1)</button><br>'+
'<button disabled  id=scaleToButton   style="font-weight:bold;width:180;" title="scale to a fixed value" onClick=Imp.scaleTo5()>scale to:(.5)</button></center>'+
'@The original bounding box center point is used as the reference to add scaling. '

basicArray[10]='Skewing Changes'+
'@After an element has been transformed, further skews can be added, and/or shewX, skewY can be reset to (0) then re-applied.'+
'@<span class=small>The kids have been scaled, rotated, skewed, each from the  original bounding box  center point, plus it was translated. </span><center>'+
'<button  disabled  id=skewByButton style="font-weight:bold;width:180;" onClick=Imp.skewBy8()>skew By:(8)</button><br><button disabled  id=skewToButton  style="font-weight:bold;width:180;" title="skew to a fixed value" onClick=Imp.skewTo25()>skew to:(25)</button>'+
'<br><span  class=small>Note: the skew angles are in radians</span></center>'+
'@The original bounding box center point is used as the reference to add skews. '

basicArray[11]='Transform Strategy'+
'@It substantially simplifies transforms if an element is initially created with its bounding box center at (0,0).'+
'<br><span class=small>The symbols are "The Machines", each being a path created with their centers at the origin(0,0).  </span>'+
'@<center>Transform Random Elements<br>'+
'<span id=strategySpan disabled><button onClick=Imp.machineRandomShuffle()>shuffle</button>'+
'<button onClick=Imp.machineRandomRotate()>rotate</button>'+
'<button onClick=Imp.machineRandomScale()>scale</button>'+
'<button onClick=Imp.machineRandomSkew()>skew</button><br>'+
'<button title="reset to original locations" onClick=Imp.machineRandomReset()>reset</button></span></center>'+
'<span class=small>The machines are placed in a grid (A-G thru 1-7). All transforms are accomplished within each grid location</span>'+

'@Each element includes its transformHistory attribute that tracks its transforms. Following each selection, the current values for each changed machine symbol are shown in the Source textarea above.'

basicArray[12]='Building Transformable Elements'+
'@Prior to creating an SVG element for transforms, its construction with a bounding box center point,  located at (0,0), can be computed.'+
'@Elements above are shown in their current bounding boxes. Select \'run\' to rebuild them with a bounding box center at the origin.<br>'+
'<center><button id=rebuildButton disabled onClick=Imp.rebuildElem()>run</button></center><span class=small>The elements will be rebuilt, then translated back to their original positions.</span>'+
'@Create elements in the svg document, then run similar functions to rebuild them so their bounding box center is at the origin(0,0)'
/*
basicArray[]='methodName'+
'@myElem.methodName(prop)'+
'@this describes what it provides'+
'@this describes its advantages if used'

*/



var exampleArray=[];

exampleArray[0]="" //--blank---

/*
exampleArray[0]="example description"+
"@ what you have to do to participate"+
"@ What was demonstrated in the example"
*/



