$(function () {
  $(".msg-body").hide();
  $(".msg-head").click(function() {
  	$(".msg-body").hide();
    $(this).next(".msg-body").slideToggle(200);
  });

    $("#social-switches li").hover(function () {
        var $this = $(this);
        $("#social-slides div").hide();
        $("#social-slide" + $this.attr("id").replace(/show/, "")).show();
    });
    $('#banner-image').cycle({
		fx: 'fade',
		speed: 800,
		pager:  '#headerPager',
		timeout: 7500,
		pagerAnchorBuilder: function(index, el) {
        	return '<a href="#"> </a>';
    	}		
	});
    $('#callGallery-1').cycle({
		fx: 'fade',
		speed: 800,
		timeout: 8000,
		startingSlide: Math.floor(Math.random()*4)		
	});
    $('#callGallery-2').cycle({
		fx: 'fade',
		speed: 800,
		delay: 4000,
		timeout: 8000,
		startingSlide: Math.floor(Math.random()*4)
	});
	
  $("#submitPoll").attr('disabled','disabled');
  $("#poll-box input[type=radio]").click(function() {
  	$("#submitPoll").attr('disabled','');
  });
  $("#submitPoll").click(function() {

	$('#pollOptions').hide();
	$('#loading').show();	
	var vote = $("input[@name=poll]:checked").val();
	var dataString = 'vote='+ vote;
			
		$.ajax({
      type: "POST",
      url: "../func/poll.func.php",
      data: dataString,
		success: function(html){
		$("#loading").hide();
		$("#display").after(html);
		}
     });
    return false;
	});
	
  $('.start_hidden').hide();

  $('#search_options').change(function() {
    ($(this).val() == "Google Search") ? $('#search_term').slideDown(200) : $('#search_term').slideUp(200);
    ($(this).val() == "Other") ? $('#other_method').slideDown(200) : $('#other_method').slideUp(200);
    ($(this).val() == "Personal Recommendation") ? $('#rec_by').slideDown(200) : $('#rec_by').slideUp(200);
    ($(this).val() == "Newspaper/Magazine") ? $('#mag_name').slideDown(200) : $('#mag_name').slideUp(200);
  });
  $('.quoteOtherRequirementsTrue').change(function() {
    ($(this).attr( 'checked' ) ) ? $('#other_req_detail').slideDown(200) : $('#other_req_detail').slideUp(200);
  });

  $('#parking_list').change(function() {
    ($(this).val() == "Other") ? $('#other_parking').slideDown(200) : $('#other_parking').slideUp(200);
  });
  
    $("input[name=quoteParking]").change(function() {
    	($(this).val() == "Yes") ? $('#parking_type').slideDown(200) : $('#parking_type').slideUp(200);
    }); 

});

