var JohnBranch = {
	audio: {
		urls: [],
		titles: []
	},
	init: function() {
		$("#audio a").each(function() {
			JohnBranch.audio.urls.push(this.href);
			JohnBranch.audio.titles.push(this.title);
		});
		if( JohnBranch.audio.urls.length ) {
			var urls = JohnBranch.audio.urls.join(",");
			var titles = JohnBranch.audio.titles.join(",");
			AudioPlayer.embed("audio", {
				soundFile: urls,
				titles: titles
			});
		}
		$("#email").autoClear("Enter your e-mail address");
		$("#photosul a").lightBox({
			imageLoading:  WP['template_directory']+"/light-box/images/lightbox-ico-loading.gif",
			imageBtnPrev:  WP['template_directory']+"/light-box/images/lightbox-btn-prev.gif",
			imageBtnNext:  WP['template_directory']+"/light-box/images/lightbox-btn-next.gif",
			imageBtnClose: WP['template_directory']+"/light-box/images/lightbox-btn-close.gif",
			imageBlank:    WP['template_directory']+"/light-box/images/lightbox-blank.gif"
		});
	}
};

$.fn.autoClear = function(value) {
	$(this).data('default', value).val(value).focus(function() {
		var value = $(this).data("default");
		if ($(this).val() == value) {
			$(this).val("");
		}
	}).blur(function() {
		if ($(this).val() == "") {
			$(this).val($(this).data("default"));
		}
	});
	return this;
}

$(JohnBranch.init);

