(function($){
	$.fn.pinToTop = function(options){
		var defaults = {},
			options = $.extend(defaults, options);
		
		return this.each(function(){
			
			var $obj = $(this);
			var initMargin = parseInt($obj.css('marginTop').replace(/auto/,0));
			var padTop = 10;
			var distY = 0;
			var initTop = 0;
			var initOffset = $obj.offset().top;
			
			function calculateOffset(){
				if(distY >= initOffset - padTop){
					$obj.css({
						position: 'fixed',
						top: initTop,
						marginTop: 10
					});
				} else {
					$obj.css({
						position: 'relative',
						float: 'left',
						top: initTop,
						marginTop: initMargin
					});
				}
			};
			
			$(window).bind({
				scroll: function(e){
					distY = $(window).scrollTop();
					calculateOffset();
				}
			});
			
		});
	};
})(jQuery);

$(function(){
	$('ul.rating_list').pinToTop();
});

function errorBoxShow(e){
	$('.error_message_box').animate({opacity: '0.8'},300).animate({opacity: '0.9'},1800).animate({opacity: '0.0'},200);
	$('.error_message_box').text(e);
	}
/*
function submitSuccess(){
	var message_box_stuff = 'Thank you.<br />Your Information<br />Has been submitted';
	$('#contact_form').html('<div id="message_box"></div>');
	$('#message_box').html(message_box_stuff).hide().fadeIn(800);
	}
*/
function IsEmail(email) {
		var regex = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
		if (regex.test(email)) return true;
		else return false;
	}



function testFun(){
	//$('#recommended span.recommend_poem_tag').html(response);	
	//alert('test');
	$('#recommended span.recommend_poem_tag').html('recommended');
};



////////////////////////////////////////////////////////////////////////////////////////






