/**
 *  lc.js
*** !!! This branched version 
   *     uses image request not http_request
   *     
   *  $Revision: 1.5 $
 */

//Revision: 1.0.2

//var vs_getdomain = ""; //for root-relative url
var vs_getdomain="http://www.atcom.cn"; // example for absolute url
var vs_filename = vs_getdomain + "/swa/j/zag2_vs_log1.asc?Log=1";
function vs_makeExit(link) {
  return function() {
    //var method = "POST";
    var method = "GET";
      
    var lhref = "&link=" + escape(link.href);
    var lname = "&linkname=" + escape(link.name);
    var theText = link.text ? link.text : link.innerText; 
    var ltext = "&linktext=" + theText;
    var dref = "&title=" + document.title;
    var dlink = "&basepage=" + window.location.href;
    var cb = "&cb=" + (new Date()).getTime();
    var url = vs_filename + lhref + lname + ltext + dref + dlink + cb;

    var imObj = new Image();
    imObj.src = url;
    return true;
  }
}

function vs_makeImg(link) {
  //var method = "POST";
  var method = "GET";

  var lsrc = "&image=" + escape(link.src);
  var ltext = "&imagetext=" + escape(link.alt);
  var lname = "&imagename=" + escape(link.name);
  var dref = "&title=" + document.title;
  var dlink = "&basepage=" + window.location.href;
  var cb = "&cb=" + (new Date()).getTime();
  var url = vs_filename + lsrc + ltext + lname + dref + dlink + cb;

  var imObj = new Image();
  imObj.src = url;
    
  return true;
}

function vs_makeSubmit(link) {
  //var method = "POST";
  var method = "GET";
  
  var lname = "&linkname=" + escape(link.name);
  var dref = "&title=" + document.title;
  var dlink = "&basepage=" + window.location.href;
  var cb = "&cb=" + (new Date()).getTime();
  var url = vs_filename + lname + dref + dlink + cb;
  
  var imObj = new Image();
  imObj.src = url;
  
  return true;
}
function vs_pageTag() {
  //var method = "POST";
  var method = "GET";
  
  var dref = "&title=" + document.title;
  var dlink = "&basepage=" + window.location.href;
  var cb = "&cb=" + (new Date()).getTime();
  var local_vars = "";  
  if (typeof vs_vars != "undefined") {
    if (vs_vars) {
      local_vars = "&" + vs_vars;
    }
  }
  var url = vs_filename + dref + dlink + local_vars + cb;
  var imObj = new Image();
  imObj.src = url;
  
  return true;
}

var vs_tempFunction = function() {
  if (typeof vs_pt != "undefined") {
    if (vs_pt) {
      vs_pageTag();
    }
  }
  // Get all of the a tags
  var o = document.getElementsByTagName("a");
  // Loop through all of the links
  for (i = 0; i < o.length; i++) {
    // Grab the rel attribute values
    if (anchs = o[i].getAttribute("rel")) {
      // If there is more than one value of rel, we need to split it
      var rels = anchs.split(" ");
      // Loop through all of the values of the rel attribute
      for (j = 0; j < rels.length; j++) {
        // If we found an exit link
        if (rels[j] == "exit") {
          // Make a new function to attach to the link
          exitLinkFunction = vs_makeExit(o[i]);
          // Attach the function to the onclick event of the link we found.
          o[i].onmousedown = exitLinkFunction;
        }
      }
    }
  }
  
  // Get all of the area tags
  var p = document.getElementsByTagName("area");
  // Loop through all of the links
  for (i = 0; i < p.length; i++) {
    // Grab the rel attribute values
    if (anchs = p[i].getAttribute("rel")) {
      // If there is more than one value of rel, we need to split it
      var arearels = anchs.split(" ");
      // Loop through all of the values of the rel attribute
      for (j = 0; j < arearels.length; j++) {
        // If we found an exit link
        if (arearels[j] == "exit") { 
          // Make a new function to attach to the link
          exitLinkFunction = vs_makeExit(p[i]);
          // Attach the function to the onclick event of the link we found.
          p[i].onclick = exitLinkFunction;
        }
      }
    }
  }
}

addToWindowOnLoad(vs_tempFunction);