function openAWindow( pageToLoad, winName, width, height, center) {
  xposition=0; yposition=0;
  if ((parseInt(navigator.appVersion) >= 4 ) &&(center)) {
   xposition = (screen.width - width) / 2;
   yposition = (screen.height - height) / 2;
  }
  args = "width=" + width + ","
  + "height=" + height + ","
  + "location=0,"
  + "menubar=0,"
  + "resizable=0,"
  + "scrollbars=0,"
  + "status=0,"
  + "titlebar=0,"
  + "toolbar=0,"
  + "hotkeys=0,"
  + "screenx=" + xposition + "," //NN Only
  + "screeny=" + yposition + "," //NN Only
  + "left=" + xposition + "," //IE Only
  + "top=" + yposition; //IE Only
  window.open( pageToLoad, winName, args );
}
function openAWindow2( pageToLoad, winName, width, height, center) {
  xposition=0; yposition=0;
  if ((parseInt(navigator.appVersion) >= 4 ) &&(center)) {
   xposition = (screen.width - width) / 2;
   yposition = (screen.height - height) / 2;
  }
  args = "width=" + width + ","
  + "height=" + height + ","
  + "location=0,"
  + "menubar=0,"
  + "resizable=0,"
  + "scrollbars=1,"
  + "status=0,"
  + "titlebar=0,"
  + "toolbar=0,"
  + "hotkeys=0,"
  + "screenx=" + xposition + "," //NN Only
  + "screeny=" + yposition + "," //NN Only
  + "left=" + xposition + "," //IE Only
  + "top=" + yposition; //IE Only
  window.open( pageToLoad, winName, args );
}

function void_() {
}

function xget(id) {
	if(document.getElementById) return document.getElementById(id);
	if(document.all) return document.all[id];
	return null;
}
		
function show_img(id,table,num) {
	var img_middle='img_middle_1';
	if (xget(img_middle)) 
	{
		xget(img_middle).src='/images.php?table='+table+'&record_id='+id+'&name=image&small=1&width=280';
		xget('img_current').innerHTML=num;
		xget('img_name').innerHTML=xget('name_small_'+num).innerHTML+'<br /><a href="javascript: show_photos_id();">увеличить фото</a>';
		xget('img_content').innerHTML=xget('content_small_'+num).innerHTML;
	}
}

function show_photos_id() {
	var img_middle='img_middle_1';
	if (xget(img_middle)) 
	{
		openAWindow2(xget(img_middle).src.replace("small=1", "small=0"), '', 800+21, 600+27, 1)
	}
}

function show_yy (y, id, id2) {
	var scrolledDown = document.body.parentNode.scrollTop;
	document.getElementById(id).style.top = y+scrolledDown-16+'px';
}

 function getAbsolutePosition(element) {
    var r = { x: element.offsetLeft, y: element.offsetTop };
    if (element.offsetParent) {
      var tmp = getAbsolutePosition(element.offsetParent);
      r.x += tmp.x;
      r.y += tmp.y;
    }
    return r;
  }
  
function makeHttpRequest(url, callback_function, return_xml,nnn) {
  var http_request = false;

  if (window.XMLHttpRequest) { // Mozilla, Safari,...
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType && return_xml == 'xml') {
			 http_request.overrideMimeType('text/xml');
		}
  } else if (window.ActiveXObject) { // IE
		try {
			 http_request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			 try {
				  http_request = new ActiveXObject("Microsoft.XMLHTTP");
			 } catch (e) {}
		}
  }

  if (!http_request) {
		alert('Unfortunately your browser doesn\'t support this feature.');
		return false;
  }

  http_request.onreadystatechange = function() {
		if (http_request.readyState == 4) {
			 if (http_request.status == 200) {
				  if (return_xml == 'xml') {
						eval(callback_function + '(http_request.responseXML,\''+nnn+'\')');
				  } else {
						eval(callback_function + '(http_request.responseText,\''+nnn+'\')');
				  }
			 } else {
				  alert('There was a problem with the request. (Code: ' + http_request.status + ')');
			 }
		}
  }

  http_request.open('GET', url, true);
  http_request.send(null);
}
  
function getProject(stat,nnn) {
	var obj=xget(nnn);
	makeHttpRequest('/getproject.php?ID='+stat, 'displayProject', 'text',nnn);
}

function displayProject(text,nnn) {   
	obj=xget(nnn);
	obj.innerHTML=text;						
}
