//Created by Sean Kane (http://celtickane.com/labs/feather-ajax/)
//Feather Ajax v1.0.1

function AjaxObject101() {
         var data2 = "";
        this.createRequestObject = function() {
                try {
                        var ro = new XMLHttpRequest();
                }
                catch (e) {
                        var ro = new ActiveXObject("Microsoft.XMLHTTP");
                }
                return ro;
        }
        this.sndReq = function(action, url, data) {
                if (action.toUpperCase() == "POST") {
                        data2=data;
                        this.http.open(action,url,true);
                        this.http.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
                        this.http.onreadystatechange = this.handleResponse;
                        this.http.send(data);
                }
                else {
                        this.http.open(action,url + '?' + data,true);
                        this.http.onreadystatechange = this.handleResponse;
                        this.http.send(null);
                }
        }
        this.handleResponse = function() {
                if ( me.http.readyState == 4) {
                        if (typeof me.funcDone == 'function') { me.funcDone();}
                        if (me.http.responseText == "success"){
                                location.href='http://www.elementbars.com/memberHome.asp';
                        }else{
                                if (me.http.responseText == "new user"){
                                        var email = prompt ("Please enter your email so we can link your account","");
                                        if (email==null)
                                            window.location.reload();
                                        if (email.length<1)
                                            window.location.reload();
                                        me.sndReq('post','http://www.elementbars.com/f_dologin.asp',data2+'&email='+email);
                                }else{
                                        if (me.http.responseText == "existing"){
                                                var password2 = prompt ("Please enter your password","");
                                                if (password2==null)
                                                    window.location.reload();
                                                if (password2.length<1)
                                                    window.location.reload();
                                                me.sndReq('post','http://www.elementbars.com/f_dologin.asp',data2.replace(/password2/, "passwordx")+'&password2='+password2);
                                        }
                                }
                        }
                }
                if ((me.http.readyState == 1) && (typeof me.funcWait == 'function')) { me.funcWait(); }
        }
        var me = this;
        this.http = this.createRequestObject();

        var funcWait = null;
        var funcDone = null;
}