function callfrm(dest){
	document.frmConsole.target = "_self"
	document.frmConsole.action = dest
	document.frmConsole.method = "POST"
	document.frmConsole.submit()
}


function callfrm2(dest){
	frmConsole.target = "_blank"
	frmConsole.action = dest
	frmConsole.method = "POST"
	frmConsole.submit()
}	

function openNew(dest,popname,width,height){
	popup=window.open(dest,popname,"left="+ (((800-width)/2)) + ",top=" + (((600-height)/2)) +",width="+width+",height="+height+",resizable=no,menubar=0,scrollbars=yes,location=no,alwaysRaised=yes");
	popup.focus();
}

function changerow(row){
	var b='tr_upload';
	for(i=0;i<15;i++){
		cb2 = eval(b + '' + i );
		if(i<row){
			cb2.style.display='';
		}else{			
			cb2.style.display='none';
		}
	}
}

function checkboxNum(chk) {
	var total = 0;
	var max = eval('document.frmConsole.' + chk + '.length');
	for (var idx = 0; idx < max; idx++) {
		if (eval('document.frmConsole.'+ chk +'[' + idx + '].checked') == true) {
			total += 1;
		}
	}
	return total;
}

function roll_over(img_name, img_src){
	document[img_name].src = img_src;
}

function DigitOnly(e) {
  
   var key;
   
   if(window.event){
      key = window.event.keyCode; // IE
       if (key = 13 && key != 8 && key != 9 && key != 16 && key != 17 && key != 20 && key != 35 && key != 36 && key != 46 && (key < 48) || (key > 57) && (key < 96) || (key > 105) && key != 116)  window.event.returnValue = false;
   }else{
      key = e.which; // Firefox      
       if (key = 13 && key != 8 && key != 9 && key != 16 && key != 17 && key != 20 && key != 35 && key != 36 && key != 46 && (key < 48) || (key > 57) && (key < 96) || (key > 105) && key != 116)  key = e.preventDefault();
    }

}




function EngOnly(){
	if (String.fromCharCode(event.keyCode) < '~'){
		return;
	}
	event.returnValue=false;	
}

function EngOnly2(){
	var keyblock = new Array(33,64,35,36,37,94,38,42,40,41,95,43,61,92,123,125,91,93,58,59,34,39,60,62,44,46,63,47);
	var cChr;
	cChr = window.event.keyCode;
//	alert(cChr);

	for(var i=0 ; i<keyblock.length ; i++){
		if(cChr == keyblock[i]){
			event.returnValue=false;	
		}
	}

	if (String.fromCharCode(event.keyCode) < '~'){
		return;
	}
	event.returnValue=false;	
}

function CloseWindows(){
	window.close();
}

function CheckEnter(callFunction,valueFunction){
	var cChr;
	cChr = window.event.keyCode;
	if (cChr == 13)
	{
		callFunction(valueFunction);
	}
}
function check_all(elem) {
	var f = elem.form;	
	if (!f.elements["chk[]"]) return;
	if (f.elements["chk[]"][0]) {
		for (var i=0; i<f.elements["chk[]"].length; i++)
			f.elements["chk[]"][i].checked = elem.checked;	
	} else {
		f.elements["chk[]"].checked = elem.checked;	
	}
	//check_all(elem);
}
function onUp(url, type, table, id,page) {
	callfrm(url + "&changerow=" + type + "&table=" + table + "&sortid=" + id +"&page="+page);
}

function onDown(url, type, table, id,page) {
	callfrm(url + "&changerow=" + type + "&table=" + table + "&sortid=" + id +"&page="+page);
}
function autotab(original,destination){
	if (original.getAttribute&&original.value.length==original.getAttribute("maxlength"))
	destination.focus()
}