/*
jQuery.fn.unwrap = function (el) {
    return this.each( function(){
      $(this.childNodes).appendTo(this.parentNode);
    });
};
$(document).ready( function(){
	$('body').addClass('javascript');
	$('.fbList a').unwrap().remove();			
});
*/

$(document).ready(function(){

// clear default text from search boxes
	$("#topSearch .inputBorder input").attr("value","Search site").focus(function (i) {
		if($(this).attr("value") == "Search site") {
			$(this).attr("value", "");
		};
	}).blur(function (i) {
		if($(this).attr("value") == "") {
			$(this).attr("value", "Search site");
		};
	});

});

// Homepage Feature (uf Javascript disabled, .NET picks up query string to reload page with active tab)

if(typeof jQuery == 'function'){
$(document).ready(function(){
	fnHomeFeatureArea();
});
};

function fnHomeFeatureArea(){
if(typeof jQuery == 'function'){
	$('.fbList a').click(
		function(){
		
			var dId = $(this).attr('href');
			
			fbId = $.query($(this).attr('href')); 
			
			$('.fb').removeClass('active');
			$('.fb').removeClass('active');
			$('#'+ fbId.fb).addClass('active');
			$('.fbList li').removeClass('active');
			$(this).parents('li').addClass('active');
			return false;
		}
	);
	};
}

if(typeof jQuery == 'function'){
jQuery.query = function(q) {
     var r = {};
     q = q.replace(/^\?/,''); // remove the leading ?
     q = q.replace(/\&$/,''); // remove the trailing &
     jQuery.each(q.split('&'), function(){
             var key = this.split('=')[0];
             var val = this.split('=')[1];
             // convert floats
             if(/^[0-9.]+$/.test(val))
                     val = parseFloat(val);
             // ingnore empty values
             if(val)
                     r[key] = val;
     });
     return r;

}; 
};