var Common=new CCommon();
function CCommon(){this.VM_SEPARATOR="!|!|@|<VM_SEPARATOR>|@|!|!";
this.BANNER_TIMEOUT=5000;
this.SEARCH_TIMEOUT=2000;
this.tempHolder=null;
this.tempHolder1=null;
this.loadingImgId="loadImg";
}CCommon.prototype.findById=function(id){try{return document.getElementById(id);
}catch(e){}};
CCommon.prototype.findByName=function(eleName){try{return document.getElementsByName(eleName);
}catch(e){}};
CCommon.prototype.setValue=function(id,val){try{var elem=Common.findById(id);
if(elem==null){return;
}elem.innerHTML=val;
}catch(e){}};
CCommon.prototype.getValue=function(id){try{var elem=Common.findById(id);
if(elem==null){return"";
}return elem.innerHTML;
}catch(e){}};
CCommon.prototype.setSrc=function(id,src){try{var elem=Common.findById(id);
if(elem==null){return;
}var tmpElem=Common.findById("tmpImg");
if(tmpElem==null){elem.src=src;
}else{tmpElem.src=src;
this.tempHolder=elem;
this.tempHolder1=tmpElem;
if(tmpElem.attachEvent){tmpElem.attachEvent("onload",setImageSrc);
tmpElem.attachEvent("onerror",setImageSrc);
}else{tmpElem.setAttribute("onload","setImageSrc()");
tmpElem.setAttribute("onerror","setImageSrc()");
}Design.replaceClass(id,"show","hide");
Design.replaceClass(this.loadingImgId,"hide","show");
}}catch(e){}};
function setImageSrc(){try{Common.tempHolder.src=Common.tempHolder1.src;
Design.replaceClass(Common.tempHolder.id,"hide","show");
Design.replaceClass(Common.loadingImgId,"show","hide");
}catch(e){}}CCommon.prototype.searchElems=function(containerId,tagName){try{if(tagName==null||tagName.length==0){return null;
}var elems=null;
if(containerId!=null){var container=document.getElementById(containerId);
if(container!=null){elems=container.getElementsByTagName(tagName);
}}else{elems=document.getElementsByTagName(tagName);
}return elems;
}catch(e){}};
CCommon.prototype.findElemIndex=function(elems,cssClass){try{for(var a=0;
a<elems.length;
a++){elem=elems[a];
if(elem.className==cssClass){return a;
}}return null;
}catch(e){}};
CCommon.prototype.findElem=function(elems,cssClass){try{for(var a=0;
a<elems.length;
a++){elem=elems[a];
if(elem.className==cssClass){return elem;
}}return null;
}catch(e){}};
function ltrim(str){return str.replace(/\s+$/,"");
}function rtrim(str){return str.replace(/^\s+/,"");
}CCommon.prototype.trim=function(str){try{return str.replace(/^\s*|\s*$/g,"");
}catch(e){}};
CCommon.prototype.showElement=function(id){try{var element=Common.findById(id);
if(element!=null){element.style.display="";
}}catch(e){}};
CCommon.prototype.hideElement=function(id){try{var element=Common.findById(id);
if(element!=null){element.style.display="none";
}}catch(e){}};
CCommon.prototype.loadImage=function(elem,uri){try{if(elem==null){return;
}elem.src=uri;
}catch(e){}};
CCommon.prototype.navigate=function(url){try{window.location.href=url;
}catch(e){}};
CCommon.prototype.checkEmailAddress=function(email){try{var emailRegexp="^[a-zA-Z0-9][\\w\\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\\w\\.-]*[a-zA-Z0-9]\\.[a-zA-Z][a-zA-Z\\.]*[a-zA-Z]$";
var goodEmail=Common.trim(email).match(emailRegexp);
return goodEmail;
}catch(e){}return false;
};
CCommon.prototype.checkPhoneNumber=function(phoneNumber){try{var goodPhone=Common.trim(phoneNumber).match("^(?:00|+)[1-9][0-9]{6,16}$");
return goodPhone;
}catch(e){}};
CCommon.prototype.allowDoubleOnly=function(evt){var charCode=(evt.which)?evt.which:evt.keyCode;
if(charCode==8||charCode==46||(charCode>=48&&charCode<=57)){return true;
}return false;
};
CCommon.prototype.validateDate=function(dateString){try{var RegExPattern=/^(?=\d)(?:(?:(?:(?:(?:0?[13578]|1[02])(\/|-|\.)31)\1|(?:(?:0?[1,3-9]|1[0-2])(\/|-|\.)(?:29|30)\2))(?:(?:1[6-9]|[2-9]\d)?\d{2})|(?:0?2(\/|-|\.)29\3(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))|(?:(?:0?[1-9])|(?:1[0-2]))(\/|-|\.)(?:0?[1-9]|1\d|2[0-8])\4(?:(?:1[6-9]|[2-9]\d)?\d{2}))($|\ (?=\d)))?(((0?[1-9]|1[012])(:[0-5]\d){0,2}(\ [AP]M))|([01]\d|2[0-3])(:[0-5]\d){1,2})?$/;
return(dateString.match(RegExPattern)&&(Common.trim(dateString)!=""));
}catch(e){}};
CCommon.prototype.checkDate=function(elem){if(elem.value=="00"){return true;
}else{return false;
}};
CCommon.prototype.sleep=function(millis){var date=new Date();
var curDate=null;
do{curDate=new Date();
}while(curDate-date<millis);
};
