function debug(str){
if(Debug=="on"){
alert(str);
}
}
function trim(s) {//get rid of blanks before and after s
var m = s.match(/^/s*(/S+(/s+/S+)*)/s*$/);
return (m == null) ? "" : m[1];
}
function $(id){
return document.getElementById(id);
}
function $F(){
var paraLen=arguments.length;
if(paraLen==0){
return document.forms[0];
}
if(paraLen==1){
return eval("document."+arguments[0]);
}
if(paraLen==2){
return eval("document."+arguments[0]+"."+arguments[1]);
}
}
function $V(variable){//return empty string if variable does not exist
if((typeof variable)=="undefined"){
return "";
}else{
return variable;
}
}
function getIdx(arr,value){//get the position of value in arr
for(var i=0;i<arr.length;i++){
if(arr[i]==value){
return i;
}
}
return null;
}
function inList(elem,arr){//ÊÇ·ñÔÚÊý×éÖÐ
if(arr.length){
for(var i=0;i<arr.length;i++){
if(arr[i]==elem){
return true;
}
}
}else{
if(arr==elem){
return true;
}
}
return false;
}
function ShowHide(obj){
if(obj.style.display!="none"){
obj.style.display="none";
}else{
obj.style.display="";
}
}
/*
*
*
* Math functions
*
*
*
*/
// usage:alert(ForDight(12345.67890,2));
function ForDight(Dight,How)
{
Dight = Math.round (Dight*Math.pow(10,How))/Math.pow(10,How);
return Dight;
}
if(Debug=="on"){
alert(str);
}
}
function trim(s) {//get rid of blanks before and after s
var m = s.match(/^/s*(/S+(/s+/S+)*)/s*$/);
return (m == null) ? "" : m[1];
}
function $(id){
return document.getElementById(id);
}
function $F(){
var paraLen=arguments.length;
if(paraLen==0){
return document.forms[0];
}
if(paraLen==1){
return eval("document."+arguments[0]);
}
if(paraLen==2){
return eval("document."+arguments[0]+"."+arguments[1]);
}
}
function $V(variable){//return empty string if variable does not exist
if((typeof variable)=="undefined"){
return "";
}else{
return variable;
}
}
function getIdx(arr,value){//get the position of value in arr
for(var i=0;i<arr.length;i++){
if(arr[i]==value){
return i;
}
}
return null;
}
function inList(elem,arr){//ÊÇ·ñÔÚÊý×éÖÐ
if(arr.length){
for(var i=0;i<arr.length;i++){
if(arr[i]==elem){
return true;
}
}
}else{
if(arr==elem){
return true;
}
}
return false;
}
function ShowHide(obj){
if(obj.style.display!="none"){
obj.style.display="none";
}else{
obj.style.display="";
}
}
/*
*
*
* Math functions
*
*
*
*/
// usage:alert(ForDight(12345.67890,2));
function ForDight(Dight,How)
{
Dight = Math.round (Dight*Math.pow(10,How))/Math.pow(10,How);
return Dight;
}