document.observe('dom:loaded', function(){

    //table hover functions
    $$('#main-list tbody tr').each(function(item) {
        item.observe('mouseover', function() {
            item.addClassName("hover");
        });
        item.observe('mouseout', function() {
            item.removeClassName("hover");
        });
    });

    //Highlight quotes
    $$('blockquote').each(function(item) {
        item.observe('mouseover', function() {
            item.addClassName("highlight");
        });
        item.observe('mouseout', function() {
            item.removeClassName("highlight");
        });
    });

});

document.observe('dom:changed', function(){

    //table hover functions
    $$('#main-list tbody tr').each(function(item) {
        item.observe('mouseover', function() {
            item.addClassName("hover");
        });
        item.observe('mouseout', function() {
            item.removeClassName("hover");
        });
    });

});

if($('pay-now'))
{
    $('pay-now').observe('click', handlePaymentButton('pay-now',false));
}



function respondToClick(event) {
    var element = event.element();
    element.addClassName('active');
}

function showInstructor(id,search,quickSearch)
{
    window.location = "/instructor-details/" + id + "/" + search + "/" + quickSearch;
}

function switchButton(button)
{
    var theButton = $(button);
    if(theButton.disabled)
    {
        theButton.disabled = false;
    }
    else
    {
        theButton.disabled = true;
    }
}

function handlePaymentButton(button,func)
{
    var theButton = $(button);
    if(func == true)
    {
        theButton.innerHTML = "Pay now"
        theButton.disabled = false;
    }
    else
    {
        theButton.innerHTML = "Please wait..."
        theButton.disabled = true;
    }
}
