$(document).ready(function(){
    // Detect browser
    var $browserNotIE = $.support.opacity;

    if( $("#password").get(0) ){
        var p = $("#password").get(0);
        if($browserNotIE){
            p.type = 'text';
        }

        /*
         * affiliateid field
         */
        $("#affiliateid").focus(function(){
            if(this.value == this.defaultValue){
                this.value = '';
            }
            if(this.value != this.defaultValue){
                this.select();
            }
        });

        $("#affiliateid").blur(function(){
            if(this.value == ''){
                this.value = this.defaultValue;
            }
        });

        /*
         * password field
         */
        $("#password").focus(function(){
            if(this.value == this.defaultValue){
                if($browserNotIE == true){
                    this.type = 'text';
                }

                this.value = '';
            }
            if(this.value != this.defaultValue){
                if($browserNotIE == true){
                    this.type = 'password';
                }
                this.select();
            }
        });

        $("#password").blur(function(){
            if(this.value == ''){
                if($browserNotIE == true){
                    this.type = 'text';
                }
                this.value = this.defaultValue;
            } else {
                if($browserNotIE == true){
                    this.type = 'password';
                }
            }
        });
    }


});
