/**
 * viewer.js
 * (C) 2006 Maxim Vuets, http://maxim.vuets.name/
 **/


var WIDTH = 320;
var START_X = 26;
var START_Y = 390;


var indicator = new Image();
indicator.onload = function() {
	var x = Math.floor( (WIDTH-indicator.width) / 2 ) + START_X;
	var y = Math.floor( (240-indicator.height) / 2 ) + START_Y;
	indicator.position = x + "px " + y + "px"; };
indicator.src = "/indicator.gif";


var examples;
var img = new Image();


function View( obj )
{
	if( ! examples )
	{
		if( ! document.getElementById ) return true;
		examples = document.getElementById( "examples" );
	}

	if( img.src == obj.href )
		return false;

	if( ! indicator.complete )
		return true;

	examples.style.backgroundPosition = indicator.position;
	examples.style.backgroundImage = "url(" + indicator.src + ")";

	img.onload = function() {};
	delete img;
	img = new Image();
	img.onload = function() {
		var x = Math.floor( (WIDTH-img.width) / 2 ) + START_X;
		examples.style.backgroundPosition = x + "px " + START_Y + "px";
		examples.style.backgroundImage = "url(" + obj.href + ")"; };
	img.src = obj.href;

	return false;
}


function DisplayCounter()
{
	document.write( '<a href="http://www.liveinternet.ru/click"><img src="http://counter.yadro.ru/hit?t25.18'
		+ ';r' + escape( document.referrer )
		+ ( ( typeof(screen) == 'undefined' ) ? '' :
				';s' + screen.width + '*' + screen.height
				+ '*' + ( screen.colorDepth ? screen.colorDepth : screen.pixelDepth ) )
		+ ';u' + escape( document.URL )
		+ ';' + Math.random()
		+ '" width="88" height="15" alt="" title="LiveInternet"/></a>' );
}
