



	// Celebrity //
	celebrity = new Object();

		celebrity.id = null;

		// Celebrity: Random //
		celebrity.random = function(){

			ajax.post('/php/ajax/celebrity.php', 'celebrity=&random=', celebrity.random_changed, true);

		}

		celebrity.random_changed = function(){

			top.window.location.href = ajax.xml_http.responseText;

		}

		// Celebrity: Gallery //
		celebrity.gallery = new Object();

			celebrity.gallery.show = function(){

				ajax.post('/php/ajax/celebrity.php', 'celebrity=&gallery=&show=', celebrity.gallery.show_changed, true);

			}

			celebrity.gallery.show_changed = function(){

				document.getElementById('celebrities').innerHTML = ajax.xml_http.responseText;

			}

		// Celebrity: Spotlight //
		celebrity.spotlight = new Object();

			celebrity.spotlight.show = function(celebrity_member_id){

				ajax.post('/php/ajax/celebrity.php', 'celebrity=&spotlight=&show=&celebrity-member-id=' + celebrity_member_id, celebrity.spotlight.show_changed, true);

			}

			celebrity.spotlight.show_changed = function(){

				document.getElementById('spotlight').innerHTML = ajax.xml_http.responseText;

			}

			celebrity.spotlight.vote = function(celebrity_member_id, member_display_name, vote){

				if (celebrity_member_id == ''){

					alert("We're sorry.  There are no celebrity look alikes to vote for in this contest.");

				}
				else if (confirm ('Confirm Vote: ' + vote + ' for ' + member_display_name + '?')){

					ajax.post('/php/ajax/celebrity.php', 'celebrity=&spotlight=&vote=' + vote + '&celebrity-member-id=' + celebrity_member_id, celebrity.spotlight.vote_changed, true);
					celebrity.spotlight.celebrity_member_id = celebrity_member_id;

				}

			}

			celebrity.spotlight.vote_changed = function(){

				var response = ajax.xml_http.responseText.split('[:response:]');
				if (response[0] == 'true'){

					celebrity.spotlight.show(celebrity.spotlight.celebrity_member_id);
					if (confirm ('Your vote has been recorded.  Continue Voting?')) celebrity.random();

				}
				else {

					alert (response[1]);

				}

			}

		// Celebrity: Member //
		celebrity.member = new Object();

			// Celebrity: Member: Gallery //
			celebrity.member.gallery = new Object();

				celebrity.member.gallery.show = function(){

					ajax.post('/php/ajax/celebrity.php', 'celebrity-member=&gallery=&show=', celebrity.member.gallery.show_changed, true);

				}

				celebrity.member.gallery.show_changed = function(){

					document.getElementById('celebrity-members').innerHTML = ajax.xml_http.responseText;

				}

		// Celebrity: Contest //
		celebrity.contest = new Object();

			celebrity.contest.open = function(celebrity_id){

				if (typeof contest == 'undefined')file.include('/member/popup/javascript/contest.js');
				contest.open(celebrity_id);

			}

			celebrity.contest.exit = function(celebrity_id){

				file.include('/member/popup/javascript/contest.js');
				contest.exit(celebrity_id);

			}

		// Celebrity: Feed //
		celebrity.feed = new Object();

			celebrity.feed.share = function(message, share_options){

				if (message != ''){

					for (var i = 0; i < share_options.length; i++){

						if (share_options[i].checked) celebrity_member_id = share_options[i].value;

					}

					message = encodeURIComponent(message);
					ajax.post('/php/ajax/celebrity.php', 'celebrity=&feed=&share=&message=' + message + '&celebrity-id=' + celebrity.id + '&celebrity-member-id=' + celebrity_member_id, celebrity.feed.share_changed, true);

				}

			}

			celebrity.feed.share_changed = function(){

				var sharetext = document.getElementById('share-text');
				sharetext.value = '';
				textarea.expand(sharetext);

				if (ajax.xml_http.responseText != ''){

					alert (ajax.xml_http.responseText);

				}
				else {

					celebrity.feed.activity.show();

				}

			}

			celebrity.feed.activity = new Object();

				celebrity.feed.activity.show = function(){

					ajax.post('/php/ajax/celebrity.php', 'celebrity=&feed=&activity=&show=&celebrity-id=' + celebrity.id, celebrity.feed.activity.show_changed, true);

				}

				celebrity.feed.activity.show_changed = function(){

					document.getElementById('activity').innerHTML = ajax.xml_http.responseText;

				}

				celebrity.feed.activity.post = new Object();

					celebrity.feed.activity.post.show_comment_box = function(comment_box_id){

						document.getElementById(comment_box_id).style.display = '';
						document.getElementById(comment_box_id + '-text').focus();

					}

					celebrity.feed.activity.post.remove = function(post_id){

						ajax.post ('/php/ajax/celebrity.php', 'celebrity=&feed=&activity=&post=&remove=&post-id=' + post_id, celebrity.feed.activity.post.remove_changed, true);

					}

					celebrity.feed.activity.post.remove_changed = function(){

						celebrity.feed.activity.show();

					}

				celebrity.feed.activity.comment = new Object();

					celebrity.feed.activity.comment.add = function(post_id, message){

						if (message != 'Write a comment...'){

							message = encodeURIComponent(message);
							ajax.post ('/php/ajax/celebrity.php', 'celebrity=&feed=&activity=&comment=&add=&post-id=' + post_id + '&message=' + message, celebrity.feed.activity.comment.add_changed, true);

						}

					}

					celebrity.feed.activity.comment.add_changed = function(){

						if (ajax.xml_http.responseText != ''){

							alert (ajax.xml_http.responseText);

						}
						else {

							celebrity.feed.activity.show();

						}

					}

					celebrity.feed.activity.comment.remove = function(comment_id){

						ajax.post ('/php/ajax/celebrity.php', 'celebrity=&feed=&activity=&comment=&remove=&comment-id=' + comment_id, celebrity.feed.activity.comment.remove_changed, true);

					}

					celebrity.feed.activity.comment.remove_changed = function(){

						celebrity.feed.activity.show();

					}




