var win=null;

function __createModalDialog (u, n, w, h, pos, scrollbars)
{
	if (pos=="random")
	{
		LeftPosition = (screen.width) ? Math.floor(Math.random() * (screen.width-w)):100
		TopPosition = (screen.height) ? Math.floor(Math.random() * ((screen.height-h)-75)):100
	}

	if (pos=="center")
	{
		LeftPosition = ((screen.width) ? (screen.width-w)/2:100) - 13
		TopPosition = ((screen.height)?(screen.height-h)/2:100) - 30
	}

	else if ((pos!="center" && pos!="random") || pos==null)
	{
		LeftPosition=50; TopPosition=50
	}

	settings = 'width='+w+', height='+h+', top='+TopPosition+', left='+LeftPosition+', scrollbars='+scrollbars+', location=0, directories=0, status=0, menubar=0, toolbar=0, resizable=0';

	win = window.open(u, n, settings)
	if(win.focus)
	{
		win.focus()
	}
}

function __createModalDialogA (u, n, w, h, pos, scrollbars)
{
	if (pos=="random")
	{
		LeftPosition = (screen.width) ? Math.floor(Math.random() * (screen.width-w)):100
		TopPosition = (screen.height) ? Math.floor(Math.random() * ((screen.height-h)-75)):100
	}

	if (pos=="center")
	{
		LeftPosition = ((screen.width) ? (screen.width-w)/2:100) - 13
		TopPosition = (screen.height)?(screen.height-h)/2:100
	}

	else if ((pos!="center" && pos!="random") || pos==null)
	{
		LeftPosition=50; TopPosition=50
	}

	settings = 'width='+w+', height='+h+', top='+TopPosition+', left='+LeftPosition+', scrollbars='+scrollbars+', location=0, directories=0, status=0, menubar=0, toolbar=0, resizable=0';

	win = window.open(u, n, settings)
	if(win.focus)
	{
		win.focus()
	}
}

function __showLib (u)
{
	LeftPosition = ((screen.width) ? (screen.width-540)/2:100) - 10
	TopPosition = ((screen.height)?(screen.height-500)/2:100) - 20

	settings = 'width=540, height=500, top='+TopPosition+', left='+LeftPosition+', scrollbars=no, location=0, directories=0, status=0, menubar=0, toolbar=0, resizable=0';

	win = window.open(u, '__ksGalleryWindow', settings)
	if(win.focus)
	{
		win.focus()
	}
}