var Path;



///////////////////////////////////////////////////////////////////////////
function chnPNGBg(nm,src)
{
	if(document.getElementById) 
	{
		mb_obj = document.getElementById(nm);
    		if(mb_obj.runtimeStyle) 
		{
	      		mb_obj.style.backgroundImage = 'none';
	      		mb_obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='scale')";
    		}
  	}
}

function imgPreLoad(src)
{
	img = new Image();
	img.src = src;
}
///////////////////////////////////////////////////////////////////////////



function SetScroll()
{
	try
	{

		ScrollPosition = document.documentElement.scrollTop;
		pos = "0px";
	
		if(ScrollPosition != 0)pos =  ScrollPosition + "px";
		else scroll(0,0);
		
		if(document.getElementById("IMGWindowPad")!=null)
			document.getElementById("IMGWindowPad").style.marginTop = pos;
	}
	catch(e)
	{
		scroll(0,0);
	}

}

function WindowResize(box_name)
{

	sizer1 = document.getElementById("Sizer1");
	sizer2 = document.getElementById("Sizer2");
	WindowDiv = document.getElementById(box_name);

	sizer1_width = sizer1.offsetWidth;
	sizer1_height = sizer1.offsetHeight;
	sizer2_width = sizer2.offsetWidth;
	sizer2_height = sizer2.offsetHeight;

	sizer1_width = 995;

	if(sizer2_width<sizer1_width) 	w = sizer1_width; else w = sizer2_width; 
	if(sizer2_height<sizer1_height)	h = sizer1_height; else h = sizer2_height; 

	WindowDiv.style.width = w  + "px";
	WindowDiv.style.height = h + "px";
}

////////////////////////////////////////////////////////////////////////
function ShowImage(url, x, y, id)
{
	CloseImg();

	SetScroll();
	ShowImageResize();
	onresize = ShowImageResize;

	try
	{
		document.getElementById("IMGWindowDiv").style.display = "block";
		img = document.getElementById("ImgHolder");

		nimg = new Image();
		nimg.onload = function() 
			{
				img.width = x;
				img.height = y;
				img.src = nimg.src;
    			}
    		nimg.src = url;	

	}
	catch(e)
	{
		x+=30;
		y+=30;
		l = (screen.width-x)/2;
		t = 50;
		window.open(url,'w' + Math.round(Math.random()*1000),'status=yes,width=' + x + ',height=' + y + ',left=' + l + ',top=' + t + ',toolbar=no,menubar=no,location=no,scrollbars=no');
	}
}





function ShowImageResize()
{
	WindowResize("IMGWindowDiv");
}

function CloseImg()
{
	document.getElementById('IMGWindowDiv').style.display='none';
	onresize = null;
	document.getElementById("ImgHolder").width = 220;
	document.getElementById("ImgHolder").height = 19;
	document.getElementById("ImgHolder").src = Path + "simg/progress.gif";
}
