
$(document).ready(function()
{
    $('#as_pas_vis_label').hide();
    $('#as_login_label').hide();
    
    $('table.compas_table tbody tr').hover(function(){
        $(this).addClass('table_str_hover');
    },function(){
        $(this).removeClass('table_str_hover');
    });
    if($('.tooltip').length)
    {
        $('.tooltip').each(function()
        {
            $(this).astooltip(
            {
                content:$(this).next('div.tooltip_text').html(),
                left:-20,
                top:0
            });
        });
    }

    if($('#as_login_label').length)
    {
        var intervalID;
        
        $('#as_login_label').click(function()
        {
            $(this).hide();
        });
        $('#as_login_id').focus(function()
        {
            $('#as_login_label').click();
            intervalID=setInterval(function(){$('#as_pas_vis').change();}, 100);
        });
        $('#as_login_id').blur(function()
        {
            if($.trim($('#as_login_id').val())=='')
            {
                $('#as_login_label').show();
            }
            clearInterval(intervalID);
        })
        if($.trim($('#as_login_id').val())!='')
        {
            $('#as_login_label').hide();
        }
        
    }
    if($('#as_pas_vis_label').length)
    {
        $('#as_pas_vis_label').click(function()
        {
            $(this).hide();
        });
        $('#as_pas_vis').focus(function()
        {
            $('#as_pas_vis_label').click();
        });
        $('#as_pas_vis').blur(function()
        {
            if($.trim($('#as_pas_vis').val())=='')
            {
                $('#as_pas_vis_label').show();
            }
        });
        if($.trim($('#as_pas_vis').val())!='')
        {
            $('#as_pas_vis_label').hide();
        }
        $('#as_pas_vis').change(function()
        {
            if($.trim($('#as_pas_vis').val())!='')
            {
                $('#as_pas_vis_label').hide();
            }
            else
            {
                $('#as_pas_vis_label').show();
            }
        });
    }
    
    $(window).load(function()
    {
        if($.trim($('#as_pas_vis').val())!='')
        {
            $('#as_pas_vis_label').hide();
        }
        else
        {
            $('#as_pas_vis_label').show();
        }
        if($.trim($('#as_login_id').val())!='')
        {
            $('#as_login_label').hide();
        }
        else
        {
            $('#as_login_label').show();
        }
    });
});

function paytype(path,formid)
{
    window.location=path+'?formid='+formid+'&'+$('#'+formid).formSerialize();
    return;
}
