//art is the number in the array of the artworkvar art = 0;//gallery_map is the map on the artwork pagevar gallery_map;var formShowing = false;$(document).ready(function(){						   	//program the buttons					   	$("#goForeward").click(function() {		art < artwork.length - 1 ? art++ : art = 0;		changeArtwork(art);		changeArrows(art);	});	$("#goBack").click(function() {		art > 0 ? art-- : art = artwork.length - 1;		changeArtwork(art);		changeArrows(art);	});					$("#respond").click(function() {		if(!formShowing){			$("#response_message").html("");			$("#response_form").show();			$("#response_form_div").fadeIn();			//$(this).hide();			formShowing = true;			$(this).html("Cancel Your Response");			return false;		} else {			cancelForm();		}	});		$("#cancelbutton").click(function() {		cancelForm();		 return false;	});		function cancelForm() {		//$("#respond").fadeIn();		 $("#response_form_div").hide();		 $(".response_input").clearFields();		 $("#response_name_warning").html("");		 $("#response_title_warning").html("");		 $("#response_feedback_warning").html("");		 $("#response_terms_warning").html("");		 $("#response_message").html("");		 $("#respond").html("We Welcome Your Feedback");		 formShowing = false;	}
		var formOptions = {			beforeSubmit: function() {					$("#response_message").html('<img src="images/loader_black_tran.gif" />');					var thisIsValid = true;					if ($("#response_name").val() == "") {						$("#response_name_warning").html("Please enter a name or nickname.");						thisIsValid = false;					} else {						$("#response_name_warning").html("");					}					if ($("#response_title").val() == "") {						$("#response_title_warning").html("Please enter a title for your post.");						thisIsValid = false;					} else {						$("#response_title_warning").html("");					}					if ($("#response_feedback").val() == "") {						$("#response_feedback_warning").html("Please enter a response");						thisIsValid = false;					} else {						$("#response_feedback_warning").html("");					}					if (!$("#response_terms").attr('checked')) {						$("#response_terms_warning").html("You must agree to the terms by clicking the box");						thisIsValid = false;					   					} else {						$("#response_terms_warning").html("");					}					if(!thisIsValid) {						$("#response_message").html("<p>Please fill in all fields prior to submitting</p>");						}					return thisIsValid;				},			success: function(responseText) {        		$("#response_message").html(responseText);				$(".response_input").clearFields();				$("#response_form").hide();				formShowing = false;				$("#respond").html("Respond to this Artwork");    		}		};			$("#response_form").ajaxForm(formOptions);		function changeArtwork(artNumber) {		$("#response_form_div").hide();		formShowing = false;		$("#respond").html("Respond to this Artwork");		//$("#respond").fadeIn();		var h2headline = '<h2 class="headline">' + artwork[artNumber].headline + '</h2>';		var imgTag = '<img src="images/' + artwork[artNumber].image_medium + '" width="' + artwork[art].med_width + '" height="' + artwork[artNumber].med_height + '" align="left" class="galleryimage"/>';		var tombstoneText =  artwork[artNumber].tombstone;		var bodyText = artwork[artNumber].bodytext;		var newHTML = h2headline + imgTag + tombstoneText + bodyText;		var content = $("#gallery_content");		content.html(newHTML);		$("#response_web_order").val(artNumber);		$("#response_web_street").val(artwork[artNumber].street);		urchinTracker("/allthesaints/art/" + artwork[artNumber].street);		return false;	}			function metaChangeArtwork(artNumber) {		var artWidth = artwork[art].med_width;		var artHeight = artwork[art].med_height;		$("#response_form_div").hide();		$("#respond").fadeIn();		var h2headline = '<h2 class="headline">' + artwork[artNumber].headline + '</h2>';		var imgTag = '<img src="images/' + artwork[artNumber].image_medium + '" width="' + artWidth + '" height="' + artHeight + '" align="left" class="galleryimage"/>';		var tombstoneText =  artwork[artNumber].tombstone;		var bodyText = artwork[artNumber].bodytext;		var newHTML = h2headline + imgTag + tombstoneText + bodyText;		var content = $("#gallery_content");		content.html(newHTML);		$("#response_web_order").val(artNumber);		$("#response_web_street").val(artwork[artNumber].street);		urchinTracker(artwork[artNumber].street);		return false;	}		function changeArrows(artNumber){		var next;		artNumber < 8 ? next = artNumber + 1 : next = 0;		$("#goForeward").attr("href","#" + next);		///////////////////		var previous;		artNumber > 0 ? previous = artNumber - 1 : previous = 8;		$("#goBack").attr("href","#" + previous);		///////////////if someone switches language on this page they will go to approp image		$("#switcher").attr("href", "switch_language.php?art=" + art);	}				$("p.submenu a").each(function(index) {		//alert("What's Going On?");		$(this).attr("href", "#" + index);	});		$("p.submenu a").each(function(index) {		//alert("What's Going On?");		$(this).click(function(){			art = index;			changeArtwork(index);			changeArrows(index);		});	});		});