jQuery(document).ready(function($){


  Cufon.replace('body.page h1, body.single h1, h2, h3');

  //convert agent email radio buttons to radioselect dropdown menu
	$('.wpcf7 div:has(.agent-email)').each(function(){
    $(this).addClass('radioselect');
    $(this).find('.agent-email').replaceWith('<ul class="agent-email up">'+$(this).find('.agent-email').html()+'</ul>');
    $(this).find('.agent-email .wpcf7-radio').replaceWith($(this).find('.agent-email .wpcf7-radio').html());
    $(this).find('.agent-email .wpcf7-list-item').each(function(){ $(this).replaceWith('<li class="wpcf7-list-item"><label>'+$(this).html()+'</label></li>'); });
  });
  $('.wpcf7 .radioselect:has(.agent-email)').after('<br class="clear" />');

	//radioselect dropdown menu
  $('.radioselect')
    .mouseenter(function(){
      $(this).css({ backgroundPosition: '0 -35px' });
    })
    .mousedown(function(){
      if($(this).find('ul').hasClass('up')) $(this).find('ul').removeClass('up').find('label').show();
    })
    .mouseleave(function(){
      $(this).css({ backgroundPositionY: 0 });
      $(this).find('ul').addClass('up').find('label:not(.selected)').hide();
    })
    .trigger('mouseleave');
  $('.radioselect label')
    .mouseover(function(){ $(this).addClass('hover'); })
    .mouseout(function(){ $(this).removeClass('hover'); })
    .mouseup(function(){
      $(this).parents('.radioselect').trigger('mouseleave').find('label').hide().removeClass('selected');
      $(this).show().addClass('selected');
    });
	$('#insurance-type-form').show();
	
	$('.radioselect label:not(:last)').addClass('notlast');

  
  //buttons
  $("button, .submit input")
    .bind("mouseover focus", function(){ $(this).addClass("hover"); })
    .bind("mouseout blur", function(){ $(this).removeClass("hover"); });


});


