var DEF_VAL = "Sökfras ...";
var AUTOSAVE_URL = "se.digitalvenues.search";
var NUM_RESULTS = 5
var isSafari = ((parseInt(navigator.productSub)>=20020000)&& (navigator.vendor.indexOf("Apple Computer")!=-1));
var rules = {
    'input.search' : function(element){
        if (isSafari) {
            element.setAttribute('type', 'search');
            element.setAttribute('placeholder', DEF_VAL);
            element.setAttribute('autosave', AUTOSAVE_URL);
            element.setAttribute('results', NUM_RESULTS);
        } else {
            element.onfocus = function() { if (this.value==DEF_VAL) this.value = ''; };
            element.onblur  = function() { if (this.value=='')      this.value = DEF_VAL; };
            if (element.value.replace(/^\s+|\s+$/g, "")=='') element.value = DEF_VAL;
        }
    }
};
Behaviour.register(rules);