function compareNumber(a,b) {
    if(a > b) {
        return 1;
    }
    if(a < b) {
        return  2;
    }
    if(a == b) {
        return  3;
    }
}

function checkData(form) {
    var typevalue = form.typevalue.value;
    if(typevalue == null || typevalue == '') {
        return 1;
    }
    for(var i=0; i<typevalue.length; i++) {
        if(typevalue.charAt(i) == ' ') {
            return 2;
        }
    }
    return 3;
} 

function isExistSpace(param) {
    for(var i=0; i<param.length; i++) {
        if(param.charAt(i) == ' ') {
            return true;
        }
    }    
    return false;
}  

function stringReplaceForTextarea(str) {
   //alert(new java.util.date());
   //alert(str);
   //alert(str.substr(349, 50));
   //alert("aa" + "\n" + "bb");
   //alert(str.indexOf(";129"));
   //alert(str.charCodeAt(580));
   //alert(str.indexOf(";64."));
   //alert(str.charCodeAt(685));
   //alert(str.charCodeAt(345));   
   //alert(str.indexOf("\r\n"));
   //alert(str.indexOf(/\r/));
   //alert(str.indexOf(String.fromCharCode(32)));
   //alert("aa"+String.fromCharCode(13)+"bb");
   //alert(Unicode2oStr(str));
   //str = Unicode2oStr(str);
   if(str == "" || str == null)
     return str;
   str = str.replace(/\r\n/g,"<br/>");
   str = str.replace(/\n/g,"<br/>");
   str = str.replace(/\r/g,"<br/>");
   /*while(str.indexOf(String.fromCharCode(13)) != -1) {
     str = str.replace(String.fromCharCode(13),"<br/>");
   } 
   while(str.indexOf(String.fromCharCode(10)) != -1) {
     str = str.replace(String.fromCharCode(10),"<br/>");
   }*/
   //str = str.replace(/String.fromCharCode(50)/g,"<br/>");
   //str = str.replace(String.fromCharCode(32),"<br/>");
   
   /*str = str.replace(/\x0d\x0a/g,"<br/>");
   str = str.replace(/\x0a/g,"<br/>");
   str = str.replace(/\cJ/g,"<br/>");
   str = str.replace(/\x0d/g,"<br/>");
   str = str.replace(/\cM/g,"<br/>");*/
   //str = str.replace(/(^*\n*)|(^*\r*)/g,"<br/>");
   //alert(str);  
   return str;
}
 
function Unicode2oStr(str){
  //alert(str.indexOf('u000A'));
  var re=/&#[\da-fA-F]{1,5};/ig;
  var arr=str.match(re);
  if(arr==null)
    return("");
  for(var i=0;i<arr.length;i++){
    arr[i]=String.fromCharCode(arr[i].replace(/[&#;]/g,""));
  }
  return(arr.toString().replace(/,/g,""));
}

function replaceByService(basehost, str) {
  var xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
  var xmlDoc=new ActiveXObject("Msxml2.DOMDocument");
  xmlHttp.open("post",basehost,false);
  xmlHttp.send(str);
  var showstr=xmlHttp.responseText;
  if(showstr != null)
    return showstr;
}

 

