with(phi.classes)
{
	Jit.get('b7df20bb044a4').state.persistent.state = {"alias":"Main","background-image":"ba0dd5cb044a4","height":"800px","repeat-x":true,"width":""};
	Jit.get('77eac8bc044a4').state.persistent.state = {"alias":"Menu Holder","float":"","height":"200px","margin-left":"auto","margin-right":"auto","position":"static","width":"960px"};
	Jit.get('771e9ffc194a4').state.persistent.state = {"data":"[{\"title\":\"Oneness With All Life\",\"description\":\"This book is beautifully packaged with evocative artwork and design, <i>Oneness with All Life<\/i> highlights the most inspiring and beautiful insights of <i>A New Earth<\/i>.\\u000a<br><br>\\u000aIn <i>A New Earth<\/i>, Eckhart Tolle describes how our current ego-based state of consciousness operates. The purpose of this book is to bring about a shift in consciousness, or in his words, an awakening. An essential part of this awakening is the recognition of the ego, and our attachment to things, the past, and enemies. In this new edition, Eckhart Tolle has picked the essential phrases and paragraphs\u2014the gems of the book\u2014that he feels are most important.\",\"comments\":\"\",\"reviews\":\"http:\/\/www.eckharttolle.com\/beta\/home\/books\/review4\/\",\"buy\":\"http:\/\/store.eckharttolle.com\/books\/oneness-with-all-life.html\",\"read\":\"http:\/\/reader.eckharttolle.com\/#oneness\/0\",\"summary\":\"This book is beautifully packaged with evocative artwork and design, Oneness with All Life highlights the most inspiring and beautiful insights of A New Earth.\",\"rolloverbackground\":\"#bf4193\",\"rollovercolor\":\"#ffffff\",\"image\":\"b4b208b4f05a4\",\"thumb\":\"eaacab64f05a4\"},{\"title\":\"A New Earth\",\"description\":\"Building on the astonishing success of <i>The Power of Now<\/i>, Eckhart Tolle presents readers with an honest look at the current state of humanity: He implores us to see and accept that this state, which is based on an erroneous identification with the egoic mind, is one of dangerous insanity.\\u000a<br><br>\\u000aTolle tells us there is good news, however. There is an alternative to this potentially dire situation. Humanity now, perhaps more than in any previous time, has an opportunity to create a new, saner, more loving world. This will involve a radical inner leap from the current egoic consciousness to an entirely new one.\\u000a<br><br>\\u000aIn illuminating the nature of this shift in consciousness, Tolle describes in detail how our current ego-based state of consciousness operates. Then gently, and in very practical terms, he leads us into this new consciousness. We will come to experience who we truly are\u2014which is something infinitely greater than anything we currently think we are\u2014and learn to live and breathe freely.\",\"comments\":\"\",\"reviews\":\"http:\/\/www.eckharttolle.com\/beta\/home\/books\/review1\/\",\"buy\":\"http:\/\/store.eckharttolle.com\/books\/a-new-earth-audiobook-edition.html\",\"read\":\"http:\/\/reader.eckharttolle.com\/#newearth\/0\",\"summary\":\"Building on the astonishing success of The Power of Now, Eckhart Tolle presents readers with an honest look at the current state of humanity: He implores us to see and accept that this state, which is based on an erroneous identification with the egoic mind, is one of dangerous insanity.\",\"rolloverbackground\":\"#24bcc2\",\"rollovercolor\":\"#ffffff\",\"image\":\"4d7483d5f05a4\",\"thumb\":\"d6ffba16f05a4\"},{\"title\":\"The Power of Now\",\"description\":\"To make the journey into the Now we will need to leave our analytical mind and its false created self, the ego, behind. From the very first page of this extraordinary book, we move rapidly into a significantly higher altitude where we breathe a lighter air. We become connected to the indestructible essence of our Being, \u201cThe eternal, ever present One Life beyond the myriad forms of life that are subject to birth and death.\u201d Although the journey is challenging, Eckhart Tolle uses simple language and an easy question and answer format to guide us.\\u000a<br><br>\\u000aA word of mouth phenomenon since its first publication, <i>The Power of Now<\/i> is one of those rare books with the power to create an experience in readers, one that can radically change their lives for the better.\",\"comments\":\"\",\"reviews\":\"http:\/\/www.eckharttolle.com\/beta\/home\/books\/review2\/\",\"buy\":\"http:\/\/store.eckharttolle.com\/books\/the-power-of-now-paperback-edition-2.html\",\"read\":\"http:\/\/reader.eckharttolle.com\/#power\/0\",\"summary\":\"A Guide to Spiritual Enlightenment\\u000aThe Power of Now, a #1 New York Times Bestseller, which has been translated into 32 languages and become one of the most influential spiritual books of our time.\",\"rolloverbackground\":\"#55b45d\",\"rollovercolor\":\"#ffffff\",\"image\":\"1ec69d96f05a4\",\"thumb\":\"4d5fc4e6f05a4\"},{\"title\":\"Practicing Power of Now\",\"description\":\"Eckhart Tolle is rapidly emerging as one of the world's most inspiring spiritual teachers, sharing the enlightenment he himself experienced after a startling personal transformation. His views go beyond any particular religion, doctrine, or guru.\\u000a<br><br>\\u000aThis book extracts the essence from his teachings in <i>The Power of Now<\/i>, showing us how to free ourselves from \u201censlavement to the mind.\u201d The aim is to be able to enter into and sustain an awakened state of consciousness throughout everyday life. Through meditations and simple techniques, Eckhart shows us how to quiet our thoughts, see the world in the present moment, and find a path to \\\"a life of grace, ease, and lightness.\\\"\",\"comments\":\"\",\"reviews\":\"http:\/\/www.eckharttolle.com\/beta\/home\/books\/review3\/\",\"buy\":\"http:\/\/store.eckharttolle.com\/books\/practicing-the-power-of-now-hardcover.html\",\"read\":\"http:\/\/www.eckharttolle.com\/beta\/home\/books\/review3\/\",\"summary\":\"Essential Teachings, Meditations, and Exercises from The Power of Now.\\u000a\",\"rolloverbackground\":\"#e7721c\",\"rollovercolor\":\"#ffffff\",\"image\":\"2cbe8728f05a4\",\"thumb\":\"9d755248f05a4\"},{\"title\":\"Stillness Speaks\",\"description\":\"<b>A book designed for meditative reading<\/b>\\u000a<br><br>\\u000aThe essence of Eckhart Tolle's message is easy to grasp: If we connect to the stillness within, we move beyond our active minds and emotions and discover great depths of lasting peace, contentment, and serenity. With his bestselling first book, <i>The Power of Now<\/i>, his message has reached millions of people worldwide. Now, in his much anticipated new book, Tolle gives us the essence of his teaching in short, simple pieces that anyone can easily understand.\\u000a<br><br>\\u000a<i>Stillness Speaks<\/i> is organized into ten chapters whose subjects range from \\\"Beyond the Thinking Mind\\\" to \\\"Suffering and the End of Suffering.\\\" Each chapter is a mosaic of individual entries, concise and complete in themselves, but profoundly transformative when read as a whole.\\u000a<br><br>\\u000aEckhart Tolle understands the spiritual needs of our time. He draws from the essence of all spiritual traditions, expressing these truths in startlingly fresh new ways. The result is a book that is paradoxically both ancient and contemporary, filled with timely and powerful messages. <i>Stillness Speaks<\/i> can be no less than an awakening for readers willing to give the words a chance to work their quiet magic.\",\"comments\":\"\",\"reviews\":\"http:\/\/www.eckharttolle.com\/beta\/home\/books\/review4\/\",\"buy\":\"http:\/\/store.eckharttolle.com\/books\/stillness-speaks-cd-1.html\",\"read\":\"http:\/\/reader.eckharttolle.com\/#stillness\/0\",\"summary\":\"A book designed for meditative reading\\u000aStillness Speaks is organized into ten chapters that gives you the essence of his teaching in short, simple pieces that anyone can easily understand.\",\"rolloverbackground\":\"#97b281\",\"rollovercolor\":\"#ffffff\",\"image\":\"adee7b29f05a4\",\"thumb\":\"d5e32149f05a4\"},{\"title\":\"Guardians of Being\",\"description\":\"This wonderfully unique collaboration brings together two masters of their fields, joining original words by spiritual teacher Eckhart Tolle with delightful illustrations by Patrick McDonnell, the creator of the acclaimed comic strip MUTTS. Every heartwarming page provokes thought, insight, and smiling reverence for all beings and each moment.\\u000a<br><br>\\u000aMore than a collection of witty and charming drawings, the marriage of Patrick McDonnell\u2019s art and Eckhart Tolle\u2019s words conveys a profound love of nature, of animals, of humans, of all life-forms. <i>Guardians of Being<\/i> celebrates and reminds us of not only the oneness of all life but also the wonder and joy to be found in the present moment, amid the beauty we sometimes forget to notice all around us.\\u000a<br><br>\\u000a<b>Available October 1, 2009<\/b>\",\"comments\":\"\",\"reviews\":\"http:\/\/www.eckharttolle.com\/beta\/home\/books\/review4\/\",\"buy\":\"http:\/\/store.eckharttolle.com\/books\/a-new-earth-audiobook-edition-1.html\",\"read\":\"http:\/\/reader.eckharttolle.com\/#gob\/0\",\"summary\":\"This books is a collaboration between spiritual teacher Eckhart Tolle with delightful illustrations by Patrick McDonnell, the creator of the acclaimed comic strip MUTTS. \",\"rolloverbackground\":\"#c94511\",\"rollovercolor\":\"#ffffff\",\"image\":\"34afd2d9f05a4\",\"thumb\":\"ad01062af05a4\"},{\"title\":\"Miltons Secret\",\"description\":\"Eckhart Tolle has a simple message for everyone\u2014living in the Now is the truest path to happiness and enlightenment. With co-author Robert Friedman and illustrator Frank Riccio, Tolle now brings his message of the power of Now to children.\\u000a<br><br>\\u000a<i>Milton's Secret<\/i> is the charming story of Milton, a bright, cheerful boy, who learns to overcome his fear of bullies and other scary things that sometimes frighten children. Children follow Milton's adventures as he learns to stop projecting his past fears into the future\u2014and live simply and happily in the moment.\\u000a<br><br>\\u000a<i>Milton's Secret<\/i> will not only appeal to the millions of readers of Tolle's other books, but also to any parent who wants to help their young children overcome typical childhood fears.\",\"comments\":\"\",\"reviews\":\"http:\/\/www.eckharttolle.com\/beta\/home\/books\/review6\/\",\"buy\":\"http:\/\/store.eckharttolle.com\/books\/milton-s-secret.html\",\"read\":\"http:\/\/reader.eckharttolle.com\/#milton\/0\",\"summary\":\"An Adventure of Discovery through Then, When, and The Power of Now\\u000aEckhart Tolle has a simple message for everyone\u2014living in the Now is the truest path to happiness and enlightenment. With co-author Robert Friedman and illustrator Frank Riccio, Tolle now brings his message of the power of Now to children.\",\"rolloverbackground\":\"#e7cd1a\",\"rollovercolor\":\"#ffffff\",\"image\":\"fa40380bf05a4\",\"thumb\":\"e2c4cf2bf05a4\"}]","float":"","height":"700px","position":"relative","width":"100%"};
	Jit.get('7a19817d044a4').state.persistent.state = {"alias":"Menu Container","height":"180px","position":"relative","width":"600px"};
	Jit.get('266a75188f5a4').state.persistent.state = {"height":"20px","width":"450px"};
	Jit.get('a4b5abfd044a4').state.persistent.state = {"alias":"menu","float":"","height":"0px","left":"0px","position":"relative","shareable":true,"top":"0px","width":"600px"};
	Jit.get('356015388f5a4').state.persistent.state = {"background-color":"","float":"left","height":"20px","margin-left":"10px","margin-top":"6px","width":"450px"};
	Jit.get('d18d7341d34a4').state.persistent.state = {"alias":"About","height":"24px","href":"home\/about","image":"6588a261f24a4","left":"18px","position":"absolute","rollover":"dc136a71f24a4","selected":"dc136a71f24a4","top":"25px","width":"57px"};
	Jit.get('105bd57df34a4').state.persistent.state = {"alias":"ETTV","height":"24px","href":"http:\/\/www.eckharttolletv.com\/eckharttolle.com","image":"0f663622295a4","left":"321px","position":"absolute","rollover":"b41ac442295a4","selected":"b41ac442295a4","top":"025px","width":"140px"};
	Jit.get('15cb2dcdf34a4').state.persistent.state = {"alias":"groups","height":"28px","href":"http:\/\/store.eckharttolle.com\/localgroups\/group_facilitator_search.php","image":"c57ae6bdf34a4","left":"473px","position":"absolute","rollover":"d11c62cdf34a4","selected":"d11c62cdf34a4","top":"025px","width":"64px"};
	Jit.get('2d3e1aaef34a4').state.persistent.state = {"alias":"events","height":"23px","href":"home\/events","image":"17ad4efdf34a4","left":"549px","position":"absolute","rollover":"f19064aef34a4","selected":"be401b0ef34a4","top":"27px","width":"62px"};
	Jit.get('42f2f029f34a4').state.persistent.state = {"alias":"books","height":"24px","href":"home\/books","image":"813fc937f34a4","left":"85px","position":"absolute","rollover":"b27554c2e34a4","selected":"b27554c2e34a4","top":"25px","width":"56px"};
	Jit.get('56bb6c1df34a4').state.persistent.state = {"alias":"downloads","height":"25px","href":"http:\/\/www.iamplify.com\/eckhart-tolle\/","image":"ee0ab10df34a4","left":"213px","position":"absolute","rollover":"f7919d0df34a4","selected":"f7919d0df34a4","top":"25px","width":"96px"};
	Jit.get('928fe7d0044a4').state.persistent.state = {"alias":"Eckhart Logo","file":"da125f40044a4","height":"85px","href":"\/home","left":"6px","position":"absolute","top":"83px","width":"145px"};
	Jit.get('afb1765cf34a4').state.persistent.state = {"alias":"store","height":"24px","href":"http:\/\/www.eckharttolle.com\/eckhartstore\/","image":"c6251d1cf34a4","left":"151px","position":"absolute","rollover":"df58c14cf34a4","top":"25px","width":"51px"};
	Jit.get('dc9300e84d4a4').state.persistent.state = {"alias":"subscribe","height":"28px","left":"646px","position":"relative","top":"8px","width":"193px"};
	Jit.get('1475d07b8f5a4').state.persistent.state = {"alias":"book menu","float":"left","height":"18px","left":"","margin-left":"190px","margin-top":"115px","position":"static","shareable":true,"top":"","width":"450px"};
	Jit.get('255c18c2046a4').state.persistent.state = {"color":"#fff","content":"<p>Subscribe to our mailing list<\/p>","float":"","height":"21px","left":"35px","position":"relative","width":"193px"};
	Jit.get('30af75294d4a4').state.persistent.state = {"content":"<!--\nDo not modify the NAME value of any of the INPUT fields\nthe FORM action, or any of the hidden fields (eg. input type=hidden).\nThese are all required for this form to function correctly.\n-->\n<p><style type=\"text\/css\">\n<!--\n.p {\n\tpadding: 7px;\n\tfloat: left;\n}\n.fl {\n\tfloat: left;\n}\n.m {\n\tfloat: right;\n\tmargin-left: 10px;\n}\n-->\n<\/style><\/p>\n<p><style type=\"text\/css\">\n\n\t.myForm td, input, select, textarea, checkbox  {\n\t\tfont-family: tahoma;\n\t\tfont-size: 12px;\n\t}\n\n\t.required {\n\t\tcolor: red;\n\t}\n\n<\/style><\/p>\n<form method=\"post\" action=\"http:\/\/www.republiklabs.com\/sendstudionx\/form.php?form=5\" id=\"frmSS5\" onSubmit=\"return CheckForm5(this);\">\n    <table cellpadding=\"2\" border=\"0\" width=\"263\" height=\"61\" class=\"myForm\">\n        <input type=\"hidden\" name=\"format\" value=\"h\" \/>\n        <tbody>\n            <tr>\n                <td width=\"170\"><input type=\"text\" size=\"30\" class=\"p\" name=\"email\" \/><\/td>\n                <td align=\"center\" width=\"79\" valign=\"middle\"><input align=\"middle\" type=\"image\" src=\"http:\/\/kommonwealth.redwerks.org\/eckharttolle\/file\/image\/hash\/a27f01c79beb3db38d2712b2533d9113ca049264\" value=\"Subscribe\" class=\"m\" \/><\/td>\n            <\/tr>\n            <tr>\n            <\/tr>\n        <\/tbody>\n    <\/table>\n<\/form>\n<script language=\"javascript\">\n\n\t\t\tfunction CheckMultiple5(frm, name) {\n\t\t\t\tfor (var i=0; i < frm.length; i++)\n\t\t\t\t{\n\t\t\t\t\tfldObj = frm.elements[i];\n\t\t\t\t\tfldId = fldObj.id;\n\t\t\t\t\tif (fldId) {\n\t\t\t\t\t\tvar fieldnamecheck=fldObj.id.indexOf(name);\n\t\t\t\t\t\tif (fieldnamecheck != -1) {\n\t\t\t\t\t\t\tif (fldObj.checked) {\n\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t}\n\t\tfunction CheckForm5(f) {\n\t\t\tif (f.email.value == \"\") {\n\t\t\t\talert(\"Please enter your email address.\");\n\t\t\t\tf.email.focus();\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\n\t\t\t\treturn true;\n\t\t\t};\n\t\t\n<\/script>","height":"24px","left":"34px","position":"relative","top":"0px","width":"193px"};
	Jit.get('4e35d205215a4').state.persistent.state = {"alias":"publishers","float":"left","href":"home\/books\/publishers","image":"e11b40e4215a4","padding-right":"35px","rollover":"f7f95fe4215a4","selected":"f7f95fe4215a4"};
	Jit.get('d60a60b7215a4').state.persistent.state = {"alias":"recommended","float":"left","href":"home\/books\/recommendedreading","image":"8ecaa096215a4","margin-right":"35px","rollover":"b7c81b08215a4","selected":"b7c81b08215a4"};
	Jit.get('f5ed6b95215a4').state.persistent.state = {"alias":"large print","float":"left","href":"home\/books\/largeprint","image":"8d377445215a4","margin-right":"35px","rollover":"229dcc46215a4","selected":"229dcc46215a4"};

}
with(phi.classes)
{
	(function() {
/** DYNAMIC **/
with(phi.classes) with(phi.frame) {var me = this;

var editing;
var $baseGallery;
var $baseView;
var $active;
this.onLoad = function() {
	$baseGallery = me.$('list').removeAttr("id").detach();
	$baseView = $(pf.id(me, 'view')).removeAttr("id").detach();
	me.state.live.set('offset', 0);
	$active = buildGallery(0).appendTo(me.node());
	function exitEdit() {
		animateTo(me.$('edit').not(':hidden'), null, 'top', 'hide');
	}
	
	var $imageInput = $('<input name=image type=hidden />');
	me.$('edit').find('.image').after($imageInput).replaceWith(phi.input.fileInput($imageInput[0]));
	var $thumbInput = $('<input name=thumb type=hidden />');
	me.$('edit').find('.thumb').after($thumbInput).replaceWith(phi.input.fileInput($thumbInput[0]));
	me.$('edit').find('input[name=rolloverbackground], input[name=rollovercolor]').each(function() {
		phi.input.textToColor(this);
	});
	me.$('edit').append(
		$('<a>Save</a>').click(function(e) {
			var event = {};
			me.$('edit').find('input, textarea').filter('[name]').each(function() {
				event[$(this).attr('name')] = $(this).val();
			});
			var list = JSON.parse(me.state.persistent.get('data', '[]'));
			if ( typeof editing == 'number' && editing in list )
				list[editing] = event;
			else
				list.push( event );
			me.state.persistent.set('data', JSON.stringify(list));
			editing = false;
			exitEdit();buildGallery(state.get('offset')).appendTo(me.node())
		}),
		$('<a>Cancel</a>').click(function(e) {
			exitEdit();
		})
	);
	/*$('<a class="allevents"><img src="'+phi.config.rootpath+'img/eck/img.all.events.arrow.gif" width=226 height=48 alt="All events" /></a>').css({float: 'right'}).click(function(e) {
		me.close();
	}).prependTo($(pf.id(me, 'view')).find('.content'));*/
	
	phi.signal.register({type: 'EditMode'}, this);
	this.onEditMode({type: 'EditMode', mode: phi.edit._mode});
};

function animateTo(node, from, to, then) {
	if ( typeof then === 'string' ) {
		var param = then;
		then = function() {
			$(this)[param]();
		};
	}
	if ( !then ) then = function() {};
	var a = {};
	var b = {};
	if ( from === 'top' ) a.top = -$(me.node()).innerHeight();
	if ( from === 'bottom' ) a.top = $(me.node()).innerHeight();
	if ( from === 'left' ) a.left = -$(me.node()).innerWidth();
	if ( from === 'right' ) a.left = $(me.node()).innerWidth();
	if ( from === 'view' ) { a.top = 0; a.left = 0; }
	if ( to === 'top' ) b.top = -$(me.node()).innerHeight();
	if ( to === 'bottom' ) b.top = $(me.node()).innerHeight();
	if ( to === 'left' ) b.left = -$(me.node()).innerWidth();
	if ( to === 'right' ) b.left = $(me.node()).innerWidth();
	if ( to === 'view' ) { b.top = 0; b.left = 0; }
	$(node).css(a).animate(b, {complete: then});
}

function buildGallery(offset) {
	var $gallery = $baseGallery.clone();
	var list = JSON.parse(me.state.persistent.get('data', '[]'));
	
	var $li = $gallery.find('ul li').each(function(i) {
		var book = list[offset+i];
		if ( !book ) return;
		$(this).attr('data-book', offset+i);
		$(this).find('.title').text(book.title);
		$(this).find('.cover').css({backgroundImage: 'url('+phi.fileURL({uid: book.thumb || book.image})+')'});
		$(this).find('.rollover').text(book.summary).css({
			backgroundColor: book.rolloverbackground,
			color: book.rollovercolor
		});
		$(this).click(function(e) {
			animateTo($gallery, null, 'top', 'remove');
			animateTo($active = buildView(offset+i).appendTo(me.node()), 'bottom', 'view');
		});
	});
	
	var edit = phi.edit._mode !== 'edit' && phi.edit._mode !== 'design';
	if ( $li.length > list.length-!!edit && !offset ) {
		$gallery.find('.prev').remove();
		$gallery.find('.next').remove();
	} else {
		$gallery.find('.prev').click(function(e) {
			var off = offset-$li.length;
			//if ( off < 0 ) off = list.length + off + $li.length*!edit;
			//if ( off > list.length-!!edit ) off = 0;
			if ( off < 0 ) while( off < list.length-$li.length+!edit ) off += $li.length;
			me.state.live.set('offset', off);
			animateTo($gallery, null, 'right', 'remove');
			animateTo($active = buildGallery(off).appendTo(me.node()), 'left', 'view');
		});
		$gallery.find('.next').click(function(e) {
			var off = offset+$li.length;
			if ( off > list.length-!!edit ) off = 0;
			me.state.live.set('offset', off);
			animateTo($gallery, null, 'left', 'remove');
			animateTo($active = buildGallery(off).appendTo(me.node()), 'right', 'view');
		});
	}
	
	galleryMakeEditable($gallery);
	
	return $gallery;
}

function galleryMakeEditable(gallery) {
	if ( phi.edit._mode !== 'edit' && phi.edit._mode !== 'design' ) return;
	var $gallery = $(gallery);
	
	$gallery.find('ul li').each(function() {
		var bookid = $(this).attr('data-book');
		var $cover = $(this).find('.cover');
		if ( bookid === undefined ) {
			$('<img class=add src="'+phi.config.rootpath+'img/eck/add-circle.png" alt=add title="Add book" width=25 height=25 />')
				.click(function(e) {
					e.stopPropagation();
					me.edit();
				}).appendTo($cover);
		} else {
			$('<img class=edit src="'+phi.config.rootpath+'img/eck/edit-circle.png" alt=edit title="Edit book" width=25 height=25 />')
				.click(function(e) {
					e.stopPropagation();
					me.edit(bookid);
				}).appendTo($cover);
			$('<img class=delete src="'+phi.config.rootpath+'img/eck/delete-circle.png" alt=delete title="Delete book" width=25 height=25 />')
				.click(function(e) {
					e.stopPropagation();
					me.deleteBook(bookid);
				}).appendTo($cover);
		}
	});
}

function buildView(i) {
	var $view = $baseView.clone();
	var list = JSON.parse(me.state.persistent.get('data', '[]'));
	var book = list[i];
	
	$view.find('.back').click(function(e) {
		animateTo($view, null, 'bottom', 'remove');
		animateTo($active = buildGallery(me.state.live.get('offset')).appendTo(me.node()), 'top', 'view');
	});
	$view.find(':header').text(book.title);
	$view.find('.description').html(book.description);
	if ( book.comments )
		$view.find('.comments').attr({href: book.comments});
	else
		$view.find('.comments').remove();
	$view.find('.reviews').attr({href: book.reviews});
	$view.find('.buy').attr({href: book.buy});
	$view.find('.read').click(function(e) {
		$('<iframe/>').attr({src: book.read}).css({height: $(window).height() * .9, width: Math.min($(window).width()*.9, 1000)}).infobox();
	});
	$view.find('.cover').attr({src: phi.fileURL({uid: book.image})});
	$view.find('.prev').click(function(e) {
		var prev = i-1;
		if ( prev < 0 ) prev = list.length-1;
		animateTo($active, null, 'right', 'remove');
		animateTo($active = buildView(prev).appendTo(me.node()), 'left', 'view');
	});
	$view.find('.next').click(function(e) {
		var next = i+1;
		if ( next >= list.length ) next = 0;
		animateTo($active, null, 'left', 'remove');
		animateTo($active = buildView(next).appendTo(me.node()), 'right', 'view');
	});
	/*$gallery.find('ul li').each(function(i) {
		var book = list[offset+i];
		if ( !book ) return;
		$(this).attr('data-book', offset+i);
		$(this).find('.title').text(book.title);
		$(this).find('.cover').css({backgroundImage: 'url('+phi.config.serverpath+'file.php?site='+phi.config.site.uid+'&id='+book.image+')'});
		$(this).find('.rollover').text(book.summary).css({
			backgroundColor: book.rolloverbackground,
			color: book.rollovercolor
		});
		$(this).click(function(e) {
			animateTo($gallery, null, 'top', 'remove');
		});
	});*/
	
	return $view;
}

this.onStateChange = function(state, changed) {
	if( state !== me.state.persistent ) return;
	if ( 'data' in changed ) {
		$active = buildGallery(me.state.live.get('offset')).replaceAll($active);
	}
	if ( 'width' in changed || 'height' in changed ) {
		me.onResize();
	}
}

this.onResize = function() {
	var o = {
		width: $(me.node()).innerWidth(),
		height: $(me.node()).innerHeight()
	};
	$(me.node()).find('> div').css(o);
	$baseGallery.css(o);
	$baseView.css(o);
};

this.onEditMode = function(o) {
	$active.find('.add, .edit, .delete').remove();
	if( o.mode == 'design' || o.mode == 'edit' ) {
		/*$('<a class=add>Add new</a>').click(function(e) {
			me.edit();
		}).prependTo(pf.id(me, 'list'));*/
		/*me.$('list').find('table tr').each(function() {
			var $td = $('<td class=edit />').prependTo(this);
			var index = $(this).attr('data-index');
			if ( index ) {
				$('<a>edit</a>').click(function(e) {
					me.edit(parseInt(index,10));
				}).appendTo($td);
				$('<a>delete</a>').click(function(e) {
					me.deleteEvent(parseInt(index,10));
				}).appendTo($td);
			}
		});*/
		if ( $active.hasClass('list') )
			$active = buildGallery(me.state.live.get('offset')).replaceAll($active); //galleryMakeEditable($active);
	}
};

this.edit = function(i) {
	if ( typeof i === 'string' ) i = parseInt(i, 10);
	editing = i;
	me.$('edit').find('input, textarea').filter('[name]').val('');
	if ( typeof i === 'number' ) {
		var event = JSON.parse(me.state.persistent.get('data', '[]'))[i];
		me.$('edit').find('input, textarea').filter('[name]').each(function() {
			var name = $(this).attr('name');
			if ( name in event )
				$(this).val( event[name] );
		});
		me.$('edit').find('.phi-input-file')[0].setValue( event.image );
	}
	
	animateTo(me.$('edit').css({zIndex: 10}).show(), 'top', 'view');
};

this.deleteBook = function(i) {
	phi.msg.confirm("Are you sure you wish to delete this book?", function() {
		var books = JSON.parse(me.state.persistent.get('data', '[]'));
		books.splice(i, 1);
		me.state.persistent.set('data', JSON.stringify(books));
	});
}

this.open = function(i) {
	var event = JSON.parse(me.state.persistent.get('data', '[]'))[i];
	var date = $.datepicker.parseDate('yy-mm-dd', event.date);
	
	var v = me.$('view');
	
	v.find(':header').text(event.title);
	v.find('.summary').html(event.summary);
	v.find('.description').html(event.description);
	v.find('.date div').text($.datepicker.formatDate('DD MM d, yy', date) + ' ' + event.dateinfo);
	v.find('.location div').text(event.location);
	v.find('.tickets div').text(event.ticketnotes);
	v.find('.buytickets').attr({href: event.tickets});
	v.find('.whattobring').unbind('click').click(function(e) {
		$('<div/>').html(event.whattobring).infobox();
	});
	
	me.$('list').css({
		left: 0,
		zIndex: 0
	}).animate({left: -$(me.node()).innerWidth()});
	me.$('view').css({
		left: $(me.node()).innerWidth(),
		zIndex: 5
	}).show().animate({left: 0});
};

this.close = function() {
	me.$('view').css({
		left: 0,
		zIndex: 5
	}).animate({left: $(me.node()).innerWidth()});
	me.$('list').css({
		left: -$(me.node()).innerWidth(),
		zIndex: 0
	}).animate({left: 0});
};

}
/** End/DYNAMIC **/
	}).apply(Jit.get('771e9ffc194a4'), []);
}
/*]]>*/

