function DoConfirm(message, url) {
	if(confirm(message)) location.href = url;
}

function DoConfirmForm() {
	var agree=confirm('Уверены?');
	if (agree) return true ;
	else return false ;
}

function show(el) {
	var eel = document.getElementById(el);
	if (eel.style.display) { eel.style.display='' }
	else { eel.style.display='none' }
}

function highlight(el, color) {
	var eel = document.getElementById(el);
	eel.style.background = color;
}

function hrefCode(url) {
	window.location.href = url;
}

function vote(id, v) {
	var url = '/vote.php?id=' + id + '&v=' + v
	window.location.href = url;
}

var requestSC2Rep;
var destSC2Rep;

function processStateChange()
{
	if (requestSC2Rep.readyState == 4)
	{
		contentDiv = document.getElementById(destSC2Rep);
		if (requestSC2Rep.status == 200)
		{
			response = requestSC2Rep.responseText;
			contentDiv.innerHTML = response;	
		}
		else
		{
			contentDiv.innerHTML = "Error: Status "+requestSC2Rep.status;
		}
	}
}

function getNewHTTPObject()
{
        var xmlhttp;

        /** Special IE only code ... */
        /*@cc_on
          @if (@_jscript_version >= 5)
              try
              {
                  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
              }
              catch (e)
              {
                  try
                  {
                      xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                  }
                  catch (E)
                  {
                      xmlhttp = false;
                  }
             }
          @else
             xmlhttp = false;
        @end @*/

        /** Every other browser on the planet */
        if (!xmlhttp && typeof XMLHttpRequest != 'undefined')
        {
            try
            {
                xmlhttp = new XMLHttpRequest();
            }
            catch (e)
            {
                xmlhttp = false;
            }
        }

        return xmlhttp;
}

function loadHTML(URL, destination)
{
	destSC2Rep = destination;
	requestSC2Rep = getNewHTTPObject();
	if (requestSC2Rep)
	{
		requestSC2Rep.onreadystatechange = processStateChange;
		requestSC2Rep.open("GET", URL, true);
		requestSC2Rep.send(null);
	}
}


function vote_replay(id, spanID, val)
{
	var callURL = '/vote_simple.php?id=' + id + '&v=' + val;
	loadHTML(callURL, spanID);
}
