// perform JavaScript after the document is scriptable.
wt(function() {
	// setup ul.tabs to work as tabs for each div directly under div.panes
	wt("ul.tabs").tabs("div.panes > div");
});
// scrollable
wt(function() {

wt(".scrollable").scrollable();

wt(".items img").click(function() {

	// see if same thumb is being clicked
	if (wt(this).hasClass("active")) { return; }

	// calclulate large image's URL based on the thumbnail URL (flickr specific)
	var url = wt(this).attr("src").replace("small", "big");

	// get handle to element that wraps the image and make it semi-transparent
	var wrap = wt("#image_wrap").fadeTo("medium", 0.5);

	// the large image from www.flickr.com
	var img = new Image();


	// call this function after it's loaded
	img.onload = function() {

		// make wrapper fully visible
		wrap.fadeTo("fast", 1);

		// change the image
		wrap.find("img").attr("src", url);

	};

	// begin loading the image from www.flickr.com
	img.src = url;

	// activate item
	wt(".items img").removeClass("active");
	wt(this).addClass("active");

// when page loads simulate a "click" on the first image
}).filter(":first").click();
});
