$(document).ready(function(){

	$('.designredline').css('height',$('.main-body').height()); 
	var heightAtLoad = $('.main-body').height(); 
	$('.otherfield').hide() ; 
	$('#hearabout').change(function(){
    var val = [];
		$('#hearabout').each(function(i){
		  if($(this).val() == 'Other'){
			$('.otherfield').fadeIn() ; 
		  }else{
			$('.otherfield').fadeOut() ; 
		  }
		  })
	  })
	
	var totalwidth = $('.frontpageContainers').width();

	var h1width;
	var spanwidths;
	h1width = $('.frontpageContainers h1.firstset').width();
	spanwidths =((totalwidth - h1width)-10)

	$('.firstset .spanright').css('width',spanwidths);

	h1width = $('.frontpageContainers h1.secondset').width();
	spanwidths =((totalwidth - h1width)-10)

	$('.secondset .spanright').css('width',spanwidths);
	
	h1width = $('.frontpageContainers h1.thirdset').width();
	spanwidths =(((totalwidth - h1width))-10)

	$('.thirdset .spanright').css('width',spanwidths);

	

 
	
	$('#bannerboxfade').cycle({  
    fx:    'fade', 
    speed:  5500,
	random: 1
	});
	


	$('.wpcf7-submit').click(function(){ 
				var destinationHeight = $('.destinationcheckboxdiv').height(); 
				var responseheight = $('.wpcf7-response-output').height();
				var newerlineheight = (heightAtLoad + destinationHeight + 160);
				$('.designredline').css('height',newerlineheight); 
	
	})

			$('#destination').change(function(){
				$('.checkboxezz').hide();
				
				$('.designredline').css('height',heightAtLoad); 
				
				$('#destination').each(function(i){

				var stringtosplit=String($(this).val()); 
				var string_array=stringtosplit.split(',');
				
				for(var i=0; i<string_array.length; i++) {
					var value = string_array[i];

				  if(value == 'Yellowstone/Grand Teton NP'){					
					$(".activitiesYellowstone").fadeIn();
					$(".selectinterest").fadeIn();
				  }
				  if(value == 'Glacier/Waterton NP'){
					$(".GlacierWatertonNP").fadeIn();
					$(".selectinterest").fadeIn();
				  }
				  if(value == 'Black Hills/ MtRushmore'){
					$(".BlackHillsMtRushmore").fadeIn();
					$(".selectinterest").fadeIn();
				  }
				  if(value == 'Rocky Mt NP'){
					$(".RockyMtNP").fadeIn();
					$(".selectinterest").fadeIn();
				  }
				  if(value == 'Utah'){
					$(".utah").fadeIn();
					$(".selectinterest").fadeIn();
				  }
				}
			
				var destinationHeight = $('.destinationcheckboxdiv').height(); 
				var newlineheight = (heightAtLoad + destinationHeight);
				$('.designredline').css('height',newlineheight); 
				});
							
							
			});

			$('#Transportation').change(function(){
				var val = [];
				$('#Transportation').each(function(i){
				  if($(this).val() == 'Flying'){					

					$(".arrivalcity").fadeIn();
				  }else{
					$(".arrivalcity").hide();
					}
				});
			});
			
			$('.secondarycheckbox').click(function(){

			$('.secondarycheckbox :checkbox').each(function(i){
				if($(this).val() == 'Im interested in more than one destination'){
					if($(this).attr('checked') ==  true){
						$(".secondarydestination").fadeIn();
					}else {
					$(".secondarydestination").hide();
				}
				return false;
				}
			})
			
			});
});



