﻿var targetURL;

function BannerClick(oLink,sBannerID,sSiteID,sDate){
    var xmlHttp;
    try {xmlHttp=new XMLHttpRequest();}  // Firefox, Opera 8.0+, Safari
    catch (e){
        // Internet Explorer
        try {xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
        catch (e){
            xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
    }
    if (xmlHttp==null) return true;  // Browser does not support AJAX, so return TRUE to continue to HREF

    targetURL = oLink.href;
    url = '/BannerClick.asp?id='+sBannerID+'&SiteID='+sSiteID+'&date='+encodeURIComponent(sDate)+'&sid='+Math.random();
    // commented out because pop-up blockers stop this from opening; going to use _blank instead
    //xmlHttp.onreadystatechange = function() { 
    //   if (xmlHttp.readyState == 4) {
    //        var newWindow = window.open(targetURL, '_blank');
    //        newWindow.focus();
    //    }
    //};
    xmlHttp.open('GET', url, true);
    xmlHttp.send(null);
    //return false;
}
