/*function FF_I1o(FF_I0,name){
    while(FF_I0!=null&&FF_I0.parentNode!=null&&!FRM_CN(FF_I0,name)){
        FF_I0=FF_I0.parentNode};
        if(FF_I0!=null&&FF_I0.parentNode!=null)
            return FF_I0;
        else 
            return false
};
*/

function FF_O1i(FF_I0, type, FF_oO){
    if(FF_I0.addEventListener){
       FF_I0.addEventListener(type, FF_oO, false);
       return true
     }else if(FF_I0.attachEvent){
       var r=FF_I0.attachEvent('on'+type, FF_oO);
       return r
     }else 
       return false
};

function FF_l0l(ul){
   var iframe;
   if(FRM_IE){
     if(FF_Ol>=5.5){
        iframe=ul.parentNode.getElementsByTagName("iframe");
         if(iframe.length>0) 
            ul.parentNode.removeChild(iframe[0])
     }else{
        FF_Io("SELECT",+1,ul);
        FF_Io("OBJECT",+1,ul)
     }
  }
}

function FF_Io(tagName, FF_l1i, menu){
   if(document.all){
      var FF_llo=document.getElementsByTagName(tagName);
      var i;
      var rect=new FF_Ooi(menu);
      var FF_oIl=FF_llo.length;
      for (i=0;i<FF_oIl;i++){
        var FF_I0=FF_llo.item(i);
        if(FF_lli(FF_I0, rect)){
             if(FF_I0.FF_O0i)
                FF_I0.FF_O0i+=FF_l1i;
             else FF_I0.FF_O0i=FF_l1i;
             
             if(FF_I0.FF_O0i==-1 && FF_l1i==-1){
                FF_I0.FF_o0i=FF_I0.style.visibility;
                FF_I0.style.visibility="hidden"
             }else if(FF_I0.FF_O0i==0 && FF_l1i==+1){
                FF_I0.style.visibility=FF_I0.FF_o0i
             }
       }
     }
   }
};

var FRM_IE=((navigator.userAgent.toLowerCase().indexOf("opera")==-1)&&navigator.appName=="Microsoft Internet Explorer")?true:false;
if(FRM_IE){
   s=navigator.appVersion;a=s.indexOf("MSIE");
   b=s.indexOf(";",a);
   var FF_Ol=parseFloat(s.substring(a+4,b))
};

function FRM_CN(FF_I0, name){
   var i, list;
   if(FF_I0.className){
      list=FF_I0.className.split(" ");
      for(i=0;i<list.length;i++)
         if(list[i]==name) return true
   };
   return false
};

function FF_O1(FF_I0, name, c){
    var i, j, FF_OIi, FF_OOi;
    if(FF_I0.className=="") return;
    FF_OOi=new Array();
    FF_OIi=FF_I0.className.split(" ");
    j=0;
    for (i=0;i<FF_OIi.length;i++)
    if(FF_OIi[i]!=name)
       FF_OOi[i-j]=FF_OIi[i];
    else 
       j++;
    if(c!=1)
       FF_I0.className=FF_OOi.join(" ");
    else 
       return FF_OOi.join(" ")
};

function FF_o1(FF_I0, name){
   if((FF_I0.className=="") || (FF_I0.className==" "))
      FF_I0.className=name;
   else if(!FRM_CN(FF_I0,name))
      FF_I0.className+=" "+name
};

function FF_lO(FF_I0,name){
   while (FF_I0 !=null && FF_I0.parentNode !=null && FF_I0.tagName && FF_I0.tagName.toLowerCase() !=name){
      FF_I0=FF_I0.parentNode};
      if(FF_I0 !=null && FF_I0.parentNode !=null)
         return FF_I0;
      else 
         return false
};

/*get elements by class name, FF_Ili mus be specified 'cos IE5.01 dont know '*' */
function FF_ll(FF_I0,FF_lOl,FF_Ili){
   var FF_Oli,FF_oOi=new Array(),j=0;
   if(FF_Ili==null||FF_Ili=="")FF_Ili="div";
   FF_Oli=FF_I0.getElementsByTagName(FF_Ili);
   for(i=0;i<FF_Oli.length;i++){
     if(FRM_CN(FF_Oli[i],FF_lOl)){
        FF_oOi[j]=FF_Oli[i];j++
     }
   };
   if(FF_oOi.length>0) 
     return FF_oOi;
   else
     return false
};

