function track (vendor, action) {

    new Ajax.Request('/calls/track.php', {
            method: 'post', postBody: 'vendor_id=' + vendor + '&action=' + action,
            onSuccess: function(transport) {
                return true;
            }
    });

}

function trackPage (pageName) {
    new Ajax.Request('/calls/trackPage.php', {
            method: 'post', postBody: 'page_name=' + pageName,
            onSuccess: function(transport) {
                return true;
            }
    });
}

// CONFIRM PROMPT
/* <a href="http://www.google.com/" onclick="return confirmPrompt(this.href, 'Are you sure you want to?');">Test</a> */
function confirmPrompt(url, msg) {
    if (confirm(msg)) window.location = url;
    return false;
}

// POPUP
/* <a href="http://www.google.com/" onclick="return doPopup(this.href, {location:'yes'});">Test</a> */
function doPopup(url, options) {
    var Popup = {
        open: function(url, options) {
            this.options = {
                width: 600,
                height: 500,
                name: '_blank',
                location: 'no',
                menubar: 'no',
                toolbar: 'no',
                status: 'yes',
                scrollbars: 'yes',
                resizable: 'yes',
                top: '',
                left: '',
                center: true
            }
            Object.extend(this.options, options || {});
            this.options.width = this.options.width < screen.availWidth ? this.options.width : screen.availWidth;
            this.options.height = this.options.height < screen.availHeight ? this.options.height : screen.availHeight;
            if (this.options.center) {
                this.options.top = (screen.height - this.options.height) / 2 ;
                this.options.left = (screen.width - this.options.width) / 2;
            }
            var openoptions = 'width=' +this.options.width+ ',height=' +this.options.height+ ',location=' +this.options.location+ ',menubar=' +this.options.menubar+ ',toolbar=' +this.options.toolbar+ ',scrollbars=' +this.options.scrollbars+ ',resizable=' +this.options.resizable+ ',status=' +this.options.status
            if (this.options.top != '') openoptions += ',top=' +this.options.top;
            if (this.options.left != '') openoptions += ',left=' +this.options.left;
            window.open(url, this.options.name, openoptions);
            return false;
        }
    }
    return Popup.open(url, options);
}

// HANDLE AJAX JSON RESPONSE
function handleResponse(transport) {
    var content = (transport.responseText).evalJSON();
    Object.keys(content.elements).each(function(item) {
        $(item).update(content['elements'][item]);
    });
    Object.keys(content.javascript).each(function(item) {
        eval( content['javascript'][item]);
    });
}
