function onlyDigit(e){
	if(window.event){
		if((event.keyCode<48)||(event.keyCode>57)) {
			event.returnValue = false;
		}
	}else{
		if((e.charCode<48)||(e.charCode>57)) {
			e.preventDefault();
		}
	}	
}

function floatDigit(e){
	if(window.event){
		if( ((event.keyCode<48)||(event.keyCode>57)) && (event.keyCode!=46) ) {
			event.returnValue = false;
		}
	}else{
		if( ((e.charCode<48)||(e.charCode>57)) && (e.keyCode!=46) ) {
			e.preventDefault();
		}	
	}
}

function check_all(theform1,signalbox,box_name)
{
var c,s;
  	theform =document.forms[theform1];
  	if (theform.elements[signalbox].checked) c =true;
  	else c=false;
	for (var i=0; i < theform.length; i++) {
	    var e = theform.elements[i];
	    if (e.type == 'checkbox' && e.style.display !='none') {
	      e.checked = c;
	      continue;
	    }
	}
  	return true;
}

function pageLink(WEBROOT_PATH,object,access)
{
		window.parent.location = WEBROOT_PATH+'?object='+object+'&access='+access;
}

function pageLinkFrame(WEBROOT_PATH,object,access)
{
		window.location = WEBROOT_PATH+'?object='+object+'&access='+access;
}

function confirmDeleteLink(WEBROOT_PATH,object,accessBrowse,access,param){
	if(confirm('Are your sure delete data?')){
		window.parent.location = WEBROOT_PATH+'?object='+object+'&access='+access+'&id='+param;
	}else{
		window.parent.location = WEBROOT_PATH+'?object='+object+'&access='+accessBrowse;
	}
}

function confirmDeleteChk(msg){
	if(msg == '' || typeof(msg) == 'undefined') {
		msg = 'Are your sure delete data?';
	}
	document.MM_returnValue=(confirm(unescape(msg)));
}

function changeto(obj,highlightcolor){
	obj.style.backgroundColor = highlightcolor;
}

function setPointer(theRow, thePointerColor, theNormalBgColor)
{
    var theCells = null;

    if (thePointerColor == '' || typeof(theRow.style) == 'undefined') {
        return false;
    }
    if (typeof(document.getElementsByTagName) != 'undefined') {
        theCells = theRow.getElementsByTagName('td');
    }
    else if (typeof(theRow.cells) != 'undefined') {
        theCells = theRow.cells;
    }
    else {
        return false;
    }

    var rowCellsCnt  = theCells.length;
    var currentColor = null;
    var newColor     = null;
    // Opera does not return valid values with "getAttribute"
    if (typeof(window.opera) == 'undefined'
        && typeof(theCells[0].getAttribute) != 'undefined' && typeof(theCells[0].getAttribute) != 'undefined') {
        currentColor = theCells[0].getAttribute('bgcolor');
        newColor     = (currentColor.toLowerCase() == thePointerColor.toLowerCase())
                     ? theNormalBgColor
                     : thePointerColor;
        for (var c = 0; c < rowCellsCnt; c++) {
            theCells[c].setAttribute('bgcolor', newColor, 0);
        } // end for
    }
    else {
        currentColor = theCells[0].style.backgroundColor;
        newColor     = (currentColor.toLowerCase() == thePointerColor.toLowerCase())
                     ? theNormalBgColor
                     : thePointerColor;
        for (var c = 0; c < rowCellsCnt; c++) {
            theCells[c].style.backgroundColor = newColor;
        }
    }

    return true;
} // end of the 'setPointer()' function
