// JScript File

// This function calls the Web service method
// passing simple type parameters and the
// callback function
function HelloWorld() {
    Site.WebService.UsageTracker.HelloWorld(SucceededCallback);
}

// This is the callback function invoked if the Web service
// succeeded.
// It accepts the result object as a parameter.
function SucceededCallback(result, eventArgs) {
    alert(result);
}

function LogUsageTransaction(siteName,
                             httpXForwardedFor,
                             clientIPAddress,
                             clientUserName,
                             requestMethod,
                             sessionID,
                             paramName1, paramValue1, paramName2, paramValue2, paramName3, paramValue3,
                             paramName4, paramValue4, paramName5, paramValue5) {
    var SiteName = siteName ? siteName : "";
    var SiteIPAddress = "NA";
    var SitePort = window.location.port ? window.location.port : "80";
    var ClientIPAddress = httpXForwardedFor ? httpXForwardedFor : (clientIPAddress ? clientIPAddress : "");
    var ClientUserName = clientUserName ? clientUserName : "Anonymous";
    var ClientUserAgent = navigator.userAgent;
    var RequestURL = window.location.pathname;
    var RequestMethod = requestMethod ? requestMethod : "";
    var RequestQueryString = window.location.search;
    var SessionID = sessionID ? sessionID : "";
    var ParamName1 = paramName1 ? paramName1 : "";
    var ParamValue1 = paramValue1 ? paramValue1 : "";
    var ParamName2 = paramName2 ? paramName2 : "";
    var ParamValue2 = paramValue2 ? paramValue2 : "";
    var ParamName3 = paramName3 ? paramName3 : "";
    var ParamValue3 = paramValue3 ? paramValue3 : "";
    var ParamName4 = paramName4 ? paramName4 : "";
    var ParamValue4 = paramValue4 ? paramValue4 : "";
    var ParamName5 = paramName5 ? paramName5 : "";
    var ParamValue5 = paramValue5 ? paramValue5 : "";
    var ParentTransactionID = getCookie("PreviousPageID");

    //    alert('SiteName = ' + SiteName + '\n' +
    //          'SiteIPAddress = ' + SiteIPAddress + '\n' +
    //          'SitePort = ' + SitePort + '\n' +
    //          'ClientIPAddress = ' + ClientIPAddress + '\n' +
    //          'ClientUserName = ' + ClientUserName + '\n' +
    //          'ClientUserAgent = ' + ClientUserAgent + '\n' +
    //          'RequestURL = ' + RequestURL + '\n' +
    //          'RequestMethod = ' + RequestMethod + '\n' +
    //          'RequestQueryString = ' + RequestQueryString + '\n' +
    //          'SessionID = ' + SessionID + '\n' +
    //          'ParamName1 = ' + ParamName1 + '\n' +
    //          'ParamValue1 = ' + ParamValue1 + '\n' +
    //          'ParamName2 = ' + ParamName2 + '\n' +
    //          'ParamValue2 = ' + ParamValue2 + '\n' +
    //          'ParamName3 = ' + ParamName3 + '\n' +
    //          'ParamValue3 = ' + ParamValue3 + '\n' +
    //          'ParamName4 = ' + ParamName4 + '\n' +
    //          'ParamValue4 = ' + ParamValue4 + '\n' +
    //          'ParamName5 = ' + ParamName5 + '\n' +
    //          'ParamValue5 = ' + ParamValue5 + '\n' +
    //          'ParentTransactionID = ' + ParentTransactionID + '\n');

    Site.WebService.UsageTracker.LogUsageTransaction(SiteName, SiteIPAddress, SitePort,
                                             ClientIPAddress, ClientUserName, ClientUserAgent,
                                             RequestURL, RequestMethod, RequestQueryString, SessionID,
                                             ParamName1, ParamValue1, ParamName2, ParamValue2,
                                             ParamName3, ParamValue3, ParamName4, ParamValue4,
                                             ParamName5, ParamValue5, ParentTransactionID, SucceededLogTransaction);
}


// This is the callback function invoked if the Web service
// succeeded.
// It accepts the result object as a parameter.
function SucceededLogTransaction(result, eventArgs) {
    setCookie("PreviousPageID", result, null);
}


function setCookie(c_name, value, expiredays) {
    var exdate = new Date(); exdate.setDate(exdate.getDate() + expiredays);
    document.cookie = c_name + "=" + escape(value) +
    ((expiredays == null) ? "" : ";expires=" + exdate.toGMTString());
}

function getCookie(c_name) {
    if (document.cookie.length > 0) {
        c_start = document.cookie.indexOf(c_name + "=");
        if (c_start != -1) {
            c_start = c_start + c_name.length + 1;
            c_end = document.cookie.indexOf(";", c_start);
            if (c_end == -1) c_end = document.cookie.length;
            return unescape(document.cookie.substring(c_start, c_end));
        }
    }
    return "";
}

$(function() {
    $.fn.maphilight.defaults = {
        fill: true,
        fillColor: '5B003D',
        fillOpacity: .75,
        stroke: false,
        fade: true,
        alwaysOn: false,
        neverOn: false,
        groupBy: false
    }
    $('.USAImageMap').maphilight();
});

$(document).ready(function() {
    //setup new person dialog
    $('#popuphumalog').dialog({
    autoOpen: false,
    draggable: true,
    resizable: false,
    zIndex: 9999,
    width: 530,
    modal: true
        
    });

});
function showDialog() {
    $('#popuphumalog').dialog("open");
}
function closeDialog() {
    $('#popuphumalog').dialog("close");
}
function interstitialpopup(Url) {
    var modpopup = window.showModalDialog('popup.aspx?ShowUrl=' + Url, null, 'dialogWidth:426px; dialogHeight:290px; center:yes');
    return modpopup;
}

    

