function form(action, method, target, submit)
{
	if ('undefined' == typeof(method)) {
		method = 'post';
	}
	var targ = '';
	if (false != target && 'undefined' != typeof(target)) {
		targ = ' target="' + target + '"';
	}
	var subm = '';
	if ('undefined' != typeof(submit)) {
		subm = ' onsubmit="'+submit+'" '
	}
	document.write('<form method="'+method+'" action="'+action+'" '+targ+' '+subm+' enctype="multipart/form-data">');
	return;
}
function formc() {document.write('</'+'fo'+'rm>');};

var setBlocks = new Array();
var setRightBG = function(divArr) {

	var s = 890;
	var bodyOffsWidth = parseInt(document.body.offsetWidth);
	var size = (bodyOffsWidth - s)  /2 ;

	var cachedBlock = new Array();
	if (setBlocks.length == 0 && divArr.length > 0) {
		setBlocks = divArr;
	}
	if (0 == cachedBlock.length && setBlocks.length > 0) {
		for (var i=-1;++i<setBlocks.length;) {
			cachedBlock[setBlocks[i]] = document.getElementById(setBlocks[i]);
		}
	}
	for (var i=-1;++i<setBlocks.length;) {
		cachedBlock[setBlocks[i]].style.width	= (s + size) + 'px';
		cachedBlock[setBlocks[i]].style.width	= (bodyOffsWidth - size) + 'px';
		cachedBlock[setBlocks[i]].style.styleFloat	= 'right';	// for noscript

		// FF 2 fix
		//cachedBlock[setBlocks[i]].className = setBlocks[i] +' floatRight';
		//cachedBlock[setBlocks[i]].style.marginLeft = '0';
		cachedBlock[setBlocks[i]].style.marginRight = '0';
	}

	if (-1 != setBlocks.indexOf('content')) { /* don't smile :P попозже почеловечески будет ;) */
		var b = parseInt(document.body.clientHeight);
		var c = parseInt(document.getElementById('content').offsetHeight);

		x1 = parseInt(document.getElementById('headMenu').offsetHeight);
		x2 = parseInt(document.getElementById('header').offsetHeight);
		x3 = parseInt(document.getElementById('pBottom').offsetHeight);
		x4 = parseInt(document.getElementById('pFooter').offsetHeight);
		var h = b - x1 - x2 - x3 - x4;
		if (Prototype.Browser.Gecko) {h-=180;}
		document.getElementById('content').style.height = h+'px';
		
	}

	return true;
}

window.onresize = setRightBG;

function sendQuest()
{
	if ('' == $F('person')) {$('req').innerHTML	= '<b>Заполните поле: <u>Контактное лицо</u></b>';return false};
	if ('' == $F('email')) 	{$('req').innerHTML		= '<b>Заполните поле: <u>E-mail</u></b>';return false};
	if ('' == $('message').value) {$('req').innerHTML = '<b>Заполните поле: <u>Сообщение</u></b>';return false};

	var field = new Array('quest', 'person', 'phone', 'email', 'message');
	new Ajax.Request('/?question', {
		method: 'post',
		onCreate: function() {
			$('req').innerHTML = 'Пожалуйста подождите...';
			field.each(function(s, index) {
				$(s).disabled	= 'disabled';
				$(s).setAttribute('disabled', 'disabled');
			});
		},
		onSuccess: function(transport) {
			if ('1' == transport.responseText) {
				$('req').innerHTML = '<i>Ваше сообщение успешно отправлено.</i>';
				field.each(function(s, index) {
					$(s).value = '';
					$(s).disabled	= '';
					$(s).removeAttribute("disabled");
				});
				$('message').innerHTML = '';
			} else {
				$('req').innerHTML = '<b>Произошла непредвиденная ошибка<br />Служба временно отключена.</b>';
			}
		},
		onFailure: function() {
			$('req').innerHTML = '<b>Произошла непредвиденная ошибка<br />Служба временно отключена.</b>';
		},
		parameters: {
			person:	$F('person'),
			phone:	$F('phone'),
			email:		$F('email'),
			message:	$F('message')
		}
	});
}

function sendComment()
{
	if ('' == $F('name')) 	{$('req').innerHTML	= '<b>Заполните поле: <u>Имя</u></b>';return false};
	if ('' == $F('message')) 	{$('req').innerHTML	= '<b>Заполните поле: <u>Сообщение</u></b>';return false};

	return true;
}

function quote(n)
{
	var q = $('com'+n).innerHTML;
	q = q.stripTags();
	//if (Prototype.Browser.IE) {
	//	$('message').innerHTML += "[quote]" + q + "[/quote]"
	//} else {
		$('message').value += "[quote]" + q + "[/quote]";
	//}
	
	return;
}

function count()
{
	d=document;var a='';a+=';r='+escape(d.referrer);
	a+=';j='+navigator.javaEnabled()
	s=screen;a+=';s='+s.width+'*'+s.height
	a+=';d='+(s.colorDepth?s.colorDepth:s.pixelDepth)
	d.write('<a href="http://top.mail.ru/jump?from=1284171"><img src="http://d8.c9.b3.a1.top.list.ru/counter?id=1284171;t=56;js=13'+a+';rand='+Math.random()+'" alt="Рейтинг@Mail.ru" border="0" height="31" width="88" /><\/a>');
	return;
}