// JavaScript Document
$(document).ready(function() {
    //    $("#find_asx").Watermark("Enter an ASX Stock Code");
    $('.text').keyup(function(){
        var searchbox = $(this).val();
        var dataString = 'searchword=' + searchbox;
        if (searchbox == ''){
        } else {
            $.ajax({
                type: "POST",
                url: "/topcompanies/search",
                data: dataString,
                cache: false,
                success: function(html){
                    $('#display_asx_search_results').html(html).show();
                }
            });
        }
        return false;
    });

    $('#trade_exits').dataTable({
        "bPaginate": true,
        "bProcessing": true,
        "bSort": false,
        "sPaginationType": "full_numbers",
        "aLengthMenu": [[10, 20, 30, 50, 100, -1], [10, 20, 30, 50, 100, "All"]],
        "iDisplayLength": 30
    });

    $('#TopCompanies').dataTable({
        "bPaginate": true,
        "bProcessing": true,
        "bSort": true,
        "sPaginationType": "full_numbers",
        "iDisplayLength": 25
    });

    $('#broadcasts').dataTable({
        "bPaginate": true,
        "bProcessing": true,
        "bSort": true,
        "sPaginationType": "full_numbers",
        "iDisplayLength": 25
    });

    $('#calendar').dataTable({
        "bPaginate": true,
        "bProcessing": true,
        "bSort": true,
        "sPaginationType": "full_numbers",
        "aaSorting": [[ 2, "desc" ]],
        "aoColumns": [null, null, {
            "asSorting": [ "desc", "asc", "asc" ]
        }],
        "iDisplayLength": 25
    });

    $("tr:nth-child(odd)").addClass("odd");
    $('.scroll').jScrollPane({
        showArrows:true
    });

    $('#dock').Fisheye({
        maxWidth: 30,
        items: 'a',
        itemsText: 'span',
        container: '.dock-container',
        itemWidth: 90,
        proximity: 100,
        halign : 'center'
    });


    $('.dock-container a').hover(function(){
        // banner = $(this).attr('title');
        //alert(banner);
        str = '<a href="' + $(this).attr('link') + '"><img src="'+ $(this).attr('banner')+'"></a>';
        $('#banner .image').html(str);
    }, function(){});


    $('#dock').hover(function(){
        $('.instr').fadeOut('fast');
        $('#hiuser').remove();
    }, function(){
        $('.instr').fadeIn('show');
    });

}).noContext();