// JavaScript Document

function getQueryVariable(variable) {
	var query = window.location.search.substring(1);
	var vars = query.split("&");
	for (var i=0;i<vars.length;i++) {
		var pair = vars[i].split("=");
		if (pair[0] == variable) {
			return pair[1];
		}
	}
}

$(document).ready(function(){

	$("div#pgContent").addClass( getQueryVariable("flint") );
	$("div#flintMenu").addClass( getQueryVariable("flint") );
	
	$("a.styleLink").click(function(){
		$("div#flintMenu").removeClass( getQueryVariable("flint") );
		$("a").removeClass("activeLink");
		$("a").removeClass("activeDefaultLink");
		$(this).addClass("activeLink");
		$("div.flintDescription").hide();
		$("div.flintImg").hide();
	})
	$("a#styleLink1").click(function(){
		$("div#random-semi-knapped-img").fadeIn("slow");
		$("div#random-semi-knapped").fadeIn("slow");
	})
	$("a#styleLink2").click(function(){
		$("div#random-knapped-img").fadeIn("slow");
		$("div#random-knapped").fadeIn("slow");
	})
	$("a#styleLink3").click(function(){
		$("div#galletted-flintwork-img").fadeIn("slow");
		$("div#galletted-flintwork").fadeIn("slow");
	})
	$("a#styleLink4").click(function(){
		$("div#coursed-flintwork-img").fadeIn("slow");
		$("div#coursed-flintwork").fadeIn("slow");
	})
	$("a#styleLink5").click(function(){
		$("div#cobblework-img").fadeIn("slow");
		$("div#cobblework").fadeIn("slow");
	})
	$("a#styleLink6").click(function(){
		$("div#square-knapped-flintwork-img").fadeIn("slow");
		$("div#square-knapped-flintwork").fadeIn("slow");
	})
	
	$("a#typeLink1").click(function(){
		$("div#field-flint-img").fadeIn("slow");
		$("div#field-flint").fadeIn("slow");
	})
	$("a#typeLink2").click(function(){
		$("div#quarry-flint-img").fadeIn("slow");
		$("div#quarry-flint").fadeIn("slow");
	})
	$("a#typeLink3").click(function(){
		$("div#beach-pebbles-img").fadeIn("slow");
		$("div#beach-pebbles").fadeIn("slow");
	})
});