function FF_OOo(o,FF_oI){
   if(self.getComputedStyle)
      return eval('self.getComputedStyle(o,null).'+FF_oI);
   if(o.currentStyle)
      return eval('o.currentStyle.'+FF_oI)
};

Array.prototype.FF_ooi=-1;
Array.prototype.FF_I1=function(val){
   for(var i=0;i<this.length;i++)
   if(this[i]===val){
      this.FF_ooi=i;
      return true
   };
   this.FF_ooi=-1;
   return false
};

String.prototype.FF_Il=function(){
   return this.replace(/^\s+|\s+$/gi, "")
};
String.prototype.FF_OIl=function(FF_oIi){
   var o=this;
   for(var i=0;FF_oIi[i];i++){
      var re=new RegExp("%"+String(i+1));
      o=o.replace(re,FF_oIi[i])
  };return o
};

function FF_IOl(FF_I0){
   FF_lOi();
   if(FF_I0.FRM){
     FF_I0.FRM.FF_o0=false;
     var o=FF_I0.FRM.check();
     if(o&&(!FRM_IE||FF_Ol>=5.5)){
        var f=function(){
           FF_I0.FRM.FF_IIl()
        };
        setTimeout(f,100)
    };
    return o
  };
  return true
};

var FF_lll=null;
function FF_l1l(){
   clearTimeout(FF_lll)
};

var FRM_hint="FRM_hint",FRM_open="FRM_open",FRM_noHintFor="",FRM_check="FRM_check";

function FRM_Help(FF_I0,t){
   if(t==null||t=='')t=3;
   FF_l1l();
   if(FRM_noHintFor==FF_I0){
      return false
   };
   FRM_noHintFor="";
   FF_lOi();
   var a=FF_lO(FF_I0,"div");
   if(a){
      var b=FF_ll(a,FRM_hint,"div");
      if(b){
         switch(t){
            case 2:
            case true:
                b[0].style.bottom=FF_OIo(a)[1]+"px";
                break;
            case 3:var c=FF_ll(a,FRM_check,"div");
           if(c){
                b[0].style.left=c[0].offsetWidth+c[0].offsetLeft+"px";
                b[0].style.top=c[0].offsetTop+"px"
          }
        };
        FF_o1(b[0],FRM_open);
        //FF_Ilo(b[0])
     };
     return false
   }
};

function FF_oOl(FF_I0){
    var a=FF_I1o(FF_I0,FRM_hint,"div");
    if(a){
       FF_o1i(a)
    }else{
       var b=FF_lO(FF_I0,"div");
       if(b){
          var c=FF_ll(b,FRM_hint,"div");
          if(c)a=c[0]
       }
    };
    if(a){
       FF_O1(a,FRM_open);
       FF_l0l(a)
    };
    return false
};

function FF_lOi(){
    var a=FF_ll(document,FRM_hint,"div");
    for(var i=0;a[i];i++){
       FF_O1(a[i],FRM_open);
       FF_l0l(a[i])
    }
};

function FF_o1i(FF_I0){
   var a=FF_lO(FF_I0.parentNode,"div");
   var b=false;
   var c=["input","select","textarea"];
   for(var i=0;c[i];i++){
      b=a.getElementsByTagName(c[i]);
      if(b[0])break
   };
   if(b[0]){
       b[0].focus();
       FRM_noHintFor=b[0]
    }
};

function FRM_init(f,type){
    var FF_I0=document.getElementById(f);
    if(FF_I0){
        FF_I0.FRM=new FF_OI(FF_I0);
        if(type)FF_I0.FRM.type=type;
             FF_I0.FRM.init()
     }
};

function FF_OI(f){
   this.FF_oli=false;
   this.FF_o0l=f;
   this.ok=true;
   this.alerts=false;
   this.type=3;
   this.FF_Ioi="FRM_check";
   this.FF_o1l=FRM_hint;
   this.FF_O1l="FRM_in";
   this.FF_I1l="FRM_dart";
   this.FF_OO=new Array();
   this.FF_l0="FRM_error"
};

