//<![CDATA[
function populateElement(selector, defvalue) {
    if($.trim($(selector).val()) == "") {
        $(selector).val(defvalue);
    }
  
    $(selector).focus(function() {
        if($(selector).val() == defvalue) {
            $(selector).val("");
        }
    });
    
    $(selector).blur(function() {
        if($.trim($(selector).val()) == "") {
            $(selector).val(defvalue);
        }
    });
 }

$(document).ready(function(){
	//remove href text and show only background img button
	$("a[title='Media Archives']").wrapInner("<span></span>");
	
	//add target="_blank" to photos link
	$("a[title='Photos']").attr("target","_blank");
	
	//remove end date from calendar events
	$("div.dtend").remove();
	$("li.comment_forbidden").remove();
	$("li.blog_usernames_blog").remove();	
	
	//change sidebar recent blog posts to read Recent News
	$("h2:contains('Recent blog posts')").text("Recent News");
	
	//change news' page title to read News
	$("h2:contains('Blogs')").text("News");
	
	//do stuff if browser is ie
	// if($.browser.msie && $.browser.version.substr(0,3)=="6.0") {
	// 	$('#legal').append('<p>For a better browsing experience, we recommend you upgrade to <a href="http://www.getfirefox.com" target="_blank" title="Upgrade to Mozilla Firefox">Mozilla Firefox</a></a>');
	// }
 
	//Add focus/blur effects for search/newsletter boxes
	populateElement('#edit-search-theme-form-1','Enter search terms..');
	populateElement('#signupForm','Enter email address..');

	//Set the #top area to the same height as #tertiary (since its absolutely positioned)
	if($("#tertiary").height() > $("#main").height())
		$("#main").height($("#tertiary").height()-25);
	
	//Remove <br /> tags from comment block output
	$('.block-comment li br').remove();
	
	//setup the login form hide/show
	$('#block-user-0').hide();
	$('.loginCancel').hide();
	$('#loginLink').click(function() {
		$('#block-user-0').toggle();
		$('#edit-name').focus();
		$('.loginLinks').toggle();
		$('.loginCancel').toggle();
		return false;
	});
	
	$('.loginCancelLink').click(function() {
		$('#block-user-0').toggle();
		$('.loginLinks').toggle();
		$('.loginCancel').toggle();
		return false;
	});
});
//]]>


