		jQuery.jQueryRandom = 0;
		jQuery.extend(jQuery.expr[":"],
		{
    		random: function(a, i, m, r) {
        		if (i == 0) {
            		jQuery.jQueryRandom = Math.floor(Math.random() * r.length);
        		};
        		return i == jQuery.jQueryRandom;
    		}
		});
	
		$(document).ready(function() {
			$("#query").focus(function() {
				if(!$(this).hasClass("edited")) {
					$(this).val("").addClass("edited");
				}
			});
			$("#query").blur(function() {
				if($(this).val() == "") {
					$(this).val("Enter your message here.").removeClass("edited");
				}
			});
			
			$("div.showme").show();
			var isAnimating = false;
			var rand = 5;
			
			$("div.carousel").hover(function() {
				if(!isAnimating) {	
					isAnimating = true;
					$(this).children("div.item:visible").hide('slide',{direction: "down"},100,function() {
						//$(this).removeClass("showme");
						$(this).siblings("div.item:random").show('slide',{direction: "up", easing: "easeOutBounce"},500,function() {
							isAnimating = false;
						});
					});
				}
				//},8);
				//$(this).children("div.showme:first").hide('slide',{direction: "down"},200,function() {
					//$(this).siblings("div:random").addClass("showme").show('slide',{direction: "up", easing: "easeOutBounce"},700);
				//});
			}, function() {});
			
			$(".slider").draggable({
				axis:'x',
				stop: function(event,ui) {
					var centre = $(".content").offset().left;
					centre += ($(".content").width() / 2);
					var position = $("#panelwork").offset();
					
					if(position.left >= centre) {
						showMain();
					} else {
						position = $("#panelcontact").offset();
						if(position.left >= centre) {
							showWork();
						} else {
							showContact();
						}
					}
				}
			});
			
			$("#clirelish").click(function() {
				$("#clientportsmouth").fadeOut();
				$("#clientirelish").fadeIn();
			});
			
			$("#clport").click(function() {
				$("#clientirelish").fadeOut();
				$("#clientportsmouth").fadeIn();
			});
			
			$("#contactform").submit(function() {
				$("#submit").val("Sending");
				$.post("contact.php", $("#contactform").serialize(),function(data) {
					if(data == "1") {
						$("#conf").fadeIn('fast');
						$("#submit").val("Sent!");
					}
				});
				return false;
			});
			
		});
		
		function showMain() {
			$("#slider").animate({
				left: '0px'
			},400);
			$("img#1").attr('src','images/dotwhite.png');
			$("img#2").attr('src','images/dotgrey.png');
			$("img#3").attr('src','images/dotgrey.png');
		}
		
		function showWork() {
			$("#slider").animate({
				left: '-640px'
			},400);
			$("img#1").attr('src','images/dotgrey.png');
			$("img#2").attr('src','images/dotwhite.png');
			$("img#3").attr('src','images/dotgrey.png');
		}
		
		function showContact() {
			$("#slider").animate({
				left: '-1280px'
			},400);
			$("img#1").attr('src','images/dotgrey.png');
			$("img#2").attr('src','images/dotgrey.png');
			$("img#3").attr('src','images/dotwhite.png');
		}
