//---The cast of players (Global vars)---
var Wizard //---SVG Document---
var Oz //---Root SVG, contains all svg elements---
var EmeraldCity //---group, <g> containing the spirals---
var YellowBrickRoad   //---the main player(s) at center stage---
//---a topmost empty group<g> used in dynamic examples--
var Rainbow
var Grid
var LocLayer
//---fired on HTML load---
function initSVG()
{
    Wizard=document.embeds["svgEmbed"].getSVGDocument();
    Oz=Wizard.documentElement;
    EmeraldCity=Wizard.getElementById("EmeraldCity");
	YellowBrickRoad=Wizard.getElementById("YellowBrickRoad");
    Rainbow=Wizard.getElementById("Rainbow");
    Grid=Wizard.getElementById("Grid");
    LocLayer=Wizard.getElementById("LocLayer");
setTimeout("initHomeNavContext()",1500)

}


function initHomeNavContext()
{
 	initHomeSVG()
	disableHomeContextItem("pathContext")
	checkHomeContextItem("pathContext")
	homeSpan.style.visibility="visible"

}

//----places opener and thumbs in import area
function importThumb()
{
	importTextValue.value=YellowBrickRoad.getAttribute("d")

	loadFormValues()
}

var Points


//==========================COM CONTROL PANEL=======================


//---used for loc point values
var CommXLocValue
var CommYLocValue

var SelectNum
var SelectString=","

//---PrevX,PrevY used for relative points----

