<script type='text/javascript'>
function cal(elm){
if(elm.value.match(/[^\d]/)){
elm.value=0;
}else if(elm.value.replace(/(^\s+)|(\s+$)/,'')==''){
elm.value=0;
}
var dist1=parseInt( document.getElementById('long').value );
var dist2=parseInt( document.getElementById('long2[]').value)
document.getElementById('total_long').value=dist1+dist2;
}
</script>