
$(document).ready(function() {
	initSearchBox();
	loginBox();
});

/******************************
   Set the content of the 
   searchbox
 ******************************/
function initSearchBox() {
	/******************************
      Searchbox Content
     ******************************/
	var searchboxContent = 'Search';
	var searchbox = '#search';
	focusBlurContent (searchboxContent, searchbox);
}

/******************************
  Set content of the login fields
 ******************************/
function loginBox () {
	$('.field-title').remove();
	focusBlurContent('Login email', '#username');
	
	/** Add / Remove Password Background Image
	 ********************************************/
	$('#password').focus(
		function() {
			$('#password').removeClass('password-field');
		}
	);
	/*$('#password').blur(
		function() {
			if ($('#password').attr('value') == '' || !$('#password').attr('value')) {
				$('#password').addClass('password-field');
			}
		}
	);*/		
}

/******************************
   function for showing / hiding
   content of field on focus /
   blur
 ******************************/
function focusBlurContent (content, elementID) {
	
	$(elementID).attr('value', content);
	$(elementID).focus(
		function() {
			if ($(elementID).attr('value') == content) {
				$(elementID).attr('value', '');
			}
		}
	);
	$(elementID).blur(
		function() {
			if ($(elementID).attr('value') == '' || !$(elementID).attr('value')) {
				$(elementID).attr('value', content);
			}
		}
	);		
}

/******************************
   Show a help bubble
 ******************************/

function bubble(i) {
	if ($('.bubble-pos:visible').length) {
		if ($('#' + i + ':visible').length) {
			$('#' + i).hide();
		} else {
			$('#' + i).show();
		}
	} else {
		$('#' + i).show();
	}
}
