
$(function(){

		$('#slider').loopedSlider();

});

$(document).ready(function() {
// apply inline-box only for mozilla
if( jQuery.browser.mozilla ) {
	// do when DOM is ready
	$( function() {
		// search form, hide it, search labels to modify, filter classes nocmx and error
		$( 'form.cmxform' ).hide().find( 'p>label:not(.nocmx):not(.error)' ).each( function() {
			var $this = $(this);
			var labelContent = $this.html();
			var labelWidth = document.defaultView.getComputedStyle( this, '' ).getPropertyValue( 'width' );
			// create block element with width of label
			var labelSpan = $("<span>")
				.css("display", "block")
				.width(labelWidth)
				.html(labelContent);
			// change display to mozilla specific inline-box
			$this.css("display", "-moz-inline-box")
				// remove children
				.empty()
				// add span element
				.append(labelSpan);
		// show form again
		}).end().show();
	});
};

						   });
 
$(document).ready(function() {
						   
						   
	$.metadata.setType("attr", "validate");
	
	
	$("#form1").validate();
	
	// validate the comment form when it is submitted
	$("#commentForm").validate();
	
	// validate signup form on keyup and submit
	$("#signupForm").validate({
		rules: {
			firstname: "required",
			lastname: "required",
			address: "required",
			telephone: "required",
			type: "required",
			responsible: "required",
			attending: "required",
			dateandtime: "required",
			additionaltimes: "required",
			username: {
				required: true,
				minlength: 2
			},
			password: {
				required: true,
				minlength: 5
			},
			confirm_password: {
				required: true,
				minlength: 5,
				equalTo: "#password"
			},
			email: {
				required: true,
				email: true
			},
			sel_conference: {
				required: "#conference:checked",
				minlength: 1
			},
			con: {
				required: "#con:checked",
				minlength: 1
			},
			topic: {
				required: "#newsletter:checked",
				minlength: 1
			},
			topic2: {
				required: "#newsletter2:checked",
				minlength: 1
			},
			topic3: {
				required: "#newsletter3:checked",
				minlength: 1
			},
			topic4: {
				required: "#newsletter4:checked",
				minlength: 1
			},
			topic5: {
				required: "#newsletter5:checked",
				minlength: 1
			},
			topic6: {
				required: "#newsletter6:checked",
				minlength: 1
			},
			topic7: {
				required: "#newsletter7:checked",
				minlength: 1
			},
			sel_conference: {
				required: "#conference:checked",
				minlength: 1
			},
			agree: "required"
		},
		messages: {
			firstname: "Please enter your organisation",
			lastname: "Please enter your organisation type",
			address: "Please enter your address",
			telephone: "Please enter your telephone number",
			responsible: "Please enter the name off the person responsible for the booking",
			type: "Please enter the type off event",
			attending: "Please enter number attending",
			dateandtime: "Please enter a Date and Time",
			additionaltimes: "Please enter a Date and Time",
			username: {
				required: "Please enter a username",
				minlength: "Your username must consist of at least 2 characters"
			},
			password: {
				required: "Please provide a password",
				minlength: "Your password must be at least 5 characters long"
			},
			confirm_password: {
				required: "Please provide a password",
				minlength: "Your password must be at least 5 characters long",
				equalTo: "Please enter the same password as above"
			},
			email: "Please enter a valid email address",
			agree: "Please accept our policy"
		}
	});
	
	// propose username by combining first- and lastname
	$("#username").focus(function() {
		var firstname = $("#firstname").val();
		var lastname = $("#lastname").val();
		if(firstname && lastname && !this.value) {
			this.value = firstname + "." + lastname;
		}
	});
	
	//code to hide topic selection, disable for demo
	var newsletter = $("#newsletter");
	// newsletter topics are optional, hide at first
	var inital = newsletter.is(":checked");
	var topics = $("#newsletter_topics")[inital ? "removeClass" : "addClass"]("gray");
	var topicInputs = topics.find("input").attr("disabled", !inital);
	// show when newsletter is checked
	newsletter.click(function() {
		topics[this.checked ? "removeClass" : "addClass"]("gray");
		topicInputs.attr("disabled", !this.checked);
	});
	
	//code to hide topic selection, disable for demo
	var newsletter2 = $("#newsletter2");
	// newsletter topics are optional, hide at first
	var inital = newsletter2.is(":checked");
	var topics2 = $("#newsletter_topics2")[inital ? "removeClass" : "addClass"]("gray");
	var topic2Inputs = topics2.find("input").attr("disabled", !inital);
	// show when newsletter is checked
	newsletter2.click(function() {
		topics2[this.checked ? "removeClass" : "addClass"]("gray");
		topic2Inputs.attr("disabled", !this.checked);
	});
	
		//code to hide topic selection, disable for demo
	var newsletter3 = $("#newsletter3");
	// newsletter topics are optional, hide at first
	var inital = newsletter2.is(":checked");
	var topics3 = $("#newsletter_topics3")[inital ? "removeClass" : "addClass"]("gray");
	var topic3Inputs = topics3.find("input").attr("disabled", !inital);
	// show when newsletter is checked
	newsletter3.click(function() {
		topics3[this.checked ? "removeClass" : "addClass"]("gray");
		topic3Inputs.attr("disabled", !this.checked);
	});
	
		//code to hide topic selection, disable for demo
	var newsletter4 = $("#newsletter4");
	// newsletter topics are optional, hide at first
	var inital = newsletter4.is(":checked");
	var topics4 = $("#newsletter_topics4")[inital ? "removeClass" : "addClass"]("gray");
	var topic4Inputs = topics4.find("input").attr("disabled", !inital);
	// show when newsletter is checked
	newsletter4.click(function() {
		topics4[this.checked ? "removeClass" : "addClass"]("gray");
		topic4Inputs.attr("disabled", !this.checked);
	});
	
		//code to hide topic selection, disable for demo
	var newsletter5 = $("#newsletter5");
	// newsletter topics are optional, hide at first
	var inital = newsletter5.is(":checked");
	var topics5 = $("#newsletter_topics5")[inital ? "removeClass" : "addClass"]("gray");
	var topic5Inputs = topics5.find("input").attr("disabled", !inital);
	// show when newsletter is checked
	newsletter5.click(function() {
		topics5[this.checked ? "removeClass" : "addClass"]("gray");
		topic5Inputs.attr("disabled", !this.checked);
	});
	
		//code to hide topic selection, disable for demo
	var newsletter6 = $("#newsletter6");
	// newsletter topics are optional, hide at first
	var inital = newsletter6.is(":checked");
	var topics6 = $("#newsletter_topics6")[inital ? "removeClass" : "addClass"]("gray");
	var topic6Inputs = topics6.find("input").attr("disabled", !inital);
	// show when newsletter is checked
	newsletter6.click(function() {
		topics6[this.checked ? "removeClass" : "addClass"]("gray");
		topic6Inputs.attr("disabled", !this.checked);
	});
	
		//code to hide topic selection, disable for demo
	var newsletter7 = $("#newsletter7");
	// newsletter topics are optional, hide at first
	var inital = newsletter7.is(":checked");
	var topics7 = $("#newsletter_topics7")[inital ? "removeClass" : "addClass"]("gray");
	var topic7Inputs = topics7.find("input").attr("disabled", !inital);
	// show when newsletter is checked
	newsletter7.click(function() {
		topics7[this.checked ? "removeClass" : "addClass"]("gray");
		topic7Inputs.attr("disabled", !this.checked);
	});
	
	
});



