/****************************************************			
*	----- COPYRIGHT © LICENCE -----					*
*	Author: To Vi Thanh								*
*	Contact: tovithanh@yahoo.com					*
*	Credit:	01/09/2005								*
*	Update: 24/09/2005								*
*	Version: 2.0									*
*	File name: funct.js								*
****************************************************/

function f_submit(f)
{
	f.submit();
	return true;
}

function check_Num(f,txtId)
{
	var nText = eval("Number(f." + txtId + ".value)");							
	if (nText.toString()=='NaN')
	{
		alert('Số bạn nhập vào không hợp lệ!,\n Bạn phải nhập số vào !');
		eval("f." + txtId + ".value='0';")
		eval("f." + txtId + ".focus();")
	}
	else
	{
		num=parseInt(nText);
		if(num<0)
		{
			alert('Số bạn nhập vào phải là 1 số nguyên dương!');
			eval("f." + txtId + ".value='0';")
			eval("f." + txtId + ".focus();")
		}
	}
	
}

function testscreen(){
var screensize = window.screen.availWidth;
str="<img src='images/img_add.gif' border='0' width='224' height='150'>";
if (screensize >1000) return str;
else
return "";
}

function back(num){
window.history.back(num);
return true;
}

function checkall(f,items){
var alen=f.items.length;
if (alen>0){ for(var i=0;i<alen;i++) if (f.items[i].checked==false){f.items[i].checked=true;}}
else{f.items.checked=true;}
return true;
}

function clearall(f,items){
var alen=f.items.length;
if (alen>0){ for(var i=0;i<alen;i++) if (f.items[i].checked==true){f.items[i].checked=false;}}
else{f.items.checked=false;}
}

// Popup Windows
var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbar=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}
