jQuery(document).ready(function($) {
	
	// if user is signed in, show YouAreSignedIn menu, if user is signed out, show NotSignedIn menu
		if (
			$('#AreYouGuest').html() == '') {
				  $("#YouAreSignedIn").css('display','none');
    			  $("#YouAreSignedIn").remove();
				  $("#NotSignedIn").show();
				}
				else {
				  $("#NotSignedIn").css('display','none');
				  $("#NotSignedIn").remove();
				  $("#YouAreSignedIn").show();
				}
	// end
	
	// if no additional checkout options, remove pay another way text
		if (
			$('#MoreCheckouts .AdditionalCheckoutButtons').html() == '') {
				  $('#MoreCheckouts p.PayAnotherWay').css('display','none');
    			  $('#MoreCheckouts p.PayAnotherWay').remove();
				}
				else {
				  $('#MoreCheckouts p.PayAnotherWay').css('display','block');
				  $('#MoreCheckouts p.PayAnotherWay').show();
				}
	// end
	
	// iterate through your links and see if they are found in the window.location.pathname string
		var loc_href = window.location.pathname;
			$('#Menu a').each(function () {
				if (loc_href == $(this).attr('href')) {
				$(this).addClass('ActiveCategory');
			}
		});
	// end
	
	// add First class to first list item on menus
		$('#Menu li:first-child, #Footer li:first-child').addClass('First');
	// end
	
	// add Last class to last list item on menus
		$('#Menu li:last-child, #Footer li:last-child').addClass('Last');
	// end
	
	// replace text inside input fields
		function textReplacement(input){
		var originalvalue = input.val();
		input.focus( function(){
			if( $.trim(input.val()) == originalvalue ){ input.val(''); }
		});
		input.blur( function(){
			if( $.trim(input.val()) == '' ){ input.val(originalvalue); }
		});
		}

		textReplacement($('#search_query')); // search
		textReplacement($('#nl_first_name')); // newsletter name
		textReplacement($('#nl_email')); // newsletter email
		textReplacement($('#revtitle')); // review title
		textReplacement($('#revfromname')); // review name
		textReplacement($('#captcha')); // captcha
	// end
	
});

