if (typeof(elementSupportAttribut) != 'function'){
    /**
     * Return if element support attribut
     *
     * @return boolean
     */
    function elementSupportAttribut(element, attribut){
        var test = document.createElement(element);
        if (attribut in test) {
            return true;
        } else {
            return false;
        }

    }
}

if (typeof(empty) != 'function'){
    /**
     * Determine whether a variable is considered to be empty
     * Returns FALSE if mixed_var has a non-empty and non-zero value.
     *
     * version: 903.421
     * discuss at: http://phpjs.org/functions/empty
     * original by: Philippe Baumann
     *
     * @return boolean
     */
    function empty( mixed_var ) {
        var key;

        if (mixed_var === ""
            || mixed_var === 0
            || mixed_var === "0"
            || mixed_var === null
            || mixed_var === false
            || mixed_var === undefined
            ){
            return true;
        }

        if (typeof mixed_var == 'object') {
            for (key in mixed_var) {
                return false;
            }
            return true;
        }

        return false;
    }
}

/**
 *  Le contenu de ce fichier est placé sous le copyright de FabienR
 *  Tous les droits sont réservés : la copie, la distribution et l'utilisation du code original ou de portions de code
 *  sont sujets à l'autorisation écrite de FabienR
 *
 *  The contents of this file are subject to the copyright of FabienR
 *  All rights reserved : You may not copy, sell or distribute this code or parts of this code without
 *  the written permission of FabienR
 *
 *  (C) 2011 FabienR
 *  contact : fabien.renard@gmail.com - http://www.developer-php.com
 *  
 *
 */
jQuery(function() {
    var supportPlaceholder = elementSupportAttribut('input', 'placeholder');

    if (!supportPlaceholder){
        jQuery('*[placeholder]').each(function() {
            var $$ = $(this);
            /* triggers */
            $$.val($$.attr('placeholder')).bind('focus', function(){
                var $$ = jQuery(this);
                var placeholder = $$.attr('placeholder');
                if ($$.val() == placeholder) $$.val('');
            }).bind('blur', function(){                  
                var $$ = jQuery(this);
                var placeholder = $$.attr('placeholder');
                if (empty($$.val())) $$.val(placeholder);
            });
        });
    }
});


