jQuery.noConflict();

// Window load effects
jQuery(window).load(function() {
});
  


jQuery(document).ready(function() {
 
      	jQuery('.wrapper').fadeIn(500); 
      	jQuery('#login-strip').fadeIn(1000); 	
// Expand Panel
  jQuery("#open").click(function(){
    jQuery( "#login-pad" ).animate( { height: '240px' }, { queue: false, duration: 1000 });
  });	

// Collapse Panel
  jQuery("#close").click(function(){
    jQuery( "#login-pad" ).animate( { height: '10px' }, { queue: false, duration: 1000 });
  });

// Switch buttons from "Open" to "Close" on click
  jQuery("#toggle a").click(function () {
    jQuery("#toggle a").toggle();
  });


  jQuery("#posts").getTwitter({
    userName: "GedNichols",
    numTweets: 1,
    loaderText: "Loading tweets...",
    slideIn: false,
    showHeading: false,
    headingText: "Latest Tweets",
    showProfileLink: false
  });

// Get latest 6 tweets by jQueryHowto
//  jQuery.jTwitter('GedNichols', 1, function(data){
//    jQuery('#posts').empty();
//    jQuery.each(data, function(i, post){
//      jQuery('#posts').append(
//        '<div class="post">'+' <div class="txt">'+ post.text +' </div>'+'</div>'
//      );
//    });
//  });


jQuery("#your_memb_no").validate({
  rules: {
    field: {
      required: true,
      number: true
    }
  }
});


  // Click to clear default text

  jQuery('#your_firstname').focus(function(){ this.value = ''; });
  jQuery('#your_surname').focus(function(){ this.value = ''; });
  jQuery('#your_email').focus(function(){ this.value = ''; });
  jQuery('#your_memb_no').focus(function(){ this.value = ''; });
  jQuery('#your_subject').focus(function(){ this.value = ''; });
  jQuery("textarea").focus(function(){ this.value = ''; });
  
  // Replace default text if left blank
  // contact form
  // jQuery('#your_name').blur(function(){ this.value = 'your name'; } });
  // jQuery('#your_email').blur(function(){ this.value = 'your email'; });
  // jQuery('#your_subject').blur(function(){ this.value = 'your subject'; });
  // jQuery('#your_message').blur(function(){ this.value = 'your message'; });

  // login form
  jQuery('#login #username').focus(function(){ this.value = ''; });
  jQuery('#login #password').focus(function(){ this.value = ''; });
  jQuery('#login #memberno').focus(function(){ this.value = ''; });
  jQuery('#login #surname').focus(function(){ this.value = ''; });
  jQuery('#fail-login #memberno').focus(function(){ this.value = ''; });
  jQuery('#fail-login #surname').focus(function(){ this.value = ''; });

  jQuery('input').corner('10px');
  jQuery('textarea').corner('10px');
  jQuery('#send').css({boxShadow: '0 0 5px #444'});
  jQuery('#submit').css({boxShadow: '0 0 5px #444'});
  jQuery('.button').corner('10px').css({boxShadow: '0 0 5px #444'});
  
  jQuery('#update-dd-mandate').corner('10px').css({boxShadow: '0 0 5px #444'});
  jQuery('#change-login-details').corner('10px').css({boxShadow: '0 0 5px #444'});
  jQuery('#change-member-details').corner('10px').css({boxShadow: '0 0 5px #444'});
  
  jQuery('#nav').css({boxShadow: '0 0 3px #888'});

  jQuery("#member_join").validate();

//  jQuery('#test').corner("bevelfold tr 25px");
//  jQuery('#test').corner("10px");


// jQuery('ul').load(function() {
//  jQuery(this).slideUp(1);
//  });


// jQuery('#nav li').hover(
// function () {
//show its submenu
//			jQuery('ul', this).slideDown(300);

//		}, 
//		function () {
//			//hide its submenu
//			jQuery('ul', this).slideUp(300);			
//		}
//	);


 
          jQuery("#submit").click(function(){
          jQuery(".error").hide();
          var hasError = false;
          var passwordVal = jQuery("#password").val();
          var checkVal = jQuery("#password-check").val();
          if (passwordVal == '') {
              jQuery("#password").after('<span class="error">Please enter a password.</span>');
              hasError = true;
          } else if (checkVal == '') {
              jQuery("#password-check").after('<span class="error">Please re-enter your password.</span>');
              hasError = true;
          } else if (passwordVal != checkVal ) {
              jQuery("#password-check").after('<span class="error">Passwords do not match.</span>');
              hasError = true;
          }
          if(hasError == true) {return false;}
      });




});

