function ShowImage (url, resX, resY, title, uid) {
	maxX=screen.availWidth;
	maxY=screen.availHeight-40;
	scrollbars=0;
	if (resX>maxX) {reX=maxX;leftC=0;scrollbars=1;}else {reX=parseInt(resX)+5;leftC=(maxX-resX)/2;}
	if (resY>maxY) {reY=maxY;reX+=20;topC=0;scrollbars=1;}else {reY=resY;topC=(maxY-resY)/2;}
	w=window.open('', 'ph_'+uid, 'width=' + reX + ',height=' + reY+',status=0,toolbar=0,resizable=1, top='+topC+', left='+leftC+',scrollbars='+scrollbars);
	if (title!=""){title1=title;}else{	title1="";}
	lead_url=url.substr(0,1);

	if (lead_url=="."){
		url=""+url.substr(1);
	}
	w.document.open();
	w.document.write('<html><head><title>' + title1 + '</title></head>');
	w.document.write('<body style="margin:0px;padding:1px;" bgcolor="#ffffff" onKeyPress="if (event.keyCode==27) window.close();">');
	w.document.write('<center><a onclick="javascript:window.close();">');
	w.document.write('<img border=0 align=center src="'+url+'" alt="'+title+' \nЛевая кнопка мыши - Закрыть" width="'+resX+'" height="'+resY+'"></a>');
	if (title!=""){
		w.document.write('<br />'+title+'');
	}
	w.document.write('</center></body></html>');
	w.document.close();
	if (w!=null){w.focus();};
}

function ShowImageOnPage(url, resX, resY, title, orig_img_id){
	img=SelectById(orig_img_id);
	if (img){
		img.src=url;
		img.alt=title;
		img.width=resX;
		img.height=resY;

	}else{
		ShowImage(url, resX, resY, title);
	}
}

function SE(domain,addr){
	em=addr+"@"+domain;
	document.write("<a href=\"mailto:"+em+"\">"+em+"</a>");
}

var object_select_type="";
if (document.getElementById) {
	object_select_type = "byelementid";
} else if (document.all){
	object_select_type = "all";
} else if (document.layers){
	object_select_type = "layers";
}


function SelectById(id){
	if (object_select_type=="byelementid"){
		return document.getElementById(id);
	}
	if (object_select_type=="all"){
		return document.all[id];
	}
	if (object_select_type=="layers"){
		return document.layers[id];
	}
}


    function show(ob) 
    { 
      var okno = "scrollbars=1,fullscreen=0,status=0,toolbar=0,"+ 
                 "top=0,left=0,width=600,height=460,resizable=1"; 
      var Win=window.open("", null, okno); 
      Win.document.open(); 
      var i; 
      var s = ""; 
      for (i in ob) s += "<B>"+i+"</B>"+" = "+ob[i]+"<BR>"; 
      Win.document.write(s); 
      Win.document.close(); 
    } 


// fixPNG(); http://www.tigir.com/js/fixpng.js (author Tigirlas Igor)
function fixPNG(element)
{
	if (/MSIE (5\.5|6).+Win/.test(navigator.userAgent))
	{
		var src;
		
		if (element.tagName=='IMG')
		{
			if (/\.png$/.test(element.src))
			{
				src = element.src;
				element.src = "img/blank.gif";
			}
		}
		else
		{
			src = element.currentStyle.backgroundImage.match(/url\("(.+\.png)"\)/i)
			if (src)
			{
				src = src[1];
				element.runtimeStyle.backgroundImage="none";
			}
		}
		
		if (src) element.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='crop')";
	}
}
function fixPNGscale(element)
{
	if (/MSIE (5\.5|6).+Win/.test(navigator.userAgent))
	{
		var src;
		
		if (element.tagName=='IMG')
		{
			if (/\.png$/.test(element.src))
			{
				src = element.src;
				element.src = "img/blank.gif";
			}
		}
		else
		{
			src = element.currentStyle.backgroundImage.match(/url\("(.+\.png)"\)/i)
			if (src)
			{
				src = src[1];
				element.runtimeStyle.backgroundImage="none";
			}
		}
		
		if (src) element.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='scale')";
	}
}