function FF_II(FF_I0){
   this.FF_I0=FF_I0;
   this.FF_oI=this.FF_IIo(FF_I0);
   this.error="";
   this.FF_I1i="";
   this.FF_o0=false;
   this.FF_l1=false;
   this.e=new Object;
   this.e['num']="%1 must be a number.";
   this.e['email']="Please fill in a valid email address.";
   this.e['pass']="Please fill in the same entry as entered in the previous field.";
   this.e['radio']="Please select one option.";
   this.e['chbox']="Please select a checkbox.";
   this.e['fill-select']="select";
   this.e['range']="Please enter %1 in range from %2-%3.";
   this.e['length']="%1 must be from %2 to %3 characters long.";
   this.e['not']="Value can't be set to %2.";
   this.e['ccn-badtyp']="Inserted %1 is either invalid or does not match the selected credit card type.";
   this.e['ccn-invalid']="Inserted %1 is invalid.";
   this.e['cct']='You have selected a %1 that does not match inserted credit card number.';
   this.e['phone']='Please fill in a valid phone number.';
   this.e['fn']='Inserted %1 is invalid.';
   this.e['charset']='%1 may consist of A-Z, 0-9, dot and underscore.';
   this.e['file']='Please fill valid file path to %1. Try to use \'Browse\' button.';
   this.FF_IIi="FRM_has-error";
   this.FF_l0="FRM_error";
   this.FF_oo="FRM_check-error";
   this.FF_I0i="FRM_check-ok"
};


FF_OI.prototype.check=function(FF_I0){
    if(FF_I0==null){
        if(this.FF_oli){
           this.FF_oli=false;
           return true
        };
        this.ok=true;
        this.FF_Ill(this.FF_o0l.childNodes,'check');
        return this.ok
    }else{
        var f=new FF_II(FF_I0);
        var o=f.check();
        if(!o){
           if(this.ok)
               FF_I0.focus();
               this.ok=false
        }
   }
};

FF_OI.prototype.init=function(FF_I0){
    if(FF_I0==null){
        this.FF_o0l.onsubmit=function(){
            return FF_IOl(this)
        };
        var h=FF_ll(this.FF_o0l,this.FF_o1l,'div');
        if(h){
           for(var i=0;h[i];i++){
              var a=document.createElement("span");
              a.onmouseover=function(){
                  FF_o1(this,"FRM_close_hover")
              };
              a.onmouseout=function(){
                  FF_O1(this,"FRM_close_hover")
              };
              a.onclick=function(){
                  return FF_oOl(this)
              };
              a.className="FRM_close";
              h[i].appendChild(a);
              var b=document.createElement("div");
              b.className=h[i].className;
              h[i].className=this.FF_O1l;
              b.id=h[i].id;
              h[i].id="";
              b.style.cssText=h[i].style.cssText;
              h[i].style.cssText="";
              h[i].parentNode.insertBefore(b,h[i]);
              b.appendChild(h[i]);
              var c=document.createElement("div");
              c.className=this.FF_I1l;
              b.appendChild(c)
          }
       };
       this.FF_Ill(this.FF_o0l.childNodes,'init');
       //this.enableSubmit();
       return true
   }else{
       if(FF_I0.type&&FF_I0.type!="hidden"){
           if(["image","submit"].FF_I1(FF_I0.type.toLowerCase())){
               var FF_oO=function(){
                   return FRM_submit(FF_I0)
               };
               //FF_O1i(FF_I0,'mousedown',FF_oO);
               this.FF_OO[this.FF_OO.length]=FF_I0
           }else{
               var FF_o0o=FF_lO(FF_I0,"div");
               var a=FF_ll(FF_o0o,this.FF_Ioi,'div');
               if(!a){
                   var b=document.createElement("div");
                   b.className=this.FF_Ioi;
                   var FF_oIo=FF_ll(FF_o0o,this.FF_l0,"span");
                   if(FF_oIo){
                       FF_oIo[0].parentNode.insertBefore(b,FF_oIo[0])
                   }else{
                       FF_I0.parentNode.appendChild(b)
                   }
               };
               var FF_oO;
               FF_oO=function(e){
               //   return FRM_BL(FF_I0,e)
               };
               FF_O1i(FF_I0,'blur',FF_oO);
               if(["radio","checkbox"].FF_I1(FF_I0.type.toLowerCase())) FF_O1i(FF_I0,'click',FF_oO);
               eval("FF_oO=function(){return FRM_Help(FF_I0,"+this.type+")}");
               FF_O1i(FF_I0,'focus',FF_oO)
         }
       }
   }
};

