$(document).ready(function() {

	$('#edit-search-block-form-1').val('Search by title, author, keyword, or ISBN');
	$('#edit-search-block-form-1').focus(function () {
		if($(this).val() == 'Search by title, author, keyword, or ISBN') {
			$(this).val('').addClass('filled');
		}
	});
	$('#edit-search-block-form-1').blur(function () {
		if($(this).val() == '') {
			$(this).val('Search by title, author, keyword, or ISBN').removeClass('filled');
		}
	});
	
	
	// ---  Start Input Box Interactivity 
	
	$('#edit-submitted-name').each(function() {
			var default_value = this.value;
			$(this).focus(function() {
					if(this.value == default_value) {
							this.value = '';
					}
			});
			$(this).blur(function() {
					if(this.value == '') {
							this.value = default_value;
					}
			});
	});
	$('#edit-submitted-e-mail-address').each(function() {
			var default_value = this.value;
			$(this).focus(function() {
					if(this.value == default_value) {
							this.value = '';
					}
			});
			$(this).blur(function() {
					if(this.value == '') {
							this.value = default_value;
					}
			});
	});
	$('#edit-submitted-phone').each(function() {
			var default_value = this.value;
			$(this).focus(function() {
					if(this.value == default_value) {
							this.value = '';
					}
			});
			$(this).blur(function() {
					if(this.value == '') {
							this.value = default_value;
					}
			});
	});
	
	// ---  End Input Box Interactivity 



	// --- Lightbox Interactivity 
	//Detail image block
	//$('#block-views-property_images-block_1');
	//Thumbs block
	$('#block-views-property_images-block_2 img').each(function (i) {
		$(this).bind('mouseenter',function(e){
			detailimg = $(this).parent().parent().parent().parent().find('.views-field-field-images-fid-1 img').attr('src');
			$('#block-views-property_images-block_1 img').attr('src',detailimg);
		});
	});
	
	// --- Homepage Stars 	
	$('.map-button').each(
        function () {
            $(this).bind('mouseenter', function (e) {
                $('.amenity-lf').removeClass('amenity-lf');
                var idEl = this.id.split("-");
                $('.amenity-on').fadeOut("fast").removeClass('amenity-on');
                $('#amenities-'+idEl[1]).fadeIn("fast");
                $('#amenities-'+idEl[1]).addClass('amenity-on').addClass('amenity-hover');
            });
            $(this).bind('mouseleave', function () {
                $(this).addClass('amenity-lf');
                setTimeout(function () {
                    if ($('.amenity-lf').length == 1) {
                        $('.amenity-on').fadeOut("fast").removeClass('amenity-on');
                    }
                }, 1000);
            });
        }
    );

//--- Makes seperate lines of links function as one

	$('.view-id-featured .views-row').bind('mouseenter mouseleave', function() {
		$(this).toggleClass('hover');
	});

	$('.view-id-ItemIndex .views-row').bind('mouseenter mouseleave', function() {
		$(this).toggleClass('hover');
	});


//--- Primary menu interactivity

	$('#block-tvmenu-0 .expanded>a, #block-tvmenu-0 .collapsed>a').each(function() {
		$(this).after('<a class="direct" href="'+$(this).attr('href')+'">&nbsp;</a>');
	});


//--- Remove Delete Button from Taxonomy Term Edit Screen
	
	$('#taxonomy-form-term #edit-delete').css('display','none');
	$('.user-admin #taxonomy-form-term #edit-delete').css('display','inline-block');


});

