﻿function KyDn(KY)
   {
   if(window.event) 
	 {
	 keynum = KY.keyCode
     }
   else if(KY.which) 
	 {
	 keynum = KY.which        
	 }
   if (keynum==27)
      {
      document.getElementById("divEsc").innerHTML=""
      window.scrollTo(0,0)
      document.getElementById("aspTBL").innerHTML=TBL1
      document.getElementById("LOPW").style.visibility="hidden"
      //document.getElementById("PL").style.visibility="hidden"
      //document.getElementById("txtUPW").value=""
      //window.scrollTo(0,640)
      //document.getElementById("txtKyEnc").value=""
      document.getElementById("PL").innerHTML="<a title='Price List Request' href='mailto:Sales@CheekyBee.com?subject=Price List PIN Code Request&amp;body=Please provide some details of your business and the products you are interested in.'><img src='../I/Catalogue.jpg' style='BORDER:inset'><a><br>"
      //document.getElementById("txtUPW").value=""
      //document.getElementById("txtUPW").blur()
      document.getElementById("txtCMD").focus()
      document.getElementById("PL").style.visibility="visible"
      return false
      }
   if (keynum==13)
      {
      //document.getElementById("PL").style.visibility="hidden"
      //document.getElementById("PL").innerHTML="<a title='Price List Request' href='mailto:Sales@CheekyBee.com?subject=Price List PIN Code Request&amp;body=Please provide some details of your business and the products you are interested in.'><img src='../I/Catalogue.jpg' style='BORDER:inset'><a><br>"
      if (PWE==WS || PWE==WS1)
         {
         document.getElementById("divEsc").innerHTML="Press the <b>Esc</b> key to return to main Catalog."
         document.getElementById("PL").innerHTML=""
         document.getElementById("aspTBL").innerHTML=TBL3
         //document.getElementById("aspTBL").innerHTML="<img src='../I/WPLG.jpg' style='BORDER:inset'><br><img src='../I/WPLI.jpg' style='BORDER:inset'>"
         document.getElementById("LOPW").style.visibility="hidden"
         window.scrollTo(0,0)
         }
      if (PWE==RT || PWE==RT1)
         {
         document.getElementById("divEsc").innerHTML="Press the <b>Esc</b> key to return to main Catalog."
         document.getElementById("PL").innerHTML=""
         document.getElementById("aspTBL").innerHTML=TBL2
         //document.getElementById("aspTBL").innerHTML="<img src='../I/RT.jpg' style='BORDER:inset'><br>"
         document.getElementById("LOPW").style.visibility="hidden"
         window.scrollTo(0,0)
         }
      document.getElementById("LOPW").style.visibility="hidden"
      //document.getElementById("txtUPW").value=""
      document.getElementById("txtCMD").focus()
      //document.getElementById("txtUPW").blur()
      //document.getElementById("PL").style.visibility="visible"
      //window.scrollTo(0,640)
      }
   if (keynum==123 || keynum==32)
      {
      document.getElementById("divEsc").innerHTML=""
      window.scrollTo(0,0)
      //document.getElementById("PL").style.visibility="hidden"
      document.getElementById("PL").innerHTML="<a title='Price List Request' href='mailto:Sales@CheekyBee.com?subject=Price List PIN Code Request&amp;body=Please provide some details of your business and the products you are interested in.'><img src='../I/Catalogue.jpg' style='BORDER:inset'><a><br>"
      document.getElementById("LOPW").style.visibility="visible"
      //document.getElementById("txtUPW").value=""
      document.getElementById("txtUPW").focus()
      document.getElementById("txtUPW").select()
      //document.getElementById("PL").style.visibility="visible"
      
      }
   if (document.getElementById("LOPW").style.visibility=="visible")
      {
      T="000" + keynum
      TL=T.length
      TS=TL-3
      PW=document.getElementById("txtUPW").value
   
      TT=T.substr(TS,3)
      C=String.fromCharCode(TT)
      //document.getElementById("txtKyEnc").value=document.getElementById("txtKyEnc").value + TT
      document.getElementById("txtKy").value=document.getElementById("txtUPW").value
      document.getElementById("txtKyNm").value=keynum
   
      PWE=""
      PWT=""
   
      for (Q = 0; Q < PW.length ; Q++)
         {
         var TMP=""
         var TMP1=""
         TMP="000"+PW.charCodeAt(Q)
         TMP1=TMP.substring(TMP.length-3,TMP.length)
         PWE=PWE+TMP1      
         }
      document.getElementById("txtKyEnc").value=PWE
      }
   }

function EscClick()
   {
      document.getElementById("divEsc").innerHTML=""
      window.scrollTo(0,0)
      document.getElementById("aspTBL").innerHTML=TBL1
      document.getElementById("LOPW").style.visibility="hidden"
      
      
      
      
      document.getElementById("PL").innerHTML="<a title='Price List Request' href='mailto:Sales@CheekyBee.com?subject=Price List PIN Code Request&amp;body=Please provide some details of your business and the products you are interested in.'><img src='../I/Catalogue.jpg' style='BORDER:inset'><a><br>"
      //document.getElementById("txtUPW").value=""
      //document.getElementById("txtUPW").blur()
      document.getElementById("txtCMD").focus()
      document.getElementById("PL").style.visibility="visible"
   
   }