with(phi.classes)
{
	(function() {
/** DYNAMIC **/
with(phi.classes) with(phi.frame) {var me = this;

this.canHaveChildren = function() { return true };

this.onLoad = function() {
	this.onEditMode({type: 'EditMode', mode: phi.edit._mode});
};

this.buttons = [];
phi.signal.register({type: 'EditMode'}, this);
this.onEditMode = function(o) {
	if( o.mode == 'design' ) {
		$(me.node()).mouseover(me.mouseover).mouseout(me.mouseout);
	} else {
		$(me.buttons).remove();
		me.buttons = [];
		$(me.node()).unbind('mouseover', me.mouseover).unbind('mouseout', me.mouseout);
	}
};

this.mouseover = function(e) {
	if( !me.buttons.length ) {
		me.buttons = $('<div class=phi-buttonbuttons>').appendTo('body')
			.append(
				$('<img src="'+phi.config.rootpath+'img/ui/edit/button/mini-options.png" class=phi-imageoptions alt=options title="Options" />')
					.click(function(e) { e.preventDefault(); $(me.node()).phiPopup(me.openOptions); })
			).get();
	}
	
	var off = $(me.node()).offset();
	$(me.buttons).css({
		position: 'absolute',
		top: off.top + 3 - $('body').offset().top,
		left: off.left + $(me.node()).outerWidth() - 13*3/*$(me.buttons).outerWidth()*/ - 3,
		zIndex: 99999
	});
};

this.mouseout = function(e) {
	var o = $(me.node()).offset();
	o.right = o.left + $(me.node()).outerWidth();
	o.bottom = o.top + $(me.node()).outerHeight();
	if( e.pageX > o.left && e.pageY > o.top && e.pageX < o.right && e.pageY < o.bottom ) return;
	$(me.node()).find('.phi-buttonbuttons').remove();
};

this.openOptions = function() {
	$(this).append(
		'<h3>Normal state</h3>',
		$('<label>').append(
			'<span>Image</span>',
			phi.input.fileInput(me.state.persistent.get('image'), function(file) {
				me.state.persistent.set('image', file || "");
			})
		),
		'<h3>Rollover (mouse hover)</h3>',
		$('<label>').append(
			'<span>Rollover image</span>',
			phi.input.fileInput(me.state.persistent.get('rollover'), function(file) {
				me.state.persistent.set('rollover', file || "");
			})
		),
		'<h3>Selected state & Linking</h3>',
		$('<label>').append(
			'<span>Selected state image</span>',
			phi.input.fileInput(me.state.persistent.get('selected'), function(file) {
				me.state.persistent.set('selected', file || "");
			})
		),
		$('<label>').append(
			'<span>Link to:</span>',
			$('<input type=text name=href />').val(me.state.persistent.get('href', ""))
				.catchChanges({
					change: function(e) {
						me.state.persistent.set('href', $(this).val());
						me.refresh();
					}
				})
		)
	);
};

this.onStateChange = function(state, changed) {
	if( state !== me.state.persistent ) return;
	if( 'href' in changed ) {
		$(me.node()).attr('href', state.get('href'));
	}
	if( 'image' in changed || 'rollover' in changed || 'selected' in changed ) {
		setTimeout(function() { me.refresh(); }, 500);
	}
};
}
/** End/DYNAMIC **/
	}).apply(Jit.get('d18d7341d34a4'), []);
}
/*]]>*/

