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

	// Hide "Der Weg" //

	$('#route').css({opacity: 0.0    });
	$('#route').css({				display: 'none'    });
	
	// Show Route //
	
	$('a#way').click(function() {
		  
		  $("body").removeClass('home');
		  $("body").removeClass('page');
		  $('#route').addClass('routeUp');
		  
		 		  
		  if(!$.browser.msie){  
		  	  $('#batch').animate({ opacity: 0.0 })
			  $('#spez').animate({    	opacity: 0    }, 500); 
			  $('#content').animate({    	opacity: 0.0    }, 500); 
			  $('#footer').animate({		opacity: 0.0    }, 500, function() {
			  	$('#route').css({				display: 'block'    });
			  	$('#route').animate({			opacity: 1.0    }, 1000);
		  	
		  	  });
		  }
		  
		  else {
		  	$('#batch').css({				display: 'none'    });
		  	$('#spez').css({				display: 'none'    });
		  	$('#content').css({				display: 'none'    });
		  	$('#footer').css({				display: 'none'    });
		  	$('#route').css({				display: 'block'    });
		  	$('#route').animate({			opacity: 1    }, 1000);  
		  };
	}); 
	
	// Hide Route //
	
	
	$('span.zuruck').click(function() {
	
		$('#route').removeClass('routeUp');
	
		if(!$.browser.msie){  
		  $('#route').animate({			opacity: 0.0    }, 200);
		  $('#route').css({				display: 'none'    });
		  $('#footer').animate({		opacity: 1   }, 500, function() {
		  	$('#batch').animate({ opacity: 1 })
		  	$("body").addClass('home');
		  	$('#spez').animate({    	opacity: 1    }, 500); 
		  	$('#content').animate({    	opacity: 1    }, 500);
		  	           		  	
		  });
		 }
		 
		 else {
		 	$('#route').css({				display: 'none'    });
		 	$('#footer').css({				display: 'block'    });
		 	$('#batch').css({				display: 'block'    });
		 	$("body").addClass('home');
		 	$('#spez').css({				display: 'block'    });
		 	$('#content').css({				display: 'block'    });		 		           		  	
		 }
	});
	
	
	// Gallery Select //
	
	$('#selectGallery').change(function() {
	 $('#footerGallery div.jsgal').animate({		opacity: 0.0    }, 400, function() {
		 $('#footerGallery div.jsgal').removeClass('showGal');
	 	 var currentGal = $('#selectGallery').val();
		 $('#footerGallery div.jsgal#gallery_'+ currentGal).addClass('showGal');
	 	$('#footerGallery div.jsgal').animate({			opacity: 1.0    }, 400);
	 });
	 
	  
	});
	
	// Add Videos into Gallery //
	
	$("#footerGallery a").each(function (arr){
	  if ($(this).attr("title").substr(0,5)=="Video"){
	   var currentSet = $(this).attr("rel") + ";width=600;height=340";
	   
	    $(this).attr("rel", currentSet);
	    $(this).attr("href",$(this).children("img").attr("title"));
	  }
	});
	
	// Style my forms //
	
	$("select, input:checkbox, input:radio, input:file").uniform();
	var pathname = "http://" + document.domain + "/";
	
	$("#ende").datepicker({
				showOn: 'button',
				buttonImage: pathname+'wp-content/themes/default/images/calender.jpg',
				buttonImageOnly: true,
				dateFormat: 'dd. MM yy',
				minDate: '01. August 2010',
				monthNames: ['Januar','Februar','M&auml;rz','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember'] 
			});
	
	$("#beginn").datepicker({
				showOn: 'button',
				buttonImage: pathname+'wp-content/themes/default/images/calender.jpg',
				buttonImageOnly: true,
				dateFormat: 'dd. MM yy',
				minDate: '01. August 2010',
				monthNames: ['Januar','Februar','M&auml;rz','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember'] 
			});
	
	
	
	$(".checklist p").remove();
	
	
	
	$('.sendmail').click(function() {
	
	//alert($(this).attr("name"));
	
	var currentID = $(this).attr("name");
	var title = $("#title_"+currentID).val().replace(/<br \/>/, '').replace(/  /, " - ");
	var time = document.getElementById("time_"+currentID).value;
	window.location.href = "mailto:contact@bluevoyage-cruises.com?subject=Booking%20request%20-%20"+title+"&body=I am interested in the special trip '"+title+"' from "+time+". Please get in touch with me.";
	});
	
	
	
});


