var is_ie = ((navigator.userAgent.toLowerCase().indexOf("msie") != -1) && (navigator.userAgent.toLowerCase().indexOf("opera") == -1));
function ShowPic(pic, lang)
{
  var temp = '/showpic.php?pic=' + pic + '&lang=' + lang;
  var xpos = (screen.width-100)/2;
  var ypos = (screen.height-100)/2;
  window.open(temp,'showpic','fullscreen=no,channelmode=no,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=1,height=1,top='+ypos+',left='+xpos); 
}


function Mark(s)
{
  var r, i;
  if (s) 
  {
    r = window.document.body.createTextRange();
    for (i=0; r.findText(s); i++) 
    {
      r.execCommand("BackColor", "", "#000000");
      r.execCommand("ForeColor", "", "#FFFFFF");
      r.execCommand("Bold", "", "");
      r.collapse(false);
    }
  }
}
function set_image(pic, x, y)	// подгружает картинку
{
	var big_pic = new Image();
	big_pic.src = pic.replace('/tn_', '/')+'?'+Math.random();
	big_pic.onload = function() {return get_image(pic, this, x, y);}
	return true;
}
function get_image (pic, big_pic, x, y)	// определяет размеры картинки и показывает
{
	var width = big_pic.width;
	var height = big_pic.height;
	if (width > 700)
	{
		width = 700;
		height = big_pic.height / (big_pic.width / width);
	}
	if (height > 525)
	{
		height = 525;
		width = big_pic.width / (big_pic.height / height);
	}
	var div = document.getElementById(pic);
	div.style.width = width+'px';
	div.style.height = (height+13)+'px';
	div.style.left = (((document.body.scrollWidth - width) / 2) + document.body.scrollLeft)+'px';
	div.style.top = (((document.body.scrollHeight - height - 13) / 2) + document.body.scrollTop)+'px';
//	div.style.left = x+'px';
//	div.style.top = y+'px';
	image = div.childNodes[1];
	image.src = big_pic.src;
	image.style.width = width+'px';
	image.style.height = height+'px';
	return true;
}

/* Открывает новое окно "Версия для печати" */
function OpenPrint(path)
{
  var addwinw = 600;
  var addwinh = 600;
  var temp = path;
  var xpos = (screen.width-addwinw)/2;
  var ypos = (screen.height-addwinh)/2;
  qqq = window.open(temp,'openprint','fullscreen=no,channelmode=no,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width='+addwinw+',height='+addwinh+',top='+ypos+',left='+xpos); 
  qqq.focus();
}