function commSelectAdd()
{

		CommLocXValue=eval("xCom"+SelectNum+"Value")
		CommLocYValue=eval("yCom"+SelectNum+"Value")

		if(Command=="+")
		{
			eval("xCom"+SelectNum+"Value.value=''")
			eval("xCom"+SelectNum+"Value.disabled=false")
			eval("xCom"+SelectNum+"Value.style.backgroundColor=''")
			eval("xCom"+SelectNum+"Value.style.borderColor='lightgreen'")
			eval("yCom"+SelectNum+"Value.value=''")
			eval("yCom"+SelectNum+"Value.disabled=false")
			eval("yCom"+SelectNum+"Value.style.backgroundColor=''")
			eval("yCom"+SelectNum+"Value.style.borderColor='lightgreen'")
			eval("z"+SelectNum+"Select.selectedIndex=0")
		}

		var relString="achlmqstv"
		if(relString.indexOf(Command)!=-1)
		{
			eval("xCom"+(SelectNum )+"Value.style.fontWeight=''")
			eval("xCom"+(SelectNum )+"Value.style.fontStyle='italic'")
			eval("yCom"+(SelectNum )+"Value.style.fontWeight=''")
			eval("yCom"+(SelectNum )+"Value.style.fontStyle='italic'")
		}

		if(Command=="A" || Command=="a")
		{
			var arcSpan=eval("com"+SelectNum+"ArcSpan")
			if(SelectNum<=9)
			{
				eval("xCom"+SelectNum+"Value.value=''")
				eval("xCom"+SelectNum+"Value.disabled=false")
				eval("xCom"+SelectNum+"Value.style.backgroundColor=''")
				eval("xCom"+SelectNum+"Value.style.borderColor='lightgreen'")
				eval("yCom"+SelectNum+"Value.value=''")
				eval("yCom"+SelectNum+"Value.disabled=false")
				eval("yCom"+SelectNum+"Value.style.backgroundColor=''")
				eval("yCom"+SelectNum+"Value.style.borderColor='lightgreen'")

				arcSpan.style.overflow=""
				arcSpan.style.height=""
				eval("angCom"+SelectNum+"Value.value='0'")
				eval("sw1Com"+SelectNum+"Select.selectedIndex=1")
				eval("sw2Com"+SelectNum+"Select.selectedIndex=1")
				eval("z"+SelectNum+"Select.selectedIndex=0")
				eval("z"+SelectNum+"Select.disabled=true")

				//---then hilite the following 1---

                eval("select"+(SelectNum+1)+"Span.innerHTML="+(SelectNum+1))

				if(relString.indexOf(Command)!=-1)
				{
					eval("xCom"+(SelectNum+1)+"Value.style.fontWeight=''")
					eval("xCom"+(SelectNum+1)+"Value.style.fontStyle='italic'")
					eval("yCom"+(SelectNum+1)+"Value.style.fontWeight=''")
					eval("yCom"+(SelectNum+1)+"Value.style.fontStyle='italic'")
				}

			}
			else
				alert("The arc requires two(2) points")

		}

		else if(Command=="V" || Command=="v")
		{
			eval("xCom"+SelectNum+"Value.value=''")
			eval("xCom"+SelectNum+"Value.disabled=true")
			eval("xCom"+SelectNum+"Value.style.backgroundColor='gainsboro'")
			eval("xCom"+SelectNum+"Value.style.borderColor=''")
			eval("yCom"+SelectNum+"Value.value=''")
			eval("yCom"+SelectNum+"Value.disabled=false")
			eval("yCom"+SelectNum+"Value.style.backgroundColor=''")
			eval("yCom"+SelectNum+"Value.style.borderColor='lightgreen'")
			eval("com"+SelectNum+"ArcSpan.style.overflow='hidden'")
			eval("com"+SelectNum+"ArcSpan.style.height=1")
			eval("angCom"+SelectNum+"Value.value=''")
			eval("sw1Com"+SelectNum+"Select.selectedIndex=0")
			eval("sw2Com"+SelectNum+"Select.selectedIndex=0")
			eval("z"+SelectNum+"Select.selectedIndex=0")
	   	}
	   else if(Command=="H" || Command=="h")
		{
			eval("yCom"+SelectNum+"Value.value=''")
			eval("yCom"+SelectNum+"Value.disabled=true")
			eval("yCom"+SelectNum+"Value.style.backgroundColor='gainsboro'")
			eval("yCom"+SelectNum+"Value.style.borderColor=''")
			eval("xCom"+SelectNum+"Value.value=''")
			eval("xCom"+SelectNum+"Value.disabled=false")
			eval("xCom"+SelectNum+"Value.style.backgroundColor=''")
			eval("xCom"+SelectNum+"Value.style.borderColor='lightgreen'")
			eval("com"+SelectNum+"ArcSpan.style.overflow='hidden'")
			eval("com"+SelectNum+"ArcSpan.style.height=1")
			eval("angCom"+SelectNum+"Value.value=''")
			eval("sw1Com"+SelectNum+"Select.selectedIndex=0")
			eval("sw2Com"+SelectNum+"Select.selectedIndex=0")
		   	eval("z"+SelectNum+"Select.selectedIndex=0")
		}
	   else if(Command=="L" || Command=="l" || Command=="T" || Command=="t")
	   {
			eval("yCom"+SelectNum+"Value.value=''")
			eval("yCom"+SelectNum+"Value.disabled=false")
			eval("yCom"+SelectNum+"Value.style.backgroundColor=''")
			eval("yCom"+SelectNum+"Value.style.borderColor='lightgreen'")
			eval("xCom"+SelectNum+"Value.value=''")
			eval("xCom"+SelectNum+"Value.disabled=false")
			eval("xCom"+SelectNum+"Value.style.backgroundColor=''")
			eval("xCom"+SelectNum+"Value.style.borderColor='lightgreen'")
			eval("com"+SelectNum+"ArcSpan.style.overflow='hidden'")
			eval("com"+SelectNum+"ArcSpan.style.height=1")
			eval("angCom"+SelectNum+"Value.value=''")
			eval("sw1Com"+SelectNum+"Select.selectedIndex=0")
			eval("sw2Com"+SelectNum+"Select.selectedIndex=0")
			eval("z"+SelectNum+"Select.selectedIndex=0")
	   	}
	   else if(Command=="M" || Command=="m")
		{
			eval("yCom"+SelectNum+"Value.value=''")
			eval("yCom"+SelectNum+"Value.disabled=false")
			eval("yCom"+SelectNum+"Value.style.backgroundColor=''")
			eval("yCom"+SelectNum+"Value.style.borderColor='lightgreen'")
			eval("xCom"+SelectNum+"Value.value=''")
			eval("xCom"+SelectNum+"Value.disabled=false")
			eval("xCom"+SelectNum+"Value.style.backgroundColor=''")
			eval("xCom"+SelectNum+"Value.style.borderColor='lightgreen'")
			eval("com"+SelectNum+"ArcSpan.style.visibility='hidden'")
			eval("com"+SelectNum+"ArcSpan.style.overflow='hidden'")
			eval("com"+SelectNum+"ArcSpan.style.height=1")
			eval("sw1Com"+SelectNum+"Select.selectedIndex=0")
			eval("sw2Com"+SelectNum+"Select.selectedIndex=0")
			eval("z"+SelectNum+"Select.selectedIndex=0")
		}
				//---hilite borders of following 2 points----
		else if(Command=="C" || Command=="c") //---minimum of 3 points---
		{
			if(SelectNum<=8)
			{
				eval("xCom"+SelectNum+"Value.value=''")
				eval("xCom"+SelectNum+"Value.disabled=false")
				eval("xCom"+SelectNum+"Value.style.backgroundColor=''")
				eval("xCom"+SelectNum+"Value.style.borderColor='lightgreen'")
				eval("yCom"+SelectNum+"Value.value=''")
				eval("yCom"+SelectNum+"Value.disabled=false")
				eval("yCom"+SelectNum+"Value.style.backgroundColor=''")
				eval("yCom"+SelectNum+"Value.style.borderColor='lightgreen'")
				eval("com"+SelectNum+"ArcSpan.style.overflow='hidden'")
				eval("com"+SelectNum+"ArcSpan.style.height=1")
				eval("angCom"+SelectNum+"Value.value=''")
				eval("sw1Com"+SelectNum+"Select.selectedIndex=0")
				eval("sw2Com"+SelectNum+"Select.selectedIndex=0")
				eval("z"+SelectNum+"Select.selectedIndex=0")
				eval("z"+SelectNum+"Select.disabled=true")
				//---then hilite the following 2---
				eval("select"+(SelectNum+1)+"Span.innerHTML="+(SelectNum+1))
				eval("select"+(SelectNum+2)+"Span.innerHTML="+(SelectNum+2))

/*
				eval("xCom"+(SelectNum+1)+"Value.style.borderColor='lightgreen'")
				eval("yCom"+(SelectNum+1)+"Value.style.borderColor='lightgreen'")
				eval("xCom"+(SelectNum+2)+"Value.style.borderColor='lightgreen'")
				eval("yCom"+(SelectNum+2)+"Value.style.borderColor='lightgreen'")
				eval("select"+(SelectNum+1)+"Span.innerHTML=''")
				eval("select"+(SelectNum+1)+"Span.disabled=true")
				eval("select"+(SelectNum+2)+"Span.innerHTML=''")
				eval("select"+(SelectNum+2)+"Span.disabled=true")
				eval("z"+(SelectNum+1)+"Select.selectedIndex=0")
				eval("z"+(SelectNum+1)+"Select.disabled=true")
				eval("z"+(SelectNum+2)+"Select.selectedIndex=0")
*/
				if(relString.indexOf(Command)!=-1)
				{
					eval("xCom"+(SelectNum+1)+"Value.style.fontWeight=''")
					eval("xCom"+(SelectNum+1)+"Value.style.fontStyle='italic'")
					eval("yCom"+(SelectNum+1)+"Value.style.fontWeight=''")
					eval("yCom"+(SelectNum+1)+"Value.style.fontStyle='italic'")
					eval("xCom"+(SelectNum+2)+"Value.style.fontWeight=''")
					eval("xCom"+(SelectNum+2)+"Value.style.fontStyle='italic'")
					eval("yCom"+(SelectNum+2)+"Value.style.fontWeight=''")
					eval("yCom"+(SelectNum+2)+"Value.style.fontStyle='italic'")
				}

			}
			else
			alert("This command requires at least three(3) set of points")
		}
		else if(Command=="S" || Command=="s"   ||Command=="Q" || Command=="q") //---minimum of 2 points---
	   	{
	        if(SelectNum<=9)
			{
				eval("xCom"+SelectNum+"Value.value=''")
				eval("xCom"+SelectNum+"Value.disabled=false")
				eval("xCom"+SelectNum+"Value.style.backgroundColor=''")
				eval("xCom"+SelectNum+"Value.style.borderColor='lightgreen'")
				eval("yCom"+SelectNum+"Value.value=''")
				eval("yCom"+SelectNum+"Value.disabled=false")
				eval("yCom"+SelectNum+"Value.style.backgroundColor=''")
				eval("yCom"+SelectNum+"Value.style.borderColor='lightgreen'")

				eval("com"+SelectNum+"ArcSpan.style.overflow='hidden'")
				eval("com"+SelectNum+"ArcSpan.style.height=1")
				eval("angCom"+SelectNum+"Value.value=''")
				eval("sw1Com"+SelectNum+"Select.selectedIndex=0")
				eval("sw2Com"+SelectNum+"Select.selectedIndex=0")
                eval("z"+(SelectNum)+"Select.selectedIndex=0")
                eval("z"+(SelectNum)+"Select.disabled=true")
			//---then hilite the following 1---
				//eval("xCom"+(SelectNum+1)+"Value.style.borderColor='lightgreen'")
				//eval("yCom"+(SelectNum+1)+"Value.style.borderColor='lightgreen'")
				eval("select"+(SelectNum+1)+"Span.innerHTML="+(SelectNum+1))
				//eval("select"+(SelectNum+1)+"Span.disabled=true")
                //eval("z"+(SelectNum+1)+"Select.selectedIndex=0")
				if(relString.indexOf(Command)!=-1)
				{
					eval("xCom"+(SelectNum+1)+"Value.style.fontWeight=''")
					eval("xCom"+(SelectNum+1)+"Value.style.fontStyle='italic'")
					eval("yCom"+(SelectNum+1)+"Value.style.fontWeight=''")
					eval("yCom"+(SelectNum+1)+"Value.style.fontStyle='italic'")
				}

			}
			else
				alert("This command requires at least two(2) sets of points")
		}

	showButton.disabled=false
	ShowInit=false

}

