// JavaScript Document
	function showColor(field)
	{

		var color_used=0;
		if(document.getElementById("color1").style.backgroundColor==document.getElementById(field.id).style.backgroundColor)
		{color_used=1;	}
		else if(document.getElementById("color2").style.backgroundColor==document.getElementById(field.id).style.backgroundColor)
		{color_used=1;	}
		else if(document.getElementById("color3").style.backgroundColor==document.getElementById(field.id).style.backgroundColor)
		{color_used=1;	}
		else if(document.getElementById("color4").style.backgroundColor==document.getElementById(field.id).style.backgroundColor)
		{color_used=1;	}
		else if(document.getElementById("color5").style.backgroundColor==document.getElementById(field.id).style.backgroundColor)
		{color_used=1;	}
		else if(document.getElementById("color6").style.backgroundColor==document.getElementById(field.id).style.backgroundColor)
		{color_used=1;	}
		
		if(color_used==0)
		{
			box=document.colormeasure.txtbox.value;
			if(box=="") { box="color1"; }
			id=field.id;
			document.getElementById(field.id).style.borderColor=document.getElementById(field.id).style.backgroundColor;
			document.getElementById(box).style.backgroundColor=id;
			
			if(box=="color1")
			{
			document.getElementById("colorvalue1").innerHTML=document.getElementById(field.id).innerHTML;
				document.getElementById("optcolor2").checked=true;
				showValue('color2')
			}
			else if(box=="color2")
			{
			document.getElementById("colorvalue2").innerHTML=document.getElementById(field.id).innerHTML;
			document.getElementById("optcolor3").checked=true;
			showValue('color3')
			}
			else if(box=="color3")
			{
			document.getElementById("colorvalue3").innerHTML=document.getElementById(field.id).innerHTML;
			document.getElementById("optcolor4").checked=true;
			showValue('color4')
			}
			else if(box=="color4")
			{
			document.getElementById("colorvalue4").innerHTML=document.getElementById(field.id).innerHTML;
			document.getElementById("optcolor5").checked=true;
			showValue('color5')
			}
			else if(box=="color5")
			{
			document.getElementById("colorvalue5").innerHTML=document.getElementById(field.id).innerHTML;
			document.getElementById("optcolor6").checked=true;
			showValue('color6')
			}
			else if(box=="color6")
			{
				document.getElementById("colorvalue6").innerHTML=document.getElementById(field.id).innerHTML;
			}
			
		}
		else
		
		{
			if(document.getElementById("cur_language").innerHTML==2)
			{
			alert("This color already selected. Please select another color");
			}
			else
			{
					alert("இந்த நிறம் ஏற்கனவே தேர்வு செய்யப்பட்டுள்ளது, வேறு நிறத்தை தேர்வு செய்யவும்");
			}
			
			/*if(document.measure.optlanguage[0].checked==true)
			{
				alert("இந்த நிறம் ஏற்கனவே தேர்வு செய்யப்பட்டுள்ளது, வேறு நிறத்தை தேர்வு செய்யவும்");
			}
			else
			{
				alert("This color already selected. Please select another color");
			}*/
			
		}
		
	}
	function showCurrentTab(id)
	{
		document.getElementById("intable1").style.backgroundColor="#ffffff";
		document.getElementById("intable2").style.backgroundColor="#ffffff";
		document.getElementById("intable3").style.backgroundColor="#ffffff";
		document.getElementById("intable4").style.backgroundColor="#ffffff";
		document.getElementById("intable5").style.backgroundColor="#ffffff";
		document.getElementById("intable6").style.backgroundColor="#ffffff";
		document.getElementById("intable1").style.borderColor="#ffffff";
		document.getElementById("intable2").style.borderColor="#ffffff";
		document.getElementById("intable3").style.borderColor="#ffffff";
		document.getElementById("intable4").style.borderColor="#ffffff";
		document.getElementById("intable5").style.borderColor="#ffffff";
		document.getElementById("intable6").style.borderColor="#ffffff";
		document.getElementById(id).style.backgroundColor="#fafafa";
		document.getElementById(id).style.borderColor="#EAEFF2";
		
	}

	function showValue(c)
	{
		document.colormeasure.txtbox.value=c;
		
		a=document.getElementById(c).style.backgroundColor;
		document.getElementById("mycolor").style.backgroundColor=a;
		v1=a.indexOf(",");
		v2=a.lastIndexOf(",");
		document.getElementById("red").value=a.substring(4,v1);
		document.getElementById("green").value=a.substring(v1+1, v2);
		document.getElementById("blue").value=a.substring(v2+1, a.length-1);
		if(c=="color1"){c1="colorvalue1"; showCurrentTab("intable1"); }
		else if(c=="color2"){c1="colorvalue2"; showCurrentTab("intable2"); }
		else if(c=="color3"){c1="colorvalue3"; showCurrentTab("intable3"); }
		else if(c=="color4"){c1="colorvalue4"; showCurrentTab("intable4"); }
		else if(c=="color5"){c1="colorvalue5"; showCurrentTab("intable5"); }
		else if(c=="color6"){c1="colorvalue6"; showCurrentTab("intable6"); }
		
		
		document.getElementById("pantone").value=document.getElementById(c1).innerHTML;
		
	}
	
	function removeColor(c)
	{
		document.getElementById(c).style.backgroundColor=document.getElementById('emptycolor').style.backgroundColor;
		
	}
	
	function removeAllColor()
	{
		document.getElementById('color1').style.backgroundColor=document.getElementById('emptycolor').style.backgroundColor;
		document.getElementById('color2').style.backgroundColor=document.getElementById('emptycolor').style.backgroundColor;
		document.getElementById('color3').style.backgroundColor=document.getElementById('emptycolor').style.backgroundColor;
		document.getElementById('color4').style.backgroundColor=document.getElementById('emptycolor').style.backgroundColor;
		document.getElementById('color5').style.backgroundColor=document.getElementById('emptycolor').style.backgroundColor;
		document.getElementById('color6').style.backgroundColor=document.getElementById('emptycolor').style.backgroundColor;
		
		document.getElementById('colorvalue1').innerHTML="&nbsp;";
		document.getElementById('colorvalue2').innerHTML="&nbsp;";
		document.getElementById('colorvalue3').innerHTML="&nbsp;";
		document.getElementById('colorvalue4').innerHTML="&nbsp;";
		document.getElementById('colorvalue5').innerHTML="&nbsp;";
		document.getElementById('colorvalue6').innerHTML="&nbsp;";
		
		document.getElementById("red").value="";
		document.getElementById("green").value="";
		document.getElementById("blue").value="";
		document.getElementById("pantone").value="";
	}
	
	function OverColor(field)
	{
		//document.getElementById(field.id).style.border="3px solid";
		document.getElementById(field.id).style.borderColor=document.getElementById(field.id).style.backgroundColor;
		document.getElementById("mycolor").style.backgroundColor=document.getElementById(field.id).style.backgroundColor;
		a=document.getElementById(field.id).style.backgroundColor;
		v1=a.indexOf(",");
		v2=a.lastIndexOf(",");
		document.getElementById("red").value=a.substring(4,v1);
		document.getElementById("green").value=a.substring(v1+1, v2);
		document.getElementById("blue").value=a.substring(v2+1, a.length-1);
		//alert(document.getElementById(c).innerHTML);
		document.getElementById("pantone").value=document.getElementById(field.id).innerHTML;
		
	}
	function OutColor(field)
	{
		document.getElementById("mycolor").style.backgroundColor=document.getElementById("emptycolor").style.backgroundColor;	
		document.getElementById(field.id).style.border="3px solid #FFFFFF";
		document.getElementById("red").value="";
		document.getElementById("green").value="";
		document.getElementById("blue").value="";
		document.getElementById("pantone").value="";
	}
	
	function setColor()
	{
		
		if(document.getElementById("color1").style.backgroundColor=="" || document.getElementById("color2").style.backgroundColor=="" || document.getElementById("color3").style.backgroundColor=="" ||document.getElementById("color4").style.backgroundColor=="" || document.getElementById("color5").style.backgroundColor=="" || document.getElementById("color6").style.backgroundColor=="" )
		{
			if(document.getElementById("cur_language").innerHTML==2)
			{
			alert("Please select minimum six color");
			}
			else
			{
					alert("6 நிறத்தினை தெரிவு செய்க");
			}
			/*if(document.measure.optlanguage[0].checked==true)
			{
				alert("6 நிறத்தினை தெரிவு செய்க");
			}
			else
			{
				alert("Please select minimum six color");
			}*/
		}
		else
		{
			document.getElementById("color11").style.backgroundColor=document.getElementById("color1").style.backgroundColor;
			document.getElementById("color21").style.backgroundColor=document.getElementById("color2").style.backgroundColor;
			document.getElementById("color31").style.backgroundColor=document.getElementById("color3").style.backgroundColor;
			document.getElementById("color41").style.backgroundColor=document.getElementById("color4").style.backgroundColor;
			document.getElementById("color51").style.backgroundColor=document.getElementById("color5").style.backgroundColor;
			document.getElementById("color61").style.backgroundColor=document.getElementById("color6").style.backgroundColor;
			
			document.colormeasure.txtcolor1.value=document.getElementById("color11").style.backgroundColor;
			document.colormeasure.txtcolor2.value=document.getElementById("color21").style.backgroundColor;
			document.colormeasure.txtcolor3.value=document.getElementById("color31").style.backgroundColor;
			document.colormeasure.txtcolor4.value=document.getElementById("color41").style.backgroundColor;
			document.colormeasure.txtcolor5.value=document.getElementById("color51").style.backgroundColor;
			document.colormeasure.txtcolor6.value=document.getElementById("color61").style.backgroundColor;
			
			document.colormeasure.txtpan1.value=document.getElementById("colorvalue1").innerHTML;
			document.colormeasure.txtpan2.value=document.getElementById("colorvalue2").innerHTML;
			document.colormeasure.txtpan3.value=document.getElementById("colorvalue3").innerHTML;
			document.colormeasure.txtpan4.value=document.getElementById("colorvalue4").innerHTML;
			document.colormeasure.txtpan5.value=document.getElementById("colorvalue5").innerHTML;
			document.colormeasure.txtpan6.value=document.getElementById("colorvalue6").innerHTML;
			
			document.getElementById("pan_id1").innerHTML=document.colormeasure.txtpan1.value;
			document.getElementById("pan_id2").innerHTML=document.colormeasure.txtpan2.value;
			document.getElementById("pan_id3").innerHTML=document.colormeasure.txtpan3.value;
			document.getElementById("pan_id4").innerHTML=document.colormeasure.txtpan4.value;
			document.getElementById("pan_id5").innerHTML=document.colormeasure.txtpan5.value;
			document.getElementById("pan_id6").innerHTML=document.colormeasure.txtpan6.value;
			
			document.getElementById("colorbox").style.display="none";
			/*document.getElementById("colorbox1").style.display="none";
			document.getElementById("colorbox2").style.display="none";*/
		}
	}
	
	function openColorBox()
	{
		document.getElementById("colorbox").style.display="block";
		
		document.getElementById("color1").style.backgroundColor=document.getElementById("color11").style.backgroundColor;
		document.getElementById("color2").style.backgroundColor=document.getElementById("color21").style.backgroundColor;
		document.getElementById("color3").style.backgroundColor=document.getElementById("color31").style.backgroundColor;
		document.getElementById("color4").style.backgroundColor=document.getElementById("color41").style.backgroundColor;
		document.getElementById("color5").style.backgroundColor=document.getElementById("color51").style.backgroundColor;
		document.getElementById("color6").style.backgroundColor=document.getElementById("color61").style.backgroundColor;
		
		document.getElementById("colorvalue1").innerHTML=document.colormeasure.txtpan1.value;
		document.getElementById("colorvalue2").innerHTML=document.colormeasure.txtpan2.value;
		document.getElementById("colorvalue3").innerHTML=document.colormeasure.txtpan3.value;
		document.getElementById("colorvalue4").innerHTML=document.colormeasure.txtpan4.value;
		document.getElementById("colorvalue5").innerHTML=document.colormeasure.txtpan5.value;
		document.getElementById("colorvalue6").innerHTML=document.colormeasure.txtpan6.value;
		
		
		
		window.scrollBy(0,175);
	}
	
	
	
	function closeColorBox()
	{
		document.getElementById("colorbox").style.display="none";
		//document.getElementById("colorbox1").style.display="none";
//		document.getElementById("colorbox2").style.display="none";
	}
	
	
	
	function showTab(tab,mtype)
	{
		if(tab==1)
		{
			
			/*document.getElementById("button1").style.backgroundColor="#6B91AB";
			document.getElementById("button1").style.borderColor="#6B91AB";
			document.getElementById("button1").style.color="#FFFFFF";
			
			document.getElementById("button2").style.backgroundColor="#E2EAEF";
			document.getElementById("button2").style.borderBottomColor="#E2EAEF";
			document.getElementById("button2").style.color="#000000";
			document.getElementById("button3").style.backgroundColor="#E2EAEF";
			document.getElementById("button3").style.borderBottomColor="#E2EAEF";
			document.getElementById("button3").style.color="#000000";*/
			
			document.getElementById("sampleimg").style.display="block";
			document.getElementById("video").style.display="none";
			document.getElementById("notes").style.display="none";
			showSampleImage1(mtype,0);
		}
		else if(tab==2)
		{
			
			/*document.getElementById("button2").style.backgroundColor="#6B91AB";
			document.getElementById("button2").style.borderColor="#6B91AB";
			document.getElementById("button2").style.borderBottomColor="#6B91AB";
			document.getElementById("button2").style.color="#FFFFFF";
			
			document.getElementById("button1").style.backgroundColor="#E2EAEF";
			document.getElementById("button1").style.borderBottomColor="#E2EAEF";
			document.getElementById("button1").style.color="#000000";
			document.getElementById("button3").style.backgroundColor="#E2EAEF";
			document.getElementById("button3").style.borderBottomColor="#E2EAEF";
			document.getElementById("button3").style.color="#000000";*/
			
			document.getElementById("video").style.display="block";
			document.getElementById("sampleimg").style.display="none";
			document.getElementById("notes").style.display="none";
			showSampleImage1(mtype,0);
		}
		else
		{
			
			/*document.getElementById("button3").style.backgroundColor="#6B91AB";
			document.getElementById("button3").style.borderColor="#6B91AB";
			document.getElementById("button3").style.borderBottomColor="#6B91AB";
			document.getElementById("button3").style.color="#FFFFFF";
			
			document.getElementById("button2").style.backgroundColor="#E2EAEF";
			document.getElementById("button2").style.borderBottomColor="#E2EAEF";
			document.getElementById("button2").style.color="#000000";
			document.getElementById("button1").style.backgroundColor="#E2EAEF";
			document.getElementById("button1").style.borderBottomColor="#E2EAEF";
			document.getElementById("button1").style.color="#000000";*/
			
			document.getElementById("notes").style.display="block";
			document.getElementById("video").style.display="none";
			document.getElementById("sampleimg").style.display="none";
			showSampleImage1(mtype,0);
		}
	}	
	
	function togglelang(n)
	{
		if(n=="tamil")
		{
			document.getElementById("tamil").style.display="block";
			document.getElementById("english").style.display="none";
		}
		else
		{
			document.getElementById("tamil").style.display="none";
			document.getElementById("english").style.display="block";
		}
		
	}

