/*
 *  @(#)$Id: join_behaviour.js,v 1.1 2008-09-27 18:31:53 gerard Exp $
 *
 *  Copyright (c) 2006 Llamawerx Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of
 *  Llamawerx ("Confidential Information").  You shall not disclose such
 *  Confidential Information and shall use it only in accordance with
 *  the terms of the license agreement you entered into with Llamawerx.
 */

var myrules = {
      'body' : function(element) {
         setFocus('first_name');
         highlight(document.getElementById('first_name'), 1);
         },
      'input' : function(element){
         element.onfocus = function() {
            highlight(element, 1);
         },
         element.onblur = function() {
            highlight(element, 0);
         }
      },
      '.validate_num' : function(element){
         element.onkeypress = function(event) {
            var keyCode = 'undefined';
            if(window.event) {
               keyCode = window.event.keyCode;
            } else if(event.which) {
               keyCode = event.which;
            }
            if(keyCode == 'undefined') {
               return true;
            }
            var key = String.fromCharCode(keyCode);
            return isNum(key) || (keyCode == 8) || (keyCode == 13) || (keyCode == 9);
         }
      },
      '#clear_btn' : function(element){
         element.onclick = function() {
            setFocus('first_name');
            highlight(document.getElementById('first_name'), 1);
         }
      }
	};
	
Behaviour.register(myrules);