$(document).ready(function() {
 
	// Expand Panel
	$("#open").click(function(){
		$("div#panel").slideDown("slow");	
	});	
 
	// Collapse Panel
	$("#close").click(function(){
		$("div#panel").slideUp("slow");	
	});		
 
	// Switch buttons from "Log In | Register" to "Close Panel" on click
	$("#toggle a").click(function () {
		$("#toggle a").toggle();
	});		
 
});

$(document).ready(function() {

$('.first_floor').hide();
$('.ground_floor').hide();

$('a.map_click').click(function() {
								
$('.building_map').fadeOut("slow");	
$('.ground_floor').fadeIn("slow");

});

$('.first_btn').click(function() {
$('.ground_floor').animate({"left" : "680px"}).fadeOut("slow"),
$('.first_floor').fadeIn("slow");
});

$('.ground_btn').click(function() {
$('.first_floor').fadeOut("slow"),
$('.ground_floor').show(),
$('.ground_floor').animate({"left" : "0px"});
});

});

$(document).ready(function() {
						    		
	
	$('.harry_sidebar_container').hide();
	$('a.harry').click(function() {
	$('.harry_sidebar_container').slideToggle('slow');
	$("a.harry").toggle();
	});
	

	
	$("a.coming_up").click(function(){
		$(".coming_up_container").animate({
			height: "410px"
		})
		.animate({
			height: "400px"
		}, "fast");
		$("a.coming_up").toggle();
	
	});	
	
   $("#hide_button").click(function(){
		$(".coming_up_container").animate({
			height: "100px"
		}, "fast");
		
	
   });	
	
	$('.building_sidebar_container').hide();	
	$('a.building').click(function() {
	$('.building_sidebar_container').slideToggle('slow');
	$("a.building").toggle();
	});
	
	$('.activities_sidebar_container').hide();	
	$('a.activities').click(function() {
	$('.activities_sidebar_container').slideToggle('slow');
	$("a.activities").toggle();
	});
	
	
									  
	$('.expand').hide();	
	$('.harrys_blog').click(function() {
		$('.expand').slideToggle('slow');
		
		});


        $('.activities_expand').hide();
        $('.activities').click(function() {
		$('.activities_expand').slideToggle('slow');
		
		});
});