/* ---------------------------- */
/* XMLHTTPRequest Enable */
/* ---------------------------- */
function createObject() {
var request_type;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer"){
request_type = new ActiveXObject("Microsoft.XMLHTTP");
}else{
request_type = new XMLHttpRequest();
}
return request_type;
}
var http = createObject();

/* -------------------------- */
/* SAVE MODEL DATA */
/* -------------------------- */
/* Required: var nocache is a random number to add to request. This value solve an Internet Explorer cache issue */
var nocache = 0;
var errmsg="";
var hiba=0;
var mehet=true;
function sign_torol(id) {
//Ellenörzések
errmsg="";
hiba=0;
mehet=true;

//Ell vége
//hibák kiirása+konkluzio
	if(hiba == 0){
// Optional: Show a waiting message in the layer with ID ajax_response

nocache = Math.random();
// Pass the login variables like URL variable
http.open("POST", "signed_torol.php", true);
var params ='id='+id+'&nocache='+nocache;
http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8');
http.setRequestHeader("Content-length", params.length);
http.setRequestHeader("Connection", "close");
http.send(params);
http.onreadystatechange = sdelReply;
	}
}
function sdelReply() {
if(http.readyState == 4){
var response = http.responseText;
if(response == "fail"){
alert("Hiba, próbáld újra!");
} 
 else if (response == "ok") {
location.reload();
} else {
alert(response);
}



}
}

