function chTab(a) {
 for (var i=1;i<5;i++) document.getElementById("stab"+i).className = (i==a)?'active':'';
 var h = document.getElementById('shidden');
 var s = document.getElementById('sfield');
 var s2 = document.getElementById('sfarea');
 var l = document.getElementById('slabel');
 var f = document.getElementById('sform');
 switch (a) {
  case 1: f.action='http://www.google.com/u/eautomatizace'; l.innerHTML='Hledat v katalogu:'; h.name=''; h.value='';  s.name='q'; s.className=''; s2.innerHTML=''; break;
  case 2: f.action='http://e-automatizace.vsb.cz/slovnik.asp'; l.innerHTML='Hledat ve slovníku:'; h.name=''; h.value=''; s.name='psearch'; s.className=''; s2.innerHTML=''; break;
  case 3: f.action='http://e-automatizace.vsb.cz/encyklopedie.asp'; l.innerHTML='Hledat v encyklopedii:'; h.name=''; h.value=''; s.name='Hledat'; s.className=''; s2.innerHTML=''; break;
  case 4: f.action='http://e-automatizace.vsb.cz/adresar.asp'; l.innerHTML='Hledat v adresáři jmen:'; h.name=''; h.value=''; s.name='paramPrijmeni'; s.className=''; s2.innerHTML=''; break; 
 }
 document.getElementById('sfield').focus();
 return false;
}

var url = "slovnicek.asp?q2=";

function handleHttpResponse() {
if (http.readyState == 4) {
document.getElementById("hiddenDIV2").style.display="block"; 
document.getElementById("hiddenDIV2").innerHTML=http.responseText;
 }
}

function ajaxdb() {
var telValue = document.getElementById("q2").value;
var myRandom=parseInt(Math.random()*99999999);  // cache buster
http.open("GET", url + escape(telValue) + "&rand=" + myRandom, true);
http.onreadystatechange = handleHttpResponse;
http.send(null);
}

function loadrecord(record) {
document.slovnicek.q2.value = record;
}

function getHTTPObject() {
var xmlhttp;
/*@cc_on
 @if (@_jscript_version >= 5)
  try {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
      } catch (e) {
      try {
	  xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	  } catch (E) {
	  xmlhttp = false;
	  }
      } 
 @else
  xmlhttp = false;
 @end @*/
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
 try {
   xmlhttp = new XMLHttpRequest();
   } catch (e) {
   xmlhttp = false;
   }
  }
  return xmlhttp;
}

var http = getHTTPObject(); // We create the HTTP Object

function gE(i){return document.getElementById(i);}

function copyToClipboard(text2copy) {
		  if (window.clipboardData) {
		    window.clipboardData.setData("Text",text2copy);
		  } else {
		    var flashcopier = 'flashcopier';
		    if(!document.getElementById(flashcopier)) {
		      var divholder = document.createElement('div');
		      divholder.id = flashcopier;
		      document.body.appendChild(divholder);
		    }
		    document.getElementById(flashcopier).innerHTML = '';
		    var divinfo = '<embed src="clipboard.swf" FlashVars="clipboard='+escape(text2copy)+'" width="30" height="30" type="application/x-shockwave-flash"></embed>';
		    document.getElementById(flashcopier).innerHTML = divinfo;
		  }
		}               

