var xmlhttp
if(!xmlhttp&&typeof XMLHttpRequest!='undefined'){try{xmlhttp=new XMLHttpRequest();}catch(e){xmlhttp=false}}
function myXMLHttpRequest(){var xmlhttplocal;try{xmlhttplocal=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{xmlhttplocal=new ActiveXObject("Microsoft.XMLHTTP")}catch(E){xmlhttplocal=false;}}
if(!xmlhttplocal&&typeof XMLHttpRequest!='undefined'){try{var xmlhttplocal=new XMLHttpRequest();}catch(e){var xmlhttplocal=false;alert('couldn\'t create xmlhttp object');}}
return(xmlhttplocal);}
function sndRequest(vote,id_num,userid_num){var element=document.getElementById('unit_long'+id_num);element.innerHTML='<div style="height: 20px;"><em>Dodaje głos ...</em></div>';xmlhttp.open('get','/rpc.php?j='+vote+'&q='+id_num+'&uid='+userid_num);xmlhttp.onreadystatechange=handleResponse;xmlhttp.send(null);}
function handleResponse(){if(xmlhttp.readyState==4){if(xmlhttp.status==200){var response=xmlhttp.responseText;var update=new Array();if(response.indexOf('|')!=-1){update=response.split('|');changeText(update[0],update[1]);}}}}
function changeText(div2show,text){var IE=(document.all)?1:0;var DOM=0;if(parseInt(navigator.appVersion)>=5){DOM=1};if(DOM){var viewer=document.getElementById(div2show)
viewer.innerHTML=text}
else if(IE){document.all[div2show].innerHTML=text}}
function limitText(limitField, limitCount, limitNum) {
    if (limitField.value.length > limitNum) {
        limitField.value = limitField.value.substring(0, limitNum);
    } else {
        limitCount.value = limitNum - limitField.value.length;
    }
}
$(document).ready(function(){
$("#pozdro-form").submit(function(){
var str = $(this).serialize();
   $.ajax({
   type: "POST",
   url: "/pozdrowienia/send_pozdro.php",
   data: str,
   success: function(msg){
$("#smswarn").ajaxComplete(function(event, request, settings){
if(msg == 'OK') 
{
result = '<div class="sms_ok">Twoje pozdrowienia zostały wysłane!</div>';
$("#polpoz").hide();
}
else
{
result = '<div class="sms_error">'+msg+'</div>';
}
$(this).html(result);
});
}
 });
return false;
});
});

