/**
 * --------------------------------------------------------------------
 * jQuery-Plugin "placeholder support for non webkit browsers"
 * Version: 1.0, 08.05.2011
 * by Christian Fillies, contact@christianfillies.com
 *                       http://christianfillies.com/
 *
 * Copyright (c) 2011 Christian Fillies
 * Licensed under GPL (http://www.opensource.org/licenses/gpl-license.php)
 *
 * (en) specify the elements to get the placeholder function
 *		the passing value is the CSS Class that gets added to the parent <DIV> when the input is in focus
 *		you need to have a <DIV> around the <INPUT> to use for focusing css styles
 *
 *	EXAMPLE: jQuery('input').placeholderFunction('input-focused');
 */ 
 
 // Value as Placeholder including focusing Styles for the parent DIV
	// (en) setup a placeholder using the html5 placeholder attribute as supported by webkit browsers, 
	//		it then gets replaced into a standard value technique supported by all browsers.
	if (jQuery.browser.webkit) {
		jQuery.fn.extend  ({
			placeholderFunction : function (focusClass) {
				return this.each(function() {
					jQuery(this).focus(function() {
						jQuery(this).parentsUntil('div').parent().addClass(focusClass);
					jQuery(this).blur(function () {
						jQuery(this).parentsUntil('div').parent().removeClass(focusClass);
				});
				});
			});
		} });
	} else {
		jQuery.fn.extend  ({
			placeholderFunction : function (focusClass) {
				return this.each(function() {
					var placeholder = jQuery(this).attr("placeholder");
						jQuery(this).val(placeholder);
					jQuery(this).focus(function() {
						jQuery(this).parentsUntil('div').parent().addClass(focusClass);
						if (jQuery(this).val() == placeholder) { jQuery(this).val(''); }
					jQuery(this).blur(function () {
						jQuery(this).parentsUntil('div').parent().removeClass(focusClass);
						if (jQuery.trim(jQuery(this).val()) == '') { jQuery(this).val(placeholder); }
					});
				});
			});
		} });
	};
