var interval=0;
var active = "";
var next = "";
foo = new Object();
foo.activeIndex=0;

$(document).ready(function(){
    $("#adminform > fieldset").addClass("collapsible");
    $("#datagrid > table").attr("cellspacing","1");
    $("#datagrid tbody tr:odd").addClass("odd");
    $("#datagrid tbody tr:even").addClass("even");
    $('textarea,input').focus(function(){
        if($(this).hasClass('text')){
            $(this).addClass('focus');
        };
    });
    $('textarea,input').blur(function(){
        if($(this).hasClass('text') && $(this).hasClass('focus')){
            $(this).removeClass('focus');
        };
    });
    $("#datagrid > table > thead > tr > th").click(function(){
        var foo = $(this).find("a").attr("href");
        if(!(typeof foo=='undefined')){
            window.location.href=foo;
        }
    });
    $("#datagrid > table > tbody > tr > td").mouseover(function(){
        $(this).parent().addClass('row-over');
    });
    $("#datagrid > table > tbody > tr > td").mouseout(function(){
        $(this).parent().removeClass('row-over');
    });
    $("#datagrid > table > thead > tr > th").mouseover(function(){
        var foo = $(this).find("a").attr("href");
        if(!(typeof foo=='undefined')){
            $(this).addClass('hover');
        }
    });
    $("#datagrid > table > thead > tr > th").mouseout(function(){
        if($(this).hasClass('hover')){
            $(this).removeClass('hover');
        }
    });
    $("#data-rows-body tr td:last-child").css('width','90px');
    $(".close-parent").click(function(){
        $(this).parentNode.css('opacity',1).animate({opacity: 0.0}, 1000).hide();
    });
    $("input:submit").attr("id","submit");

    $("a[href$='jpg'], a[href$='png'], a[href$='gif'], a[href$='jpeg'], a[href$='bmp'], a[href$='JPG'], a[href$='PNG'], a[href$='GIF'], a[href$='JPEG'], a[href$='BMP'], .lightbox, .shadowbox").each(function(){
        var rel = $(this).attr('rel');
        if(rel=='undefined' || rel=='' || rel==null){
            $(this).attr('rel', 'shadowbox');
        }
    });

});

$(document).ready(function(){
    $("a, span, div").hoverbox();
    $('.target').attr('target','_blank');
    $('.hand').css('cursor','pointer');
    
    $('input.field-code').alpha({nocaps:true,allow:"_"});
    $('input.system-code').alpha({nocaps:true,allow:"-_"});
    $('input.url-alias-code').alphanumeric({nocaps:true,allow:"-_,/"});
    $('input.url-path').alphanumeric({nocaps:true,allow:"-_,/"});
    $('input.numeric').numeric();
});
//----------

