//Browser Support Code
function zobrazit_profil(nick,id) {
	var ajaxRequest;  // Definicia premennej ajaxu
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// chyba...
				alert("Nepodporovany prehliadac!");
				return false;
			}
		}
	}
	// Vytvori funkciu na primanie dat zo servera
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			var ajaxDisplay = document.getElementById(id);
			ajaxDisplay.innerHTML = ajaxRequest.responseText;
		}
	}
	var queryString = "?id=" + id + "&nick=" + nick;
	ajaxRequest.open("GET", "profil.php" + queryString, true);
	ajaxRequest.send(null); 
}
function emoticon(text) {
  var txtarea = document.form.text;
  text = ' ' + text;
  if (txtarea.createTextRange && txtarea.caretPos) {
    var caretPos = txtarea.caretPos;
    caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
    txtarea.focus();
  } else {
    txtarea.value  += text;
    txtarea.focus();
  }
}

function AddSmileyIcon(iconCode) {
		document.formular.text.value += iconCode + "  ";
		document.formular.text.focus();
}

function zmaz(x) {
  if (x == "black_del") {
    if (confirm("Naozaj chcete odstrániť tohoto BLACK USERa?")) {return true;}
	 else {return false;}
  }
  else if (x == "user") {
    if (confirm("Naozaj chcete odstrániť tohoto USERa?")) {return true;}
	 else {return false;}
  }
  else if (x == "black_del_all") {
    if (confirm("Naozaj chcete odstrániť všetky záznam pridané týmto užívateľom?")) {return true;}
	 else {return false;}
  }
  else if (x == "zaznam") {
    if (confirm("Naozaj chcete tento záznam odstrániť?")) {return true;}
	 else {return false;}
  }  
  else if (x == "black_add") {
    if (confirm("Naozaj chcete tohoto užívateľa pridať do BLACK LISTu?")) {return true;}
	  else {return false;}
  }
}

function smile(typ) {
datum = new Date(); // aktualny cas
datum.setTime(datum.getTime() + 7 *24*60*60*1000) ; //tyzden dopredu

  if (typ == "new") {
    document.getElementById('smile_old').style.visibility= 'hidden';
    document.getElementById('smile_new').style.visibility= 'visible';
    document.cookie = "smile=neww;expires="+ datum.toGMTString();
  }
  else if (typ == "old") {
    document.getElementById('smile_new').style.visibility= 'hidden';
    document.getElementById('smile_old').style.visibility= 'visible';
    document.cookie = "smile=old;expires="+ datum.toGMTString();
  }
}

function zobrazit (id) {
  document.getElementById(id).style.visibility= 'visible';
}

function skryt (id) {
  document.getElementById(id).style.visibility= 'hidden';
}
