function loginClicked() {
    jQuery.ajax({
        url: '/includes/login-handler.php',
        dataType: 'json',
        type: 'post',
        data: {action: 'login', user: jQuery('#username').val(), pass: jQuery('#password').val()},
        success: function(data) {
            if (data.status == 'OK') {
                jQuery('.logged_username').html(data.username);
                jQuery('#client_login').hide();
                jQuery('#client_loggedin').show();
                // reload page
                //window.location.reload();
                window.location = '/vendor/';
            } else if (data.status == 'INVALID_LOGIN') {
                jQuery('#client_login').hide();
                jQuery('#login_unsuccessful').show();
            }
        }
    });
    return false;
}
function loginAgainClicked() {
    jQuery('#login_unsuccessful').hide();
    jQuery('#client_login').show();
    return false;
}
function logoutClicked() {
    jQuery.ajax({
        url: '/includes/login-handler.php',
        dataType: 'json',
        type: 'post',
        data: {action: 'logout'},
        success: function(data) {
            if (data.status == 'OK') {
                //jQuery('#client_loggedin').hide();
                //jQuery('#client_login').show();
                // reload page
                window.location.reload();
            }
        }
    });
    return false;
}

// functions for search 
var bikky = document.cookie;
var today = new Date();
var expiry = new Date(today.getTime() + 28 * 24 * 60 * 60 * 1000); // plus 28 days


function setCookie(name, value) { // use: setCookie("name", value);
    if (value != null && value != "")
      document.cookie=name + "=" + escape(value) + "; expires=" + expiry.toGMTString() + "; path=/";
    bikky= document.cookie; // update bikky
}


	