with(phi.classes)
{
	(function() {
/** DYNAMIC **/
with(phi.classes) with(phi.frame) {var me = this;

this.canHaveChildren = function() { return true };

this.onLoad = function() {
	this.onEditMode({type: 'EditMode', mode: phi.edit._mode});
};

this.buttons = [];
phi.signal.register({type: 'EditMode'}, this);
this.onEditMode = function(o) {
	if( o.mode == 'design' ) {
		$(me.node()).mouseover(me.mouseover).mouseout(me.mouseout);
	} else {
		$(me.buttons).remove();
		me.buttons = [];
		$(me.node()).unbind('mouseover', me.mouseover).unbind('mouseout', me.mouseout);
	}
};

this.mouseover = function(e) {
	if( !me.buttons.length ) {
		me.buttons = $('<div class=phi-buttonbuttons>').appendTo('body')
			.append(
				$('<img src="'+phi.config.rootpath+'img/ui/edit/button/mini-options.png" class=phi-imageoptions alt=options title="Options" />')
					.click(function(e) { e.preventDefault(); $(me.node()).phiPopup(me.openOptions); })
			).get();
	}
	
	var off = $(me.node()).offset();
	$(me.buttons).css({
		position: 'absolute',
		top: off.top + 3 - $('body').offset().top,
		left: off.left + $(me.node()).outerWidth() - 13*3/*$(me.buttons).outerWidth()*/ - 3,
		zIndex: 99999
	});
};

this.mouseout = function(e) {
	var o = $(me.node()).offset();
	o.right = o.left + $(me.node()).outerWidth();
	o.bottom = o.top + $(me.node()).outerHeight();
	if( e.pageX > o.left && e.pageY > o.top && e.pageX < o.right && e.pageY < o.bottom ) return;
	$(me.node()).find('.phi-buttonbuttons').remove();
};

this.openOptions = function() {
	$(this).append(
		'<h3>Normal state</h3>',
		$('<label>').append(
			'<span>Image</span>',
			phi.input.fileInput(me.state.persistent.get('image'), function(file) {
				me.state.persistent.set('image', file || "");
			})
		),
		'<h3>Rollover (mouse hover)</h3>',
		$('<label>').append(
			'<span>Rollover image</span>',
			phi.input.fileInput(me.state.persistent.get('rollover'), function(file) {
				me.state.persistent.set('rollover', file || "");
			})
		),
		'<h3>Selected state & Linking</h3>',
		$('<label>').append(
			'<span>Selected state image</span>',
			phi.input.fileInput(me.state.persistent.get('selected'), function(file) {
				me.state.persistent.set('selected', file || "");
			})
		),
		$('<label>').append(
			'<span>Link to:</span>',
			$('<input type=text name=href />').val(me.state.persistent.get('href', ""))
				.catchChanges({
					change: function(e) {
						me.state.persistent.set('href', $(this).val());
						me.refresh();
					}
				})
		)
	);
};

this.onStateChange = function(state, changed) {
	if( state !== me.state.persistent ) return;
	if( 'href' in changed ) {
		$(me.node()).attr('href', state.get('href'));
	}
	if( 'image' in changed || 'rollover' in changed || 'selected' in changed ) {
		setTimeout(function() { me.refresh(); }, 500);
	}
};
}
/** End/DYNAMIC **/
	}).apply(Jit.get('105bd57df34a4'), []);
}
/*]]>*/

