// Global

	
$(document).ready(function() {
    function myOnComplete(){
      vals = [];
      $("#user_form :checkbox[name=project]:checked").each(function(){
        vals.push($(this).val());
      })
      v = "";
      for(var i = 0; i < vals.length; i++) {
        v += vals[i];
        if((i+1) != vals.length) v+= ", ";
      };
      $("#user_form input[name=projects]").val(v);
      return true;
    }
    
   	$("#user_form").RSV({
  	  onCompleteHandler: myOnComplete,
  		rules: [
			"required,name,Please enter your name.",
			"required,phone,Please enter your phone number.",
      		"digits_only,phone,The phone field may only contain digits.",
			"required,enquiry,Please enter your enquiry."
  		]
  	});
  });
	
  

$(document).ready(function() {
    
	// email replacement	
	$('a.email').each(function(){
		e = this.rel.replace('default.htm','@');
		this.href = 'mailto:' + e;
		$(this).text(e);
	});

	// rel external
	$('A[rel="external"]').click( function() {
        window.open( $(this).attr('href') );
        return false;
    });
	
	// png supersleight
	$('body').supersleight();
	
});
