// JavaScript Document

function borderColorId(id, color)

{

	borderColor(document.getElementById(id), color);

}



function borderColor(obj, color)

{

	obj.style.borderColor = color;

}



function IsNumeric(sText)

{	

	var ValidChars = "0123456789.";

	var IsNumber=true;

	var Char;

	for (i = 0; i < sText.length && IsNumber == true; i++) 

	{ 

		Char = sText.charAt(i); 

		if (ValidChars.indexOf(Char) == -1) 		

			IsNumber = false;		

	}

	return IsNumber;

}



function checkNumeric(obj, v)

{

	if(!IsNumeric(obj.value))

	{

		alert('Please enter a valid number');

		//obj.value = '0';

		var str = obj.value;

		obj.value = v;//str.substr(0, (str.length - 1));			

		obj.focus();

	}

}


function checkStock(inp, stock)
{
	if(inp.value > stock)
	{
		alert('Not enough stock! There is only '+stock+' available');
		inp.value = stock;
		inp.focus();
	}
}


function show(id){document.getElementById(id).style.display="block";}

function hide(id){document.getElementById(id).style.display="none";}
