function show_photo(text,file,width,height){
	no=window.open("", "zoom", "left=5, top=5, width="+width+", height="+height+", toolbar=no, location=no, status=no, scrollbars=auto");
	with (no.document)
	{
		open();
		writeln('<body style="margin: 0px;"><a href="javascript:void window.close();"><img src="'+file+'" style="border: 0px;" /></a></body>');
		close();
		no.focus();
	}
}

function openWindow(text,file,width,height,type){
	if (type=='img'){
		no=window.open("", "zoom", "left=5, top=5, width="+width+", height="+height+", toolbar=no, location=no, status=no, scrollbars=auto");
		with (no.document)
		{
			open();
			writeln('<body style="margin: 0px;"><a href="javascript:void window.close();"><img src="'+file+'" alt="'+text+'"style="border: 0px;" /></a></body>');
			close();
			no.focus();
		}
	}
	if (type=='file'){
		window.open(file, "zoom", "left=5, top=5, resizable,toolbar=no, location=no, status=no, scrollbars=yes");
		
		
	}
	return false;
}

function changeImage (url,foto) {
	if (document.getElementById) {
    	//window.alert(foto);    
                document.getElementById('mainphoto').src = url;
                document.getElementById('largephoto').href = foto;
               // photo_id = fotka_id;
        }
        return false;
}

function showLargeImage(url,width,height,type) {
	if (screen.height) {
		screenY = screen.height
		screenX = screen.width
	}
	var top = ((screenY/2)-(height/2));
	var left = ((screenX/2)-(width/2));
	window.open(url,'','resizable=no,status=no,scrollbars=no,width='+width+',height='+height+',top=50,left=50');
	return false;
}

function newWindow(url){
	x = window.open(url, "new_win", "");
	if (x) return false;
}

function ajax(url,idElement){
	if (url != 0){
		if (window.ActiveXObject){
    		httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
		}
        else{
			httpRequest = new XMLHttpRequest();
		}
    	httpRequest.open("GET", url+'&popisek='+idElement, true);
        httpRequest.onreadystatechange= function () {processRequest(idElement); } ;
        httpRequest.send(null);
	}
	else{
		document.getElementById(idElement).innerHTML = "";
	}
	//setTimeout("alert('"+idElement+"')",10);
}

function processRequest(element){
	if (httpRequest.readyState == 4){
		if(httpRequest.status == 200){
			var vystup = document.getElementById(element);
			vystup.innerHTML = httpRequest.responseText;
		}
		else{
			alert("Chyba pri nacitani stanky"+ httpRequest.status +":"+ httpRequest.statusText);
		}
	}
}

// vlozime id prvku jako parametr, pokud je viditelny, skryje se a naopak
function ShowORhidden(prvek){
	if (document.getElementById(prvek).style.display == 'none' || document.getElementById(prvek).style.display == '')
		document.getElementById(prvek).style.display='block';
	else
		document.getElementById(prvek).style.display='none'
}

// vlozime id prvku jako parametr, pokud je viditelny, skryje se a naopak
function ShowORhidden2(prvek){
	if (document.getElementById(prvek).style.display == 'none' || document.getElementById(prvek).style.display == '')
		document.getElementById(prvek).style.display='inline';
	else
		document.getElementById(prvek).style.display='none'
}

function password(){
	document.getElementById('passwordbox').innerHTML = "<input class=\"in-plain ps-log\" type=\"password\" name=\"heslo\" id=\"heslo\" value=\"\" tabindex=\"2\" />";
	document.getElementById('heslo').focus();
}

// Yobrayovani clanku na HP v zavisloti na pohybu mysi v menu
function hp_articles(id){
	// nacteme clanky z rubriky
	ajax('/index.php?pg=processdata&save_form=ajax_clanky_hp&id='+id,'ajax-cont');
	
	// vsem polozkam v menu zrusime aktivni styl
	for(i=0;i<=100;i++){
		if (document.getElementById('m'+i)) document.getElementById('m'+i).className = '';
	}
	// a nastavime aktivni styl vybrane polozce
	document.getElementById('m'+id).className = 'activeItem';
}

function changeAction(url) {
    //window.alert(url);
	document.modely.action = url;
	document.modely.submit();
}
