function Get_Info(twitterUser) {
    
    var id;
    var name;
    var picture;
    
    if($.cookie("twttr_status") == "connected") {
        
        if(twitterUser != undefined) {
            $.cookie("pic", twitterUser.profileImageUrl, {path: "/"});
            $.cookie("name", twitterUser.name, {path: "/"});
            //Set_User();
            ready();
        }
        
    } else if ($.cookie("fb_status") == "connected") {
        FB.api('/me', function(response) {
            name = response.name;
            id = response.id;
            picture = "http://graph.facebook.com/" + id + "/picture";
            $.cookie("name", name, {path: "/"});
            $.cookie("pic", picture, {path: "/"});
            //Set_User();
            ready();
        });
        
    }
    
    function ready() {
        if($.cookie("splash") == 'true') {
            $.cookie("splash", null);
            parent.location = "/";
            parent.$.fancybox.close();
        } else {
            Set_User();
        }
    }
    
    
}

function Set_User() {
    
    if($.cookie("fb_status") != null || $.cookie("twttr_status") != null) {
        
        $("#login-button-wrapper").hide();
        $("#login-wrapper").show();
        $("#login-picture img").attr("src", $.cookie("pic"));
        $("#login-name").html($.cookie("name"));
        
    } else {
        
        $("#login-button-wrapper").show();
        $("#login-wrapper").hide();
        
        $("#login-picture img").attr("src", "");
        $("#login-name").html("");
      
    }
    
}

function Logout() {
    
    $.cookie("pic", null);
    $.cookie("name", null);
    
    if($.cookie("twttr_status")) {
        twttr.anywhere.signOut();
    }
    
    $.cookie("twttr_status", null);
    $.cookie("fb_status", null);
    $.cookie("facebook_id", null);
    
    Set_User();
    
}

function Verify_Email(email) {
    var email_check = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
    if(email_check.test(email)) {
        return true;
    } else {
        return false;
    }
    
}

