
function getLeftTopForWindow(width, height)
{ 

	var left = ((screen.width / 2) - (width / 2)); 
	var top = ((screen.height / 2) - ((height / 2) + 30)); 

	if (top < 0) { top = 0; } 
	if (left < 0) { left = 0; } 

	return "left=" + left + ",top=" + top; 
}

function OpenWndScreenShot( img_name, width, height )
{
//	width = x; height = y;
//	x += 50; y += 70;
//	imageViewer = window.open("screenShot.php?current=" + currentScreen + "&data=" + data + "&width=" + width + "&height=" + height, "imageViewer", "scrollbars=0,menu=0,width=" + x + ",height=" + y + "," + getLeftTopForWindow(x,y));
//	window.open( img_name );
	window.open(img_name,"Screenshot",
	"height=" + (height+32) + ",width=" + (width+16) + ",status=no,toolbar=no,menubar=no,location=no," + getLeftTopForWindow(width,height));
}


// Wallpaper functions.

function ShowScreenResolutionStatus( resolution )
{
	var current_resolution = screen.width + 'x' + screen.height;

	if ( current_resolution == resolution )
		document.write( " <font color=\"888888\">( *Your screen resolution )</font>" );
}

function MakeLargeTnLinkStart( imageid, has_size_1600x1200 )
{
	var current_resolution = screen.width + 'x' + screen.height;
	var tn_url = '<a href="/wallpaperview.php/' + imageid + '/' + current_resolution + '">';

	var valid_resolution = 0;

	if ( current_resolution == '1600x1200' || current_resolution == '1280x1024' || current_resolution == '1024x768' || current_resolution == '800x600' )
		valid_resolution = 1;

	if ( valid_resolution && current_resolution != '1600x1200' )
		document.writeln( tn_url );
	else if ( current_resolution == '1600x1200' && has_size_1600x1200 )
		document.writeln( tn_url );
	else
		document.writeln( '<a href="/preview.php/' + imageid + '">' );
}

function MakeLargeTnLinkEnd()
{
	document.writeln( '</a>' );
}

function GetScreenSet( screensize )
{
	if ( screensize == '1600x1200' && screen.width == 1600 && screen.height == 1200 )
		return true;
	else if ( screensize == '1280x1024' && screen.width == 1280 && screen.height == 1024 )
		return true;
	else if ( screensize == '1024x768' && screen.width == 1024 && screen.height == 768 )
		return true;
	else if ( screensize == '800x600' && screen.width == 800 && screen.height == 600 )
		return true;

	return false;
}

