function detectJavascript(url) {
  // Their javascript isn't good enough
  if (window.document.getElementById == null)
    return;
    
//  window.location = url;
   
  // This was a cool idea but the above code is just fine...
  var xmlHttp;
  try {
    // Firefox, Opera 8.0+, Safari
    xmlHttp = new XMLHttpRequest();
  }
  catch (e) {
    // Internet Explorer
    try {
      xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch (e) {
      try {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
      }
      catch (e) {
        window.location = url;
      }
    }
  }

  //first parameter is to specify Method either GET or POST
  //second parameter is URL of server, where you want to send request
  //Third parameter would define either communication pattern is synchornous(false) or asynchornous(true)
  xmlHttp.open("GET", url + "&ajax=1", true);
  xmlHttp.onreadystatechange = function() {
    if (xmlHttp.readyState == 4) { // readyState, see below
      if (xmlHttp.responseText.length < 10) {
        window.location = url;
      } else {
        var div = document.createElement("div");
        div.innerHTML = 
           xmlHttp.responseText.substring(xmlHttp.responseText.indexOf("<!-- Begin top menu content -->"),
           xmlHttp.responseText.indexOf("<!-- End top menu content -->"));
        document.getElementById("top_menu_content").parentNode.replaceChild(div,
          document.getElementById("top_menu_content"));

        if (xmlHttp.responseText.substring(xmlHttp.responseText.indexOf("<!-- Begin side menu content -->")) != -1) {
          div = document.createElement("div");
          div.innerHTML =
            xmlHttp.responseText.substring(xmlHttp.responseText.indexOf("<!-- Begin side menu content -->"),
            xmlHttp.responseText.indexOf("<!-- End side menu content -->"));
          document.getElementById("side_menu_content").parentNode.replaceChild(div,
            document.getElementById("side_menu_content"));
        }

        var i = xmlHttp.responseText.indexOf("<!-- Begin image preview content -->");
        while (i != -1) {
          div = document.createElement("div");
          div.innerHTML =
            xmlHttp.responseText.substring(xmlHttp.responseText.indexOf("<!-- Begin image preview content -->"),
            xmlHttp.responseText.indexOf("<!-- End image preview content -->"));
          document.getElementById("image_preview_content").parentNode.replaceChild(div,
            document.getElementById("image_preview_content"));
          xmlHttp.responseText.indexOf("<!-- Begin image preview content -->", i + 1);
        }
      }
    }
  }

  //GetWeather.aspx is include in sample, which is intermediate between your request and web service.
  //send request to server according to parameters
  xmlHttp.send(null);
}
