﻿function getCONTENT(strlink, div) {

    var agt = navigator.userAgent.toLowerCase();
    var is_ie = (agt.indexOf('msie') != -1);
    var is_ie5 = (agt.indexOf('msie 5') != -1);

    function handle_do_search() {
        if (xmlhttp.readyState == 4)//request completed
        {
            if (xmlhttp.status == 200)//request successful
            {
               document.getElementById(div).innerHTML = xmlhttp.responseText;
            }
            else {
                //alert('request failed: ' + xmlhttp.status);
            }
        }
    }

    var xmlhttp = null;

    if (is_ie) {
        var control = (is_ie5) ? "Microsoft.XMLHTTP" : "Msxml2.XMLHTTP";
        try {
            xmlhttp = new ActiveXObject(control);
            xmlhttp.onreadystatechange = handle_do_search;
        }
        catch (e) {
            alert("You need to enable active scripting and activeX controls");
        }
    }
    else {
        xmlhttp = new XMLHttpRequest();
        xmlhttp.onload = handle_do_search;
        xmlhttp.onerror = handle_do_search;
    }
    //alert('http://' + window.location.host + strlink);
    xmlhttp.open('GET', "http://" + window.location.host + strlink , true);
    xmlhttp.send(null);
}

function sendMailTo(name, company, domain) {
    locationstring = 'mai' + 'lto:' + name + '@' + company + '.' + domain;
    window.location.replace(locationstring);
}

function setNLcookie() {
    var theDate = new Date();
    var oneYearLater = new Date(theDate.getTime() + 315360000000);
    //alert(oneYearLater.toGMTString());
    document.cookie = "NL=1; path=/; expires=" + oneYearLater.toGMTString() + ";";
   
}

function checkNL() {
    NLcookie = getCookie('NL');
    if (NLcookie == "1") {
        document.getElementById('NLbutton').style.display = 'none';
        //alert("xxx");
    }
}

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 killNLcookie() {
    document.cookie = "NL=1; path=/; expires=Thu, 01-Jan-1970 00:00:01 GMT;";
}
