/* jSelect (using jQuery library).
*--------------------------------------------*
*  @author : ukhome ( ukhome@gmail.com | ntkhoa_friends@yahoo.com )
*--------------------------------------------*
*  @released : 24-Mar-2009 : version 1.0
*--------------------------------------------*
*  @revision history : ( latest version : 1.0 )
*--------------------------------------------*
*      + 24-Mar-2009 : version 1.0
*          - released
*--------------------------------------------*
*/

/* External Interface
*/

function callExternalFunction(o/*caller*/, droplists/*all droplists*/, val/*rel in <a>*/) {
    /*
    * o : selectUI object
    *   o.select : <select> in jQuery type
    *   o.elUL : list drop down, main list <ul>
    *----------------------------------------------*
    * droplists : all selectUI droplists in page, call by its id droplists(id), will return selectUI object
    * val : rel value in a of each selectUI option
    */

    //o.select.attr("id") <-- check current select id

}

function callExternalBeforeFunction(o) {
    //modification via js pour ne pas "casser" le fonctionnement du plugin

    if (o.elUL.attr("offsetHeight") >= o.config.maxDropListHeight) {

        var delta = ($.browser.msie && $.browser.version == "6.0")
				? 11 :
				($.browser.msie && $.browser.version == "8.0") ? 2 :
					($.browser.msie && $.browser.version == "7.0") ? 10 : 3

        var w = $(o.elUL.get(0).childNodes[0]).width() - delta;

        if (w) {
            o.elUL.css("width", w + "px");
            o.elUL.css("height", (o.el.height() - 10) + "px");
            o.elUL.css("overflowY", "scroll");
            o.elUL.css("overflowX", "hidden");
            o.elUL.parent().css("paddingBottom", "30px");
            o.elUL.bind("scroll", function(e) {
                e.preventDefault(e);
                e.stopImmediatePropagation(e);
            });

        }
    }
}
