function TestText(Ctrl){
 var k;
 if (Ctrl.value=="") return (false);
 for (k=0;k<Ctrl.value.length;k++){
  if (!(Ctrl.value.charAt(k)==' ')) return (true);}
 Ctrl.value='';
 return (false);}
function TestInteger(string){
 var strValidChars="0123456789";
 var strChar;
 var blnResult=true;
 for (i=0;i<string.length&&blnResult==true;i++){
  strChar=string.charAt(i);
  if (strValidChars.indexOf(strChar)==-1) blnResult=false;}
 if (blnResult==false) return (false);
 return (true);}
function TestDropdown(Ctrl){
 if (Ctrl.selectedIndex==0){
  return (false);} 
 else
  return (true);}
function TestRadio(Ctrl){
 for (i=0;i<Ctrl.length;i++){
  if (Ctrl[i].checked == true){
   return (true);}}
 return (false);}
function TestEmail(Ctrl){
  if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(Ctrl.value)){
    return (true);}
  return (false);} 
function ValidatePrompt(Ctrl,PromptStr){
 alert(PromptStr);
 Ctrl.focus();
 return;}
function IfConfirm(form,msg){
 agree=confirm(msg);
 if (agree) return (true);
 return (false);}
function IfConfirmLink(msg){
 agree=confirm(msg);
 if (agree) return (true);
 return (false);}
function OpenWindow(url,name,features){
 window.open(url,name,features);}
function JumpMenu(selObj,restore){
 eval("parent.location='"+selObj.options[selObj.selectedIndex].value+"'");
 if (restore) selObj.selectedIndex=0;}
function Querystring(qs){
 this.params=new Object();
 this.get=Querystring_get;
 if (qs==null) qs=location.search.substring(1,location.search.length);
 if (qs.length==0) return;
 qs=qs.replace(/\+/g, ' ');
 var args=qs.split('&');
 for (var i=0;i<args.length;i++){
  var value;
  var pair=args[i].split('=');
  var name=unescape(pair[0]);
  if (pair.length==2){
   value=unescape(pair[1]);}
  else{
   value=name;}
  this.params[name] = value;}}
function Querystring_get(key,default_){
 if (default_==null) default_=null;
 var value=this.params[key];
 if (value==null) value=default_;
 return value;}
function getCookie(NameOfCookie){
 if (document.cookie.length>0){ 
 begin=document.cookie.indexOf(NameOfCookie+"="); 
 if (begin!=-1){ 
  begin+=NameOfCookie.length+1; 
  end=document.cookie.indexOf(";", begin);
  if (end==-1) end=document.cookie.length;
  return unescape(document.cookie.substring(begin,end)); }}
 return null;}
function setCookie(NameOfCookie,value,expiredays){
 var ExpireDate=new Date();
 ExpireDate.setTime(ExpireDate.getTime()+(expiredays*24*3600*1000));
 document.cookie=NameOfCookie+"="+escape(value)+((expiredays==null)?"" : "; expires="+ExpireDate.toGMTString());}
function delCookie(NameOfCookie){
 if (getCookie(NameOfCookie)){
  document.cookie=NameOfCookie+"="+"; expires=Thu, 01-Jan-01 00:00:01 GMT";}} 
function getRandomInteger(maxvalue){
 var ranNum=Math.floor(Math.random()*maxvalue);
 return ranNum;}
function MultiDimensionalArray(iRows,iCols){ 
 var i; 
 var j; 
 var a=new Array(iRows); 
 for (i=0;i<iRows;i++){ 
  a[i]=new Array(iCols); 
  for(j=0;j<iCols;j++){ 
   a[i][j]="";}} 
 return(a);} 
function chtml(id,text){
 var _id=document.getElementById(id);
 _text=_id.firstChild;
 _text.data=text;}
function currentURL(){
 var _url=unescape(window.location.pathname);
 var _qs=location.search.substring(1,location.search.length);
 if (_qs!="") _url=_url+"?"+_qs;
 return(_url);}
function Hide(id){
 document.getElementById(id).style.visibility="hidden";
 return;}
function unHide(id){
 document.getElementById(id).style.visibility="visible";
 return;}
function TestCheckAlphaNum(Ctrl,min,max) {
  var valid="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
  var ok="yes";
  var temp;
  if ((Ctrl.value.length<min)||(Ctrl.value.length>max)){
    ok="no";}
  for (var i=0;i<Ctrl.value.length;i++) {
    temp=""+Ctrl.value.substring(i,i+1);
    if (valid.indexOf(temp)=="-1") ok="no";}
  if (ok=="no") return false;
  return true;}
function isEmpty(str){ 
 strRE=new RegExp(); 
 strRE.compile('^[s ]*$','gi'); 
 return strRE.test(str.value);} 
function changeBackgroundColor(id, color)
{	
 if (document.all) eval("document.all."+id+".style.backgroundColor='"+color+"';");
 else if (document.getElementById) eval("document.getElementById('"+id+"').style.backgroundColor='"+color+"';");
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