with(phi.classes)
{
	(function() {
/** DYNAMIC **/
with(phi.classes) with(phi.frame) {var me = this;

this.canHaveChildren = function() { return true };

this.onLoad = function() {
	this.onEditMode({type: 'EditMode', mode: phi.edit._mode});
};

this.buttons = [];
phi.signal.register({type: 'EditMode'}, this);
this.onEditMode = function(o) {
	if( o.mode == 'design' ) {
		$(me.node()).mouseover(me.mouseover).mouseout(me.mouseout);
	} else {
		$(me.buttons).remove();
		me.buttons = [];
		$(me.node()).unbind('mouseover', me.mouseover).unbind('mouseout', me.mouseout);
	}
};

this.mouseover = function(e) {
	if( !me.buttons.length ) {
		me.buttons = $('<div class=phi-buttonbuttons>').appendTo('body')
			.append(
				$('<img src="'+phi.config.rootpath+'img/ui/edit/button/mini-options.png" class=phi-imageoptions alt=options title="Options" />')
					.click(function(e) { e.preventDefault(); $(me.node()).phiPopup(me.openOptions); })
			).get();
	}
	
	var off = $(me.node()).offset();
	$(me.buttons).css({
		position: 'absolute',
		top: off.top + 3 - $('body').offset().top,
		left: off.left + $(me.node()).outerWidth() - 13*3/*$(me.buttons).outerWidth()*/ - 3,
		zIndex: 99999
	});
};

this.mouseout = function(e) {
	var o = $(me.node()).offset();
	o.right = o.left + $(me.node()).outerWidth();
	o.bottom = o.top + $(me.node()).outerHeight();
	if( e.pageX > o.left && e.pageY > o.top && e.pageX < o.right && e.pageY < o.bottom ) return;
	$(me.node()).find('.phi-buttonbuttons').remove();
};

this.openOptions = function() {
	$(this).append(
		'<h3>Normal state</h3>',
		$('<label>').append(
			'<span>Image</span>',
			phi.input.fileInput(me.state.persistent.get('image'), function(file) {
				me.state.persistent.set('image', file || "");
			})
		),
		'<h3>Rollover (mouse hover)</h3>',
		$('<label>').append(
			'<span>Rollover image</span>',
			phi.input.fileInput(me.state.persistent.get('rollover'), function(file) {
				me.state.persistent.set('rollover', file || "");
			})
		),
		'<h3>Selected state & Linking</h3>',
		$('<label>').append(
			'<span>Selected state image</span>',
			phi.input.fileInput(me.state.persistent.get('selected'), function(file) {
				me.state.persistent.set('selected', file || "");
			})
		),
		$('<label>').append(
			'<span>Link to:</span>',
			$('<input type=text name=href />').val(me.state.persistent.get('href', ""))
				.catchChanges({
					change: function(e) {
						me.state.persistent.set('href', $(this).val());
						me.refresh();
					}
				})
		)
	);
};

this.onStateChange = function(state, changed) {
	if( state !== me.state.persistent ) return;
	if( 'href' in changed ) {
		$(me.node()).attr('href', state.get('href'));
	}
	if( 'image' in changed || 'rollover' in changed || 'selected' in changed ) {
		setTimeout(function() { me.refresh(); }, 500);
	}
};
}
/** End/DYNAMIC **/
	}).apply(Jit.get('15cb2dcdf34a4'), []);
}
/*]]>*/

