/**
* @Source : http://ip-lookup.net/
*/

function $searchByID(id) {
    return document.getElementById(id)
}
function cursor(i) {
    //document.body.style.cursor = (i == 1 ? "wait" : "default")
}
function get_lan_address() {
    cursor(1);
    $searchByID("lan_address").innerHTML = '<img src="/images/loading.gif" height="16" width="16" alt="" />';
    $searchByID("lan_address_applet").innerHTML = '<applet code="MyAddress.class" mayscript="true" width="0" height="0">' + '<param name="status" value="" />' + '<param name="call" value="set_lan_address" />' + "</applet>";

	return false;
}
function set_lan_address(IP) {
    cursor(0);
    $searchByID("lan_address").innerHTML =  IP;
}


/*function set_favorite() {
    if (navigator.appVersion.indexOf("Mac", 0) > 0) {
        alert("This function is not available on Macintosh. Use instead the key combination Apple-D.");
        return
    }
    if ((navigator.appName.indexOf("Microsoft", 0) >= 0) && (parseInt(navigator.appVersion) >= 4)) {
        window.external.AddFavorite("http://www.ip-lookup.net/", "IP-Lookup")
    } else {
        alert("This function is only available on Internet Explorer. For Netscape, you can use instead the key combination Control-D.")
    }
    return false
}
function show_form_single_IP() {
    $searchByID("form_single_IP").style.display = "block";
    $searchByID("form_multi_IP").style.display = "none";
    $searchByID("ip").focus();
    $searchByID("ip").value += "";
    return false
}
function show_form_multi_IP() {
    $searchByID("form_single_IP").style.display = "none";
    $searchByID("form_multi_IP").style.display = "block";
    $searchByID("ips").focus();
    $searchByID("ips").value += "";
    return false
}
function exec_remote_script(iIP, iDomain, iHost, iKey, iAction) {
    $searchByID("rs_IP").value = iIP;
    $searchByID("rs_domain").value = iDomain;
    $searchByID("rs_host").value = iHost;
    $searchByID("rs_key").value = iKey;
    document.forms["rs_form"].action = iAction;
    document.forms["rs_form"].submit();
    return false
}
var iTimer;

function get_information(iIP, iKey) {
    cursor(1);
    show_record("information", iKey, "Address information", true);
    iTimer = setTimeout("cancel_record('information'," + iKey + ")", 10000);
    return exec_remote_script(iIP, "", "", iKey, "rs-information.php")
}
function get_conversion(iIP, iKey) {
    cursor(1);
    show_record("conversion", iKey, "Conversions (IPv4 / IPv6)", true);
    iTimer = setTimeout("cancel_record('conversion'," + iKey + ")", 10000);
    return exec_remote_script(iIP, "", "", iKey, "rs-conversion.php")
}
function get_ping(iIP, iKey) {
    cursor(1);
    show_record("ping", iKey, "Ping result", true);
    iTimer = setTimeout("cancel_record('ping'," + iKey + ")", 20000);
    return exec_remote_script(iIP, "", "", iKey, "rs-ping.php")
}
function get_local_ip(iKey) {
    cursor(1);
    show_record("local_IP", iKey, "Local IP adresses", true);
    iTimer = setTimeout("cancel_record('local_IP'," + iKey + ")", 10000);
    return exec_remote_script("", "", "", iKey, "rs-local-ip.php")
}
function get_related(iIP, iDomain, iHost, iKey) {
    cursor(1);
    show_record("related", iKey, "Related IP adresses", true);
    iTimer = setTimeout("cancel_record('related'," + iKey + ")", 10000);
    return exec_remote_script(iIP, iDomain, iHost, iKey, "rs-related.php")
}
function get_whois_ip(iIP, iKey) {
    cursor(1);
    show_record("whois_IP", iKey, "IP owner info (Whois)", true);
    iTimer = setTimeout("cancel_record('whois_IP'," + iKey + ")", 10000);
    return exec_remote_script(iIP, "", "", iKey, "rs-whois-ip.php")
}
function get_whois(iDomain, iKey) {
    cursor(1);
    show_record("whois", iKey, "Domain owner info (Whois / Abuse)", true);
    iTimer = setTimeout("cancel_record('whois'," + iKey + ")", 10000);
    return exec_remote_script("", iDomain, "", iKey, "rs-whois.php")
}
function hide_information(iKey) {
    cursor(0);
    show_record("information", iKey, "Address information", false);
    return false
}
function hide_conversion(iKey) {
    cursor(0);
    show_record("conversion", iKey, "Conversions (IPv4 / IPv6)", false);
    return false
}
function hide_ping(iKey) {
    cursor(0);
    show_record("ping", iKey, "Ping result", false);
    return false
}
function hide_local_ip(iKey) {
    cursor(0);
    show_record("local_IP", iKey, "Local IP adresses", false);
    return false
}
function hide_related(iKey) {
    cursor(0);
    show_record("related", iKey, "Related IP adresses", false);
    return false
}
function hide_whois_ip(iKey) {
    cursor(0);
    show_record("whois_IP", iKey, "IP owner info (Whois)", false);
    return false
}
function hide_whois(iKey) {
    cursor(0);
    show_record("whois", iKey, "Domain owner info (Whois / Abuse)", false);
    return false
}
function cancel_record(iName, iKey) {
    cursor(0);
    $searchByID(iName + "_body_" + iKey).innerHTML = '<span class="red"><b>No response !...</b></span><br />&nbsp;'
}
function show_record(iName, iKey, iCaption, iDisplay) {
    $searchByID(iName + "_body_" + iKey).style.display = (iDisplay ? "block" : "none");
    $searchByID(iName + "_header_" + iKey).style.display = "block";
    $searchByID(iName + "_header_" + iKey).innerHTML = '&nbsp;<img src="/img/' + (iDisplay ? "" : "un") + 'fold.gif" width="16" height="13" alt="" title="' + (iDisplay ? "" : "Un") + 'fold..." />&nbsp; &nbsp;<a href="#" onclick="return show_record(' + "'" + iName + "'," + iKey + ',' + "'" + iCaption + "'," + (iDisplay ? false : true) + ',false);">' + iCaption + "</a>";
    return false
}
function clear_timeout() {
    clearTimeout(iTimer)
}
function popup(iURL, iHeight, iWidth, iFluid, iStatus) {
    var sFluid = (iFluid ? "yes" : "no");
    var sStatus = (iStatus ? "yes" : "no");
    var l = parseInt((screen.width - iWidth) / 2);
    var t = parseInt((screen.height - iHeight) / 2);
    var iWin = window.open(iURL, "popup", "dependent,height=" + iHeight + ",width=" + iWidth + ",left=" + l + ",top=" + t + ",toolbar=no,menubar=no,scrollbars=" + sFluid + ",resizable=" + sFluid + ",location=no,directories=no,status=" + sStatus);
    iWin.focus();
    return false
}*/
