
var img; // nastavi hlavicka!!!
var url_lide;
var url_chat;
var url_message;
var url_blog;
var url_forum;
var url_date;
var url_meet;
var url_profile;

var browser = null
if (document.all)
	browser = 'ie' 
if (!document.all && document.getElementById)
	browser = 'nn6'

function popup(url,name,x,y)
{
	re = new RegExp ("\.", "ig");
	name = name.replace(re,"")
	aa = window.open(url, name,'resizable,scrollbars,menubar=0,status,width=' + x + ',height=' + y); 
	if(aa)
		aa.focus();
	else
		alert('Povolte v prohlizeci Pop-up okna!')
	return false
}
function checkLen(obj,maxlen)
{
	if(!maxlen) { maxlen = 255 }
	if (obj.value.length>maxlen)
	{
		obj.value = obj.value.substring(0,maxlen)
	}
	window.status = obj.value.length + ' znaků z '+maxlen
}
function infouser(user,auth)
{
	//pro zacatek jen nahradim profilem
	aa = window.open(url_profile+'/'+user+'/profil/'); 
	if(aa)
		aa.focus();
	else
		alert('Povolte v prohlizeci Pop-up okna!')
}
function inforoom(room_ID,auth)
{
	var x=500; var y=280;
	aa = window.open(url_chat+'/index.fcgi?akce=info_room&room_ID='+room_ID+'&auth='+auth, 'Room'+room_ID,'resizable,scrollbars,status,menubar=0,width=' + x + ',height=' + y); 
	if(aa)
		aa.focus();
	else
		alert('Povolte v prohlizeci Pop-up okna!')
}
function friends_show(friend_ID,auth)
{
	var x=510; var y=510;
	aa = window.open(url_profile+'/friend.fcgi?akce=friend_info&friend_ID='+friend_ID+'&auth='+auth, 'friends'+friend_ID,'resizable,scrollbars,status,menubar=0,width=' + x + ',height=' + y); 
	if(aa)
		aa.focus();
	else
		alert('Povolte v prohlizeci Pop-up okna!')
}
function showPreview(user_ID,auth)
{
	var x=500; var y=300;
	aa = window.open(url_profile+'/setup.fcgi?akce=photo_popup&user_ID='+user_ID+'&auth='+auth, '', 'resizable,scrollbars,status,menubar=0,width=' + x + ',height=' + y); 
	if(aa)
		aa.focus();
	else
		alert('Povolte v prohlizeci Pop-up okna!')
}
function showPhoto(x,y,file,comment,close)
{
	comment = comment.replace('<','&lt;');
	comment = comment.replace('>','&gt;');

	var w = screen.availWidth||screen.width;
	var h = screen.availHeight||screen.height;
	var move_win = 0;
	wx = x+42; wy = y + 32;
	h -= 30; w -= 30;
	if (wx>w) { wx = w; move_win=1 }
	if (wy>h) { wy = h; move_win=1 }
	if (!comment) {	comment = '' }
	if (file.substring(0,4) != 'http' && file.charAt(0) != '/')
		file = "http://imb.lide.cz/photo/big/"+file
	var data_close = ""
	if (close==1)
		data_close ="onClick='window.close()' style='cursor: hand; cursor: pointer; '"
	var data = "<HTML><BODY bgcolor='#FFE29D' STYLE=\"margin: 5px;\"><DIV align=center>"+comment+"<BR><IMG SRC='"+file+"' width="+x+" height="+y+" border=1 "+data_close+"></DIV></BODY></HTML>"
	var aa = window.open("", 'photo', 'resizable,scrollbars,status,menubar=0,width=' + wx + ',height=' + wy);
	if(aa)
	{
		if (move_win==1) { aa.moveTo(0,0) }
		aa.document.write(data)
		aa.document.close();
		aa.focus();
	}
	else
		alert('Povolte v prohlizeci Pop-up okna!')
}

function sendMsg(auth, name_to)
{
	var x=800; var y=305;
	aa = window.open(url_message+'/index.fcgi?akce=msg_send&name_to='+name_to+'&auth='+auth, '', 'resizable,scrollbars,status,menubar=0,width=' + x + ',height=' + y); 
	if(aa)
		aa.focus();
	else
		alert('Povolte v prohlizeci Pop-up okna!')
}

function ok()
{
	return confirm("Opravdu provést?")
}
function del()
{
	return confirm("Opravdu smazat?")
}

function crypt_email(s)
{
	var r="";
	for(i=0; i < s.length; i++)
	{ 
		n = s.charCodeAt(i); 
		if (n>=8364) {n = 128;}
		r += String.fromCharCode(n-4); 
	}
	return r;
}

function kukina(key,val)
{
	if (!val) { val = "" }
	document.cookie = key+"="+val+";expires=Thu, 31-Dec-2020 00:00:00 GMT;path=/;domain=lide.cz";
	return true;
}