with(phi.classes)
{
	(function() {
/** DYNAMIC **/
with(phi.classes) with(phi.frame) {var me = this;

this.canHaveChildren = function() { return true };

this.onLoad = function() {
	this.onEditMode({type: 'EditMode', mode: phi.edit._mode});
};

this.buttons = [];
phi.signal.register({type: 'EditMode'}, this);
this.onEditMode = function(o) {
	if( o.mode == 'design' ) {
		$(me.node()).mouseover(me.mouseover).mouseout(me.mouseout);
	} else {
		$(me.buttons).remove();
		me.buttons = [];
		$(me.node()).unbind('mouseover', me.mouseover).unbind('mouseout', me.mouseout);
	}
};

this.mouseover = function(e) {
	if( !me.buttons.length ) {
		me.buttons = $('<div class=phi-buttonbuttons>').appendTo('body')
			.append(
				$('<img src="'+phi.config.rootpath+'img/ui/edit/button/mini-options.png" class=phi-imageoptions alt=options title="Options" />')
					.click(function(e) { e.preventDefault(); $(me.node()).phiPopup(me.openOptions); })
			).get();
	}
	
	var off = $(me.node()).offset();
	$(me.buttons).css({
		position: 'absolute',
		top: off.top + 3 - $('body').offset().top,
		left: off.left + $(me.node()).outerWidth() - 13*3/*$(me.buttons).outerWidth()*/ - 3,
		zIndex: 99999
	});
};

this.mouseout = function(e) {
	var o = $(me.node()).offset();
	o.right = o.left + $(me.node()).outerWidth();
	o.bottom = o.top + $(me.node()).outerHeight();
	if( e.pageX > o.left && e.pageY > o.top && e.pageX < o.right && e.pageY < o.bottom ) return;
	$(me.node()).find('.phi-buttonbuttons').remove();
};

this.openOptions = function() {
	$(this).append(
		'<h3>Normal state</h3>',
		$('<label>').append(
			'<span>Image</span>',
			phi.input.fileInput(me.state.persistent.get('image'), function(file) {
				me.state.persistent.set('image', file || "");
			})
		),
		'<h3>Rollover (mouse hover)</h3>',
		$('<label>').append(
			'<span>Rollover image</span>',
			phi.input.fileInput(me.state.persistent.get('rollover'), function(file) {
				me.state.persistent.set('rollover', file || "");
			})
		),
		'<h3>Selected state & Linking</h3>',
		$('<label>').append(
			'<span>Selected state image</span>',
			phi.input.fileInput(me.state.persistent.get('selected'), function(file) {
				me.state.persistent.set('selected', file || "");
			})
		),
		$('<label>').append(
			'<span>Link to:</span>',
			$('<input type=text name=href />').val(me.state.persistent.get('href', ""))
				.catchChanges({
					change: function(e) {
						me.state.persistent.set('href', $(this).val());
						me.refresh();
					}
				})
		)
	);
};

this.onStateChange = function(state, changed) {
	if( state !== me.state.persistent ) return;
	if( 'href' in changed ) {
		$(me.node()).attr('href', state.get('href'));
	}
	if( 'image' in changed || 'rollover' in changed || 'selected' in changed ) {
		setTimeout(function() { me.refresh(); }, 500);
	}
};
}
/** End/DYNAMIC **/
	}).apply(Jit.get('2d3e1aaef34a4'), []);
}
/*]]>*/

