function processRequestt(status){
  if (httpRequest.readyState == 4){
    if(httpRequest.status == 200){
		alert( httpRequest.responseText);
    }else{
        alert("Chyba pri nacitani stanky"+ httpRequest.status +":"+ httpRequest.statusText);
    }
  }
}

function open_window(name, url, left, top, width, height, toolbar, menubar, statusbar, scrollbar, resizable){
  toolbar_str = toolbar ? 'yes' : 'no';
  menubar_str = menubar ? 'yes' : 'no';
  statusbar_str = statusbar ? 'yes' : 'no';
  scrollbar_str = scrollbar ? 'yes' : 'no';
  resizable_str = resizable ? 'yes' : 'no';
  window.open(url, name, 'left='+left+',top='+top+',width='+width+',height='+height+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str);
}

function open_window(name, url, left, top, width, height, toolbar, menubar, statusbar, scrollbar, resizable)
{
  toolbar_str = toolbar ? 'yes' : 'no';
  menubar_str = menubar ? 'yes' : 'no';
  statusbar_str = statusbar ? 'yes' : 'no';
  scrollbar_str = scrollbar ? 'yes' : 'no';
  resizable_str = resizable ? 'yes' : 'no';
  window.open(url, name, 'left='+left+',top='+top+',width='+width+',height='+height+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str);
}

function vote_now(object){

     if (object != ""){
        if (window.ActiveXObject){
          httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
        }else{
          httpRequest = new XMLHttpRequest();
        }
        if(status == true){
        	obj = grabObject("button_confront");
        	obj.style.visibility = "visible";
        	obj.style.position = "relative";
        	status = "yes";
        }else{
        	status = "no";
        }
        httpRequest.open("GET", "/moduls/POLL/vote_now.php?ida="+object, true);
        httpRequest.onreadystatechange= function () {processRequestt(); } ;
        httpRequest.send(null);
     }
}

function switch_visibility(to_visible, to_hidden){
	
	for(h=0;h<to_hidden.length; h++){
		var obj = grabObject(to_hidden[h]);
		if(obj){
			obj.style.visibility = "hidden";
			obj.style.position = "absolute";
		}
	}
	for(v=0;v<to_visible.length; v++){
		var obj = grabObject(to_visible[v]);
		if(obj){
			obj.style.visibility = "visible";
			obj.style.position = "relative";
		}
	}
}
function confirmDelete(delUrl) {
  if (confirm("Potvrzujete smazání tohoto prvků? Je to nenávratný.")) {
    document.location = delUrl;
  }
}
