function on_change(show, hide)
{
   $('#'+show).show();
   $('#'+hide).hide();
}

var now = new Date();
jQuery.validator.addMethod("dob", function(value, element) {
     return value < now.getFullYear();
}, "Please, select the Date of Birth");  

$(function(){
     $('.qtip').each(function(){
          var title = $(this).attr('title');
          if ('' == title)
          {
               return;
          }
          $(this).qtip({
             content: title,
             hide: {
                fixed: true
             },
             position: {
                    corner:{
                       tooltip: 'leftMiddle',
                       target: 'rightMiddle'
                    }
             },
             style: {
                name: 'light', //dark | light | green | red | blue | cream
                width: {min: 150, max: 450},
                border: {width: 1, radius:5, color:'#464646'},
                tip: true
             }
           });
          $(this).qtip({
             content: title,
             hide: {
                fixed: true
             },
             position: {
                    corner:{
                       tooltip: 'leftMiddle',
                       target: 'rightMiddle'
                    }
             },
             style: {
                name: 'light', //dark | light | green | red | blue | cream
                width: {min: 150, max: 450},
                border: {width: 1, radius:5, color:'#464646'},
                tip: true
             },
             show: {
                when: {
                   event: 'focus'
                }
             },
             hide: {
                when: {
                   event: 'blur'
                }
             }
           });
           $(this).removeAttr('title');
     });

     var $reg = $("#reg").validate({
           rules:{
               'registration[d_year]':{
                    dob:true
               }
           },
           messages:{
               'registration[confirm_email]':{
                   equalTo:'Please enter the same "Primary Email Address" as above'
               },
               'registration[confirm]':{
                   equalTo:'Please enter the same password as above'
               }
           }
     });
     //$(".dt_dob").datepicker({showOn: 'both', buttonImageOnly: true, buttonImage: HTTP_STATIC_IMAGE_PATH+'/js/jquery-ui/theme/images/calendar.gif', yearRange:'-100:-10', dateFormat:'dd/mm/yy', altField:'#altDate', altFormat:'yy-mm-dd'});

     $('#clear').click(function(){
          $reg.resetForm();
     });
      
});