with(phi.classes)
{
	(function() {
/** DYNAMIC **/
with(phi.classes) with(phi.frame) {var me = this;

this.canHaveChildren = function() { return true };

this.onLoad = function() {
	this.onEditMode({type: 'EditMode', mode: phi.edit._mode});
};

this.buttons = [];
phi.signal.register({type: 'EditMode'}, this);
this.onEditMode = function(o) {
	if( o.mode == 'design' ) {
		$(me.node()).mouseover(me.mouseover).mouseout(me.mouseout);
	} else {
		$(me.buttons).remove();
		me.buttons = [];
		$(me.node()).unbind('mouseover', me.mouseover).unbind('mouseout', me.mouseout);
	}
};

this.mouseover = function(e) {
	if( !me.buttons.length ) {
		me.buttons = $('<div class=phi-buttonbuttons>').appendTo('body')
			.append(
				$('<img src="'+phi.config.rootpath+'img/ui/edit/button/mini-options.png" class=phi-imageoptions alt=options title="Options" />')
					.click(function(e) { e.preventDefault(); $(me.node()).phiPopup(me.openOptions); })
			).get();
	}
	
	var off = $(me.node()).offset();
	$(me.buttons).css({
		position: 'absolute',
		top: off.top + 3 - $('body').offset().top,
		left: off.left + $(me.node()).outerWidth() - 13*3/*$(me.buttons).outerWidth()*/ - 3,
		zIndex: 99999
	});
};

this.mouseout = function(e) {
	var o = $(me.node()).offset();
	o.right = o.left + $(me.node()).outerWidth();
	o.bottom = o.top + $(me.node()).outerHeight();
	if( e.pageX > o.left && e.pageY > o.top && e.pageX < o.right && e.pageY < o.bottom ) return;
	$(me.node()).find('.phi-buttonbuttons').remove();
};

this.openOptions = function() {
	$(this).append(
		'<h3>Normal state</h3>',
		$('<label>').append(
			'<span>Image</span>',
			phi.input.fileInput(me.state.persistent.get('image'), function(file) {
				me.state.persistent.set('image', file || "");
			})
		),
		'<h3>Rollover (mouse hover)</h3>',
		$('<label>').append(
			'<span>Rollover image</span>',
			phi.input.fileInput(me.state.persistent.get('rollover'), function(file) {
				me.state.persistent.set('rollover', file || "");
			})
		),
		'<h3>Selected state & Linking</h3>',
		$('<label>').append(
			'<span>Selected state image</span>',
			phi.input.fileInput(me.state.persistent.get('selected'), function(file) {
				me.state.persistent.set('selected', file || "");
			})
		),
		$('<label>').append(
			'<span>Link to:</span>',
			$('<input type=text name=href />').val(me.state.persistent.get('href', ""))
				.catchChanges({
					change: function(e) {
						me.state.persistent.set('href', $(this).val());
						me.refresh();
					}
				})
		)
	);
};

this.onStateChange = function(state, changed) {
	if( state !== me.state.persistent ) return;
	if( 'href' in changed ) {
		$(me.node()).attr('href', state.get('href'));
	}
	if( 'image' in changed || 'rollover' in changed || 'selected' in changed ) {
		setTimeout(function() { me.refresh(); }, 500);
	}
};
}
/** End/DYNAMIC **/
	}).apply(Jit.get('42f2f029f34a4'), []);
}
/*]]>*/

with(phi.classes)
{
	(function() {
/** DYNAMIC **/
with(phi.classes) with(phi.frame) {var me = this;

this.canHaveChildren = function() { return true };

this.onLoad = function() {
	this.onEditMode({type: 'EditMode', mode: phi.edit._mode});
};

this.buttons = [];
phi.signal.register({type: 'EditMode'}, this);
this.onEditMode = function(o) {
	if( o.mode == 'design' ) {
		$(me.node()).mouseover(me.mouseover).mouseout(me.mouseout);
	} else {
		$(me.buttons).remove();
		me.buttons = [];
		$(me.node()).unbind('mouseover', me.mouseover).unbind('mouseout', me.mouseout);
	}
};

this.mouseover = function(e) {
	if( !me.buttons.length ) {
		me.buttons = $('<div class=phi-buttonbuttons>').appendTo('body')
			.append(
				$('<img src="'+phi.config.rootpath+'img/ui/edit/button/mini-options.png" class=phi-imageoptions alt=options title="Options" />')
					.click(function(e) { e.preventDefault(); $(me.node()).phiPopup(me.openOptions); })
			).get();
	}
	
	var off = $(me.node()).offset();
	$(me.buttons).css({
		position: 'absolute',
		top: off.top + 3 - $('body').offset().top,
		left: off.left + $(me.node()).outerWidth() - 13*3/*$(me.buttons).outerWidth()*/ - 3,
		zIndex: 99999
	});
};

this.mouseout = function(e) {
	var o = $(me.node()).offset();
	o.right = o.left + $(me.node()).outerWidth();
	o.bottom = o.top + $(me.node()).outerHeight();
	if( e.pageX > o.left && e.pageY > o.top && e.pageX < o.right && e.pageY < o.bottom ) return;
	$(me.node()).find('.phi-buttonbuttons').remove();
};

this.openOptions = function() {
	$(this).append(
		'<h3>Normal state</h3>',
		$('<label>').append(
			'<span>Image</span>',
			phi.input.fileInput(me.state.persistent.get('image'), function(file) {
				me.state.persistent.set('image', file || "");
			})
		),
		'<h3>Rollover (mouse hover)</h3>',
		$('<label>').append(
			'<span>Rollover image</span>',
			phi.input.fileInput(me.state.persistent.get('rollover'), function(file) {
				me.state.persistent.set('rollover', file || "");
			})
		),
		'<h3>Selected state & Linking</h3>',
		$('<label>').append(
			'<span>Selected state image</span>',
			phi.input.fileInput(me.state.persistent.get('selected'), function(file) {
				me.state.persistent.set('selected', file || "");
			})
		),
		$('<label>').append(
			'<span>Link to:</span>',
			$('<input type=text name=href />').val(me.state.persistent.get('href', ""))
				.catchChanges({
					change: function(e) {
						me.state.persistent.set('href', $(this).val());
						me.refresh();
					}
				})
		)
	);
};

this.onStateChange = function(state, changed) {
	if( state !== me.state.persistent ) return;
	if( 'href' in changed ) {
		$(me.node()).attr('href', state.get('href'));
	}
	if( 'image' in changed || 'rollover' in changed || 'selected' in changed ) {
		setTimeout(function() { me.refresh(); }, 500);
	}
};
}
/** End/DYNAMIC **/
	}).apply(Jit.get('56bb6c1df34a4'), []);
}
/*]]>*/

with(phi.classes)
{
	(function() {
/** DYNAMIC **/
with(phi.classes) with(phi.frame) {var me = this;

var href;
this.onLoad = function() {
	this.onEditMode({type: 'EditMode', mode: phi.edit._mode});
	
	$(me.node()).click(function() {
		if(me.state.persistent.get('lightbox')) {
			if(phi.lightimage && phi.lightimage.uid == me.uid()) return;
			if(phi.lightimage) phi.lightimage.close();
			function close() {
				delete phi.lightimage;
				var off = $(img).offset();
				$(zoom).animate({
					top: off.top, left: off.left,
					width: $(img).innerWidth(),
					height: $(img).innerHeight()
				}, {complete: function() {$(this).remove();}});
			}
			phi.lightimage = {
				uid: me.uid(),
				close: close
			};
			
			var img = this;
			var zoom;
			var off = $(img).offset();
			var tag = $('<img/>')
				.attr({alt:img.alt, src: phi.fileURL({uid: me.state.persistent.get('file')})})
				.css({
					position: 'absolute',
					top: off.top, left: off.left,
					width: $(img).innerWidth(),
					height: $(img).innerHeight()
				})
				.appendTo('body').hide();
			
			phi.fileinfo(me.state.persistent.get('file'), function(f) {
				var win = { w: $(window).width(), h: $(window).height() };
				var max = { w: win.w-100, h: win.h-100 };
				var size = { w: f.width, h: f.height };
				if( size.w > max.w || size.h > max.h ) {
					var wratio = max.w/size.w, hratio = max.h/size.h;
					var ratio = Math.min(wratio, hratio);
					size.w = size.w*ratio;
					size.h = size.h*ratio;
				}
				zoom = tag.show().animate({
					top: win.h/2-size.h/2,
					left: win.w/2-size.w/2,
					height: size.h,
					width: size.w
				}).click(close);
			});
		} else if(href = me.state.persistent.get('href')) window.location = href;
	});
};

this.buttons = [];

phi.signal.register({type: 'EditMode'}, this);
this.onEditMode = function(o) {
	if( o.mode == 'design' ) {
		$(me.node()).mouseover(me.mouseover).mouseout(me.mouseout);
	} else {
		$(me.buttons).remove();
		me.buttons = [];
		$(me.node()).unbind('mouseover', me.mouseover).unbind('mouseout', me.mouseout);
	}
};

this.mouseover = function(e) {
	if( !me.buttons.length ) {
		me.buttons = $('<div class=phi-imagebuttons>').appendTo('body')
			.append(
				$('<img src="'+phi.config.rootpath+'img/ui/edit/button/mini-options.png" class=phi-imageoptions alt=options title="Options" />')
					.click(function() { e.preventDefault();$(me.node()).phiPopup(me.openOptions); }),
				$('<img src="'+phi.config.rootpath+'img/ui/edit/button/mini-edit.png" class=phi-imageedit alt=edit title="Change image" />')
					.click(function() { e.preventDefault();
						phi.input.file(function(file)
						{
							me.state.persistent.set('file', file);
							me.refresh();
						});
					})
			).get();
	}
	
	var off = $(me.node()).offset();
	$(me.buttons).css({
		position: 'absolute',
		top: off.top + 3 - $('body').offset().top,
		left: off.left + $(me.node()).outerWidth() - 13*3/*$(me.buttons).outerWidth()*/ - 3,
		zIndex: 99999
	});
};

this.mouseout = function(e) {
	var o = $(me.node()).offset();
	o.right = o.left + $(me.node()).outerWidth();
	o.bottom = o.top + $(me.node()).outerHeight();
	if( e.pageX > o.left && e.pageY > o.top && e.pageX < o.right && e.pageY < o.bottom ) return;
	$(me.buttons).remove();
	me.buttons = [];
};

this.openOptions = function() {
	$(this).append(
		$('<label>').append(
			$('<input type=checkbox name=height value=on />').val(me.state.persistent.get('lightbox', ""))
				.change(function(e) {
					me.state.persistent.set('lightbox', this.checked ? 'on' : '');
				}),
			'<span>Use lightbox</span>'
		),
		'or',
		$('<label>').append(
			'<span>Link to:</span>',
			$('<input type=text name=href />').val(me.state.persistent.get('href', ""))
				.catchChanges({
					change: function(e) {
						me.state.persistent.set('href', $(this).val());
						me.refresh();
					}
				})
		)
	);
};

}
/** End/DYNAMIC **/
	}).apply(Jit.get('928fe7d0044a4'), []);
}
/*]]>*/

