// Detail /////////////////////////////////////////////////////////////////////
var winPop;
var timer;
var obrazek = new Image();
var obrazekText = '';
var n=navigator.userAgent;
var pozice= n.indexOf("MSIE");

function open_popup(adresa, nazev, sirka, vyska ) {
	winPop = window.open(adresa, nazev, 'toolbar=no, menubar=no, location=no, directories=no, scrollbars=no, resizable=yes, status=no, width='+sirka+', height='+vyska+', top=100, left=150');
	winPop.focus();
	if (winPop) return false;
}

function gOI(obj) {
	var object = document.getElementById(obj);
	return object;
}

// meni fotku
var ie5 = document.all && !document.fireEvent && !window.opera;
function changePic(path,name,no,text) {
	if (!ie5){
		var imgs = gOI('detPicturesMin').getElementsByTagName('img');
		var ahrefs = gOI('detPicturesMin').getElementsByTagName('a');
		obrazekText = text;
		if (timer) clearInterval(timer);
		adm_img = false;

		for(i=0; i < ahrefs.length; i++)
		{
			if (ahrefs[i].className == "imgBorderActive")
			{
				ahrefs[i].className = "imgBorder";
			}
		}
				
		for(i=0; i < imgs.length; i++)
		{
			if (imgs[i].className == "imgMinActive")
			{
				imgs[i].className = "";
			}
			
			if (imgs[i].className == "adm_image")
			{
				adm_img = true;
			}
		}
		
		if (adm_img == true)
		{
			no = no*3;
		}
		//Aktivnimu objektu nastavim tridu
		imgs[no].className = "imgMinActive";
		ahrefs[no].className = "imgBorderActive";
		
		obrazek.src=path+'mid/'+name;
		
		if (gOI('detPicMid').src != obrazek.src)
		{
			timer = setInterval(ObrazekNacten, 50);
		}
		
		gOI('detPicMax').href = BASE_PATH+'image.php5'+'?path='+path+'max/'+name;
		
		if(winPop != null && !winPop.closed) {
			winPop = window.open(BASE_PATH+'image.php5'+'?path='+path+'max/'+name,'img','width=680,height=510');
			winPop.focus();
		}

		return false;
	}
}

function ObrazekNacten()
{
	if (obrazek.complete)
	{
		if (pozice>=0 && parseFloat(n.substr(pozice+5,3))>=5.5 && n.indexOf("Opera")==(-1))
		{
			ObalDetPicMid.filters[0].enabled = true;
		    ObalDetPicMid.filters[0].Apply();
		    ObalDetPicMid.filters[0].Play();
		}
		
		gOI('detPicMid').title = obrazekText;
		gOI('detPicMid').alt = obrazekText;
		gOI('detNameMin').innerHTML = obrazekText;
		gOI('detPicMid').src = obrazek.src;
		obrazek=new Image();
		clearInterval(timer);			
	}
	else
	{
		if (document.getElementById('detNameMin').innerHTML!='Loading...') document.getElementById('detNameMin').innerHTML='Loading...';
	}
}

// Ostatni ////////////////////////////////////////////////////////////////////
function hlRow(element, color) {
  element.style.backgroundColor = color;
}

function CursorPointer(element) {
  element.style.cursor = 'pointer';
}

function checkLength(idInput, idMsg, maxLength)
{
  ta = idInput;
  mc = document.getElementById(idMsg);
  
  l = maxLength - ta.value.length;
  mc.innerHTML = l;
  
  if(l >= 0)
  {
    mc.style.color = "#000000";
  }
  else
  {
  	ta.value = ta.value.substring(0, maxLength);
    mc.style.color = "#FF0000";
  }
}

// Novinky ////////////////////////////////////////////////////////////////////

function showNews(id)
{
	e = document.getElementById("News_Item_"+id);
	state = document.getElementById("News_State_"+id);
	title = document.getElementById("News_Title_"+id);
	if (e) {
		if (e.style.display == "block" || e.style.display == "") {
			e.style.display = "none";
			if (state) {
				state.innerHTML = "&gt;&gt;";
			}
		} else {
			e.style.display = "block";
			if (state) {
				state.innerHTML = "&lt;&lt;";
			}
		}
		if (title) {
			title.style.cursor = "pointer";
		}
	}
}

