function htmlEncode(str) {
if ( typeof str !== "string") {
return str
}
var tmp = "";
if (str.length == 0) {
return ""
}
tmp = str;
tmp = tmp.replace(/&/g, "&");
tmp = tmp.replace(//g, ">");
tmp = tmp.replace(/ /g, " ");
tmp = tmp.replace(/\'/g, "'");
tmp = tmp.replace(/\"/g, """);
return tmp
}
function htmlDecode(str) {
if ( typeof str !== "string") {
return str
}
var tmp = "";
if (str.length == 0) {
return ""
}
tmp = str.replace(/&/g, "&");
tmp = tmp.replace(/</g, "<");
tmp = tmp.replace(/>/g, ">");
tmp = tmp.replace(/ /g, " ");
tmp = tmp.replace(/'/g, "'");
tmp = tmp.replace(/"/g, '"');
return tmp
}
var __arrHrefEncode =[["%","%25"],["\b",""],["\n",""],["\r",""],["\t","%09"],
[" ","%20"],["!","%21"],["\"","%22"],["#","%23"],["$","%24"],["&","%26"],
["\'","%27"],["(","%28"],[")","%29"],["*","%2A"],["+","%2B"],[",","%2C"],
["-","%2D"],[".","%2E"],["/","%2F"],[":","%3A"],[";","%3B"],["<","%3C"],
["=","%3D"],[">","%3E"],["?","%3F"],["@","%40"],["[","%5B"],["\\","%5C"],
["]","%5D"],["^","%5E"],["_","%5F"],["`","%60"],["{","%7B"],["|","%7C"],
["}","%7D"],["~","%7E"]];
function hrefEncode(str) {
if ( typeof str !== "string") {
return str
}
var tmp = "";
if (str.length == 0) {
return ""
}
tmp = str;
for(i=0;i<__arrHrefEncode.length;i++){
var reg=new RegExp("\\"+__arrHrefEncode[i][0],"g");
tmp = tmp.replace(reg, __arrHrefEncode[i][1]);
}
return tmp
}
function showLoding(msg){
if ( typeof msg !== "string") {
return msg
}
if (msg.length == 0) {
msg="Loading...";
}
mini.MessageBox.show({
minHeight : 50,
showHeader : false,
showCloseButton : false,
message : msg,
iconCls : "mini-messagebox-waiting"
})
}
function expandTextarea(elementId){
var change = 100;
if(typeof(document.getElementById(elementId).style.height)=="undefined") {return;}
var newheight = parseInt((document.getElementById(elementId)).style.height,10) + change;
if(newheight<=1200){
document.getElementById(elementId).style.height = newheight+"px";
}
}
function shrinkTextarea(elementId){
var change = 100;
if(typeof(document.getElementById(elementId).style.height)=="undefined") {return;}
var newheight = parseInt((document.getElementById(elementId)).style.height,10) - change;
if(newheight>=change){
document.getElementById(elementId).style.height = newheight+"px";
}
}