with(phi.classes)
{
	(function() {
/** DYNAMIC **/
with(phi.classes) with(phi.frame) {var me = this;

this.canHaveChildren = function() { return true };

this.onLoad = function() {
	this.onEditMode({type: 'EditMode', mode: phi.edit._mode});
};

this.buttons = [];
phi.signal.register({type: 'EditMode'}, this);
this.onEditMode = function(o) {
	if( o.mode == 'design' ) {
		$(me.node()).mouseover(me.mouseover).mouseout(me.mouseout);
	} else {
		$(me.buttons).remove();
		me.buttons = [];
		$(me.node()).unbind('mouseover', me.mouseover).unbind('mouseout', me.mouseout);
	}
};

this.mouseover = function(e) {
	if( !me.buttons.length ) {
		me.buttons = $('<div class=phi-buttonbuttons>').appendTo('body')
			.append(
				$('<img src="'+phi.config.rootpath+'img/ui/edit/button/mini-options.png" class=phi-imageoptions alt=options title="Options" />')
					.click(function(e) { e.preventDefault(); $(me.node()).phiPopup(me.openOptions); })
			).get();
	}
	
	var off = $(me.node()).offset();
	$(me.buttons).css({
		position: 'absolute',
		top: off.top + 3 - $('body').offset().top,
		left: off.left + $(me.node()).outerWidth() - 13*3/*$(me.buttons).outerWidth()*/ - 3,
		zIndex: 99999
	});
};

this.mouseout = function(e) {
	var o = $(me.node()).offset();
	o.right = o.left + $(me.node()).outerWidth();
	o.bottom = o.top + $(me.node()).outerHeight();
	if( e.pageX > o.left && e.pageY > o.top && e.pageX < o.right && e.pageY < o.bottom ) return;
	$(me.node()).find('.phi-buttonbuttons').remove();
};

this.openOptions = function() {
	$(this).append(
		'<h3>Normal state</h3>',
		$('<label>').append(
			'<span>Image</span>',
			phi.input.fileInput(me.state.persistent.get('image'), function(file) {
				me.state.persistent.set('image', file || "");
			})
		),
		'<h3>Rollover (mouse hover)</h3>',
		$('<label>').append(
			'<span>Rollover image</span>',
			phi.input.fileInput(me.state.persistent.get('rollover'), function(file) {
				me.state.persistent.set('rollover', file || "");
			})
		),
		'<h3>Selected state & Linking</h3>',
		$('<label>').append(
			'<span>Selected state image</span>',
			phi.input.fileInput(me.state.persistent.get('selected'), function(file) {
				me.state.persistent.set('selected', file || "");
			})
		),
		$('<label>').append(
			'<span>Link to:</span>',
			$('<input type=text name=href />').val(me.state.persistent.get('href', ""))
				.catchChanges({
					change: function(e) {
						me.state.persistent.set('href', $(this).val());
						me.refresh();
					}
				})
		)
	);
};

this.onStateChange = function(state, changed) {
	if( state !== me.state.persistent ) return;
	if( 'href' in changed ) {
		$(me.node()).attr('href', state.get('href'));
	}
	if( 'image' in changed || 'rollover' in changed || 'selected' in changed ) {
		setTimeout(function() { me.refresh(); }, 500);
	}
};
}
/** End/DYNAMIC **/
	}).apply(Jit.get('afb1765cf34a4'), []);
}
/*]]>*/

with(phi.classes)
{
	(function() {
/** DYNAMIC **/
with(phi.classes) with(phi.frame) {var me = this;

this.onLoad = function() {
	this.onEditMode({type: 'EditMode', mode: phi.edit._mode});
};

phi.signal.register({type: 'EditMode'}, this);
this.onEditMode = function(o) {
	if( o.mode == 'design' || o.mode == 'edit' ) {
		$(me.node()).mouseover(me.mouseover).mouseout(me.mouseout);
	} else {
		$(me.node()).find('.phi-textedit').remove();
		$(me.node()).unbind('mouseover', me.mouseover).unbind('mouseout', me.mouseout)
	}
};

this.mouseover = function(e) {
	var buttons = $(me.node()).find('.phi-textbuttons');
	if( !buttons.length ) {
		buttons = $('<div class=phi-textbuttons>').prependTo(me.node())
			.append(
				$('<img src="'+phi.config.rootpath+'img/ui/edit/button/mini-edit.png" class=phi-textedit alt=edit title="Edit text" />')
					.click(function(e) {
						e.preventDefault(); e.stopPropagation();
						$(this).remove();
						phi.edit.editor('text', function() { this.doEdit.call(me) });
					})
			);
	}
	
	var off = $(me.node()).position();
	buttons.css({
		position: 'absolute',
		top: off.top + 3,
		left: off.left + $(me.node()).outerWidth() - buttons.outerWidth() - 3
	});
};

this.mouseout = function(e) {
	var o = $(me.node()).offset();
	o.right = o.left + $(me.node()).outerWidth();
	o.bottom = o.top + $(me.node()).outerHeight();
	if( e.pageX > o.left && e.pageY > o.top && e.pageX < o.right && e.pageY < o.bottom ) return;
	$(me.node()).find('.phi-textbuttons').remove();
};

}
/** End/DYNAMIC **/
	}).apply(Jit.get('255c18c2046a4'), []);
}
/*]]>*/

with(phi.classes)
{
	(function() {
/** DYNAMIC **/
with(phi.classes) with(phi.frame) {var me = this;

this.onLoad = function() {
	this.onEditMode({type: 'EditMode', mode: phi.edit._mode});
};

phi.signal.register({type: 'EditMode'}, this);
this.onEditMode = function(o) {
	if( o.mode == 'design' || o.mode == 'edit' ) {
		$(me.node()).mouseover(me.mouseover).mouseout(me.mouseout);
	} else {
		$(me.node()).find('.phi-textedit').remove();
		$(me.node()).unbind('mouseover', me.mouseover).unbind('mouseout', me.mouseout)
	}
};

this.mouseover = function(e) {
	var buttons = $(me.node()).find('.phi-textbuttons');
	if( !buttons.length ) {
		buttons = $('<div class=phi-textbuttons>').prependTo(me.node())
			.append(
				$('<img src="'+phi.config.rootpath+'img/ui/edit/button/mini-edit.png" class=phi-textedit alt=edit title="Edit text" />')
					.click(function(e) {
						e.preventDefault(); e.stopPropagation();
						$(this).remove();
						phi.edit.editor('text', function() { this.doEdit.call(me) });
					})
			);
	}
	
	var off = $(me.node()).position();
	buttons.css({
		position: 'absolute',
		top: off.top + 3,
		left: off.left + $(me.node()).outerWidth() - buttons.outerWidth() - 3
	});
};

this.mouseout = function(e) {
	var o = $(me.node()).offset();
	o.right = o.left + $(me.node()).outerWidth();
	o.bottom = o.top + $(me.node()).outerHeight();
	if( e.pageX > o.left && e.pageY > o.top && e.pageX < o.right && e.pageY < o.bottom ) return;
	$(me.node()).find('.phi-textbuttons').remove();
};

}
/** End/DYNAMIC **/
	}).apply(Jit.get('30af75294d4a4'), []);
}
/*]]>*/

