var NotSuggestedToInstallFlash = true;

function FlashVersion()
{
	var Result = new String("");
	var i = 0;
	if ((navigator.appName == "Microsoft Internet Explorer") && (navigator.userAgent.search(/Opera/) == -1))
	{
		if (window.ActiveXObject)
			for (i = 2; i <= 20; i++)
				try	{
					if (eval("new ActiveXObject('ShockwaveFlash.ShockwaveFlash." + i + "')")) Result = i;
				} catch(e) {}
	} else {
		if (navigator.plugins && navigator.plugins.length)
			for (i=0; i < navigator.plugins.length; i++)
				if (navigator.plugins[i].name.indexOf('Shockwave Flash') != -1)
				{
					Result = navigator.plugins[i].description.split('Shockwave Flash ')[1];
					break;
				}
		if (Result) Result = Result.charAt(0); else Result = 0;
	}
	return Result;
}

function PrintFlash(IdAndName, FlashFile, Width, Height, Align, BgColor, ImgFile, ImgAlt) {
	if (FlashVersion() >= 6)
	{
		document.write(
			'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="' + Width + '" height="' + Height + '" id="' + IdAndName + '" align="' + Align + '">\n' +
			'<param name="allowScriptAccess" value="sameDomain" />\n' +
			'<param name="movie" value="' + FlashFile + '" />\n' +
			'<param name="quality" value="high" />\n' +
			'<param name="bgcolor" value="' + BgColor + '" />\n' +
			'<embed src="' + FlashFile + '" quality="high" bgcolor="' + BgColor + '" width="' + Width + '" height="' + Height + '" name="' + IdAndName + '" align="' + Align + '" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\n' +
			'<' + '/object>\n');
	} else {
		document.write('<img src="' + ImgFile + '" align="' + Align + '" alt="' + ImgAlt + '" title="' + ImgAlt + '" border="0" />\n');
		if (NotSuggestedToInstallFlash) {
			document.write(
				'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="1" height="1" id="flash-hat" align="right">\n' +
				'<param name="allowScriptAccess" value="sameDomain" />\n' +
				'<param name="movie" value="/images/interface/empty.swf" />\n' +
				'<param name="quality" value="high" />\n' +
				'<param name="bgcolor" value="#3967BA" />\n' +
				'<embed src="/images/interface/empty.swf" quality="high" bgcolor="#3967BA" width="1" height="1" name="hat" align="right" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\n' +
				'<' + '/object>\n');
			NotSuggestedToInstallFlash = false;
		}
	}
}

function PrintWeather() {
	document.write('<object id="weather" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="160" height="185">\n' +
		'<param name=movie value="http://informer.gismeteo.ru/flash/mtown.swf" />\n' +
		'<param name="flashvars" value="cset=1&tnumber=10&city0=27595&city1=27612&city2=62463&city3=62460&city4=41194&city5=48454&city6=78479&city7=78374&city8=17300&city9=43192" />\n' +
		'<param name="quality" value="high" />\n' +
		'<param name="bgcolor" value="#FFFAF0" />\n' +
		'<embed src="http://informer.gismeteo.ru/flash/mtown.swf?cset=1&tnumber=10&city0=27595&city1=27612&city2=62463&city3=62460&city4=41194&city5=48454&city6=78479&city7=78374&city8=17300&city9=43192" quality="high" bgcolor="#FFFAF0" width="160" height="185" name="mtown" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\n' +
		'<' + '/object>\n');
}

function PrintBeglobal() {
	document.write('<iframe name="beglobal" src="http://www.beglobal.ru/external/937/search.jsp" ' +
		'width="600" height="255" scrolling="auto" frameborder="0"> </iframe>');
}
//==============================================================================

window.onload = function() {
	//? ? ? ? ? ? ? ?
	if (document.getElementsByTagName) {
		var spans = document.getElementsByTagName('span')
		for (var i = 0; i < spans.length; ++i) {
			if (spans[i].className == 'email') {
				var c = spans[i].firstChild.nodeValue.split('(0)').join('@');
				var anchorText = document.createTextNode(c);
				var anchor = document.createElement('a');
				anchor.href = 'mailto:' + c;
				anchor.appendChild(anchorText);
				spans[i].replaceChild(anchor, spans[i].firstChild);
			}
		}
	}
	//?????????? ??? ???? ???????? ? IE
	if ((navigator.appName == "Microsoft Internet Explorer")&&
		(navigator.userAgent.search(/Opera/) == -1)) {
		window.onresize = NewWidth;
		NewWidth();
		StartList();
	}
}

function NewWidth() {
	if (document.body.clientWidth < 771) {
		document.getElementById('hat').style.width = '770px';
		document.getElementById('menu').style.width = '770px';
		document.getElementById('main').style.width = '770px';
		document.getElementById('copyright').style.width = '770px';
	} else {
		document.getElementById('hat').style.width = '99%';
		document.getElementById('menu').style.width = '99%';
		document.getElementById('main').style.width = '99%';
		document.getElementById('copyright').style.width = '99%';
	};
}

function StartList() {
	if (document.all && document.getElementById) {
		navRoot = document.getElementById("mainmenu");
		for (i = 0; i < navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName == "LI") {
				node.onmouseover = function() {this.className += " over";}
				node.onmouseout  = function() {this.className = this.className.replace(" over", "");}
			}
		}
	}
}

//==============================================================================
function GuestOk() {
	var Res = true;
	if (document.getElementById('name').value == '') {
		alert('???? "???? ???" ??????????? ??? ??????????.');
		Res = false;
	} else {
		if (document.getElementById('guest_message').value == '') {
			alert('???? "???? ?????????" ??????????? ??? ??????????.');
			Res = false;
		} else {
			if (document.getElementById('word').value == '') {
				alert('???? "?????? ?? ???????" ??????????? ??? ??????????.');
				Res = false;
			}
		}
	}
	return Res;
}

//===RSS========================================================================
function AbilonMessage() {
	var Message = '??????????? ???? http://www.abilon.org/ ????????? Abilon ' +
		'News Aggregator ?? ???? ????????? ??? ?????????, ????? ????? ???? ' +
		'??????????.\n\n'+
		'?? ?????? ??????? ??? ????????? ? ?????? ????? (?????? 2.5.3, build ' +
		'196). ?????? ?????????? 595 ??, ???????? ?????? ?? ????? ???? ' +
		'?????.\n\n' +
		'??? ?????? ???????? ??????? [??].';

	if (confirm(Message))
		document.location = 'http://otdohnu.ru/downloads/InstallAB.exe';
	return false;
}