//----select + point------
var PlusPointArray=[]; // highlights drag/drop plus points
function commAddPoint()
{

		CommLocXValue=eval("xCom"+SelectNum+"Value")
		CommLocYValue=eval("yCom"+SelectNum+"Value")
			eval("xCom"+SelectNum+"Value.value=''")
			eval("xCom"+SelectNum+"Value.disabled=false")
			eval("xCom"+SelectNum+"Value.style.backgroundColor=''")
			eval("xCom"+SelectNum+"Value.style.borderColor='lightgreen'")
			eval("yCom"+SelectNum+"Value.value=''")
			eval("yCom"+SelectNum+"Value.disabled=false")
			eval("yCom"+SelectNum+"Value.style.backgroundColor=''")
			eval("yCom"+SelectNum+"Value.style.borderColor='lightgreen'")
			eval("z"+SelectNum+"Select.selectedIndex=0")



PlusPointArray[PlusPointArray.length]=SelectNum

	showButton.disabled=false
	ShowInit=false
}


function commSelectRemove()
{

		for(var k=SelectNum;k<=10;k++)
		{
			eval("select"+k+"Span.innerHTML=''")
			eval("select"+k+"Span.disabled=true")
			eval("select"+k+"Span.style.borderWidth=1")
			eval("select"+k+"Span.style.backgroundColor='white'")
			eval("select"+k+"Span.style.cursor=''")
			eval("select"+k+"Span.style.title=''")


			eval("xCom"+k+"Value.value=''")
			eval("xCom"+k+"Value.disabled=false")
			eval("xCom"+k+"Value.style.backgroundColor=''")
			eval("xCom"+k+"Value.style.borderColor=''")
			eval("xCom"+k+"Value.style.fontWeight='bold'")
			eval("xCom"+k+"Value.style.fontStyle=''")

			eval("yCom"+k+"Value.style.fontWeight='bold'")
			eval("yCom"+k+"Value.style.fontStyle=''")
			eval("yCom"+k+"Value.value=''")
			eval("yCom"+k+"Value.disabled=false")
			eval("yCom"+k+"Value.style.backgroundColor=''")
			eval("yCom"+k+"Value.style.borderColor=''")

			eval("com"+k+"ArcSpan.style.overflow='hidden'")
			eval("com"+k+"ArcSpan.style.height=1")
			eval("angCom"+k+"Value.value=''")
			eval("sw1Com"+k+"Select.selectedIndex=0")
			eval("sw2Com"+k+"Select.selectedIndex=0")
			eval("z"+k+"Select.selectedIndex=0")
		  	eval("z"+k+"Select.disabled=false")
		}

		var reNumLoc=/NumLoc/ //---id, a number
		var reTagLoc=/TagLoc/	//---id commande
		//----clear downstream Loc Points-----

		for(var k=LocLayer.childNodes.length-1;k>=0;k--)
		{
			var elem=LocLayer.childNodes.item(k)
			if(elem.getAttribute("pnt")) //--the circle
			{
				var locPntCnt=elem.getAttribute("pnt")
				if(locPntCnt>=SelectNum)
					LocLayer.removeChild(elem)
			}
			if(elem.getAttribute("id")) //---num or command---
			{
				var tagId=elem.getAttribute("id")
				if(tagId.indexOf("NumLoc")!=-1)
				{
					var locPntCnt=tagId.replace(reNumLoc,"")
					if(locPntCnt>=SelectNum)
						LocLayer.removeChild(elem)
				}

				if(tagId.indexOf("TagLoc")!=-1)
				{
					var locPntCnt=tagId.replace(reTagLoc,"")
					if(locPntCnt>=SelectNum)
						LocLayer.removeChild(elem)
				}
			}

		}

		//---reset Loc Pnt-----
        	for(var k=SelectNum;k<RelPointArray.length;k++)
			{
				RelPointArray[k]=""
			}

			var holdArray=[];
        	for(var k=0;k<SelectNum;k++)
			{
				holdArray[holdArray.length]=PlusPointArray[k]
			}
			PlusPointArray=holdArray



			HiliteString=""

			for(k=1;k<SelectNum;k++)
			{
				HiliteString+=k

			}



			SelectString=","
			for(k=1;k<SelectNum-1;k++)
			{
				SelectString+=k+","
			}



			//---activate this command-----
			eval("select"+SelectNum+"Span.disabled=false")
			eval("select"+SelectNum+"Span.style.borderWidth=2")
			eval("select"+SelectNum+"Span.style.cursor=''")
			eval("select"+SelectNum+"Span.style.title=''")

	showButton.disabled=false
	ShowInit=false
}



