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

	$(".grow").hide();
	$(".grow").slideDown("slow");
	
	$(".fade-in").hide();
	$(".fade-in-slow").fadeIn(2000);
	$(".fade-in-med").fadeIn(1500);
	$(".fade-in-fast").fadeIn(1000);
	
	
	$(".more").hide();
	$(".showmore").click(function(){
			$(".more").slideToggle("slow");
			$(".showmore .choices").toggle();
	});

	/* MG Added this and the below check_for_stupidity() function to 
	   give SEO morons a bit more of a hint. */
	var tarea = $("textarea[name='cfMessage']");

	if (tarea) {
		tarea.keyup(function() {
			check_for_stupidity(tarea);
		});
	}
	
	/* MG Added to show/hide appropriate Amazon store links */
	$('div.country-us').hide();
	$.getJSON("http://api.gothick.org.uk/hereorthere.php?callback=?", function(data) {
		if (data.country_code == 'GB') {
			$('div.country-uk').show();
			$('div.country-us').hide();
		} else {
			$('div.country-uk').hide();
			$('div.country-us').show();						
		}
	});

});

/* Contact Form Validation */
function validate(form)
{
	if( form.cfName.value == "" || form.cfEmail.value == "" || form.cfComments.value == "" ) 
   { 
	  document.getElementById('message').innerHTML = 'Please fill out name, email and a message.';
	  document.getElementById('message').style.display = 'block';
	  return false; 
   }
}

function check_for_stupidity(tarea) {
		var matches = tarea.val().match(/\bSEO\b/g);
		if (matches) {
			jQuery("input[name='send_mail']").hide();
			jQuery("#warning").show();
		}
		else { 
			jQuery("input[name='send_mail']").show();
			jQuery("#warning").hide();
		}
	}


