<!--
function send_vote(voteid, param, val)
{

        if(param == 'vote')
        {
            var answer = document.getElementsByName("vote");
            var isanswered = false;
            for(var i=0; i<answer.length; i++)
	    if(answer[i].checked == true)
	    {
	        isanswered = true;
	        break;
	    }
            if(!isanswered)
            {
	    alert("Вы не указали ответ!");
	    return;
            }
        }
        var http_request = false;
        if (window.XMLHttpRequest) { // Mozilla, Safari, ...
            http_request = new XMLHttpRequest();
            if (http_request.overrideMimeType) {
                http_request.overrideMimeType('text/xml');
                // See note below about this line
            }
        } else if (window.ActiveXObject) { // IE
            try {
                http_request = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    http_request = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {}
            }
        }
        if (!http_request) {
            alert('Giving up :( Cannot create an XMLHTTP instance');
            return false;
        }

        http_request.onreadystatechange = function() { output_vote_result(http_request); };
        if(param == 'vote')
             url = '/js/pea_ajax_votes.php?id='+voteid+'&param=vote&ans='+answer[i].value;
        else
             url = '/js/pea_ajax_votes.php?id='+voteid+'&param='+param+'&ans='+val;
        http_request.open('GET', url, true);
        http_request.send(null);
}

function output_vote_result(http_request) {
        if (http_request.readyState == 4) {
            if (http_request.status == 200) {
		str_resp = http_request.responseText;
  		if(str_resp != '')
                         	{
		   alert(str_resp)
		}
                
            } else {
                alert('There was a problem with the request.');
            }
        }
}

function chat_select(obj)
{
   var chats = document.getElementById('chats_onmain');
   var tot = 0;
   for(var i=0; i<chats.childNodes.length; i++)
        if(chats.childNodes[i].tagName == 'DIV')
	chats.childNodes[i].className = "chat_item";
   obj.className = "chat_item chat_item_active";
   document.getElementById('chid').value = obj.id;
   document.getElementById('chform').action = '/chat/'+obj.id+'/';
}

function check_chat_enter()
{
   if(document.getElementById('usernik').value=='')
   {
       alert('Укажите Ник!');
       return false;
   }  
   if(document.getElementById('chid').value=='0')
   {
       alert('Выберите чат!');
       return false;
   }  
}

function show_podskazka()
{
   $('body').append('<div id="pagedsbl"></div>');   
   $('#pagedsbl').fadeTo(300, 0.3);
   document.getElementById('podsksazka').style.top = ((self.pageYOffset || (document.documentElement && document.documentElement.scrollTop) || (document.body && document.body.scrollTop))-1+50)+"px";
   document.getElementById('podsksazka').style.marginLeft = "300px";
   document.getElementById('podsksazka').style.display='block';

}

function hide_podskazka_win()
{
   $('#pagedsbl').remove();   
   document.getElementById('podsksazka').style.display='none';
}

function vote4photo()
{
   var x = document.getElementsByName('votephoto');
   var checkedimg = 0;
   for(i=0; i<x.length; i++)
     if(x[i].checked == true)
     {
	checkedimg = x[i].value;
	document.getElementById('holdcheckedimg').value = checkedimg;
	break;
     }

   if(checkedimg > 0)
   {
        $.ajax( 
        {
        url: "/js/vote4photo.php",
        type: "POST",
        data: "iid="+document.getElementById('holdcheckedimg').value+"&rnd="+(new Date()).getTime(),
        cache: false,  
        success: function(html){  
		if(html == '1')
	                   alert('Ваш голос принят! Спасибо! \n');
	             else if(html == 2)
	                 alert('Вы уже пользовались данным сервисом! Попробуйте позже! \n');
		else
	                 alert('Ошибка выполнения операции! \n');
	        }
        });
   }
   else
      alert('Не выбрана фотография!');

}

function sms_vote4photo()
{
   var x = document.getElementsByName('votephoto');
   var checkedimg = 0;
   for(i=0; i<x.length; i++)
     if(x[i].checked == true)
     {
	checkedimg = x[i].value;
	document.getElementById('holdcheckedimg').value = checkedimg;
	break;
     }

   if(checkedimg > 0)
   {
       fotovotewin = window.open('/smsutil/pea_photovote_sms.php?id='+checkedimg,'view','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,width=900,height=600,top=0,left=0,resizable=yes');
       fotovotewin.focus();
   }
   else
      alert('Не выбрана фотография!');
}

function ch_imgsecur(obj)
{
    obj.innerHTML = '<img src="/img_crt.php?rnd='+(new Date()).getTime()+'" class="secure" align="absbottom" title="обновить цифры"';
}
//--> 

