function passreset(isbn){
        Dialog.confirm("<h3>Reset Your Password through Email</h3>",{
            className:"alphacube", width:300, okLabel: "Yes",
            id: "myDialogId",
            onOk:function(){
                new Ajax.Request('/action/resetpassword', {
                    parameters: { email: isbn},
                    onSuccess: function(transport) {
                        $('id').clear();
                        Dialog.confirm(transport.responseText, {className:"alphacube", width:300,id: "myDialog",onOk:function(){
                                window.location.href="http://www.memoryfab.com";
                        }
                        });
                    },
                    onFailure: function(){ $('id').clear(); Dialog.confirm('Email not valid...', {className:"alphacube", width:300,id: "myDialog"});}
                });
                return true;
            }
        });
}
function checklogin(isbn){
        var goodform=true;
        if(!$('id').value.match(/^[A-Z0-9._%+-]+@[^\.]+(?:\.[^\.]+)+$/i)) {
        $('id').setStyle({
            backgroundColor: 'pink'
            });
        goodform = false;
        }
        else {
            $('id').setStyle({
            backgroundColor: 'white'
            });
        }
        
        if(isbn){
            if(goodform){
                passreset($F('id'));
            }else{
                if(!goodform){
                    $('warnmsg').show();
                }else{
                    $('warnmsg').hide();
                }
            }
        }else{
            if(!$('pass').value) {
                $('pass').setStyle({
                backgroundColor: 'pink'
                });
                goodform = false;
            }
            else {
                $('pass').setStyle({
                backgroundColor: 'white'
                });
            }
            if(!goodform){
                $('warnmsg').show();
            }else{
                $('warnmsg').hide();
            }
            return goodform;
        }
        
}
function checkcreate(){
        var goodform=true;
        if(!$('email').value.match(/^[A-Z0-9._%+-]+@[^\.]+(?:\.[^\.]+)+$/i)) {
        $('email').setStyle({
            backgroundColor: 'pink'
            });
        goodform = false;
        }
        else {
            $('email').setStyle({
            backgroundColor: 'white'
            });
        }
        
        if(!$('remail').value.match(/^[A-Z0-9._%+-]+@[^\.]+(?:\.[^\.]+)+$/i) || ($F('remail')!=$F('email'))) {
        $('remail').setStyle({
            backgroundColor: 'pink'
            });
        goodform = false;
        }
        else {
            $('remail').setStyle({
            backgroundColor: 'white'
            });
        }
        if(!$('fname').value) {
            $('fname').setStyle({
            backgroundColor: 'pink'
            });
            goodform = false;
        }
        else {
            $('fname').setStyle({
            backgroundColor: 'white'
            });
        }
        
        if(!$('lname').value) {
            $('lname').setStyle({
            backgroundColor: 'pink'
            });
            goodform = false;
        }
        else {
            $('lname').setStyle({
            backgroundColor: 'white'
            });
        }
        if(!goodform){
            $('warnmsg').show();
        }else{
            $('warnmsg').hide();
        }
        return goodform;
    }
    function cleanname(isbn){
        $(isbn).value=$(isbn).value.gsub(/(\d+|[@.:;*&^$#!?\|_%"+=\\\[\]\{\}\\(\)\`\~\$]+)/, '');
    }
    
