// Add placeholder text to inputs
function addPlaceholder(element, text){
	var supported = 'placeholder' in document.createElement('input');;
	
	// If placeholder attribute is supported use it
	if(supported === true){
		element.attr('placeholder', text);
	}
	// Otherwise fall back to standard method
	else{
		element.val(text).addClass('empty');
		element.focus(function(){
			if(element.val() == text){
				element.val('').removeClass('empty');	
			}
		}).blur(function(){
			if(element.val() == ''){
				element.val(text).addClass('empty');	
			}
		});
	}
}

$(function(){
	addPlaceholder($('#reg'), 'Username');
	addPlaceholder($('#password'), 'Password');
	addPlaceholder($('#search-box').find('input'), 'Search pact');
	addPlaceholder($('#filterbox').find('input.filter-keyword'), 'Keyword');
	addPlaceholder($('#filter-news, #filter-events, #filter-documents').find('#in-keyword'), 'Keyword');
});
