﻿//document.getElementById('ugSector').checked = true;

function checkAction(def_formaction) {
    if (document.forms[0].elements["sector"].value == "UG")
        document.forms[0].action = def_formaction;
}

function AjaxGetData(url, responseHandler) {
    if (window.XMLHttpRequest) {
        // browser has native support for XMLHttpRequest object
        req = new XMLHttpRequest();
    }
    else if (window.ActiveXObject) {
        // try XMLHTTP ActiveX (Internet Explorer) version
        req = new ActiveXObject("Microsoft.XMLHTTP");
    }

    if (req) {
        req.onreadystatechange = responseHandler;
        req.open('GET', url, true);
        req.setRequestHeader("content-type", "application/x-www-form-urlencoded");
        req.send('');
    }
    else {
        alert('Your browser does not seem to support XMLHttpRequest.');
    }
}

function retHandler(reg) {
    var nop = true;
}

function SetTracking(Sector, PartnerID, sessid, actid, DestinationURL, Position, ContentType, ContentID, FilterName) {
    var sActivityID = actid;
    if (ContentType == 'ARTICLE') {

        sActivityID = actid + ' , 10008';
    }
    if (ContentType == 'SCHOLARSHIP') {

        sActivityID = actid + ' , 10009';
    }
    var url = DestinationURL;
    var QString = '';

    if (Sector != null) QString = QString + '&Sector=' + Sector;
    if (PartnerID != null) QString = QString + '&PartnerID=' + PartnerID;
    if (DestinationURL != null) QString = QString + '&DestinationURL=' + DestinationURL;
    if (Position != null) QString = QString + '&Position=' + Position;
    if (ContentType != null) QString = QString + '&ContentType=' + ContentType;
    if (ContentID != null) QString = QString + '&ContentID=' + ContentID;
    if (FilterName != null) QString = QString + '&FilterName=' + FilterName;

    AjaxGetData('UsageLog.ashx?ActivityID=' + sActivityID + '&SessionID=' + sessid + QString, retHandler);
    // window.location = url ;
    return false;
}

//$(document).ready(function() {
//    $("#nav-one li").hover(
//				function() { $("ul", this).fadeIn("fast"); },
//				function() { }
//			);
//    if (document.all) {
//        $("#nav-one li").hoverClass("sfHover");
//    }
//});

//$.fn.hoverClass = function(c) {
//    return this.each(function() {
//        $(this).hover(
//					function() { $(this).addClass(c); },
//					function() { $(this).removeClass(c); }
//				);
//    });
//};

