function popup(img, gallery_id, foto_id) {
	popupSingle(img.src.replace(/(\.thumb|_?m).jpg/,'.jpg'));
	//window.open('/snb/foto/'+gallery_id+'/popup/'+foto_id, 'popup', 'width=640,height=480,resizable=1,scrollbars=yes');
}
function flashpopup(file){
	window.open('/www/flashpopup.php?file='+file, 'popup', 'width=700,height=467,resizable=1,scrollbars=no');
}
function foto(image) {
	window.open('/www/popup.php?img='+image, 'popup', 'width=640,height=480,resizable=1,scrollbars=yes');
}
function popupSingle(image) {
	foto(image);	
}

function popupInit() {
	//	uprava velikosti popup okna na spravnou velikost
	var plusHeight = 110 ;
	var plusWidth = 32;
	
	s=window;
	var w = 1024, h = 768;
	if (document.all || document.layers) {
	   w = screen.availWidth;
	   h = screen.availHeight;
	}
	
	
	sirkaOk=document.images[0].width+plusWidth;
	vyskaOk=document.images[0].height+plusHeight;
	
		
	window.resizeTo(sirkaOk, vyskaOk);
	
	s.focus();
	
}

function parseQueryString (str) {
  str = str ? str : location.search;
  var query = str.charAt(0) == '?' ? str.substring(1) : str;
  var args = new Object();
  if (query) {
    var fields = query.split('&');
    for (var f = 0; f < fields.length; f++) {
      var field = fields[f].split('=');
      args[unescape(field[0].replace(/\+/g, ' '))] = 
unescape(field[1].replace(/\+/g, ' '));
    }
  }
  return args;
}

function responseComment(parent_comment_id, nick, text) {
	self.location.href='#comment_add';
	$('comment_answer').innerHTML='Odpověď na příspěvek:<br /> <i>'+text+'</i> <span class="nick">(by '+nick+')</span> <span onclick="cancelParentComment()" class="cancel">&times;zrušit</span>';
	Effect.BlindDown('comment_answer');
	$('comment_parent_id').value=parent_comment_id;
}

function cancelParentComment() {
	Effect.BlindUp('comment_answer');
	$('comment_parent_id').value='null';
	$('comment_answer').innerHTML='';
}