function commSelectChange(comm)
{
	commSelectRemove()
	Command=comm
	var selectSpan=eval("select"+SelectNum+"Span")
	selectSpan.innerText=Command
	commSelectAdd()
}


function clearComValues()
{
	SelectNum=1
	commSelectRemove()
	if(YellowBrickRoad.getAttribute("transform"))
	YellowBrickRoad.removeAttribute("transform")
	initLocPoints()
	YellowBrickRoad.setAttribute("d","")
importButton.disabled=true
	importTextValue.style.color="blue"
	importTextValue.value="Click on the image to locate the path starting M point"

	if(PrevThumb !=null)
	{
	 var prevTD=eval("thumb"+PrevThumb+"TD")
	 prevTD.style.borderStyle="outset"
	}
	PrevThumb=null
	showButton.disabled=true

	infoSpan.innerHTML=""
	//---focus M start---
	select1Span.innerText="M"
	select1Span.style.borderWidth=2
	Command="M"
 	PrevHilite=null
 	HiliteString=""
	PrevChange=null
	//---remove previous drag circles----
	if(Rainbow.childNodes.length>0)
	{
		for(var k=Rainbow.childNodes.length-1;k>=0;k--)
		{
			Rainbow.removeChild(Rainbow.childNodes.item(k))
		}
	}
	PlusPointArray=[]
	//---clear Rel values---
	for(var k=0;k<RelPointArray.length;k++)
	{
		RelPointArray[k]=""
	}

}

