var U_PanelId;
var	U_X=0;
var	U_Y=0;
var	U_OffsetX=0;
var	U_OffsetY=0;
var	U_PanelMoving=false;
var U_Width=400;
var U_Height=460;
var U_DlgInfo=false;

function ASPanelMouseDown()
{
	try
		{
			if (U_DlgInfo)
				{
					U_X=eval('document.getElementById("'+U_PanelId+'").style.left;');
					U_Y=eval('document.getElementById("'+U_PanelId+'").style.top;');
					U_OffsetX=Math.abs(parseInt(U_X)-window.event.clientX);
					U_OffsetY=Math.abs(parseInt(U_Y)-window.event.clientY);
//					U_PanelMoving=true;
					eval('document.getElementById("'+U_PanelId+'").style.zIndex=1000');
				}
		}
	catch(e){}
}

function ASPanelMouseMove()
{
	U_X=window.event.clientX;
	U_Y=window.event.clientY;
	var L_Left,L_Top,L_LeftOld,L_TopOld;
	try
	{
		window.status=window.event.button;
	if ((window.event.button==1)&&(U_PanelMoving==true))
		{
			L_Left=U_X-U_OffsetX;
			L_Top=U_Y-U_OffsetY;
			window.status=U_X;
			if (L_Left<0)
				L_Left=0;
			if (L_Top<0)
				L_Top=0;
//			if  (L_Left+U_Width>document.body.clientWidth)
//				L_Left=document.body.clientWidth-U_Width;
//			if  (L_Top+U_Height+document.body.scrollTop>document.body.clientHeight)
//				L_Top=document.body.clientHeight-U_Height;
			eval('document.getElementById("'+U_PanelId+'").style.left=L_Left');
			eval('document.getElementById("'+U_PanelId+'").style.top=L_Top');
		}
	}
	catch(e){}
	window.event.returnValue=false;			
}
	
function ASPanelMouseUp()
{
	if (U_PanelMoving==true)
		U_PanelMoving=false;
}

function ASGetDialog()
{
		U_PanelId='idDlgInfo';
		ASPanelMouseDown();
}

function ASCloseDlgInfo()
{
//	document.getElementById("idDlgInfo").innerHTML="";
//	document.getElementById("idDlgInfo").outerHTML="";
	document.getElementById("idOutDlgInfo").innerHTML="";
	U_DlgInfo=false;
}

function ASShowInfo(A_Src)
{
	if (U_DlgInfo==false)
		{
			L_Left=Math.round(document.body.clientWidth/2-U_Width/2);
			L_Top=Math.round(document.body.clientHeight/2-U_Height/2);
			L_Top=document.body.scrollTop+L_Top;
//			L_Left=eval('document.getElementById('+idDlgInfo+'.style.left;');
// alert(L_Left);
//			L_Top=eval('document.getElementById('+idDlgInfo+'.style.top;');

			L_Out='<div id="idDlgInfo" onselectstart="return false" style="position:absolute;left:'+L_Left+'px;top:'+L_Top+'px;width:'+(U_Width+4)+'px;height:'+U_Height+'px;border:2px outset; background-color:#cccccc;overflow:hidden;">'+
			'<div style="background-image:url(http://www.studio.starport.ru/images/design/caphot.gif);padding-top:3px;font:bold 12px arial; width:'+(U_Width)+'px;height:22px;color:white;cursor:default;" onmousedown="ASGetDialog();">&nbsp;Фотография</div>'+
			'<image src="images/design/close.gif" style="position:absolute;left:'+(U_Width-18)+'px;top:2px;" onclick="ASCloseDlgInfo();">'+
			'<div align="center"><img src="'+A_Src+'"></div>'+
			'<a class="td" style="position:absolute;left:180px;top:'+(U_Height-32)+'px;" href="javascript:onclick=ASCloseDlgInfo();">Закрыть</a></div>';
//			L_Out='document.getElementById("idBody").insertAdjacentHTML("BeforeEnd"\,\''+L_Out+'\');';
			document.getElementById("idOutDlgInfo").innerHTML=L_Out;
//			eval(L_Out);
			U_DlgInfo=true;
			//document.getElementById("idDlgInfo").style.visibility='visible';
		}
}
//------------------------------------------
function ASShowPhoto(A_This)
{
	var L_String=A_This.src;
	var L_Pos=0;
	var L_Name;
	var L_PathToBig;
	var L_Split=L_String.split('/');
	L_PathToBig='http://127.0.0.1/www.studio.starport.ru/images/photoalbom/'+L_Split[L_Split.length-3]+'/big/'+L_Split[L_Split.length-1];
	ASShowInfo(L_PathToBig);
}
