﻿$(function() {
    $('.news-container').vTicker();
});

var mar = 0;
var pad = 0;

if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) { //test for MSIE x.x;
    var ieversion = new Number(RegExp.$1) // capture x.x portion and store as a number
    
    if (ieversion == 7)
    mar = 10;
    pad = 7;
}

(function() {
    $.fn.vTicker = function(options) {
        var defaults = {
            speed: 4000,
            pause: 6000,
            showItems: 4,
            animation: '',
            mousePause: false
        };

        var options = $.extend(defaults, options);

        moveUp = function(obj, height) {
            obj = obj.children('ul');
            first = obj.children('li:first').clone(true);

            obj.animate({ top: '-=' + height + 'px' }, options.speed, function() {
                $(this).children('li:first').remove();
                $(this).css('top', '0px');
            });

            if (options.animation == 'fade') {
                obj.children('li:first').fadeOut(options.speed);
                obj.children('li:last').hide().fadeIn(options.speed);
            }

            first.appendTo(obj);
        };

        return this.each(function() {
            obj = $(this);
            maxHeight = 95;

            obj.css({ overflow: 'hidden', position: 'relative' })
			.children('ul').css({ position: 'absolute', margin: mar, padding: pad })
			.children('li').css({ margin: 0, padding: 0 });

            obj.children('ul').children('li').each(function() {
                if ($(this).height() > maxHeight) {
                    maxHeight = 95;
                }
            });

            obj.children('ul').children('li').each(function() {
                $(this).height(maxHeight);
            });

            obj.height(maxHeight * 2);

            interval = setInterval('moveUp(obj, maxHeight)', options.pause);

            if (options.mousePause) {
                obj.bind("mouseenter", function() {
                    clearInterval(interval);
                }).bind("mouseleave", function() {
                    interval = setInterval('moveUp(obj, maxHeight)', options.pause);
                });
            }
        });
    };
})(jQuery);



function load(sessionID) {
    var load = window.open('FullPage.aspx?pageID=null&type=graduates&sessionID=' + sessionID, '', 'scrollbars=no,menubar=no,height=600,width=400,resizable=yes,toolbar=no,location=no,status=no');
}