var ShowInit=false
function show()
{
//--prevents added loc points during preview drag/drop----
ShowInit=true //---changed to false after change(s) at comm form---
	SelectString=","
	PrevX=0
	PrevY=0
	importTextValue.style.color=""
//----parse for sequential commands & filled x,y values



 var com1=select1Span.innerText
if(com1=="+"||com1=="")com1=""
else
com1+=" "

var x1=xCom1Value.value
var y1=yCom1Value.value

//---horiz/vertical----
if(com1=="H " || com1=="h ")
{
 	x1+=","
	y1=""
}
else
{
	if(x1!="")x1+=" "
	if(y1!="")y1=y1+","
}

 var ang1=angCom1Value.value
 var sw1_1=sw1Com1Select.options[sw1Com1Select.selectedIndex].value
 var sw2_1=sw2Com1Select.options[sw2Com1Select.selectedIndex].value
 if(ang1!="")ang1=ang1+","
 if(sw1_1!="")sw1_1=sw1_1+","
 if(sw2_1!="")sw2_1=sw2_1+","
 var z1=""

 var com2=select2Span.innerText
if(com2=="+"||isNaN(com2)==false)com2=""
else
com2+=" "

var x2=xCom2Value.value
var y2=yCom2Value.value

//---horiz/vertical----
if(com2=="H " || com2=="h ")
{
 	x2+=","
	y2=""
}
else
{
	if(x2!="")x2+=" "
	if(y2!="")y2=y2+","
}

 var ang2=angCom2Value.value
 var sw1_2=sw1Com2Select.options[sw1Com2Select.selectedIndex].value
 var sw2_2=sw2Com2Select.options[sw2Com2Select.selectedIndex].value
 if(ang2!="")ang2=ang2+","
 if(sw1_2!="")sw1_2=sw1_2+","
 if(sw2_2!="")sw2_2=sw2_2+","

var z2=z2Select.options[z2Select.selectedIndex].value
if(z2!="")z2+=","


 var com3=select3Span.innerText
if(com3=="+"||isNaN(com3)==false)com3=""
else
com3+=" "

var x3=xCom3Value.value
var y3=yCom3Value.value

//---horiz/vertical----
if(com3=="H " || com3=="h ")
{
 	x3+=","
	y3=""
}
else
{
	if(x3!="")x3+=" "
	if(y3!="")y3=y3+","
}

 var ang3=angCom3Value.value
 var sw1_3=sw1Com3Select.options[sw1Com3Select.selectedIndex].value
 var sw2_3=sw2Com3Select.options[sw2Com3Select.selectedIndex].value
 if(ang3!="")ang3=ang3+","
 if(sw1_3!="")sw1_3=sw1_3+","
 if(sw2_3!="")sw2_3=sw2_3+","
var z3=z3Select.options[z3Select.selectedIndex].value
if(z3!="")z3+=","

 var com4=select4Span.innerText
if(com4=="+"||isNaN(com4)==false)com4=""
else
com4+=" "

var x4=xCom4Value.value
var y4=yCom4Value.value

//---horiz/vertical----
if(com4=="H " || com4=="h ")
{
 	x4+=","
	y4=""
}
else
{
	if(x4!="")x4+=" "
	if(y4!="")y4=y4+","
}

 var ang4=angCom4Value.value
 var sw1_4=sw1Com4Select.options[sw1Com4Select.selectedIndex].value
 var sw2_4=sw2Com4Select.options[sw2Com4Select.selectedIndex].value
 if(ang4!="")ang4=ang4+","
 if(sw1_4!="")sw1_4=sw1_4+","
 if(sw2_4!="")sw2_4=sw2_4+","
var z4=z4Select.options[z4Select.selectedIndex].value
if(z4!="")z4+=","

 var com5=select5Span.innerText
if(com5=="+"||isNaN(com5)==false)com5=""
else
com5+=" "

var x5=xCom5Value.value
var y5=yCom5Value.value

//---horiz/vertical----
if(com5=="H " || com5=="h ")
{
 	x5+=","
	y5=""
}
else
{
	if(x5!="")x5+=" "
	if(y5!="")y5=y5+","
}

 var ang5=angCom5Value.value
 var sw1_5=sw1Com5Select.options[sw1Com5Select.selectedIndex].value
 var sw2_5=sw2Com5Select.options[sw2Com5Select.selectedIndex].value
 if(ang5!="")ang5=ang5+","
 if(sw1_5!="")sw1_5=sw1_5+","
 if(sw2_5!="")sw2_5=sw2_5+","
var z5=z5Select.options[z5Select.selectedIndex].value
if(z5!="")z5+=","

 var com6=select6Span.innerText
if(com6=="+"||isNaN(com6)==false)com6=""
else
com6+=" "

var x6=xCom6Value.value
var y6=yCom6Value.value

//---horiz/vertical----
if(com6=="H " || com6=="h ")
{
 	x6+=","
	y6=""
}
else
{
	if(x6!="")x6+=" "
	if(y6!="")y6=y6+","
}

 var ang6=angCom6Value.value
 var sw1_6=sw1Com6Select.options[sw1Com6Select.selectedIndex].value
 var sw2_6=sw2Com6Select.options[sw2Com6Select.selectedIndex].value
 if(ang6!="")ang6=ang6+","
 if(sw1_6!="")sw1_6=sw1_6+","
 if(sw2_6!="")sw2_6=sw2_6+","
var z6=z6Select.options[z6Select.selectedIndex].value
if(z6!="")z6+=","

 var com7=select7Span.innerText
if(com7=="+"||isNaN(com7)==false)com7=""
else
com7+=" "

var x7=xCom7Value.value
var y7=yCom7Value.value

//---horiz/vertical----
if(com7=="H " || com7=="h ")
{
 	x7+=","
	y7=""
}
else
{
	if(x7!="")x7+=" "
	if(y7!="")y7=y7+","
}

 var ang7=angCom7Value.value
 var sw1_7=sw1Com7Select.options[sw1Com7Select.selectedIndex].value
 var sw2_7=sw2Com7Select.options[sw2Com7Select.selectedIndex].value
 if(ang7!="")ang7=ang7+","
 if(sw1_7!="")sw1_7=sw1_7+","
 if(sw2_7!="")sw2_7=sw2_7+","
var z7=z7Select.options[z7Select.selectedIndex].value
if(z7!="")z7+=","

 var com8=select8Span.innerText
if(com8=="+"||isNaN(com8)==false)com8=""
else
com8+=" "

var x8=xCom8Value.value
var y8=yCom8Value.value

//---horiz/vertical----
if(com8=="H " || com8=="h ")
{
 	x8+=","
	y8=""
}
else
{
	if(x8!="")x8+=" "
	if(y8!="")y8=y8+","
}

 var ang8=angCom8Value.value
 var sw1_8=sw1Com8Select.options[sw1Com8Select.selectedIndex].value
 var sw2_8=sw2Com8Select.options[sw2Com8Select.selectedIndex].value
 if(ang8!="")ang8=ang8+","
 if(sw1_8!="")sw1_8=sw1_8+","
 if(sw2_8!="")sw2_8=sw2_8+","
var z8=z8Select.options[z8Select.selectedIndex].value
if(z8!="")z8+=","

 var com9=select9Span.innerText
if(com9=="+"||isNaN(com9)==false)com9=""
else
com9+=" "

var x9=xCom9Value.value
var y9=yCom9Value.value

//---horiz/vertical----
if(com9=="H " || com9=="h ")
{
 	x9+=","
	y9=""
}
else
{
	if(x9!="")x9+=" "
	if(y9!="")y9=y9+","
}

 var ang9=angCom9Value.value
 var sw1_9=sw1Com9Select.options[sw1Com9Select.selectedIndex].value
 var sw2_9=sw2Com9Select.options[sw2Com9Select.selectedIndex].value
 if(ang9!="")ang9=ang9+","
 if(sw1_9!="")sw1_9=sw1_9+","
 if(sw2_9!="")sw2_9=sw2_9+","
var z9=z9Select.options[z9Select.selectedIndex].value
if(z9!="")z9+=","

 var com10=select10Span.innerText
if(com10=="+"||isNaN(com10)==false)com10=""
else
com10+=" "

var x10=xCom10Value.value
var y10=yCom10Value.value

//---horiz/vertical----
if(com10=="H " || com10=="h ")
{
 	x10+=","
	y10=""
}
else
{
	if(x10!="")x10+=" "
	if(y10!="")y10=y10+","
}

 var ang10=angCom10Value.value
 var sw1_10=sw1Com10Select.options[sw1Com10Select.selectedIndex].value
 var sw2_10=sw2Com10Select.options[sw2Com10Select.selectedIndex].value
 if(ang10!="")ang10=ang10+","
 if(sw1_10!="")sw1_10=sw1_10+","
 if(sw2_10!="")sw2_10=sw2_10+","
var z10=z10Select.options[z10Select.selectedIndex].value
if(z10!="")z10+=","

	Points=""+
	com1 +x1 +y1 +ang1+sw1_1+sw2_1+z1+
	com2 +x2 +y2 +ang2+sw1_2+sw2_2+z2+
	com3 +x3 +y3 +ang3+sw1_3+sw2_3+z3+
	com4 +x4 +y4 +ang4+sw1_4+sw2_4+z4+
	com5 +x5 +y5 +ang5+sw1_5+sw2_5+z5+
	com6 +x6 +y6 +ang6+sw1_6+sw2_6+z6+
	com7 +x7 +y7 +ang7+sw1_7+sw2_7+z7+
	com8 +x8 +y8 +ang8+sw1_8+sw2_8+z8+
	com9 +x9 +y9 +ang9+sw1_9+sw2_9+z9+
	com10 +x10 +y10 +ang10+sw1_10+sw2_10+z10

	if(Points.length>3) //---cleared---
	{

		//---remove the last space-----
		if(Points.substr(Points.length-1)==" ")
			Points=Points.substr(0,Points.length-1)
		//---remove the last comma(from z)-----
		if(Points.substr(Points.length-1)==",")
			Points=Points.substr(0,Points.length-1)

		importTextValue.value=Points

		 YellowBrickRoad.setAttribute("d",Points)
		 loadDragCircles()

		//---update bg colors
		 updateBgColor()
		 showButton.disabled=true
	}


}





