
//SuckerTree Horizontal Menu (Sept 14th, 06)
//By Dynamic Drive: http://www.dynamicdrive.com/style/

var menuids=["treemenu1"] //Enter id(s) of SuckerTree UL menus, separated by commas

function buildsubmenus_horizontal(){
for (var i=0; i<menuids.length; i++){
  var ultags=document.getElementById(menuids[i]).getElementsByTagName("ul")
    for (var t=0; t<ultags.length; t++){
		if (ultags[t].parentNode.parentNode.id==menuids[i]){ //if this is a first level submenu
			ultags[t].style.top=ultags[t].parentNode.offsetHeight+"px" //dynamically position first level submenus to be height of main menu item
			ultags[t].parentNode.getElementsByTagName("a")[0].className="mainfoldericon"
		}
		else{ //else if this is a sub level menu (ul)
		  ultags[t].style.left=ultags[t-1].getElementsByTagName("a")[0].offsetWidth+"px" //position menu to the right of menu item that activated it
    	ultags[t].parentNode.getElementsByTagName("a")[0].className="subfoldericon"
		}
    ultags[t].parentNode.onmouseover=function(){
    this.getElementsByTagName("ul")[0].style.visibility="visible"
    }
    ultags[t].parentNode.onmouseout=function(){
    this.getElementsByTagName("ul")[0].style.visibility="hidden"
    }
    }
  }
}

if (window.addEventListener)
window.addEventListener("load", buildsubmenus_horizontal, false)
else if (window.attachEvent)
window.attachEvent("onload", buildsubmenus_horizontal)



function new_window(href) {
window.open(href, "_blank","toolbar=yes,location=yes,directories=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,top=0,left=0,width=650,height=500")
}

function foto(picture,velka) {
document.getElementById('velka').src="http://www.eantik.sk/images/galery/"+picture;
document.getElementById('zvacsi').href="http://www.eantik.sk/images/galery/origin/"+picture;
document.getElementById('zvacsi').style.display=velka;
}
function eantik() {
document.getElementById('art').style.display='none';
document.getElementById('vyber_autor').style.display='none';
document.getElementById('obdobie').style.display='block';
}

	
function art() {
document.getElementById('art').style.display='block';
document.getElementById('vyber_autor').style.display='block';
document.getElementById('obdobie').style.display='none';
}
function obrazy() {
document.getElementById('art').style.display='none';
}

function vyber(co){
hodnota = co.options[co.selectedIndex].value
if (hodnota==9) art(); 
else { if(hodnota==8) { art(); obrazy(); }
else eantik();
}

}

function conf(a) {
a=window.confirm(a);
if(a) { return true; }
else { return false;}
}

function kontrola(formular) {
     if (formular.nazov.value=="" || formular.cena.value=="" || formular.zaradenie.value=="0") {
        alert ("Musí byť vyplnený názov diela, cena a zaradenie!");
        return false;
        }
     else return true;
}

function info(url)
{
    oinfo=window.open('http://www.artconsulting.sk/'+url,'oinfo','width=700,height=550,toolbar=no,menubar=no,scrollbars=yes,status=no');
    oinfo.focus();
}
function zmaz_foto(id,hash,nazov) {


a=window.confirm('Naozaj zmazať ???');
if(a) {


new Ajax.Request('/ajax/zmaz_foto.php',
  {
 method:'post',
   postBody:"id="+id+"&nazov="+nazov+"&hash="+hash,
    onSuccess: function(transport){
	  var response = transport.responseText || "no response text";
	document.getElementById('zmaz_'+id).innerHTML=response;

	},
    onFailure: function(){ alert('Nastala chyba pri spracovaní.') }
  });
}
}
function zmaz_foto_n(id,hash,nazov) {


a=window.confirm('Naozaj zmazať ???');
if(a) {


new Ajax.Request('/ajax/zmaz_foto_n.php',
  {
 method:'post',
   postBody:"id="+id+"&nazov="+nazov+"&hash="+hash,
    onSuccess: function(transport){
	  var response = transport.responseText || "no response text";
	document.getElementById('zmaz_'+id).innerHTML=response;

	},
    onFailure: function(){ alert('Nastala chyba pri spracovaní.') }
  });
}
}

function zmaz_foto_zmeny(id,hash,idp) {


a=window.confirm('Naozaj zmazať ???');
if(a) {


new Ajax.Request('/ajax/zmaz_foto_zmeny.php',
  {
 method:'post',
   postBody:"id="+id+"&idp="+idp+"&hash="+hash,
    onSuccess: function(transport){
	  var response = transport.responseText || "no response text";
	document.getElementById('zmaz_'+id).innerHTML=response;

	},
    onFailure: function(){ alert('Nastala chyba pri spracovaní.') }
  });
}
}

function inspiracia() {

new Ajax.Request('/ajax/inspiracia.php',
  {
   method:'post',
   //postBody:"id="+id+"id2="+id2+"id3="+id3+"id4="+id4,
   onSuccess: function(transport){
   var response = transport.responseText || "no response text";
	document.getElementById('inspiracia').innerHTML=response;
    window.setTimeout("inspiracia()", 5000);

   },
    onFailure: function(){ alert('Nastala chyba.') }
});

}

function zmaz_polozku(id,idu) {
a=window.confirm('Naozaj vymazať ?');
if(a) {
new Ajax.Request('/ajax/zmaz_polozku.php',
  {
	method:'post',
	postBody:"id="+id+"&user="+idu,
    onSuccess: function(transport){
	  var response = transport.responseText || "nastala chyba, skuste znova";
          alert(response);
	},
    onFailure: function(){ alert('Nastala chyba pri spracovaní.') }
  });

}
return false;
}
