﻿// JScript File
$(document).ready(function(){

        var regs = new Array();
        regs['num']      =/^[0-9]+$/;
        regs['alpha']   =/^[a-zA-Z]+$/;
        regs['alphanum']=/^[a-zA-Z0-9]+$/;
        regs['required']=/^.+$/;
        regs['tick']   =/^1$/; 
        regs['email'] =/^[-+.\w]{1,64}@[-.\w]{1,64}\.[-.\w]{2,6}$/ ;
            
    $("#txtKey").mouseup(function(e){
        $("#notes").css({'display':'block'});
    });
    
    
    $("#txtKey").hover(function(e){
        $("#notes").css({'display':'block'});
    },
        function(e){
            $("#notes").css({'display':'none'});
        }
    );
    
    
    $("#TextLocation").hover(function(e){
        $("#DivLocation").css({'display':'block'});
    },
        function(e){
            $("#DivLocation").css({'display':'none'});
        }
    );
    
    $("#TextLocation").mouseup(function(e){
        $("#DivLocation").css({'display':'block'});
    });
    
    
    $("#contactid").change(function(e){
       
        if ($("#ctl00_ContentPlaceHolder1_ctl00_frvDetailsYellowPage_urlw").val() == "")
        {
            $("#urlwebid").css({'display':'none'});
            
        }
        else
        {
            $("#urlwebid").css({'display':'block'});
        }
    });

    $("#ctl00_ContentPlaceHolder1_RegYellowPageControl1_CreateUserWizard1_emailTextBox").blur(function()
        {
            
            if ($(this).val() != "")
            {
                if(!$(this).val().match(regs['email']))
                {
                    $("#ctl00_ContentPlaceHolder1_RegYellowPageControl1_CreateUserWizard1_emailTextBox").focus();
                    $("#ctl00_ContentPlaceHolder1_RegYellowPageControl1_CreateUserWizard1_emailTextBox").val('');
                    alert("Không đúng định dạng Email!");
                }
            }            
        });
        
     $("#ctl06_frvUpdateGuid_emailTextBox").blur(function()
    {
        
        if ($(this).val() != "")
        {
            if(!$(this).val().match(regs['email']))
            {
                $("#ctl05_frvUpdateGuid_emailTextBox").focus();
                $("#ctl05_frvUpdateGuid_emailTextBox").val('');
                alert("Không đúng định dạng Email!");
            }
        }            
    });
        
        
        
    $("#ctl00_ContentPlaceHolder1_RegYellowPageControl1_CreateUserWizard1_telTextBox").keypress(function (e)  
        { 
              //if the letter is not digit then display error and don't type anything
              if( e.which!=8 && e.which!=0 && (e.which<48 || e.which>57) && e.which != 40 && e.which != 41 && e.which != 46 && e.which != 45 && e.which != 43)
              {
                return false;
              }
        });
        
        
    $("#ctl06_frvUpdateGuid_telTextBox").keypress(function (e)  
        { 
              //if the letter is not digit then display error and don't type anything
              if( e.which!=8 && e.which!=0 && (e.which<48 || e.which>57) && e.which != 40 && e.which != 41 && e.which != 46 && e.which != 45 && e.which != 43)
              {
                return false;
              }
        });
        
        
    $("#ctl00_ContentPlaceHolder1_RegYellowPageControl1_CreateUserWizard1_glatTextBox").keypress(function (e)  
    { 
          //if the letter is not digit then display error and don't type anything
          if( e.which!=8 && e.which!=0 && (e.which<48 || e.which>57) && e.which != 46)
          {
            return false;
          }
        });
        
        
    $("#ctl06_frvUpdateGuid_glatTextBox").keypress(function (e)  
    { 
          //if the letter is not digit then display error and don't type anything
          if( e.which!=8 && e.which!=0 && (e.which<48 || e.which>57) && e.which != 46)
          {
            return false;
          }
        });
        
    $("#ctl00_ContentPlaceHolder1_RegYellowPageControl1_CreateUserWizard1_glongTextBox").keypress(function (e)  
    { 
          //if the letter is not digit then display error and don't type anything
          if( e.which!=8 && e.which!=0 && (e.which<48 || e.which>57) && e.which != 46)
          {
            return false;
          }
        });
        
      
    $("#ctl06_frvUpdateGuid_glongTextBox").keypress(function (e)  
    { 
          //if the letter is not digit then display error and don't type anything
          if( e.which!=8 && e.which!=0 && (e.which<48 || e.which>57) && e.which != 46)
          {
            return false;
          }
        });

    $("#ctl00_ContentPlaceHolder1_ctl00_frvDetailsYellowPage_contentLabel:first-child").css("padding-left","20px")
});


