/* 
 * Default JS Behaviour
 * Make sure the page behaves normal without js
 * Use js for enhancement
 *
 * I'll try to be verbose so these scripts can be rewriten to jquery if that's the prefered library
 *
 */

window.addEvent('domready', function(){

    /* =======
     * Gracefully blur on input elements
     * ======= */

    // If a input text has a set title, we use the title as default value for tips until focus occurs
    // source: <input type="text" class="text" name="zip" title="voer postcode in als 9725 GH" />
    // onLoad: <input type="text" class="text blur" name="zip" value="voer postcode in als 9725 GH" />
    // onBlur: <input type="text" class="text" name="zip" value="" />

    

    // find all the input with type=text and title and itterate through them
    $$('input[type=text][title]').each(function(el,i){
        
        // find out if value is allready set
        if(el.value == ""){
            // set the style to blur
            el.addClass('blur');
            // set the value to title
            el.value = el.get('title');
            // add the focus event
            el.addEvent('focus',function(){
                // als er nog niet eerder geblurred is
                if(el.hasClass('blur')){
                    // remove the blur class
                    el.removeClass('blur');
                    // remove the default value set by js
                    el.value = '';
                }
            })
        }

    });

	

});




