// JavaScript Document
// modified by chow ----------------------

function checkAll()
{
	if(document.getElementById('check').checked == true){		
		for(i=0;i<document.getElementById('countCheck').value;i++){
			document.getElementById('downCheck' + i).checked = true;
		}		
	}else{
		for(i=0;i<document.getElementById('countCheck').value;i++){
			document.getElementById('downCheck' + i).checked = false;
		}
	}
}

function checkAllByParam(stat)
{		
	for(i=0;i<document.getElementById('countCheck').value;i++){
		document.getElementById('downCheck' + i).checked = stat;
	}		
}

function checkLogin(username, pass)
{
	var err;
	if(username.value == '')
	{
		alert('User ID harus diisi');
		username.focus();
		return false;
	}
	
	if(pass.value == '')
	{
		alert('Password harus diisi');	
		pass.focus();
		return false;
	}
}

function setInput(object, val)
{
	document.getElementById(object).value = val;
}

function clearInput(object)
{
	object.value = '';
}

function clearHTML(object)
{
	object.innerHTML = '';
}

function openChildWindow(html, mode){
	//var mode = 'width=300, height=400, menubar=no, statusbar=no, toolbar=no, scrollbar=yes';
	var newWindow = window.open(html, 'windowRef', mode);
	if(!newWindow.opener)
		newWindow.opener = self;
}

/*function addChild(induk, count) {
	var x = count.value;
	
	if(x >= 3){
		return false;
	}
	
	if(x == ''){
		x = 1;
		document.getElementById('counter').value = x;
	}else{
		x = parseInt(x) + 1;
		document.getElementById('counter').value = x;
	}
	
	var parentObj = induk;
	
	var nInput = document.createElement('input');
	
	
	nInput.setAttribute('type', 'file');
	nInput.setAttribute('name', 'file[]');
	
	//create the table
	var oTable = document.createElement('table');
	oTable.setAttribute('class', 'table-inbox');
	oTable.setAttribute('width', '100%');
	//create the tbody
	var oTBody = document.createElement('tbody');
	oTable.appendChild(oTBody);
	//create the first row
	var oTR1 = document.createElement('tr');
	oTBody.appendChild(oTR1);
	var oTD11 = document.createElement('td');
	oTD11.appendChild(document.createTextNode('->'));
	oTR1.appendChild(oTD11);
	var oTD21 = document.createElement('td');
	oTD21.appendChild(nInput);
	oTR1.appendChild(oTD21);
	
	//add the table to the document body
	parentObj.appendChild(oTable);
	
}*/

