// JavaScript Document
function BoxFocus(InputBox, InOut)
	{
		if(InOut == "In")
		{
			InputBox.style.backgroundColor = "#FFFFDD";
		}else{
			InputBox.style.backgroundColor = "#FFFFFF";
		}
	}
	
	
/*14 ส.ค. 08/ดนุชพงศ์ เศวตศิลา
แสดง Row ตาม Action ที่เกิดขึ้น Hover, Click
strAction มี 3 แบบ
	out --> onMouseOut
	over --> onMouseOver
	check --> check, uncheck
	
isOdd เพื่อเป็นการเช็คดูว่า Row นั้นเป็น Row คู่หรือไม่จะใช้ค่า Default ต่างไป

*/

function fnRowColor (strAction, objInput, objRow, intNumRow, isEven)
{
	var strClass = '';
	
	if(document.getElementById(objInput).checked != true)
	{
		if (strAction == 'out' || strAction == 'check')
		{
			strClass = 'row_default';
		}
		else if (strAction == 'over')
		{
			strClass = 'row_hover';
		}
	}
	else
	{
		strClass = 'row_selected';
	}
	
	if (strClass != '')
	{
		if (strClass == 'row_default' && isEven)
		{
			strClass = 'row_even';
		}
		
		for (i=0 ; i < (intNumRow); i++)
		{
			document.getElementById(objRow + 'x' + i).className = strClass;
		}
	}
	
}


/*
14 ส.ค. 08/ดนุชพงศ์ เศวตศิลา
ปรับปรุงให้ทำหลายๆ ค่าในครั้งเดียว
- ค่า Object ID และ Number of Row ที่ใส่เข้ามา
- มีหลายค่าและจะใช้ "," คั่นแต่ละค่า
*/

function fnSelectedColor (strCheckObject, strTargetObject, strNumRow)
{
	if (strCheckObject){
		var arrObjID = strCheckObject.split(',');
		var arrNumRow = strNumRow.split(',');
		var arrTargetID = strTargetObject.split(',');
		
		for (i = 0; i < arrObjID.length; i++)
		{
			if (arrObjID[i].length > 0)
			{
				if (document.getElementById(arrObjID[i]).checked == true)
				{
					for (j = 0; j < arrNumRow[i]; j++)
					{
						document.getElementById(arrTargetID[i] + 'x' + j).className = 'row_selected';
					}
				}
			}
		}
	}
}

function RadioMakeSelect(objSelect,tbObj)
	{
		for(i=1;i<6;i++)
			{
			if(i==objSelect)
				{
				document.getElementById(tbObj+i).style.background='#D9F2FF';
			}else{
				document.getElementById(tbObj+i).style.background='none';
				}
			}
	}


function isBlank(myObj)
	{
		if(trim(myObj.value)=='') { return true; }
		return false;
	}
	
function trim(s) 
	{
		while (s.substring(0,1) == ' ') 
		{
			s = s.substring(1,s.length);
		}
		while (s.substring(s.length-1,s.length) == ' ') 
		{
			s = s.substring(0,s.length-1);
		}
		return s;
	}

function CheckOptionDisplay (objSelect, tbObj)
	{
		for(i=1; i<6; i++)
			{
				if (document.getElementById(objSelect+i).checked==true)
					{
						document.getElementById(tbObj+i).style.background='#D9F2FF';
					}
			}
	}
