function doLoad(url,params,method) {
  var req = window.XMLHttpRequest? 
    new XMLHttpRequest() : 
    new ActiveXObject("Microsoft.XMLHTTP");
  req.onreadystatechange = function() {
    if (req.readyState == 4) 
      alert('Loaded:\n'+req.responseText);
  }
  
   if(method=='POST'){
		req.open('POST',url,false);
		req.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		req.send(params);
	}
	if(method=='GET'){
		req.open('GET',url + params,true);
		req.send(null);
	}
  //req.open("GET", url, true);
  //req.send(null);
}

function processStateChange()
{
	if (request.readyState == 4)
	{
		contentDiv = document.getElementById(dest);
		if (request.status == 200)
		{
			response = request.responseText;
			contentDiv.innerHTML = response;
		}
	}
}
function loadHTML(URL, destination, method, params)
{
	dest = destination;
	if(window.XMLHttpRequest)
	{
		request = new XMLHttpRequest();
		request.onreadystatechange = processStateChange;
		request.open(method, URL, true);
		request.send(params);
	}
	else if (window.ActiveXObject) 
	{
		request = new ActiveXObject("Microsoft.XMLHTTP");
		if (request) 
		{
			request.onreadystatechange = processStateChange;
			request.open(methos, URL, true);
			request.send(params);
	    }
	}
}
function v(el, i) {
	el.style.backgroundColor='#d0d0d0';

	el.firstChild.title = 'Куль!';
	el.firstChild.onclick = function() { vote(i, 1, el); }

	el.lastChild.title = 'Не куль!';
	el.lastChild.onclick = function() { vote(i, -1, el); }
}

function x(el) {
	el.style.backgroundColor='#fff';
}

function expandit(curobj, hide) {
	if(document.getElementById(curobj)) {
  		folder=document.getElementById(curobj).style;
	} else {
		if(ns6==1||operaaa==true) {
			folder=curobj.nextSibling.nextSibling.style;
		} else {
			folder=document.all[curobj.sourceIndex+1].style;
		}
   }
	if(folder.display=="none")
	{
		folder.display="";
	} else {
		folder.display="none";
	}
	if(hide) {
		var hide_objects = hide.split(",");
		for(i=0; i<hide_objects.length; i++) {
			hide_objects[i]=hide_objects[i].replace(/^\s*(.*)/, "$1");
			hide_objects[i]=hide_objects[i].replace(/(.*?)\s*$/, "$1");
			if(document.getElementById(hide_objects[i])) {
				hidden=document.getElementById(hide_objects[i]).style;
				if(hidden.display=="") {
					hidden.display="none";
				}
			}
		}
	}
}
// Запишем код функции, для выставления форматирования
// Используется метод execCommand объекта document
function setBold(id) {
	iWin[id].focus();
	iWin[id].document.execCommand("bold", null, "");
}
function setItal(id) {
	iWin[id].focus();
	iWin[id].document.execCommand("italic", null, "");
}
function setUnder(id) {
	iWin[id].focus();
	iWin[id].document.execCommand("underline", null, "");
}

function sendForm(id) {

	var message = iWin[id].document.body.innerHTML;

	loadHTML('ajax.php?message='+message+'&id='+id, 'write:'+id, 'POST', 'message='+message+'&id='+id);
	loadHTML('comments.php?id='+id, 'comment:'+id, 'POST', 'id='+id);
}


var isGecko = new Array();
var iframe = new Array();
var iWin = new Array();
var iDoc = new Array();
