
/* Primary Menu control */
(function ($) { $.fn.hoverIntent = function (f, g) { var cfg = { sensitivity: 7, interval: 100, timeout: 0 }; cfg = $.extend(cfg, g ? { over: f, out: g} : f); var cX, cY, pX, pY; var track = function (ev) { cX = ev.pageX; cY = ev.pageY; }; var compare = function (ev, ob) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); if ((Math.abs(pX - cX) + Math.abs(pY - cY)) < cfg.sensitivity) { $(ob).unbind("mousemove", track); ob.hoverIntent_s = 1; return cfg.over.apply(ob, [ev]); } else { pX = cX; pY = cY; ob.hoverIntent_t = setTimeout(function () { compare(ev, ob); }, cfg.interval); } }; var delay = function (ev, ob) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); ob.hoverIntent_s = 0; return cfg.out.apply(ob, [ev]); }; var handleHover = function (e) { var p = (e.type == "mouseover" ? e.fromElement : e.toElement) || e.relatedTarget; while (p && p != this) { try { p = p.parentNode; } catch (e) { p = this; } } if (p == this) { return false; } var ev = jQuery.extend({}, e); var ob = this; if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); } if (e.type == "mouseover") { pX = ev.pageX; pY = ev.pageY; $(ob).bind("mousemove", track); if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout(function () { compare(ev, ob); }, cfg.interval); } } else { $(ob).unbind("mousemove", track); if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout(function () { delay(ev, ob); }, cfg.timeout); } } }; return this.mouseover(handleHover).mouseout(handleHover); }; })(jQuery);
var autoAdvance = false;



// SET JAVASCRIPT FOR CHAT WINDOW TRIGGERS
$(document).ready(function () {

    $('.chatTrigger')
    	.attr("title", "Chat Live")
        .css("cursor", "pointer")
	    .click(function () {
	        openPopup('http://server.iad.liveperson.net/hc/11719988/?cmd=file&file=visitorWantsToChat&site=11719988&SESSIONVAR!skill=Argosy%20University&SESSIONVAR!AlreadyInquired=no&imageUrl=http://www.argosy.edu/images/liveperson/redesign&referrer=' + escape(document.location), 'chat11719988', '490', '380', '');
	        return false;
	    });

    $('.appointmentSetTrigger')
    	.attr("title", "Schedule an Appointment")
        .css("cursor", "pointer")
	    .click(function () {
	        openPopup('https://www.securedata-trans16.com/ap/educationmangement/index.php?page=10', 'AppointmentSet', '800', '650', '');
	        return false;
	    });

    $('.getACallBackTrigger')
    	.attr("title", "Let Us Call You")
        .css("cursor", "pointer")
	    .click(function () {
	        openPopup('http://server.iad.liveperson.net/hc/11719988/?cmd=file&file=visitorWantsToTalk&site=11719988&byhref=1&oursite=argosy&SESSIONVAR!skill=Argosy%20University&SESSIONVAR!AlreadyInquired=NO&' + escape(document.location), 'CallBack', '470', '360', '');
	        return false;
	    });




    //This function will hide any empty table cells generated by the datalist in the primary navigation sub nav
    $("table.primary-sub-menu-table tr td").each(function () {
        if ($.trim($(this).html()) == "")
            $(this).css("visibility", "hidden");
    });

    $('.dropdown').hide();

    $('[class^=listPrimaryNav]').each(function () {
        $(this).hoverIntent({
            timeout: 100,
            over: function () {
                var current = $(this).find('div.dropdown:eq(0)', this);
                current.slideDown(350);
            },
            out: function () {
                var current = $(this).find('div.dropdown:eq(0)', this);
                current.fadeOut(400);
            }
        });
    });

    //This is the manual closer for the Primary nav dropdown.  May need to modify the 'parent().parent()' depending on final html
    $('.open-radwindow')
	    .click(function () {
	        var windowname = $(this).attr("rel");
	        if (windowname != '') {
	            openRadWindow(windowname);
	        }
	        return false;
	    });

    $(".open-location-radwindow-disabled")
	    .click(function () {
	        var windowname = 'radWindowLocations';
	        if (windowname != '') {
	            openRadWindow(windowname);
	        }
	        return false;
	    });


    $('a.dropdown-closer-link')
	.html("")
	.attr("title", "Close")
	.click(function () {
	    $('.dropdown').fadeOut(600);
	    return false;
	});

    //This is the news and events summary slide toggle
    $('a.toggle-news-summary')
	.attr("title", "show/hide summary")
	.click(function () {
	    //Hide all currently opened ones
	    $('.divNewsItem div.news-summary').fadeOut(600);
	    var detailDiv = $(this).parent('.divNewsItem').find('div.news-summary');
	    detailDiv.fadeIn(600);
	    return false;
	});

});




