
var inputs = new Hash({
  'elephant': "Please select the name of Orphan you want to foster",
  'feedbackname': "Please enter your name",
  'address': "Please enter your address",
  'address3': "Please enter the name of your city",
  'address5': "Please enter your postcode",
  'feedbackemail': "Please enter your email"
});

var gift_details = new Hash({
  'recipient': "Please enter recipient's name",
  'recipient_address': "Please enter recipient's address",
  'recipient_address3': "Please enter the name of recipient's city",
  'recipient_address5': "Please enter recipient's postcode"
});

function check_form() {
  
  var actual_error;
  
  inputs.each(function(item){
    var id = item.key;
    var error = item.value;
    
    if( $(id).getValue() == '' ) {
      if( !actual_error ) actual_error = error;
    }
    
  });
    
  if( $('gift').checked ) {
    
    gift_details.each(function(item){
      var id = item.key;
      var error = item.value;

      if( $(id).getValue() == '' ) {
        if( !actual_error ) actual_error = error;
      }
    });
    
  }
  
  if( actual_error ) {
    alert(actual_error);
    return false;
  }
  
  $('check_page').setValue(1);
  return true;
  
}

function showhide_gift() {
  
	if( $('gift').checked ){ 
		$('gift_details').addClassName('showIt');
		$('gift_details').removeClassName('hideIt');
	} else {
		$('gift_details').removeClassName('showIt');
		$('gift_details').addClassName('hideIt');
	}
	
}
