declare var Tipped: Tipped.ITipped;

declare module Tipped {

    type position = "topleft" | "top" | "topright" | "righttop" | "right" | "rightbottom" | "bottomleft" | "bottom" | "bottomright" | "lefttop" | "left" | "leftbottom" | string;

    interface ITipped {
        clearAjaxCache();
        create(handle: string | HTMLElement | JQuery);
        create(handle: string | HTMLElement | JQuery, text: string | HTMLElement | JQuery);
        create(handle: string | HTMLElement | JQuery, text: string | HTMLElement | JQuery, options: ITippedOptions);
        delegate(cssSelector: string, options: any);
        disable(handle: string | HTMLElement | JQuery);
        enable(handle: string | HTMLElement | JQuery);
        findElement(handle: string | HTMLElement): HTMLElement;
        get(handle: string | HTMLElement): Array;
        remove(handle: string | HTMLElement | JQuery);
        hide(handle: string | HTMLElement | JQuery);
        hideAll();
        init();
        refresh(handle: string | HTMLElement);
        remove(handle: string | HTMLElement);
        setDefaultSkin(name: string);
        setStartingZIndex(zIndex: number);
        show(handle: string | HTMLElement | JQuery);
        toggle(handle: string | HTMLElement);
        undelegate(cssSelector: string);
        visible(handle?: string | HTMLElement);
        Skins: any;
    }

    interface ITippedOptions {
        afterHide?: (content: HTMLElement, element: HTMLElement) => void;
        afterUpdate?: (content: HTMLElement, element: HTMLElement) => void;
        ajax?: JQueryAjaxSettings,
        behavior?: "hide" | "mouse" | "sticky";
        cache?: boolean;
        container?: JQuery | string;
        containment?: boolean;
        close?: boolean;
        detach?: boolean;
        fadeIn?: number;
        fadeOut?: number;
        fixed?: boolean;
        hideAfter?: number;
        hideDelay?: number;
        hideOn?: "click" | "click-outside" | "mouseleave" | "mouseenter" | boolean;
        hideOnClickOutside?: boolean;
        hideOthers?: boolean;
        inline?: string;
        maxWidth?: number;
        offset?: { x?: number, y?: number };
        onShow?: (content: HTMLElement, element: HTMLElement) => void;
        padding?: boolean;
        position?: position | { target: position, tooltip: position };
        radius?: boolean;
        shadow?: boolean;
        showDelay?: number;
        showOn?: "click" | "mouseleave" | "mouseenter" | boolean;
        size?: "x-small" | "small" | "medium" | "large";
        skin?: string;
        stem?: boolean;
        spinner?: boolean;
        target?: "element" | "mouse" | HTMLElement;
        title?: string;
        voila?: boolean;
        zIndex?: number;
    }

}