$(document).ready(function(){
	checkForHash();
	checkForVideo();
});

function checkForHash() {
	var url = window.location.href;
	
	var message = "<p class='feedback'>Thanks for sharing your story. Someone from the university will be in contact with you soon.</p>";
	
	var myregex = /#/;
	var mymatch = myregex.exec(url);
	if (mymatch) {
		$(".shareYourStory div div div div").prepend(message);
		$(".feedback").fadeIn("slow");
	} 	
}

function checkForVideo() {
	imageFolderPath = getImagePath();
	
	var elements = $(".item .thumbnail object");
	
	for (i=0;i<elements.length;i++) {
		var parent = $(elements[i]).parent().get(0);
		$(parent).empty();
		$(parent).html("<img src='" + imageFolderPath + "img/tv.gif' width='184' height='140' />");
	}
}

function getImagePath() {
	var imagePath = $("#logo img").attr("src");
	var myregex = /img/;
	imagePath = imagePath.split(myregex);
	imageFolderPath = imagePath[0];
	return imageFolderPath;
}