$(document).ready(function(){
			///POEM TEXT SIZE CONTROL
			$('#poem_text_size_control a').hover(function(){
				$(".poem_text").stop().animate({'font-size':'40px','line-height': '50px'},{queue:false,duration:300});
			}, function(){
				$(".poem_text").stop().animate({'font-size':'14px','line-height': '18px'},{queue:false,duration:300});
			});
		
			
			
			
			///SEARCH BOX
			$('ul#search_box li a#search_link').click(function(){
				
			});
			

			
			///TABLE Authors
			$('#poem_table tr:even td').css('background-color', '#bbbbff');
			
			
			
			//$('.tag_big_text h2 a').append('&nbsp;&nbsp;&nbsp;');
			
				
			
			
			
			
			/*------------------------------------LIGHTBOX FORMS---------------------------------------*/
			//LIGHTBOX OVERLAY
			/*
			var signout_height = 200;
			var signout_dist = (signout_height/2)*-1;
			
			var email_height = 400;
			var email_dist = (email_height/2)*-1;
			
			var register_height = 311;
			var register_dist = (register_height/2)*-1;
			
			var signin_height = 0;
			var signin_dist = (signin_height/2)*-1;
			
			$('#register_form_lightbox .lightbox_container').before('<div class="register_distance"></div>');
			$('#signin_form_lightbox .lightbox_container').before('<div class="signin_distance"></div>');
			$('#email_form_lightbox .lightbox_container').before('<div class="email_distance"></div>');
			$('#signout_form_lightbox .lightbox_container').before('<div class="signout_distance"></div>');

			$('.register_distance').css({'height':'50%','margin-bottom':register_dist});
			$('.signin_distance').css({'height':'50%','margin-bottom':signin_dist});
			$('.email_distance').css({'height':'50%','margin-bottom':email_dist});
			$('.signout_distance').css({'height':'50%','margin-bottom':signout_dist});
			*/
			
			$('#register_form_lightbox .lightbox_container').before('<div class="register_distance"></div>');
			$('#signin_form_lightbox .lightbox_container').before('<div class="signin_distance"></div>');
			$('#email_form_lightbox .lightbox_container').before('<div class="email_distance"></div>');
			$('#signout_form_lightbox .lightbox_container').before('<div class="signout_distance"></div>');
			
			
			
			
			
			
			/*
			var divHeight = $('.lightbox_container').height();
			var divDist = (divHeight/2)*-1 - 150;
			$('.lightbox_container').before('<div class="distance"></div>');

			var cssDistance = {'height':'50%','margin-bottom':divDist}
			$('.distance').css(cssDistance);
			
			
			$('.lightbox').width($(document).width());
			$('.lightbox').height($(document).height());
			
			$('.lightbox').hide();
			*/
			
			
			
			
			
			
			
			
			
			//////
			//var yo = $('.lightbox .signin_form_lightbox .lightbox_container').data('height');
			//alert(yo);
			
			
			
			/*
			$('.signin_form_lightbox .lightbox').each(function() {
				$(this).data('height',$(this).height()).hide();
			});
			*/		
			
			//var test_height = $('.signin_form_lightbox .lightbox').height();
			//alert(test_height);
			/*
			#register_form_lightbox .lightbox {}
			#signin_form_lightbox .lightbox {}
			#email_form_lightbox .lightbox {}
			*/
			
			
			
			
			
			
			
			
			///////////////// call - L I G H T B O X   to   APPEAR
			//CLOSE LIGHT BOX
			//show - 'sign in' form lightbox
			$('#signin_link a, li.gen_box_text a.sign_in_link, ul.siteinfobox_list li.text a.sign_in_link').click(function(){
				$('#signin_form_lightbox').fadeIn();
				$('#signin_form_lightbox input.text_field:first').focus();
				return false;
			});
			$('#signin_form_lightbox a.close_lightbox').click(function(){
				$('#signin_form_lightbox').fadeOut();
				return false;
			});
			
			
			//register form lightbox
			$('#register_link a, li.gen_box_text a.register_link, div.general_info_text a.register_link, ul.siteinfobox_list li.text a.register_link').click(function(){
				$('#register_form_lightbox').fadeIn();
				$('#register_form_lightbox input.text_field:first').focus();
				return false;
			});
			$('#register_form_lightbox a.close_lightbox').click(function(){
				$('#register_form_lightbox').fadeOut();
				return false;
			});
			
			
			//OPEN LIGHT BOX
			$('#signout_link a').click(function(){
				$('#signout_form_lightbox').fadeIn();
				return false;
			});
			$('#signout_form_lightbox a.close_lightbox').click(function(){
				$('#signout_form_lightbox').fadeOut();
				return false;
			});
			
			
			///email form lightbox
			$('a#icon_email').click(function(){
				$('#email_form_lightbox').fadeIn();
				return false;
			});
			$('#email_form_lightbox a.close_lightbox').click(function(){
				$('#email_form_lightbox').fadeOut();
				return false;
			});
			
			
			
			////BUTTON HOVER EFFECT
			$('input.form_submit_button').hover(function() {
				$(this).attr("src", $(this).attr("src").split(".").join("_hover."));
				}, function() {
				$(this).attr("src", $(this).attr("src").split("_hover.").join("."));
			});
			
			
			
			
			
			

			////////////////// L I G H T B O X   form collect data
			//var sendURL = 'sites/ark/ark_html_verify.php?p=ark';
			var sendURL = 'cup_verify.php?p=ark';
			
			$('#lightbox_email a#email_form_send').click(function(){
				var emailData = $('form#lightbox_email :input').serialize();
				//alert(filters);
				$.ajax({type: "POST",
						url: sendURL,
						data: emailData,
						success: alert('Success')
				});
				return false;
			});
			
			//$('#lightbox_email .text_area').text('what up yo');
			
			$('input#icon_facebook').click(function(){
				var item_id = $('#itemID').val();
				var member_id = $('#memberID').val();
				var shareData = 'form_name=share&memberID='+member_id+'&itemID='+item_id;
				//alert(filters);
				$.ajax({type: "POST",
						url: sendURL,
						data: shareData
				});
				return false;
			});
			
			$('a#icon_twitter').click(function(){
				var item_id = $('#itemID').val();
				var member_id = $('#memberID').val();
				var shareData = 'form_name=share&memberID='+member_id+'&itemID='+item_id;
				//alert(filters);
				$.ajax({type: "POST",
						url: sendURL,
						data: shareData
				});
				window.open(this.href);
				return false;
			});
			
			$('#lightbox_signin a#signin_form_send').click(function(){
				var signInData = $('form#lightbox_signin :input').serialize();
				$.ajax({type: "POST",
						url: sendURL,
						data: signInData,
						//success: alert(signInData)
						success:  $('#lightbox_signin').fadeOut()
				});
				return false;
			});
			
			
			
			
			
			
			$('#lightbox_register a#register_form_send').click(function(){
				var registerData = $('form#lightbox_register :input').serialize();
				//alert(filters);
				$.ajax({type: "POST",
						url: sendURL,
						data: registerData,
						success: alert('Success')
				});
				return false;
			});		
			
			
			
			
			
			
			
			
			
			/*------------------------------------LIGHTBOX FORMS /// END ---------------------------------------*/
			
			
			
			
			//////RATING POEM
			//$('ul#rating_buttons li a').addClass('rating_button_off');
			//$('ul#rating_buttons li a').bind('mousemover',ratingButtonOver);
			//$('ul#rating_buttons li a').bind('mouseleave',ratingButtonOff);
			
			//$('ul#rating_buttons li a').hover(ratingButtonOver, ratingButtonOff);
			
			
			
			
			
			
			$('body.loggedin a#rating_button_01').click(function(){
					/*
					$.ajax({ type: "GET",
					url: "sites/ark/test.html",
					data: "",
					success: function(msg){ alert( "Data Saved: " + msg ); }
					});
					*/
					var item_id = $('#itemID').val();
					var member_id = $('#memberID').val();
					var poemRatingData = 'form_name=rate&rating=1&itemID='+item_id+'&memberID='+member_id;
					//alert(poemRatingData);
					var response = $.ajax({type: "POST",
							url:'cup_verify.php?p=ark',
							data: poemRatingData,
							async: false
					}).responseText;
					$("p.rating_number").html(response);
					$('a#rating_button_01').addClass('rating_button_on'); //SET BUTTON CLASS TO ON
					// SET OTHER BUTTONS TO OFF
					$('a#rating_button_02').removeClass('rating_button_on');
					$('a#rating_button_02').addClass('rating_button_off');
					$('a#rating_button_03').removeClass('rating_button_on');
					$('a#rating_button_03').addClass('rating_button_off');					
					return false;
			});
			$('body.loggedin a#rating_button_02').click(function(){
					var item_id = $('#itemID').val();
					var member_id = $('#memberID').val();
					var poemRatingData = 'form_name=rate&rating=2&itemID='+item_id+'&memberID='+member_id;
					//alert(poemRatingData);
					var response = $.ajax({type: "POST",
							url:'cup_verify.php?p=ark',
							data: poemRatingData,
							async: false
					}).responseText;
					$("p.rating_number").html(response);
					$('a#rating_button_02').addClass('rating_button_on'); //SET BUTTON CLASS TO ON
					// SET OTHER BUTTONS TO OFF
					$('a#rating_button_01').removeClass('rating_button_on');
					$('a#rating_button_01').addClass('rating_button_off');
					$('a#rating_button_03').removeClass('rating_button_on');
					$('a#rating_button_03').addClass('rating_button_off');			
					return false;
			});
			
			$('body.loggedin a#rating_button_03').click(function(){
					var item_id = $('#itemID').val();
					var member_id = $('#memberID').val();
					var poemRatingData = 'form_name=rate&rating=3&itemID='+item_id+'&memberID='+member_id;
					
					//alert(poemRatingData);
					var response = $.ajax({type: "POST",
							url:'cup_verify.php?p=ark',
							data: poemRatingData,
							async: false
					}).responseText;
					$("p.rating_number").html(response);
					$('a#rating_button_03').addClass('rating_button_on'); //SET BUTTON CLASS TO ON
					// SET OTHER BUTTONS TO OFF
					$('a#rating_button_01').removeClass('rating_button_on');
					$('a#rating_button_01').addClass('rating_button_off');			
					$('a#rating_button_02').removeClass('rating_button_on');
					$('a#rating_button_02').addClass('rating_button_off');
					return false;
			});
			///
			//$('span.recommended_poem_tag').toggle(fn01, fn02);
			//$('span.unrecommend_poem_tag').toggle(fn02, fn01);
			
			$('#recommended span.recommend_poem_tag').click(function() {
					var item_id = $('#itemID').val();
					var member_id = $('#memberID').val();
					var poemRatingData = 'form_name=recommend&itemID='+item_id+'&memberID='+member_id;
					var response = $.ajax({
							type: "POST",
							url:'cup_verify.php?p=ark',
							data: poemRatingData,
							async: false
							//success: alert('fn01')
					}).responseText;
					$(this).html(response);
					return false;
					
					
			});
			
			///////////////////////// CSS (styling)
			
			/*----POEM PAGE----*/
			var last_list_item = {'border-bottom':'none','padding-bottom':'0px','margin-bottom':'0px'};
			//var poem_list_css = {'border-bottom':'#000 dotted 1px','padding':'10px 0px 40px 0px', 'clear':'both'};
			//var poem_list_css = {'padding':'10px 0px 40px 0px', 'clear':'both'};
			var poem_list_css = {'clear':'both'};
			var rating_list_css = {'border-bottom':'#507b84 solid 1px'};
			$('ul.poem_list li').css(poem_list_css);
			$('ul.rating_list li').css(rating_list_css);
			$('ul.rating_list li:last').css(last_list_item);
			
			
			$('ul.poem_list li:last').css({'background':'none'/*,'padding-top':'20px'*/});
			
			//$('ul.poem_node_list li a').css({'background':'#000','opacity':'.6'});
			/*
			$('ul.poem_node_list li a').hover(function(){
				$(this).stop().animate({'opacity':'.3'},{queue:false,duration:300});
			}, function() {
				$(this).stop().animate({'opacity':'.9'},{queue:false,duration:300});
			});
			*/
			
			$('.profile_desc_box ul li:last').css({'padding-bottom':'0px','margin-bottom':'0px'});
			
			/*----PRIZE WINNER PAGE----*/
			var prize_winner_even_css = {'background':'#d1dcde'};
			var prize_winner_odd_css = {'background':'#e7ecef'};
			$('ul.prize_winner_list li:even').css(prize_winner_even_css);
			$('ul.prize_winner_list li:odd').css(prize_winner_odd_css);
			
			
			
			
			$('a#prize_box_link').hover(prizeHoverOn, prizeHoverOff);
			
			function prizeHoverOn(evt){
				//alert('on');
				$('#prize_box').css({'opacity':'.6'});
			};
			function prizeHoverOff(evt){
				//alert('off');
				$('#prize_box').css({'opacity':'.99'});
			};
			
			
			//poem node list
			//DO NOT DELETE
			//$('ul.poem_node_list li:odd:even, ul.poem_node_list li:even:even').addClass("poem_node_row_01");
			//$('ul.poem_node_list li:even:odd, ul.poem_node_list li:odd:odd').addClass("poem_node_row_02");
			
			
			//$('ul.poem_node_list li:even:odd, ul.poem_node_list li:odd:even').addClass('poem_node_dark_bg_color');
			
			/*----------
			$('ul.poem_node_list li').addClass('test');
			$('ul.poem_node_list li.test:even:odd, ul.poem_node_list li.test:odd:even').addClass('poem_node_dark_bg_color');
			*/
			$('ul.poem_node_list').each(function() {
				$(this).find("li:nth-child(4n+3)").addClass('poem_node_dark_bg_color');
				$(this).find("li:nth-child(4n+2)", "li:nth-child(4n+3)").addClass('poem_node_dark_bg_color');
			});
			
			
			
			/*
			$('#recommended_poems ul.poem_node_list li:even:odd, #recommended_poems ul.poem_node_list li:odd:even').addClass('test');
			$('#rated_poems ul.poem_node_list li:even:odd, #rated_poems ul.poem_node_list li:odd:even').addClass('test');
			$('#shared_poems ul.poem_node_list li:even:odd, #shared_poems ul.poem_node_list li:odd:even').addClass('test');
			$('#submitted_poems ul.poem_node_list li:even:odd, #submitted_poems ul.poem_node_list li:odd:even').addClass('test');
			*/
			
			//
			/*
			$('.hide_node').hide();
			$('a.view_all_tag').click(function(){
				$('.poem_node_container .hide_node').slideToggle(1000);
				//$(this).closest('.hide_node').slideToggle(1000);
				//$('.hide_node').slideToggle(1000);
				//$(this).parent().parent().parent().find('.hide_node').slideToggle(1000);
				return false;
			});
			*/
			$('.hide_node').hide();
			$('table.poem_node_container.recommended_poems a.view_all_tag').click(function(){
				$('table.poem_node_container.recommended_poems .hide_node').slideToggle(700);
				return false;
			});
			$('table.poem_node_container.rated_poems a.view_all_tag').click(function(){
				$('table.poem_node_container.rated_poems .hide_node').slideToggle(700);
				return false;
			});
			$('table.poem_node_container.shared_poems a.view_all_tag').click(function(){
				$('table.poem_node_container.shared_poems .hide_node').slideToggle(700);
				return false;
			});
			$('table.poem_node_container.submitted_poems a.view_all_tag').click(function(){
				$('table.poem_node_container.submitted_poems .hide_node').slideToggle(700);
				return false;
			});
			$('table.poem_node_container.round a.view_all_tag').click(function(){
				$('table.poem_node_container.round .hide_node').slideToggle(700);
				return false;
			});	
			
			
			
			
			
			
			//WHITE BOX HIGHLIGHT when you roll over nodes
			//$('ul.poem_node_list li table').wrap('<div class="hover_box"></div>');
			//$('.hover_box').css({'padding':'5px 0px'});
			
			$('ul.poem_node_list li').hover(function() {
				$(this).find('.hover_box').addClass('hover_box_css');
				},function(){$(this).find('.hover_box').removeClass("hover_box_css");
			});
			
			
			
			
			
			
			
			
			$('li.faq_box_feed:last').css({'padding-bottom':'30px'});
			
			
			
			
			
			/*
			$('ul.poem_node_list li').hover(function(){
				$(this).find('.hover_box').css({'background':'#fff'});
			});
			*/
			
			
			
			
			
			
			
			
			
			//$('li.recommended').css({'background-color':'#000'});
			$('li.recommended').prepend('<div class="recommended_tag"></div>');
			
			/*----FORM 'CSS' states----*/
			$('input.text_field, .text_area').css({backgroundColor:"#fff",borderColor:"#d7c500"});
			$('input.text_field, .text_area').focus(function(){
				$(this).css({backgroundColor:"#bbe0e8",borderColor:"#01222b"});
			});
			$('input.text_field, .text_area').blur(function(){
				$(this).css({backgroundColor:"#fff",borderColor:"#d7c500"});
			});
			
			/*
			var search_results_nav_bar = {'border-right':'#fff solid 1px'};
			$('.search_results_nav_bar li').css(search_results_nav_bar);
			$('.search_results_nav_bar li:last').css({'border-right':'none'});
			*/
			
			$('.sort_types li').css({'border-right':'#fff solid 1px'});
			$('.sort_types li:last-child').css({'border-right':'none'});
			$('.page_numbers li').css({'border-right':'#fff solid 1px'});
			$('.page_numbers li:last-child').css({'border-right':'none'});
			
			
			
			$('.already_registered_link a').click(function(){
				$('#signin_form_lightbox').fadeIn();
				$('#signin_form_lightbox input.text_field:first').focus();
				return false;
			});
			/*
			$('.form_container').hide();
			$('.already_registered_box .title span').click(function(){
				$('.form_container').slideToggle("slow");
			});
			*/
			
			
			
			
			
			
			
			
			/*----------------Content_Cloumn - FORM - collect all DATA---------------*/
			//Error Box
			$('.form_poem_bottom').after('<div class="error_message_box"></div>');
			$('.error_message_box').css({'background':'#FFFF00', 'color':'#FF0000', 'float':'left','padding':'10px', 'margin':'20px 0px 0px 102px', 'font-weight':'bold', 'font-family':'Arial, Helvetica, sans-serif'});
			$('.error_message_box').css('opacity','0.0');
			
		
			
			
			
			
			
			
			
			
			/*----Submit a Poem (FORM)----*/
			$('a#submit_form').click(function(){
				var submitData = $('form#form_poem_submit :input').serialize();
				$.ajax({type: "POST",
						url: sendURL,
						data: submitData,
						success: alert(submitData)
				});
				return false;
			});
			
			/////////////////////
			
			var submitTitle = $('#form_poem_submit input[name="poem_title"]');
			var defTitle = "Title here";
			
			submitTitle.focus(function(e){
				if($(this).attr("value") == defTitle) $(this).attr("value", "");
			});
			// submitTitle.blur(function(){
				// if($(this).attr("value") == "") $(this).attr("value", defTitle);
			// });
			
			/////////////////////
			
			var submitAuthor = $('#form_poem_submit input[name="poem_author"]');
			var defAuthor = "Author here";
			
			submitAuthor.focus(function(e){
				if($(this).attr("value") == defAuthor) $(this).attr("value", "");
			});
			// submitAuthor.blur(function(){
				// if($(this).attr("value") == "") $(this).attr("value", defAuthor);
			// });
			
			/////////////////////
			
			var submitPublisher = $('#form_poem_submit input[name="publisher"]');
			var defPublisher = "Publisher here";
			
			submitPublisher.focus(function(e){
				if($(this).attr("value") == defPublisher) $(this).attr("value", "");
			});
			// submitPublisher.blur(function(){
				// if($(this).attr("value") == "") $(this).attr("value", defPublisher);
			// });
			
			/////////////////////
			
			var submitText = $('#form_poem_submit textarea[name="poem"]');
			var defText = "Poem only (place title in appropriate field above)";
			
			submitText.focus(function(e){
				if($(this).attr("value") == defText) $(this).attr("value", "");
			});
			// submitText.blur(function(){
				// if($(this).attr("value") == "") $(this).attr("value", defText);
			// });
			
			/////////////////////
			
			var submitSignature = $('#form_poem_submit input[name="signature"]');
			var defSignature = "Name here";
			
			submitSignature.focus(function(e){
				if($(this).attr("value") == defSignature) $(this).attr("value", "");
			});
			// submitSignature.blur(function(){
				// if($(this).attr("value") == "") $(this).attr("value", defSignature);
			// });
			
			///VALIDATE FORM
			$('#form_poem_submit').validate();
			$('#lightbox_register').validate();
			$('#form_poem_nominate').validate();
			$('#form_login_box').validate();
			
			
			/*----Nominate a Poem (FORM)----*/
			$('a#nominate_form').click(function(){
				
				var nominate_form_fields = $('#form_poem_nominate input.text_field').val();
				if (nominate_form_fields == ""){							
					errorBoxShow('Please fill all fields');
					return false;
				}
				//
				var nominateData = $('form#form_poem_nominate :input').serialize();
				$.ajax({type: "POST",
						url: sendURL,
						data: nominateData,
						success: alert(nominateData)
				});
				return false;
			});
			
			
			

		
		
		/*----LOG IN (Section)-----------*/
		$('.login_box_register form li.button_item a').click(function(){
			var registerRegData = $('.login_box_register form :input').serialize();
			$.ajax({type: "POST",
				url: sendURL,
				data: registerRegData
				//success: alert(registerRegData)
			});
			return false;
		});
		///
		$('.already_registered_box form li.button_item a').click(function(){
			var registerLoginData = $('.already_registered_box form :input').serialize();
			$.ajax({type: "POST",
				url: sendURL,
				data: registerLoginData,
				success: alert(registerLoginData)
			});
			return false;
		});
		/*----LOG IN (Section)/// END----*/
		
		
		
		
		/*----SEARCH BOX RESULTS----*/
		$('form#search_box_results a.search_link').click(function(){
			var searchBoxResultsData = $('form#search_box_results :input').serialize();
			$.ajax({type: "POST",
				url: sendURL,
				data: searchBoxResultsData,
				success: alert(searchBoxResultsData)
			});
			//return false;
		});
		/*----SEARCH BOX RESULTS /// END----*/


		

		//UPLOAD FIELD
		$('input[type=file]').each(function(){
			  $(this).addClass('file').addClass('hidden');
			  $(this).parent().append($('<div class="fakefile" />').append($('<input class="upload_field" type="text" />').attr('id',$(this).attr('id')+'__fake')).append($('<img class="browse_button" src="sites/ark/images/browse_button.png"/>')));
			 
			  $(this).bind('change', function() {
				$('#'+$(this).attr('id')+'__fake').val($(this).val());;
			  });
			  $(this).bind('mouseout', function() {
				$('#'+$(this).attr('id')+'__fake').val($(this).val());;
			  });
		});
		//upload browse button highlight
		$('input.upload_field').hover(function() {
			$('img.browse_button').attr("src", $('img.browse_button').attr("src").split(".").join("_hover."));
			}, function() {
			$('img.browse_button').attr("src", $('img.browse_button').attr("src").split("_hover.").join("."));
		});
		
		

		
		
		
		
		
		
		
		
		//POEM NODE COLLAPSE
		/*
		var poem_node_margin_offset = 2;
		var poem_node_height = $('.box ul li').height() + poem_node_margin_offset;
		var init_poem_node_container_height = poem_node_height * 2;
		var item_group_height = $('.box ul li').size()*poem_node_height /4;
		
		$('.box ul.poem_node_list').css({'height':init_poem_node_container_height,'overflow':'hidden'});
		
		$('.view_all').toggle(fnClick01,fnClick02);
		
		function fnClick01(evt){
			$(this).next('ul').animate({height: item_group_height},1000);
			};
			
		function fnClick02(evt){
			$(this).next('ul').animate({height: init_poem_node_container_height},1000);
			};
		*/
		
		var c_poem_node_height = $('ul.poem_node_list li').height();
		
		//$('.node_collapse').css({'height':'100px !important','overflow':'hidden !important'});
		
		
		
		
		//$('.node_collapse ul.poem_node_list').hide();
		
		
		
		
		
		
		
		
		
		
		//RESET PASSWORD Form
		$('input.reset_username_field, input.new_password_field, input.again_password_field').css({backgroundColor:"#e1e1e1"});
		$('input.reset_username_field, input.new_password_field, input.again_password_field').focus(function(){$(this).css({backgroundColor:"#F2F2F2"});});
		$('input.reset_username_field, input.new_password_field, input.again_password_field').blur(function(){$(this).css({backgroundColor:"#e1e1e1"});});

		$('form#reset_password_form input.form_submit_button').click(function(){
					
					/*
					var item_id = $('#itemID').val();
					var member_id = $('#memberID').val();
					var poemRatingData = 'form_name=rate&rating=3&itemID='+item_id+'&memberID='+member_id;
					
					//alert(poemRatingData);
					var response = $.ajax({type: "POST",
							url:'cup_verify.php?p=ark',
							data: poemRatingData,
							async: false
					}).responseText;
					return false;
					*/
					/*
					var password1_val = $('input.new_password_field').val();
					var password1_val = $('input.again_password_field').val();
					
					if (password1_val == password2_val){
						alert('yes - match');
						} else {
						alert('no - match');
					};
					*/
			});









		



		
				


});//////////////////////////////////////////////////////////////////////////////////////////////////////


//ESC 'key' close LIGHTBOX BOX overlay
$(document).keyup(function(event){
    if (event.keyCode == 27){
		$('.lightbox').fadeOut();
    };
	/*
    if (event.keyCode == 13) {
        alert('you pressed enter key!');
    }
	*/
});


//LIGHTBOX overlay Resize on Window Change
$(window).bind('resize', function(){
		$('.lightbox').width($(window).width());
		$('.lightbox').height($(window).height());
});



function ratingButtonOver(evt){
	$(this).removeClass('rating_button_off');
	$(this).addClass('rating_button_on');
	};
function ratingButtonOff(evt){
	$(this).removeClass('rating_button_on');
	$(this).addClass('rating_button_off');
	};
	
	


