
    $('html').addClass('js');

    /* $('.js .hidden').hide(); */

    var skin_path = 'skins/default/';


/*
    load_imgs();

    function load_imgs() {
        var imgs_loaded = [];
        imgs_loaded.push('careers');
        imgs_loaded.push('gch');
        imgs_loaded.push('hle');
        imgs_loaded.push('medicine');
        imgs_loaded.push('surgery');
        imgs_loaded.push('psychiatry');

        $(imgs_loaded).each(function() {
            var val = this;
            img = new Image();
            $(img).attr('src', skin_path+'images/covers/'+val+'.jpg');
        });
    } */


    $(function() {
        $('#previous_issues_tab').click (
            function (event) {
                var cur = $('#current_issue_box');
                var prev = $('#previous_issues_box');
                if (prev.is(':hidden')) {
                    cur.hide(0);
                    prev.show(0);
                }
                event.preventDefault();
            }
        );
        $('#current_issue_tab').click (
            function (event) {
                var cur = $('#current_issue_box');
                var prev = $('#previous_issues_box');
                if (cur.is(':hidden')) {
                    prev.hide(0);
                    cur.show(0);
                }
                event.preventDefault();
            }
        );
    });


    $(function() {
        var li = $('#main_menu > li');
        $('a', li).mouseover(function() {
            var ul = $(this).next();
            if (ul.is(':hidden'))
                ul.show(0).animate({paddingTop: "10px"}, 500);
        });
        li.mouseleave(function() {
            var ul = $('ul', this);
            if (ul.is(':visible')) {
                ul.animate({paddingTop: "0px"}, 500);
                setTimeout( function() { ul.hide(0); } , 500);
            }
        });
        $('#main_menu > li > a').click(function(e) {
            if ($(this).attr('href')=='#')
                e.preventDefault();
        });
    });



    $(function() {

        $('a.pop').click(function(event) {
            var me = $(this);
            var href = me.attr('href');
            var size = me.attr('rel');
            var follow = pop(href, 1024, 660);
            if (!follow)
                event.preventDefault();
        });

        function pop(url, width, height) {
            window.name = 'mothership';
            var options = "resizable=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,width="+width+",height="+height;
            myWin = window.open(url, "zine", options); // NO SPACES IN NAME!! - IE errors
            if (myWin) {
                return false;
            }
            return true;
        }
    });



    $(function() {

        var areas = $('#star_map area');
        var cover = $('#cover_box');
        var pre = 'shape_';

        if (0 < areas.length) {
            areas.mouseover(function(e) {
                var name = $(this).attr('id').substr(pre.length);
                $('#cover_box img:not(#cover_'+name+')').hide(0);
                $('#cover_'+name).show(0);

                //$('#cover_box a').html('<img height="565" width="400" id="splash_cover" src="'+skin_path+'images/covers/'+name+'.jpg"/>');
                //cover.attr('src', skin_path+'images/covers/'+name+'.jpg');
            });
            areas.mouseout(function(e) {
                $('#cover_box img:not(#cover_home)').hide(0);
                $('#cover_home').show(0);
                //cover.attr('src', skin_path+'images/covers/cover.jpg');
            });
        }
    });





    $(function () {
        var ads1 = $('#adbox_top img');
        if (1 < ads1.length) {
            var wait = $('#adbox_top img:not(:hidden)').parent().attr('rel');
            setTimeout(function() { advert_cycle(ads1, 0); }, wait*1000);
        }

        var ads2 = $('#adbox_sky img');
        if (1 < ads2.length) {
            wait = $('#adbox_sky img:not(:hidden)').parent().attr('rel');
            setTimeout(function() { advert_cycle(ads2, 0); }, wait*1000);
        }

        function advert_cycle(ads, idx, advert_timeout) {
            $(ads.get(idx)).fadeOut(1000);
            idx++;
            if (!(idx < ads.length)) {
                idx = 0;
            }
            setTimeout(function() { $(ads.get(idx)).fadeIn(1000); }, 1000);
            var time = $(ads.get(idx)).parent().attr('rel');
            setTimeout(function() { advert_cycle(ads, idx); }, time*1000);
        }

    });




