function grabObject (id) {
         //var view = eval(id);
   var view = document.getElementById(id);
   return view;
}

function show_hide(id, what) {
   var hdn_div = grabObject(what+id);
   if (window.opera)
   hdn_div.style.display = 'block';
   else if (navigator.appName!='Microsoft Internet Explorer')
   hdn_div.style.display = 'block';
   else
   hdn_div.style.display = 'block';
}

function show_hide_hide(id, what) {
   var hdn_div = grabObject(what+id);
   hdn_div.style.display = 'none';
}
// ROZBALENI PODSEKCE - HLAVNI STRUKTURA
function rozbalSekci_struktura(id){
	var obr = grabObject("obr"+id);
	var el = grabObject("podsekce"+id);
	
    if(el.style.display == "none"){
        obr.src = "/admin/images/menu/struktura_minus.png";
        el.style.display = "";
    }else{
        obr.src = "/admin/images/menu/struktura_plus.png";
        el.style.display = "none";
    }
}
function show_values(kolik, what)
{
    for (i=0;i<kolik;i++) show_hide(i, what);
    for (i=kolik;i<25;i++) show_hide_hide(i, what);
}

function show_valuess(kolik, what, a)
{
    for (i=0;i<kolik;i++) show_hide(i, what);
    for (i=kolik;i<a;i++) show_hide_hide(i, what);
}


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 show_insert_box(){

document.all.div_insert.style.visibility = "visible";

mouseY = event.y;
mouseX = event.x;
document.all.div_insert.style.top = mouseY;
document.all.div_insert.style.left = mouseX;

}
function show_admin_menu_box(box_to, X, Y){
   var box = grabObject(box_to);
   if(box.style.visibility == "visible"){
	box.style.visibility = "hidden";
   }else{
     //grabObject("div_menu_top_subjects").style.visibility = "hidden";
     //grabObject("div_menu_top_content").style.visibility = "hidden";
     grabObject("div_menu_top_options").style.visibility = "hidden";
     //grabObject("div_menu_top_admin_system").style.visibility = "hidden";

	  box.style.visibility = "visible";
   }
	
		if(document.all){
				mouseY = event.screenY-220;
				mouseX = event.screenX;
				
				box.style.top = mouseY+"px";
				box.style.left =  mouseX+"px";
		}else{
			box.style.top = Y;
		};

}
function style_some_box(id_box,visibility, position, X, Y){
	if(id_box != ""){
		   var box = grabObject(id_box);
		   if(visibility != ""){
			   box.style.visibility = visibility;
		   }
		   if(position != ""){
			   box.style.position = position;
		   }
		   if(position != ""){
			   box.style.top = Y;
		   }
		   if(position != ""){
			   box.style.left = X;
		   }
	}
}

function hidden_insert_box(){
	document.all.div_insert.style.visibility = "hidden";
}

function admin_answers(ido){
	
     	if (ido != ""){
     	
		        if (window.ActiveXObject){
		          httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
		        }else{
		          httpRequest = new XMLHttpRequest();
		        }
		        
		        httpRequest.open("GET", "admin_answers.php?mod_edit=yes&d[ido]="+ido, true);
		        httpRequest.onreadystatechange= function () {
		        	
					  if (httpRequest.readyState == 4){
					    if(httpRequest.status == 200){
							document.getElementById('answers').innerHTML = httpRequest.responseText;  
					    }else{
					        alert("Chyba pri nacitani stanky"+ httpRequest.status +":"+ httpRequest.statusText);
					    }
					  }
		        
		        } ;
		        httpRequest.send(null);
	     }else{
			document.getElementById('answers').innerHTML = "Zvolte uroven pro výpis zaznamu urovně.";
	     }
  
}

function add_this_file(file){
      var thumbs = grabObject("thumbs");
      thumbs.value = thumbs.value+file+"|";
}

function clear_thumbs(){
      var thumbs = grabObject("thumbs");
      thumbs.value = "";
}