if (self.parent.frames.length != 0)
	self.parent.location.replace(document.location.href);

var flash_counter = 1;
var none_value = "none";
var default_value = "Найти";
var text_changed = false;

if (self.parent.frames.length != 0)
	self.parent.location.replace(document.location.href);

function print_select(lines, small)
{
	var width_text = "width:"+(small?"100":"166")+"px";
	if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0)
		width_text = "width:100%";
	document.write ('<select name="nav" onchange="open_location(this.form)" style="'+width_text);
	document.write (';font-family:arial narrow,arial;font-size:11px;');
	document.write ('">');
	for(i=0; i<lines.length; i++)
	{
		sel = lines[i][2] ? " selected" : "";
		document.write ('<option value="'+lines[i][0]+'"'+sel+'>'+lines[i][1]+'</option>');
	}
	document.write ('</select>');
}               
                
function open_location(form)
{               
	var formindex = form.nav.selectedIndex;
	if (form.nav.options[formindex].value != none_value)
		document.location = form.nav.options[formindex].value; 
}

function text_on_submit(form)
{
	if (!text_changed)
	{
		alert("Введите слово для поиска");
		return false;
	}
	return true;
}

function text_on_focus(obj)
{
	if (!text_changed)
		obj.value = "";
}

function text_on_focus_out(obj)
{
	if (obj.value == "")
		text_changed = false;

	if (!text_changed)
		obj.value = default_value;
}

function text_on_keydown(obj)
{
	text_changed = true;
}

//____________________________________________
// Flash detecting
var plugin = 0;
if (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"] && navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin)
{
	if (navigator.plugins && navigator.plugins["Shockwave Flash"])
		plugin = 1;
}
else
if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 
   && (navigator.userAgent.indexOf("Windows 95")>=0 || navigator.userAgent.indexOf("Windows 98")>=0 || navigator.userAgent.indexOf("Windows NT")>=0))
{
	document.write('<script language=vbscript\> \n');
	document.write('on error resume next \n');
	document.write('plugin = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3")))\n');
	document.write('if (plugin <= 0) then plugin = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4")))\n');
	document.write('if (plugin <= 0) then plugin = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5")))\n');
	document.write('</script\> \n');
}

if (!(navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0))
	plugin = 0;

if (navigator.userAgent && navigator.userAgent.indexOf("Opera")>=0)
	plugin = 0;

//____________________________________________
function write_flash(flashName, flashWidth, flashHeight, flashBG, imageName)
{
	var params = new Array();
	write_flash_params(flashName, flashWidth, flashHeight, flashBG, imageName, params);
}

function write_flash_params(flashName, flashWidth, flashHeight, flashBG, imageName, params)
{
	if (plugin)
	{
		var flash_id = "flashobject"+flash_counter;
		var flash_obj = 0;
		document.write('<object id="'+flash_id+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
		document.write(' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,0,0" ');
		document.write(' width='+flashWidth+' height='+flashHeight+'>');
		document.write('<param name=movie value="'+flashName+'"><param name=quality value=high>');
		if (flashBG.length) document.write('<param name=bgcolor value='+flashBG+'>');
		document.write('<param name=wmode value=transparent><param name=menu value=false><param name=scale value=exactfit>');
		document.write('<embed src="'+flashName+'" menu=false quality=high scale=exactfit swLiveConnect=FALSE');
		if (flashBG.length) document.write(' bgcolor='+flashBG);
		document.write(' width='+flashWidth+' height='+flashHeight);
		document.write(' type="application/x-shockwave-flash" pluginspace="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">');
		document.write('</embed>');
		document.write('<noembed><img src="'+imageName+'" width="'+flashWidth+'" height="'+flashHeight+'"></noembed>');
		document.write('</object>');

		flash_obj = window.document.getElementById(flash_id);
		if (flash_obj)
		{
			for (var i=0; i<params.length; i++)
				flash_obj.SetVariable("_root."+params[i][0], params[i][1]);
		}

		flash_counter++;
	}
	else
		document.write('<img src="'+imageName+'" width="'+flashWidth+'" height="'+flashHeight+'">');
}
