      function getHttpRequest()
      {
      var http_request = false;
      if (window.XMLHttpRequest)
      {
      http_request = new XMLHttpRequest();
      if (http_request.overrideMimeType)
      {
      http_request.overrideMimeType('text/xml');
      }
      }
      else if (window.ActiveXObject)
      {
      try
      {
      http_request = new ActiveXObject("Msxml2.XMLHTTP");
      }
      catch (e)
      {
      try
      {
      http_request = new ActiveXObject("Microsoft.XMLHTTP");
      }
      catch (e)
      {
      }
      }
      }
      return http_request;
      }

      function makeRequest(aId, aURL)
      {
      var http_request = getHttpRequest();
      try
      {
      http_request.overrideMimeType('text/html');
      }
      catch (e)
      {
      }
      if (aId != null)
      {
      http_request.onreadystatechange = function() { renderContent(aId, http_request); };
      }


      var tmpElement = document.getElementById(aId);

      var height;
      var width;
      if (document.all)
      {
        height = document.all[aId].offsetHeight;
        width = document.all[aId].offsetWidth
      }
      else if (document.defaultView.getComputedStyle)
      {
      height = document.defaultView.getComputedStyle(tmpElement,'').height;
      width =  document.defaultView.getComputedStyle(tmpElement,'').width;
      }
      tmpElement.innerHTML = '<div class="loading" style="padding: 0px;magin: 0px;height: ' + height + ';width: ' + width + '"><center>&nbsp;<p><img src=images/loading.gif></div>'

      http_request.open('GET', aURL, true);
      http_request.send(null);


      }



      function makeRequestPost(aURL, aParameters, aRedirectId, aRedirectUrl)
      {
      var http_request = getHttpRequest();
      try
      {
      http_request.overrideMimeType('text/html');
      }
      catch (e)
      {
      }
      http_request.onreadystatechange = function() { renderContent(aRedirectId, http_request); };
      http_request.open('POST', aURL, true);
      http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      http_request.setRequestHeader("Content-length", aParameters.length);
      http_request.setRequestHeader("Connection", "close");
      http_request.send(aParameters);
      }

      function redirectOnReady(aHttpRequest, aRedirectId, aRedirectUrl)
      {
      if (aHttpRequest.readyState == 4)
      {
      //var tmpElement = document.getElementById(aRedirectId);
      //tmpElement.innerHTML = aHttpRequest.responseText
      makeRequest(aRedirectId, aRedirectUrl);
      }
      }

      function renderContent(aId, aHttpRequest) {
      //alert(aHttpRequest.readyState);
      if (aHttpRequest.readyState == 4) {
      var tmpElement = document.getElementById(aId);
      tmpElement.innerHTML = aHttpRequest.responseText
      }
      //alert( aHttpRequest.responseText );
      }

      function addComment(aId)
      {
      var parameters = '';
      parameters += "message=" + document.forms['comment_' + aId].elements['message'].value;
      parameters += "&object_id=" + document.forms['comment_' + aId].elements['object_id'].value;
				parameters += "&comment_type_id=" + document.forms['comment_' + aId].elements['comment_type_id'].value;
				parameters += "&name=" + document.forms['comment_' + aId].elements['name'].value;
				parameters += "&password=" + document.forms['comment_' + aId].elements['password'].value;
				parameters += "&action=insert";

				makeRequestPost("kill_comment.php", parameters, "kill_detail_" + aId, "kill_comment.php?id=" + aId);
			}

			function registerKill()
			{
				var parameters = '';
				parameters += "kill_mail=" + document.forms['register_mail_form'].elements['kill_mail'].value;
				parameters += "&password=" + document.forms['register_mail_form'].elements['password'].value;
				parameters += "&action=insert";
				makeRequestPost("kill_add.php", parameters, "kill_list", "kill_add.php");
			}

				var detailType = new Array();
				function itemInfo(aId, aURL, aType)
				{
					var tmpElement = document.getElementById(aId);
					//alert(aURL);
                                        //aURL = "gettxt.php?f=" + aURL;
					if (detailType[aId] != aType && tmpElement.innerHTML.length > 0 || 1==1)
					{
						makeRequest(aId, aURL);
						detailType[aId] = aType;
					}
					else if (detailType[aId] == aType)
					{
							//tmpElement.innerHTML = "";
							//detailType[aId] = 0;
					}
					else
					{
						if (tmpElement.innerHTML.length > 0)
						{
							tmpElement.innerHTML = "";
							detailType[aId] = 0;
						}
						else
						{
							makeRequest(aId, aURL);
							detailType[aId] = aType;
						}
					}

				}

				var previousSearchQuery = "";
				function searchFormOnChange()
				{
					var query = document.forms['search_form'].elements['query'].value;
					if (query != previousSearchQuery)
					{

						var http_request = getHttpRequest();
						try
						{
							http_request.overrideMimeType('text/html');
						}
						catch (e)
						{
						}

						http_request.onreadystatechange = function() { renderDropDown(http_request); };
						http_request.open('GET', "search_result.php?type=1&query=" + query, true);
						http_request.send(null);

						previousSearchQuery = query;
					}
				}

				function searchSelectItem(aQuery)
				{
					var tmpElement = document.getElementById("search_drop_down");
					tmpElement.style.visibility='hidden';

					updateFilter(aQuery);
				}

				function renderDropDown(http_request)
				{
					if (http_request.readyState == 4)
					{
						eval(http_request.responseText);
					}
				}

				function updateDropDown(aResult, aType, aQuery)
				{
					var tmpElement = document.getElementById("search_drop_down");
					tmpHtml = '';
					for (i = 0; i < aResult.length; i++)
					{
						tmpHtml += '<div class=\"search_drop_down_item\" onclick=\"searchSelectItem(\'' + aQuery[i].replace('\'', '\\\'') + '\')\">' + aResult[i] + ' <span class=\"search_drop_down_item_stats\">(' + aType[i] + ')' + '</span></div>';
					}
					tmpElement.innerHTML = tmpHtml;	
					if (tmpHtml.length > 0)
					{
						tmpElement.style.visibility='visible';				
					}
					else
					{
						tmpElement.style.visibility='hidden';
					}
					
				}

				function submitForm()
				{
					makeRequest("kill_list", "search_result_list.php?type=1&query=" + document.forms['search_form'].elements['query'].value);
					var tmpElement = document.getElementById("search_drop_down");
					tmpElement.innerHTML = ''
					tmpElement.style.visibility='hidden';
				}