//==================THUMBS===================================

var thumbDArray=[]
thumbDArray[0]=""
thumbDArray[1]="M 48 270,T 105 121,T 267 271,Z"
thumbDArray[2]="M 31 248,Q 145 49,281 246,Z"
thumbDArray[3]="M 21 273,C 89 112,201 112,284 270,Z"
thumbDArray[4]="M 26 255,S 143 19,276 253,Z"
thumbDArray[5]="M 26 48,A 114 223,0,0,0,275 50,Z"
thumbDArray[6]="M 25 271,A 114 223,0,0,1,279 271,Z"
thumbDArray[7]="M 58 240,A 142 94,0,1,1,249 239,Z"
thumbDArray[8]="M 76 241,A 164 94,45,1,1,283 242,Z"
thumbDArray[9]="M 33 273,S 43 38,161 226,211 175,227 31,Z"
thumbDArray[10]="M 105 284,C 58 175,149 223,28 36,202 149,210 59,285 92,Z"
thumbDArray[11]="M 0 151,T 13 50,50 150,100 150,150 150,200 150,250 150,300 150,Z"
thumbDArray[12]="M 143 105,L 97 221,L 195 220,Z,M 101 71,T 61 194,T 203 252,T 119 65,Z"
thumbDArray[13]=""
thumbDArray[14]=""
thumbDArray[15]=""
thumbDArray[16]=""
thumbDArray[17]=""
thumbDArray[18]=""
thumbDArray[19]=""
thumbDArray[20]=""



var PrevThumb
function showThumb(num)
{

	//---remove previous drag circles----
	if(Rainbow.childNodes.length>0)
	{
		for(var k=Rainbow.childNodes.length-1;k>=0;k--)
		{
			Rainbow.removeChild(Rainbow.childNodes.item(k))
		}
	}

	if(LocLayer.childNodes.length>0)
	{
		for(var k=LocLayer.childNodes.length-1;k>=0;k--)
		{
			LocLayer.removeChild(LocLayer.childNodes.item(k))
		}
	}


	if(PrevThumb !=null)
	{
		var prevTD=eval("thumb"+PrevThumb+"TD")
		prevTD.style.borderStyle="solid"
		prevTD.style.borderColor=""
	}

   	eval("thumb"+num+"TD.style.borderStyle='inset'")
   	eval("thumb"+num+"TD.style.borderColor='lightgreen'")
	var d=thumbDArray[num]
	clearComValues()
	YellowBrickRoad.setAttribute("d",d)
	importThumb()
	infoSpan.innerHTML=eval("thumb"+num+"Descr.innerHTML")
	PrevThumb=num

}