FF_OI.prototype.FF_Ill=function(FF_I0,FF_oO){
    for(var i=0;i<FF_I0.length;i++){
        if(this.alerts&&!this.ok)
           break;
        if(FF_I0[i]!=null&&FF_I0[i].tagName&&["input","select","textarea","button"].FF_I1(FF_I0[i].tagName.toLowerCase()))
           eval('this.'+FF_oO+'(FF_I0[i])');
        if(FF_I0[i].childNodes.length>0)
        this.FF_Ill(FF_I0[i].childNodes,FF_oO)
    }
};


FF_II.prototype.FF_IIo=function(FF_I0){
   if(!FF_I0.className)return false;
       var r=FF_I0.className.match(/\/\*(.*)\*\//);
   if(r!=null){
       var b=r[1].split(" ");
       for(var i=0;b[i];i++)
          b[i]=b[i].replace(/\<sp>/g," ");
       return b
   }else 
       return false
};

FF_II.prototype.FF_O1o=function(){
     var o=true;
     if(this.FF_I0.value.FF_Il()==''){
        o=false;
        var t=(this.FF_I0.tagName.toLowerCase()=="select")?'select':'fill';this.FF_IO('fill',[this.e['fill-'+t]])
     };
     return o
};

FF_II.prototype.FF_IO=function(error,FF_oIi){
    if(!FF_oIi)FF_oIi=Array();
    var e=(this.FF_I1i!=""?this.FF_I1i:this.e[error]).FF_OIl([this.FF_I0o().toLowerCase()].concat(FF_oIi));
    this.error+=e.charAt(0).toUpperCase()+e.substr(1)+" "
};

FF_II.prototype.FF_I0o=function(){
    var l=" ";
    if(this.FF_I0&&this.FF_I0.id){
       var a=document.getElementsByTagName("label");
       for(var i=0;a[i];i++){
          if(a[i].htmlFor==this.FF_I0.id){
             l=FF_Ool(a[i]).replace(/[\*:]/g,"").FF_Il();
             break
          }
       }
    };
    return l
};

FF_II.prototype.FF_ool=function(){
   var FF_I0=this.FF_I0;
   while(FF_I0!=null&&FF_I0.parentNode!=null&&FF_I0.tagName&&FF_OOo(FF_I0,'display')!='none')
      FF_I0=FF_I0.parentNode;
   if(FF_I0!=null&&FF_I0.parentNode!=null)
      return true;
   else 
      return false
};

FF_II.prototype.FF_Oll=function(){
   if(navigator.userAgent.search(/Windows/)!=-1){
       var s=this.FF_I0.value.FF_Il();
       if(s==""||s.search(/^([a-z]\:)|(\\)/i)!=-1)
          return true;
       else 
          return false
   }else 
       return true
};

FF_II.prototype.check=function(){
   if(this.FF_oI===false||this.FF_I0.disabled||this.FF_ool())  return true;
   var ok=true;
   for(var i=0;i<this.FF_oI.length;i++){
      var o=true;
      switch(this.FF_oI[i]){
          case"req":
              if(this.FF_I0.type&&this.FF_I0.type=="checkbox"){
                  if(!this.FF_I0.checked){
                     o=false;
                     this.FF_IO('chbox')
                  }
              }else 
                  o=this.FF_O1o();
              break;
          case"num":
              if(!isFinite(this.FF_I0.value.FF_Il())){
                  o=false;
                  this.FF_IO('num')
              };
              break;
          case"num+":
              if(!isFinite(this.FF_I0.value.FF_Il().replace(/([\s\-])/g,""))){
                  o=false;
                  this.FF_IO('num')
              };
              break;
          case"charset":
              if(this.FF_I0.value.FF_Il().replace(/[\w-+.]/gi,"")!==""){
                 o=false;
                 this.FF_IO('charset')
              };
                 break;
          case"email":
              if(this.FF_I0.value.FF_Il().search(/^\s*([\w-+.]+@[\w-]+(\.[\w-]+)+)?\s*$/)==-1){
                 o=false;
                 this.FF_IO('email')
              };
              break;
          case"phone":
              if(!isFinite(this.FF_I0.value.FF_Il().replace(/([\(\)\s\-\#\.]|ext)/ig,""))||(this.FF_I0.value.FF_Il().replace(/[^0-9]/g,"").length<10&&this.FF_I0.value.FF_Il()!="")){
                 o=false;
                 this.FF_IO('phone')
              };
              break;
          case"pass":
              var n=this.FF_I0.id.substr(0,this.FF_I0.id.length-1);
              var FF_ooo=document.getElementById(n+"1");
              if(FF_ooo)
                  if(this.FF_I0.value!==FF_ooo.value){
                      o=false;
                      this.FF_IO('pass')
                  };
              break;
          case"radio":
              var a=eval('this.FF_I0.form.'+this.FF_I0.name);
              if(a.length!=undefined){
                 o=false;for(var j=0;j<a.length;j++)
                 if(a[j].checked==true){
                   o=true;break
                 }
             }else 
                 o=a.checked;
             if(!o)
                 this.FF_IO('radio');
             break;
         case"chbox":
             if(!this.FF_I0.checked){
                 o=false;
                 this.FF_IO('chbox')
             };
             break;
         case"file":
             if(!this.FF_Oll()){
                o=false;
                this.FF_IO('file')
             };
             break;
         default:
            var re;
            if(re=this.FF_oI[i].match(/^\[(\d+)-(\d+)\]$/))
               o=this.FF_oOo(re[1],re[2]);
            else if(re=this.FF_oI[i].match(/^(\d+)-(\d+)$/))
               o=this.FF_lOo(re[1],re[2]);
            else if(re=this.FF_oI[i].match(/^\[\!([\w-+]+)\]$/))
               o=this.FF_Ooo(re[1]);
            else if(re=this.FF_oI[i].match(/^E=(.*)$/))
               this.FF_I1i=re[1].replace(/_/g," ");
            else if(re=this.FF_oI[i].match(/^ccn\(([\w]+)\)$/))
               o=this.FF_Olo(re[1]);
            else if(re=this.FF_oI[i].match(/^cct\(([\w]+)\)$/))
               o=this.FF_l1o(re[1]);
            else if(!this.FF_l1&&(re=this.FF_oI[i].match(/^test\(([\w]+)\)$/)))
               o=this.FF_OOl(re[1]);
            else if(re=this.FF_oI[i].match(/^fn\(([\w]+)\)$/)){
               try{
                   o=eval(re[1])(this.FF_I0)
               }catch(e){
                   o=true
               };
              if(!o)this.FF_IO('fn')
            }else if(re=this.FF_oI[i].match(/^re\((.*)\)$/)){
                 try{
                    var o=(this.FF_I0.value.FF_Il()!=''&&this.FF_I0.value.match(eval(re[1]))==null)?false:true
                 }catch(e){
                    o=true
                 };
                 if(!o)this.FF_IO('fn')
           }
     };
     if(!o){
        ok=false;
        break
     }
   };
   var p=FF_lO(this.FF_I0,"div");
   if(p)
      if(!ok){
         if(!this.FF_o0){
            FF_o1(p,this.FF_IIi);
            var a=FF_ll(p,this.FF_l0,"span");
            if(a===false){
               a=document.createElement("span");
               a.className=this.FF_l0;
               a.innerHTML=this.error;
               p.appendChild(a)
            }else 
               a[0].innerHTML=this.error
               this.FF_Oo()
         };
         FF_O1(p,this.FF_I0i);
         FF_o1(p,this.FF_oo)
      }else{
         if(!FRM_IE||FF_Ol >=5.5){
             var FF_l0o=this;
             var FF_oO=function(){
                 FF_O1(p,FF_l0o.FF_IIi);
                 FF_l0o.FF_Oo()
             };
             setTimeout(FF_oO,100)
         }else 
             FF_O1(p,this.FF_IIi)
             FF_O1(p,this.FF_oo);
             this.FF_Oo();
             if(this.FF_I0.value.FF_Il()!=="")
                  FF_o1(p,this.FF_I0i);
             else FF_O1(p,this.FF_I0i)};
                  return ok
};

FF_II.prototype.FF_Oo=function(){
     if(!FRM_IE||FF_Ol >=5.5){
         var p=FF_lO(this.FF_I0,"div");
         var FF_l0o=this.FF_Ioi;
         var FF_oO=function(){
             var a=FF_ll(p,FF_l0o,'div');
             for(var i=0;a[i];i++){
                 a[i].style.visibility="hidden";
                 a[i].style.visibility="visible"
             }
        };
        setTimeout(FF_oO,1)
     }
};