jQuery(window).load(function() {
	//jQuery('#issue').css({visibility: "visible"});
	jQuery('#loadingBackground').hide();
	jQuery('#loadedBackground').show();
});


// wait for the DOM to be loaded
$(document).ready(function()
{
	// bind 'contact' and provide a simple callback function
	$('#contact').ajaxForm(function() {
		//$('#contact_form').html("<div id='message'></div>");
		//$('#message').html("<h2>Your message has been sent!</h2>")
		//.append("<p>We will be in touch very soon.</p>")
		//.hide()
		//.fadeIn
		//(
		//	1500
		//,	function()
		//	{
		//		$('#message');
		//	}
		//);
		
		$("#submit_btn").attr('value', 'Message Sent');
		$("#submit_btn").addClass("sent");
		$('#sentSuccessful').show();
	});
});

$(function()
{
	$("#mybook").booklet({
	width:			904,
	height:			584,
	pagePadding:	0,
	covers:			true,
	closed:			true,
	manual:			false,
	next:			"nextPage",
	prev:			"previousPage",
	pageNumbers:	false,
	arrows:			true,
	autoCenter:		true,
	hash:			false,
	hovers:			false
	});
});


$(function()
{
	var removeLink = '<a class="remove" href="#" onclick="$(this).parent().slideUp(function(){ $(this).remove() }); return false">remove</a>';
	$('a.add').relCopy({ append: removeLink});	
});


function toggle_visibility(id)
{
	var e = document.getElementById(id);
	if(e.style.visibility == 'visible')
	{
		e.style.visibility = 'hidden';
	}
	else
	{
		e.style.visibility = 'visible';
	}
}

function selectedIssue(selectedCover)
{
	var coverContainer = document.getElementById("selectedIssue");
	coverContainer.style.backgroundImage = "url(http://localhost:8888/onthegoEastEnd" + selectedCover + ")";
}

function changeClass(targetID, toClass, currentObject)
{
	document.getElementById(targetID).className = toClass;

	$('.active').removeClass();
	currentObject.parentNode.className = 'active';
}
