$(document).ready(function() {
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);


function EndRequestHandler(sender, args) {
        if (args.get_error() == undefined) AttachToolTip();
    }

    function AttachToolTip() {
        $(document).ready(function() {

            jQuery.each($('.TableDest tr td[bgcolor=#315490]'), function() {
                $(this).attr("style","cursor:pointer");
                var DepDate = $(this).attr('DepDate');
                var ProdLen = $(this).attr('ProdLen');
                var DestName = $(this).attr('DestName');
                var ItinDesc = $(this).attr('ItinDesc');
                var DepPort = $(this).attr('DepPort');
                var ShipName = $(this).attr('ShipName');
                var CruiseId = $(this).attr('CruiseId');
                var ShipCode = $(this).attr('ShipCode');
                var myHeight;
                myHeight = $("#tip_div").height();
                $(this).tooltip({
                    tip: '#tip_div',
                    position: 'center right',
                    
                    offset: [-((myHeight/2)+($(this).height()/2)+3), 0],
                    lazy: true,
                    delay: 150,

                    onBeforeShow: function() {
                        $('#ToolTip_DepDate')[0].firstChild.nodeValue = DepDate;
                        $('#ToolTip_ProdLen')[0].firstChild.nodeValue = ProdLen;
                        $('#ToolTip_DestName')[0].firstChild.nodeValue = DestName;
                        $('#ToolTip_ItinDesc')[0].firstChild.nodeValue = ItinDesc;
                        $('#ToolTip_DepPort')[0].firstChild.nodeValue = DepPort;
                        $('#ToolTip_ShipName')[0].firstChild.nodeValue = ShipName;

                        $('#cruise_id').val(CruiseId);                    
                        $('#ship_code').val(ShipCode);
                    }

                });

            });
        });
    }

    AttachToolTip();                
    
    });