mouse_coord=Array();

div_coords=Array();

id='';

z_index=20;

move=false;

wn=0;

function newWindow_2(text,winWidth, winHeight)

	{
	wn+=1;
	z_index+=wn;

	path_for_images_2="/public_scripts/windows_2/window/";

	tmp_id="window_2_"+Math.round(Math.random()*1000000);

	pos=ViewPosition();

	winX=(pos[0]-winWidth)/2+pos[2];

	winY=(pos[1]-winHeight)/2+pos[3];

	if (winX<0) winX=0;

	if (winY<0) winY=0;

	window_tmp=

"<div id='"+tmp_id+"' style=\"position:absolute; top:"+winY+"px; left:"+winX+"px; width:"+winWidth+"px; height:"+winHeight+"px; min-width:200px;\">"

+"<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width='100%'>"

+"<tr>"

+"<th style=\"width:41px; height: 37px; background-image:url("+path_for_images_2+"top_left.png); background-repeat:repeat-x;\" id='pngFix_1_"+wn+"'></th>"

+"<td style=\"background-image:url("+path_for_images_2+"top.png); height:37px; background-repeat:repeat-x\" valign=\"bottom\" id='pngFix_2_"+wn+"'>"

+"</td>"

+"<th style=\"background-image:url("+path_for_images_2+"top_right.png); width:42px; background-repeat:repeat-x;\" valign=\"top\" align=\"right\" id='pngFix_3_"+wn+"'>"

+"</th>"

+"</tr>"

+"<tr valign=\"top\">"

+"<th style=\"background-image:url("+path_for_images_2+"left.png); background-repeat:repeat-y;\" id='pngFix_5_"+wn+"'>&nbsp;</th>"

+"<td style=\"background:rgb(235,216,201);\" id='pngFix_6_"+wn+"'>"

+"<table width='100%' border='0'><tr><td align='right'><img src='/images/standart/krest.gif' border='0' id='pngFix_4_"+wn+"' alt='X' onclick=\"$('#"+tmp_id+"').remove().html('');\" style='cursor:pointer;' /></td></tr></table>"

+"<div align='left' style='height:"+(winHeight-80)+"px; overflow:auto' id='"+tmp_id+"_content'>"

+text

+"</div>"

+"</td>"

+"<td style=\"background-image:url("+path_for_images_2+"right.png); background-repeat:repeat-y;\" id='pngFix_7_"+wn+"'>&nbsp;</td>"

+"</tr>"

+"<tr>"

+"<th style=\"width:41px; height: 42px; background-image:url("+path_for_images_2+"bottom_left.png); background-repeat:repeat-x;\" id='pngFix_8_"+wn+"'></th>"

+"<td style=\"background-image:url("+path_for_images_2+"bottom.png); height:42px;\" id='pngFix_9_"+wn+"'>&nbsp;</td>"

+"<th style=\"background-image:url("+path_for_images_2+"bottom_right.png); width:42px; background-repeat:repeat-x;\"id='pngFix_10_"+wn+"'></td>"

+"</tr>"

+"</table>"

+"</div>";

	$(window_tmp).css("display",'none').appendTo(document.body).fadeIn('slow');

	id=tmp_id;

	fixPNG(document.getElementById('pngFix_1_'+wn));

	fixPNG(document.getElementById('pngFix_2_'+wn));

	fixPNG(document.getElementById('pngFix_3_'+wn));

	fixPNG(document.getElementById('pngFix_4_'+wn));

	fixPNG(document.getElementById('pngFix_5_'+wn));

	fixPNG(document.getElementById('pngFix_6_'+wn));

	fixPNG(document.getElementById('pngFix_7_'+wn));

	fixPNG(document.getElementById('pngFix_8_'+wn));

	fixPNG(document.getElementById('pngFix_9_'+wn));

	fixPNG(document.getElementById('pngFix_10_'+wn));

	return tmp_id;

	}



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 = "/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')";

	}

}	



function ViewPosition()

	{

	var xScroll, yScroll;

	var windowWidth, windowHeight;

	if (self.pageYOffset) 

		{

		yScroll = self.pageYOffset;

		xScroll = self.pageXOffset;

		} 

	else if (document.documentElement && document.documentElement.scrollTop) 

		{

		yScroll = document.documentElement.scrollTop;

		xScroll = document.documentElement.scrollLeft;

		} 

	else if (document.body) 

		{

		yScroll = document.body.scrollTop;

		xScroll = document.body.scrollLeft;	

		}

	if (self.innerHeight) 	// all except Explorer

		{

		if(document.documentElement.clientWidth)

			{

			windowWidth = document.documentElement.clientWidth; 

			} 

		else 

			{

			windowWidth = self.innerWidth;

			}

		windowHeight = self.innerHeight;

		} 

	else if (document.documentElement && document.documentElement.clientHeight)  // Explorer 6 Strict Mode

		{

		windowWidth = document.documentElement.clientWidth;

		windowHeight = document.documentElement.clientHeight;

		} 

	else if (document.body)  // other Explorers

		{

		windowWidth = document.body.clientWidth;

		windowHeight = document.body.clientHeight;

		}	

	return [windowWidth, windowHeight, xScroll, yScroll];

	}	