with(phi.classes)
{
	(function() {
/** DYNAMIC **/
with(phi.classes) with(phi.frame) {var me = this;

this.canHaveChildren = function() { return true };

this.onLoad = function() {
	this.onEditMode({type: 'EditMode', mode: phi.edit._mode});
};

this.buttons = [];
phi.signal.register({type: 'EditMode'}, this);
this.onEditMode = function(o) {
	if( o.mode == 'design' ) {
		$(me.node()).mouseover(me.mouseover).mouseout(me.mouseout);
	} else {
		$(me.buttons).remove();
		me.buttons = [];
		$(me.node()).unbind('mouseover', me.mouseover).unbind('mouseout', me.mouseout);
	}
};

this.mouseover = function(e) {
	if( !me.buttons.length ) {
		me.buttons = $('<div class=phi-buttonbuttons>').appendTo('body')
			.append(
				$('<img src="'+phi.config.rootpath+'img/ui/edit/button/mini-options.png" class=phi-imageoptions alt=options title="Options" />')
					.click(function(e) { e.preventDefault(); $(me.node()).phiPopup(me.openOptions); })
			).get();
	}
	
	var off = $(me.node()).offset();
	$(me.buttons).css({
		position: 'absolute',
		top: off.top + 3 - $('body').offset().top,
		left: off.left + $(me.node()).outerWidth() - 13*3/*$(me.buttons).outerWidth()*/ - 3,
		zIndex: 99999
	});
};

this.mouseout = function(e) {
	var o = $(me.node()).offset();
	o.right = o.left + $(me.node()).outerWidth();
	o.bottom = o.top + $(me.node()).outerHeight();
	if( e.pageX > o.left && e.pageY > o.top && e.pageX < o.right && e.pageY < o.bottom ) return;
	$(me.node()).find('.phi-buttonbuttons').remove();
};

this.openOptions = function() {
	$(this).append(
		'<h3>Normal state</h3>',
		$('<label>').append(
			'<span>Image</span>',
			phi.input.fileInput(me.state.persistent.get('image'), function(file) {
				me.state.persistent.set('image', file || "");
			})
		),
		'<h3>Rollover (mouse hover)</h3>',
		$('<label>').append(
			'<span>Rollover image</span>',
			phi.input.fileInput(me.state.persistent.get('rollover'), function(file) {
				me.state.persistent.set('rollover', file || "");
			})
		),
		'<h3>Selected state & Linking</h3>',
		$('<label>').append(
			'<span>Selected state image</span>',
			phi.input.fileInput(me.state.persistent.get('selected'), function(file) {
				me.state.persistent.set('selected', file || "");
			})
		),
		$('<label>').append(
			'<span>Link to:</span>',
			$('<input type=text name=href />').val(me.state.persistent.get('href', ""))
				.catchChanges({
					change: function(e) {
						me.state.persistent.set('href', $(this).val());
						me.refresh();
					}
				})
		)
	);
};

this.onStateChange = function(state, changed) {
	if( state !== me.state.persistent ) return;
	if( 'href' in changed ) {
		$(me.node()).attr('href', state.get('href'));
	}
	if( 'image' in changed || 'rollover' in changed || 'selected' in changed ) {
		setTimeout(function() { me.refresh(); }, 500);
	}
};
}
/** End/DYNAMIC **/
	}).apply(Jit.get('4e35d205215a4'), []);
}
/*]]>*/

with(phi.classes)
{
	(function() {
/** DYNAMIC **/
with(phi.classes) with(phi.frame) {var me = this;

this.canHaveChildren = function() { return true };

this.onLoad = function() {
	this.onEditMode({type: 'EditMode', mode: phi.edit._mode});
};

this.buttons = [];
phi.signal.register({type: 'EditMode'}, this);
this.onEditMode = function(o) {
	if( o.mode == 'design' ) {
		$(me.node()).mouseover(me.mouseover).mouseout(me.mouseout);
	} else {
		$(me.buttons).remove();
		me.buttons = [];
		$(me.node()).unbind('mouseover', me.mouseover).unbind('mouseout', me.mouseout);
	}
};

this.mouseover = function(e) {
	if( !me.buttons.length ) {
		me.buttons = $('<div class=phi-buttonbuttons>').appendTo('body')
			.append(
				$('<img src="'+phi.config.rootpath+'img/ui/edit/button/mini-options.png" class=phi-imageoptions alt=options title="Options" />')
					.click(function(e) { e.preventDefault(); $(me.node()).phiPopup(me.openOptions); })
			).get();
	}
	
	var off = $(me.node()).offset();
	$(me.buttons).css({
		position: 'absolute',
		top: off.top + 3 - $('body').offset().top,
		left: off.left + $(me.node()).outerWidth() - 13*3/*$(me.buttons).outerWidth()*/ - 3,
		zIndex: 99999
	});
};

this.mouseout = function(e) {
	var o = $(me.node()).offset();
	o.right = o.left + $(me.node()).outerWidth();
	o.bottom = o.top + $(me.node()).outerHeight();
	if( e.pageX > o.left && e.pageY > o.top && e.pageX < o.right && e.pageY < o.bottom ) return;
	$(me.node()).find('.phi-buttonbuttons').remove();
};

this.openOptions = function() {
	$(this).append(
		'<h3>Normal state</h3>',
		$('<label>').append(
			'<span>Image</span>',
			phi.input.fileInput(me.state.persistent.get('image'), function(file) {
				me.state.persistent.set('image', file || "");
			})
		),
		'<h3>Rollover (mouse hover)</h3>',
		$('<label>').append(
			'<span>Rollover image</span>',
			phi.input.fileInput(me.state.persistent.get('rollover'), function(file) {
				me.state.persistent.set('rollover', file || "");
			})
		),
		'<h3>Selected state & Linking</h3>',
		$('<label>').append(
			'<span>Selected state image</span>',
			phi.input.fileInput(me.state.persistent.get('selected'), function(file) {
				me.state.persistent.set('selected', file || "");
			})
		),
		$('<label>').append(
			'<span>Link to:</span>',
			$('<input type=text name=href />').val(me.state.persistent.get('href', ""))
				.catchChanges({
					change: function(e) {
						me.state.persistent.set('href', $(this).val());
						me.refresh();
					}
				})
		)
	);
};

this.onStateChange = function(state, changed) {
	if( state !== me.state.persistent ) return;
	if( 'href' in changed ) {
		$(me.node()).attr('href', state.get('href'));
	}
	if( 'image' in changed || 'rollover' in changed || 'selected' in changed ) {
		setTimeout(function() { me.refresh(); }, 500);
	}
};
}
/** End/DYNAMIC **/
	}).apply(Jit.get('d60a60b7215a4'), []);
}
/*]]>*/

with(phi.classes)
{
	(function() {
/** DYNAMIC **/
with(phi.classes) with(phi.frame) {var me = this;

this.canHaveChildren = function() { return true };

this.onLoad = function() {
	this.onEditMode({type: 'EditMode', mode: phi.edit._mode});
};

this.buttons = [];
phi.signal.register({type: 'EditMode'}, this);
this.onEditMode = function(o) {
	if( o.mode == 'design' ) {
		$(me.node()).mouseover(me.mouseover).mouseout(me.mouseout);
	} else {
		$(me.buttons).remove();
		me.buttons = [];
		$(me.node()).unbind('mouseover', me.mouseover).unbind('mouseout', me.mouseout);
	}
};

this.mouseover = function(e) {
	if( !me.buttons.length ) {
		me.buttons = $('<div class=phi-buttonbuttons>').appendTo('body')
			.append(
				$('<img src="'+phi.config.rootpath+'img/ui/edit/button/mini-options.png" class=phi-imageoptions alt=options title="Options" />')
					.click(function(e) { e.preventDefault(); $(me.node()).phiPopup(me.openOptions); })
			).get();
	}
	
	var off = $(me.node()).offset();
	$(me.buttons).css({
		position: 'absolute',
		top: off.top + 3 - $('body').offset().top,
		left: off.left + $(me.node()).outerWidth() - 13*3/*$(me.buttons).outerWidth()*/ - 3,
		zIndex: 99999
	});
};

this.mouseout = function(e) {
	var o = $(me.node()).offset();
	o.right = o.left + $(me.node()).outerWidth();
	o.bottom = o.top + $(me.node()).outerHeight();
	if( e.pageX > o.left && e.pageY > o.top && e.pageX < o.right && e.pageY < o.bottom ) return;
	$(me.node()).find('.phi-buttonbuttons').remove();
};

this.openOptions = function() {
	$(this).append(
		'<h3>Normal state</h3>',
		$('<label>').append(
			'<span>Image</span>',
			phi.input.fileInput(me.state.persistent.get('image'), function(file) {
				me.state.persistent.set('image', file || "");
			})
		),
		'<h3>Rollover (mouse hover)</h3>',
		$('<label>').append(
			'<span>Rollover image</span>',
			phi.input.fileInput(me.state.persistent.get('rollover'), function(file) {
				me.state.persistent.set('rollover', file || "");
			})
		),
		'<h3>Selected state & Linking</h3>',
		$('<label>').append(
			'<span>Selected state image</span>',
			phi.input.fileInput(me.state.persistent.get('selected'), function(file) {
				me.state.persistent.set('selected', file || "");
			})
		),
		$('<label>').append(
			'<span>Link to:</span>',
			$('<input type=text name=href />').val(me.state.persistent.get('href', ""))
				.catchChanges({
					change: function(e) {
						me.state.persistent.set('href', $(this).val());
						me.refresh();
					}
				})
		)
	);
};

this.onStateChange = function(state, changed) {
	if( state !== me.state.persistent ) return;
	if( 'href' in changed ) {
		$(me.node()).attr('href', state.get('href'));
	}
	if( 'image' in changed || 'rollover' in changed || 'selected' in changed ) {
		setTimeout(function() { me.refresh(); }, 500);
	}
};
}
/** End/DYNAMIC **/
	}).apply(Jit.get('f5ed6b95215a4'), []);
}
/*]]>*/with(phi.classes) with(phi.frame) {
	jQuery(function()
	{
		for( var iid in Jit.instances )
		{
			(function(jit) {
				if(jit.onLoad) jit.doOnLoad();
			})(Jit.instances[iid]);
		}
	});
}