selectedEnd = "blank";
function updateEndType(selectionName)
{
	//update global variable that tracks current selection
	selectedEnd=selectionName;

	if (selectionName=="CENG")
	{
		document.getElementById("txt5").value="Close ends, not ground";
	}
	else if (selectionName=="CEG")
	{
		document.getElementById("txt5").value="Close ends, ground";
	}
	else if (selectionName=="OENG")
	{
		document.getElementById("txt5").value="Open ends, not ground";
	}
	else if (selectionName=="OEG")
	{
		document.getElementById("txt5").value="Open ends, ground";
	}
}

function changeBorder(imageObject, process, endType)
{
	//if the this end is selected, do nothing. This allows the box to stay highlighted.
	if (endType!=selectedEnd)
	{
		if (process == "show")
		{
			imageObject.style.border="3px solid #09509F";
		}
		else if (process == "hide")
		{
			imageObject.style.border="0px solid #09509F";
		}
		else if (process == "click")
		{
			imageObject.style.border="5px solid #09509F";

			//remove the border from the previously selected image
			var imageObjectCENG = document.getElementById("CENG");
			var imageObjectCEG = document.getElementById("CEG");
			var imageObjectOEG = document.getElementById("OEG");
			var imageObjectOENG = document.getElementById("OENG");

			if (endType != "CENG" )
			{
				imageObjectCENG.style.border="0px solid #09509F";
			}
			if (endType != "CEG" )
			{
				imageObjectCEG.style.border="0px solid #09509F";
			}
			if (endType != "OEG" )
			{
				imageObjectOEG.style.border="0px solid #09509F";
			}
			if (endType != "OENG" )
			{
				imageObjectOENG.style.border="0px solid #09509F";
			}

		}
	}
}

function updateCharCounter(text)
{
	charCounter = document.getElementById("charCount");
	charCounter.innerHTML = text.length;
}

function changeUnits()
{
	var spans = document.getElementById("mainBody").getElementsByTagName("span");
	var choice = document.forms[0].lstUnits.value;

	if (choice==1)
	{
		for (i = 0; i < spans.length; i++)
		{
			if(spans[i].className=='millimeters')
				spans[i].style.display="none";
			else if(spans[i].className=='inches')
				spans[i].style.display="inline";
		}
	}
	else if (choice==2)
	{
		for (i = 0; i < spans.length; i++)
		{
			if(spans[i].className=='inches')
				spans[i].style.display = "none";
			else if(spans[i].className=='millimeters')
				spans[i].style.display = "inline";
		}
	}
}
function updateCharCounter(text)
{
	charCounter = document.getElementById("charCount");
	charCounter.innerHTML = text.length;
}
function validateForm()
{
	if(jQuery.trim($('#txtCustName').val()) == "")
	{
		alert("Please enter customer name");
		$('#txtCustName').focus();
		return false;
	}
	if(jQuery.trim($('#txtCompany').val()) == "")
	{
		alert("Please enter company name");
		$('#txtCompany').focus();
		return false;
	}	
	if(jQuery.trim($('#txtPhone').val()) == "")
	{
		alert("Please enter phone");
		$('#txtPhone').focus();
		return false;
	}		
	if(jQuery.trim($('#txtQuantity').val()) == "")
	{
		alert("Please enter quanty");
		$('#txtQuantity').focus();
		return false;
	}			
	else if(!IsNumeric($('#txtQuantity').val()))
	{
		alert("Please enter quanty as numeric");
		$('#txtQuantity').focus();
		return false;
	
	}
	if(jQuery.trim($('#txtMan4').val()) != "" && !IsNumeric($('#txtMan4').val()))
	{
		alert("Please enter Relative loop position as numeric");
		$('#txtMan4').focus();
		return false;
	
	}	
	if(jQuery.trim($('#txtAdv5').val()) != "" && !IsNumeric($('#txtAdv5').val()))
	{
		alert("Please enter  Number of  total number of coils as numeric");
		$('#txtAdv5').focus();
		return false;
	
	}	
	return true;
}

