var googleUser = {};
var startGoogleSign = function() {
    gapi.load('auth2', function(){
        auth2 = gapi.auth2.init({
            client_id: poc_sign_in_google_client_id,
            cookiepolicy: 'single_host_origin',
        });
        attachSignin(document.getElementById('poc_sign_in_google'));
    });
};

function attachSignin(element) {
    auth2.attachClickHandler(element, {},
        function(googleUser) {
            _autocomplete_field($('div.poc_styles input[name="firstname"]'),googleUser.getBasicProfile().getName());
            _autocomplete_field($('div.poc_styles input[name="email"]'),googleUser.getBasicProfile().getEmail());
            _insert_alert_manual($('div.perfect_one_checkout_main_container'), poc_sign_in_success_title, 'success', 'inside', true);
        }, function(error) {
            alert(JSON.stringify(error, undefined, 2));
    });
}