function check(minim, maxim)
{
	num = document.getElementById("PAGE");

	if(num.value=="")
		num = document.getElementById("PAGE2");
	if(num.value!="")
		if(num.value>=1 && num.value<=maxim)
			return true;
			
	alert('Nelze prejit na stranu: '+num.value);
	return false;
}

var subItemOpen = ""; 

function obj( obj ) {
	if(document.getElementById) obj=document.getElementById(obj);
  	else if(document.all) obj=document.all[obj];
  	else obj=null;
	return obj;
} 

function collapse(id) {
//	if (id.indexOf("a2") == 0) {
		if (subItemOpen != "" && subItemOpen != id) { 
			obj(subItemOpen).className = "close"; 
		}
		if (obj(id).className == "close") {
			obj(id).className = "open"; 
			subItemOpen = id; 
		}
		else { 
			obj(id).className = "close"; 
			subItemOpen = ""; 
		}
//	}
} 

function DetailReceptu(ID) {
//	alert(ID);
	img = document.getElementById(ID);
	p = img.src.substring(img.src.lastIndexOf('\/')+1);
	window.open('detail.php?filename='+p,'DetailReceptu','width=750,height=580,scrollbars=yes,resizable=yes');
	return true;
}

function DetailReceptu2(ID) {
//	alert(ID);
	img = document.getElementById(ID);
	p = img.src.substring(img.src.lastIndexOf('\/')+1);
	window.open('detail2.php?filename='+p,'DetailReceptu','width=750,height=580,scrollbars=yes,resizable=yes');
	return true;
}

function DalsiObrazek(fold,pict,numbers,ID,count,delta) {
	//alert(ID);
	img = document.getElementById(ID);
	p = img.src.substring(img.src.lastIndexOf('\/')+1);
	//img.src = 'http://www.profimedia.cz/img/thumbnails/'+fold+'/'+pict;
	pictures = pict.split(",");
	number_id = ID.replace('i','n');
	number = document.getElementById(number_id);
	numberlist = numbers.split(",");
//	alert(number_id);
	
	i=0;
	while(i<count)
	{
		//alert(pictures[i]);
		if(pictures[i]==p)
			break;
		i++;
	}
	i+=delta;
	if(i<0)
		i=count-1;
	if(i>count-1)
		i=0;
	//alert('http://www.profimedia.cz/img/thumbnails/'+fold+'/'+pictures[i+1]);
	img.src = 'http://www.profimedia.cz/img/thumbnails/'+fold+'/'+pictures[i];
//	number.innerHTML = numberlist[i];
	return true;
}

function recipe() {
	window.open("recipe_info.php","recipe","width=300,height=150");
}

function story(id) {
	window.open("view_story.php?id="+id,"story","width=750,height=550,scrollbars=yes,resizable=yes");
}

function nepublikovat(id) {
	window.open("nepublikovat.php?id="+id,"recipe","width=200,height=80");
}

function zobrazit(filename,zobr) {
	window.open("zobrazit.php?filename="+filename+"&zobr="+zobr,"recipe","width=200,height=80");
	window.location.reload();
}

function isFlash(ver) {
var state = false;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : false;
if (plugin) {
	state = (parseInt(plugin.description.substring(plugin.description.indexOf(".")-1)) >= ver)? true : false;
}
else if (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.indexOf("MSIE 4") == -1 && navigator.appVersion.indexOf("Macintosh") == -1 && navigator.appVersion.indexOf("68K") == -1) {
	eval('try { var flash = new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + ver); state = true; } catch(e) {  }');
}
return state;
}

function fgFwrite(d,FGswfSource,FGxmlSource)	{
d.write('<OBJECT CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" CODEBASE="http://active.macromedia.com/flash5/cabs/swflash.cab#version=5,0,0,0"" ID=fgmovie WIDTH=784 HEIGHT=241> ');
d.write(' <PARAM NAME="movie" VALUE="'+FGswfSource+'?xmlfile='+FGxmlSource+'&duration=10000">');
d.write(' <PARAM NAME="play" VALUE="false">');
d.write(' <PARAM NAME="quality" VALUE="high">');
d.write(' <EMBED NAME=fgmovie SRC="'+FGswfSource+'?xmlfile='+FGxmlSource+'&duration=10000" WIDTH=784 HEIGHT=241 PLAY=false SWLIVECONNECT=true QUALITY=high>');
d.write('</OBJECT>');
}

function newlight() {

	window.open("create_lightbox.php","Lightbox","width=400,height=190,scrollbars=auto");
} 

function tips() {
	window.open("tips.php","recipe","width=650,height=600,scrollbars=yes");
}

function help() {
	window.open("help.php","recipe","width=650,height=600,scrollbars=yes");
}

function uprava(cislo) {
	window.open("uprava.php?cislo="+cislo,"recipe","width=650,height=600,scrollbars=yes");
}

function AddLightbox(filename) {
	
	img = document.getElementById(filename);
	p = img.src.substring(img.src.lastIndexOf('\/')+1);
	top.frames[1].location = 'lightbox.php?akce=add&image='+p;
}

function collapseFrame() {
	if (parent.document.body.rows.indexOf(128) > 0) {
		parent.document.body.rows = "*,31";
		document.images["coll-img"].src="img/btn_collapse_max.gif";
		document.getElementById("coll-txt").innerHTML = "Show";
		document.getElementById("preview").style.display = "none";
	} else {
		document.getElementById("preview").style.display = "block";
		document.images["coll-img"].src="img/btn_collapse_min.gif";
		document.getElementById("coll-txt").innerHTML = "Hide";
		parent.document.body.rows = "*,128";
	}
}

function send_lightbox() {

	window.open("./send_lightbox.php","logout","width=600,height=280,scrollbars=0");	
} 

function register() {
	window.open("./register.php","registrace","width=600,height=600,scrollbars=1");
} 

function login() {
	window.open("./login.php","login","width=550,height=400,scrollbars=1");
} 

function logout() {
	window.open("./login.php?odeslano=2","logout","width=600,height=600,scrollbars=1");
} 

function remindpassword() {
	window.open("./zadost.php","vop","width=450,height=230,scrollbars=0");	
} 

function OrderHires(cislo, nazev) {
	window.open('objednavka_hiresu.php?image='+cislo+'&nazev='+nazev,'HiresOrder','width=750,height=480,scrollbars=yes,resizable=yes')
} 