//Menu
function jsHover() {
	var hEls = document.getElementById("menu").getElementsByTagName("LI");
	for (var i=0, len=hEls.length; i<len; i++) {
		hEls[i].onmouseover=function() { this.className+=" jshover"; }
		hEls[i].onmouseout=function() { this.className=this.className.replace(" jshover", ""); }
	}
}
if (window.attachEvent && navigator.userAgent.indexOf("Opera")==-1) window.attachEvent("onload", jsHover);
//End menu

addEvent = function(obj, type, fn) {
	if (obj.addEventListener)
		obj.addEventListener(type, fn, false);
	else if (obj.attachEvent) {
		obj['e' + type + fn] = fn;
		obj[type+fn] = function() { obj['e' + type + fn](window.event); };
		obj.attachEvent('on' + type, obj[type + fn]);
	}
}
function disableSelection(element) {
	addEvent(element, 'selectstart', function() {
		return false;
	});
	element.unselectable = "on";
	element.style.MozUserSelect = "none";
}

/*--gallery--*/
var Prev, Next, Table, Items = [], Timer, Step, Active, Current, chTimer, Photo, PhotoName, _newsphotos, _newsphotosCount = 1;

initGallery = function() {
	PhotoName = document.getElementById('fullnameid');
	initStep();
	var tmp = document.getElementById('scroll').getElementsByTagName('*');
	for (i=0; i<tmp.length; i++) {
		switch (tmp[i].className) {
			case 'prev':
				Prev = tmp[i];
			break;
			case 'next':
				Next = tmp[i];
			break;
			case 'table':
				Table = tmp[i];
			break;
			case 'mask':
				Items.push(tmp[i]);
			break;
		}
	}
	Photo = document.getElementById('photoid')
	disableSelection(Prev);
	disableSelection(Next);
	addEvent(Prev, 'click', function() {
		try {
			clearInterval(Timer);
		}
		catch(err){}
		Timer = setInterval('slow(1)', 40);
	});
	addEvent(Next, 'click', function() {
		try {
			clearInterval(Timer);
		}
		catch(err){}
		Timer = setInterval('slow(-1)', 40);
	});
	for (i=0; i<Items.length; i++) {
		Items[i].count = i;
		addEvent(Items[i], 'click', function() {
			if (Step == 20) {
				for (j=0; j<Items.length; j++) {
					if (Items[j].parentNode.parentNode.className == 'active') Active = Items[j];
				}
				Current = Items[this.count];
				try {
					clearInterval(chTimer);
				}
				catch(err){}
				chTimer = setInterval('chSlow()', 20);
			}
		});
	}
}
delta = function() {
	return (10 - (10-Step/2)*(10-Step/2)*(10-Step/2)*(10-Step/2)/1000)*2;
}
initStep = function() {
	Step = 20;
}
slow = function(direction) {
	if (Step!=0 && parseInt(Table.style.left)<=0 && (parseInt(Table.style.left) + Table.offsetWidth) >= 420 ) {
		Step--;
		Table.style.left = parseInt(Table.style.left) + direction * delta() + 'px';
	}
	else {
		initStep();
		clearInterval(Timer);
	}
	if (parseInt(Table.style.left) > 0) {
		Table.style.left = '0px';
		initStep();
		clearInterval(Timer);
	}
	if ((parseInt(Table.style.left) + Table.offsetWidth) < 420) {
		Table.style.left = 420 - Table.offsetWidth + 'px';
		initStep();
		clearInterval(Timer);
	}
}
chSlow = function() {
	if (Step!=0) {
		Step -= 2;
		Active.style.opacity = 0.32-Step/62.5;
		Current.style.opacity = Step/62.5;

		Active.style.filter = "alpha(opacity=" + (32-Step/.625) + ")";
		Current.style.filter = "alpha(opacity=" + Step/.625 + ")";

		Active.style.width = Active.offsetWidth - 2 - 2 + 'px';
		Active.style.height = Active.offsetHeight - 2 - 2 + 'px';
		Current.style.width = Current.offsetWidth - 2 + 2 + 'px';
		Current.style.height = Current.offsetHeight - 2 + 2 + 'px';

		Active.parentNode.style.width = Active.parentNode.offsetWidth - 2 + 'px';
		Active.parentNode.style.height = Active.parentNode.offsetHeight - 1 + 'px';
		Current.parentNode.style.width = Current.parentNode.offsetWidth + 2 + 'px';
		Current.parentNode.style.height = Current.parentNode.offsetHeight + 1 + 'px';

		Active.parentNode.getElementsByTagName('img')[0].style.width = Active.parentNode.getElementsByTagName('img')[0].offsetWidth - 2 - 2 + 'px';
		Active.parentNode.getElementsByTagName('img')[0].style.height = Active.parentNode.getElementsByTagName('img')[0].offsetHeight - 2 - 2 + 'px';
		Current.parentNode.getElementsByTagName('img')[0].style.width = Current.parentNode.getElementsByTagName('img')[0].offsetWidth - 2 + 2 + 'px';
		Current.parentNode.getElementsByTagName('img')[0].style.height = Current.parentNode.getElementsByTagName('img')[0].offsetHeight - 2 + 2 + 'px';

		Active.style.marginTop = (10-Step/2) + 'px';
		Current.style.marginTop = Step/2 + 'px';
		Active.parentNode.getElementsByTagName('img')[0].style.marginTop = (10-Step/2) + 'px';
		Current.parentNode.getElementsByTagName('img')[0].style.marginTop = Step/2 + 'px';

	}
	else {
		initStep();
		clearInterval(chTimer);

		Active.parentNode.removeAttribute('style');
		Current.parentNode.removeAttribute('style');

		Active.parentNode.parentNode.className = '';
		Current.parentNode.parentNode.className = 'active';

		Photo.src=preimages[Current.count].src;
		PhotoName.innerHTML = fullnames[Current.count];
	}
}

/*--/gallery--*/

/*--registration form--*/
var activeForm;
regForm = function(formid) {
	activeForm = formid;

	if (document.getElementById('firstname').value.length<1) {
		alert('Введите Имя');
		document.getElementById('firstname').focus();
		return false;
	}
	if (document.getElementById('lastname').value.length<1) {
		alert('Введите Фамилию');
		document.getElementById('lastname').focus();
		return false;
	}
	if (document.getElementById('work').value.length<1) {
		alert('Введите Организацию');
		document.getElementById('work').focus();
		return false;
	}
	if (document.getElementById('job').value.length<1) {
		alert('Введите Должность');
		document.getElementById('job').focus();
		return false;
	}
	if (document.getElementById('email').value.length<1) {
		alert('Введите Электронную почту');
		document.getElementById('email').focus();
		return false;
	}
	if(!isEmail(document.getElementById('email').value)) {
		alert('Введите корректно Электронную почту');
		document.getElementById('email').focus();
		return false;
	}
	Company = false;
	for ( i=0; i<activeForm.company.length; i++ ) {
		if ( activeForm.company[i].checked == true ) Company = true;
	}
	if (!Company) {
		alert('Выберите Область деятельности компании');
		return false;
	}
	if (document.getElementById('phone').value.length<1) {
		alert('Введите Телефон');
		document.getElementById('phone').focus();
		return false;
	}
	if (document.getElementById('zip').value.length<1) {
		alert('Введите Индекс');
		document.getElementById('zip').focus();
		return false;
	}
	if (document.getElementById('city').value.length<1) {
		alert('Введите Город');
		document.getElementById('city').focus();
		return false;
	}
	if (document.getElementById('adress').value.length<1) {
		alert('Введите Улицу и Дом');
		document.getElementById('adress').focus();
		return false;
	}
	par = new Array('firstname', 'lastname', 'secondname', 'work', 'job', 'email', 'companyother', 'phone', 'fax', 'country', 'zip', 'city', 'region', 'adress');
	var ajaxstring = getstring(par);

	for (i=0; i<activeForm.company.length; i++) {
		if (activeForm.company[i].checked == true)
			ajaxstring += '&company=' + activeForm.company[i].value;
	}
	//alert(ajaxstring);
	ajaxPOST('/reg.php', ajaxstring, ajaxRegForm);
	return false;
}
regForm2 = function(formid) {
	activeForm = formid;

	if (document.getElementById('firstname').value.length<1) {
		alert('Введите Имя');
		document.getElementById('firstname').focus();
		return false;
	}
	if (document.getElementById('lastname').value.length<1) {
		alert('Введите Фамилию');
		document.getElementById('lastname').focus();
		return false;
	}
	if (document.getElementById('work').value.length<1) {
		alert('Введите Организацию');
		document.getElementById('work').focus();
		return false;
	}
	if (document.getElementById('job').value.length<1) {
		alert('Введите Должность');
		document.getElementById('job').focus();
		return false;
	}
	if (document.getElementById('email').value.length<1) {
		alert('Введите Электронную почту');
		document.getElementById('email').focus();
		return false;
	}
	if(!isEmail(document.getElementById('email').value)) {
		alert('Введите корректно Электронную почту');
		document.getElementById('email').focus();
		return false;
	}
	Company = false;
	for ( i=0; i<activeForm.company.length; i++ ) {
		if ( activeForm.company[i].checked == true ) Company = true;
	}
	if (!Company) {
		alert('Выберите Область деятельности компании');
		return false;
	}
	if (document.getElementById('phone').value.length<1) {
		alert('Введите Телефон');
		document.getElementById('phone').focus();
		return false;
	}
	if (document.getElementById('zip').value.length<1) {
		alert('Введите Индекс');
		document.getElementById('zip').focus();
		return false;
	}
	if (document.getElementById('city').value.length<1) {
		alert('Введите Город');
		document.getElementById('city').focus();
		return false;
	}
	if (document.getElementById('adress').value.length<1) {
		alert('Введите Улицу и Дом');
		document.getElementById('adress').focus();
		return false;
	}
	par = new Array('firstname', 'lastname', 'secondname', 'work', 'job', 'email', 'companyother', 'phone', 'fax', 'country', 'zip', 'city', 'region', 'adress');
	var ajaxstring = getstring(par);

	for (i=0; i<activeForm.company.length; i++) {
		if (activeForm.company[i].checked == true)
			ajaxstring += '&company=' + activeForm.company[i].value;
	}
	//alert(ajaxstring);
	ajaxPOST('/reg2.php', ajaxstring, ajaxRegForm);
	return false;
}

regForm3 = function(formid) {
	activeForm = formid;

	if (document.getElementById('firstname3').value.length<1) {
		alert('Введите Имя');
		document.getElementById('firstname3').focus();
		return false;
	}
	if (document.getElementById('lastname3').value.length<1) {
		alert('Введите Фамилию');
		document.getElementById('lastname3').focus();
		return false;
	}
	if (document.getElementById('work3').value.length<1) {
		alert('Введите Организацию');
		document.getElementById('work3').focus();
		return false;
	}
	if (document.getElementById('job3').value.length<1) {
		alert('Введите Должность');
		document.getElementById('job3').focus();
		return false;
	}
	if (document.getElementById('email3').value.length<1) {
		alert('Введите Электронную почту');
		document.getElementById('email3').focus();
		return false;
	}
	if(!isEmail(document.getElementById('email3').value)) {
		alert('Введите корректно Электронную почту');
		document.getElementById('email3').focus();
		return false;
	}
	Company = false;
	for ( i=0; i<activeForm.company3.length; i++ ) {
		if ( activeForm.company3[i].checked == true ) Company = true;
	}
	if (!Company) {
		alert('Выберите Область деятельности компании');
		return false;
	}
	if (document.getElementById('phone3').value.length<1) {
		alert('Введите Телефон');
		document.getElementById('phone3').focus();
		return false;
	}
	if (document.getElementById('zip3').value.length<1) {
		alert('Введите Индекс');
		document.getElementById('zip3').focus();
		return false;
	}
	if (document.getElementById('city3').value.length<1) {
		alert('Введите Город');
		document.getElementById('city3').focus();
		return false;
	}
	if (document.getElementById('adress3').value.length<1) {
		alert('Введите Улицу и Дом');
		document.getElementById('adress3').focus();
		return false;
	}
	par = new Array('firstname3', 'lastname3', 'secondname3', 'work3', 'job3', 'email3', 'companyother3', 'phone3', 'fax3', 'country3', 'zip3', 'city3', 'region3', 'adress3');
	var ajaxstring = getstring(par);

	for (i=0; i<activeForm.company3.length; i++) {
		if (activeForm.company3[i].checked == true)
			ajaxstring += '&company=' + activeForm.company3[i].value;
	}
	//alert(ajaxstring);
	ajaxPOST('/reg3.php', ajaxstring, ajaxRegForm);
	return false;
}

regForm4 = function(formid) {
	activeForm = formid;

	if (document.getElementById('firstname4').value.length<1) {
		alert('Введите Имя');
		document.getElementById('firstname4').focus();
		return false;
	}
	if (document.getElementById('lastname4').value.length<1) {
		alert('Введите Фамилию');
		document.getElementById('lastname4').focus();
		return false;
	}
	if (document.getElementById('work4').value.length<1) {
		alert('Введите Организацию');
		document.getElementById('work4').focus();
		return false;
	}
	if (document.getElementById('job4').value.length<1) {
		alert('Введите Должность');
		document.getElementById('job4').focus();
		return false;
	}
	if (document.getElementById('email4').value.length<1) {
		alert('Введите Электронную почту');
		document.getElementById('email4').focus();
		return false;
	}
	if(!isEmail(document.getElementById('email4').value)) {
		alert('Введите корректно Электронную почту');
		document.getElementById('email4').focus();
		return false;
	}
	Company = false;
	for ( i=0; i<activeForm.company4.length; i++ ) {
		if ( activeForm.company4[i].checked == true ) Company = true;
	}
	if (!Company) {
		alert('Выберите Область деятельности компании');
		return false;
	}
	if (document.getElementById('phone4').value.length<1) {
		alert('Введите Телефон');
		document.getElementById('phone4').focus();
		return false;
	}
	if (document.getElementById('zip4').value.length<1) {
		alert('Введите Индекс');
		document.getElementById('zip4').focus();
		return false;
	}
	if (document.getElementById('city4').value.length<1) {
		alert('Введите Город');
		document.getElementById('city4').focus();
		return false;
	}
	if (document.getElementById('adress4').value.length<1) {
		alert('Введите Улицу и Дом');
		document.getElementById('adress4').focus();
		return false;
	}
	par = new Array('firstname4', 'lastname4', 'secondname4', 'work4', 'job4', 'email4', 'companyother4', 'phone4', 'fax4', 'country4', 'zip4', 'city4', 'region4', 'adress4');
	var ajaxstring = getstring(par);

	for (i=0; i<activeForm.company4.length; i++) {
		if (activeForm.company4[i].checked == true)
			ajaxstring += '&company=' + activeForm.company4[i].value;
	}
	//alert(ajaxstring);
	ajaxPOST('/reg4.php', ajaxstring, ajaxRegForm);
	return false;
}





regFormU = function(formid,postfix,title) {

	if( typeof postfix == "undefined" ) {
		postfix = '';
	}

	if( typeof title == "undefined" ) {
		title = '';
	}
	Companys = document.getElementsByName('company' + postfix);

	activeForm = formid;

	if (document.getElementById('firstname' + postfix).value.length<1) {
		alert('Введите Имя');
		document.getElementById('firstname' + postfix).focus();
		return false;
	}
	if (document.getElementById('lastname' + postfix).value.length<1) {
		alert('Введите Фамилию');
		document.getElementById('lastname' + postfix).focus();
		return false;
	}
	if (document.getElementById('work' + postfix).value.length<1) {
		alert('Введите Организацию');
		document.getElementById('work' + postfix).focus();
		return false;
	}
	if (document.getElementById('job' + postfix).value.length<1) {
		alert('Введите Должность');
		document.getElementById('job' + postfix).focus();
		return false;
	}
	if (document.getElementById('email' + postfix).value.length<1) {
		alert('Введите Электронную почту');
		document.getElementById('email' + postfix).focus();
		return false;
	}
	if(!isEmail(document.getElementById('email' + postfix).value)) {
		alert('Введите корректно Электронную почту');
		document.getElementById('email' + postfix).focus();
		return false;
	}
	Company = false;
	//for ( i=0; i<activeForm.company4.length; i++ ) {
	for ( i=0; i<Companys.length; i++ ) {
		if ( Companys[i].checked == true ) Company = true;
	}
	if (!Company) {
		alert('Выберите Область деятельности компании');
		return false;
	}
	if (document.getElementById('phone' + postfix).value.length<1) {
		alert('Введите Телефон');
		document.getElementById('phone' + postfix).focus();
		return false;
	}
	if (document.getElementById('zip' + postfix).value.length<1) {
		alert('Введите Индекс');
		document.getElementById('zip' + postfix).focus();
		return false;
	}
	if (document.getElementById('city' + postfix).value.length<1) {
		alert('Введите Город');
		document.getElementById('city' + postfix).focus();
		return false;
	}
	if (document.getElementById('adress' + postfix).value.length<1) {
		alert('Введите Улицу и Дом');
		document.getElementById('adress' + postfix).focus();
		return false;
	}
	par = new Array('firstname' + postfix, 'lastname' + postfix, 'secondname' + postfix, 'work' + postfix, 'job' + postfix, 'email' + postfix, 'companyother' + postfix, 'phone' + postfix, 'fax' + postfix, 'country' + postfix, 'zip' + postfix, 'city' + postfix, 'region' + postfix, 'adress' + postfix);
	var ajaxstring = getstring(par);

	for (i=0; i<Companys.length; i++) {
		if (Companys[i].checked == true)
			ajaxstring += '&company=' + Companys[i].value;
	}
	ajaxstring += '&postfix=' + postfix;
	ajaxstring += '&title=' + title;
	//alert(ajaxstring);
	ajaxPOST('/regU.php', ajaxstring, ajaxRegForm);
	return false;
}




isEmail = function(string) {
	return string.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
}
function ajaxRegForm() {
	if (xmlHttp) {
		if (xmlHttp.readyState == 4) {
			if (xmlHttp.responseXML) {
				activeForm.innerHTML = xmlHttp.responseXML.getElementsByTagName('content')[0].firstChild.nodeValue;
			}
			else {
				//alert("No xmlHttp.responseXML!: \n" + xmlHttp.responseText);
			}
		}
	}
	else {
		//alert("No xmlHttp!");
	}
}
getstring = function(params) {
	var str = '';
	for (i=0; i<params.length; i++) {
		str += params[i] + '=' + document.getElementById(params[i]).value;
		if (i<params.length-1) str += '&';
	}
	return str;
}

var headers, lists = [], sublists = [], sublistsitem = [];
var _iam1, _iam2, _patriot, formElements, _conf, _sb, _sbitem;
var forumHeader = [], forumContent = [];
init = function () {

if(document.getElementById('forums')!=null) {
	var forumTMP = document.getElementById('forums').getElementsByTagName('div');
	var i = forumTMP.length; while (i--) {
		if(forumTMP[i].className == 'forumheader') forumHeader.push(forumTMP[i]);
		if(forumTMP[i].className == 'forumcontent') forumContent.push(forumTMP[i]);
	}
	var i = forumHeader.length; while (i--) {
		forumHeader[i].count = i;
		forumHeader[i].style.cursor = 'pointer';
		addEvent(forumHeader[i],'click',function() {
			var j = forumContent.length; while (j-- && j!=this.count) {
				forumContent[j].style.display = 'none';
			}
			//forumContent[this.count].style.display = 'block';
			forumContent[this.count].style.display == 'block' ? forumContent[this.count].style.display = 'none' : forumContent[this.count].style.display = 'block';
		})
	}
	var i = forumContent.length; while (i--) {
		forumContent[i].style.display = 'none';
	}
}
if(document.getElementById('patriot')!=null) {
	_patriot = document.getElementById('patriot');
	formElements = _patriot.getElementsByTagName('input');
	var i = formElements.length; while (i--) {
		formElements[i].disabled = true;
	}
	_patriot.getElementsByTagName('textarea')[0].disabled = true;
}

if(document.getElementById('iam1')!=null) {
	_conf = document.getElementById('conf');
	_conf.checked = false;
	_sbitem = document.getElementById('sbitem');
	_sb = document.getElementById('submitbutton');
	_iam1 = document.getElementById('iam1');
	_iam2 = document.getElementById('iam2');
	_iam1.checked = false;
	_iam2.checked = false;
	addEvent(_conf, 'click', function() {
		if(_conf.checked == true) {
			_sb.className = '';
			_sbitem.disabled = false;
		}
		else {
			_sb.className = 'disabled';
			_sbitem.disabled = true;
		}
	})
	if(_patriot!=null) {
		addEvent(_iam1,'click',function() {
			_patriot.className = '';
			var i = formElements.length; while (i--) {
				formElements[i].disabled = false;
			}
			_patriot.getElementsByTagName('textarea')[0].disabled = false;
		});
		addEvent(_iam2,'click',function() {
			_patriot.className = '';
			var i = formElements.length; while (i--) {
				if (formElements[i].className!='button') {
					formElements[i].disabled = false;
				}
			}
			_patriot.getElementsByTagName('textarea')[0].disabled = false;
		});
	}
}

try {
	_newsphotos = document.getElementById('newsPhotos').getElementsByTagName('img')[0];
	setInterval('changeNewsPhotos()', 5000);
}
catch (err) {
	
}


vPlayer();
try {
	headers = document.getElementById('parts').getElementsByTagName('h3');
	tmp = document.getElementById('parts').getElementsByTagName('ul');
	for (i=0; i<tmp.length; i++) if ( tmp[i].parentNode.tagName == 'DIV' ) lists.push(tmp[i]);

	tmp = document.getElementById('parts').getElementsByTagName('li');
	for (i=0; i<tmp.length; i++) if ( tmp[i].getElementsByTagName('ul').length>0 ) { sublists.push(tmp[i]); sublistsitem.push(tmp[i].getElementsByTagName('ul')[0])}
	for ( i=0; i<lists.length; i++ ) lists[i].style.display = 'none';
	for ( i=0; i<sublists.length; i++ ) {
		sublists[i].style.textDecoration = 'underline';
		sublists[i].style.cursor = 'pointer';
	}
	for ( i=0; i<sublistsitem.length; i++ ) sublistsitem[i].style.display = 'none';

	for ( i=0; i<headers.length; i++ ) {
		headers[i].count = i;
		headers[i].onclick = function () {
			for (j=0; j<headers.length; j++ ) ( j != this.count ? lists[j].style.display = 'none' : lists[j].style.display = lists[j].style.display );
			( lists[this.count].style.display == 'none' ? lists[this.count].style.display = 'block' : lists[this.count].style.display = 'none' );
		}
	}

	for ( i=0; i<sublists.length; i++ ) {
		sublists[i].count = i;
		sublists[i].onclick = function () {
			for (j=0; j<sublists.length; j++ )
				if ( j != this.count ) {
					sublists[j].style.textDecoration = 'underline';
					sublistsitem[j].style.display = 'none';
				}
			if ( sublistsitem[this.count].style.display == 'none' ) {
				sublists[this.count].style.textDecoration = 'none';
				sublistsitem[this.count].style.display = 'block';
			}
			else {
				sublists[this.count].style.textDecoration = 'underline';
				sublistsitem[this.count].style.display = 'none';
			}
		}
	}

}
catch (err) {}

/*try {
	programs = document.getElementById('progs').getElementsByTagName('input');
}
catch (err) {}*/

}

addEvent(window,'load',init);

/*--/registration form--*/

regAct = function(formid) {
	activeForm = formid;

	if (document.getElementById('firstname').value.length<1) {
		alert('Введите Имя');
		document.getElementById('firstname').focus();
		return false;
	}
	if (document.getElementById('lastname').value.length<1) {
		alert('Введите Фамилию');
		document.getElementById('lastname').focus();
		return false;
	}
	if (document.getElementById('work').value.length<1) {
		alert('Введите Организацию');
		document.getElementById('work').focus();
		return false;
	}
	if (document.getElementById('job').value.length<1) {
		alert('Введите Должность');
		document.getElementById('job').focus();
		return false;
	}
	if (document.getElementById('email').value.length<1) {
		alert('Введите Электронную почту');
		document.getElementById('email').focus();
		return false;
	}
	if(!isEmail(document.getElementById('email').value)) {
		alert('Введите корректно Электронную почту');
		document.getElementById('email').focus();
		return false;
	}
	Company = false;
	for ( i=0; i<activeForm.company.length; i++ ) {
		if ( activeForm.company[i].checked == true ) Company = true;
	}
	if (!Company) {
		alert('Выберите Область деятельности компании');
		return false;
	}
	if (document.getElementById('phone').value.length<1) {
		alert('Введите Телефон');
		document.getElementById('phone').focus();
		return false;
	}
	if (document.getElementById('zip').value.length<1) {
		alert('Введите Индекс');
		document.getElementById('zip').focus();
		return false;
	}
	if (document.getElementById('city').value.length<1) {
		alert('Введите Город');
		document.getElementById('city').focus();
		return false;
	}
	if (document.getElementById('region').value.length<1) {
		alert('Введите Область');
		document.getElementById('region').focus();
		return false;
	}
	if (document.getElementById('adress').value.length<1) {
		alert('Введите Улицу и Дом');
		document.getElementById('adress').focus();
		return false;
	}
	var prgs = document.getElementById('progs').getElementsByTagName('input');
	var regssum = 0;
	for (var i = 0; i<prgs.length; i++) {
		if (prgs[i].checked == true) regssum++;
	}
	if (regssum==0) {
		alert("Выберите событие");
		document.getElementById('prog1').focus();
		return false;
	}

	par = new Array('firstname', 'lastname', 'secondname', 'work', 'job', 'email', 'companyother', 'phone', 'fax', 'country', 'zip', 'city', 'region', 'adress');
	var ajaxstring = getstring(par);

	for (i=0; i<activeForm.company.length; i++) {
		if (activeForm.company[i].checked == true)
			ajaxstring += '&company=' + activeForm.company[i].value;
	}
	for (var i=0; i<prgs.length; i++) {
		ajaxstring += '&prog' + (i+1) + '=' + document.getElementById('prog' + (i+1)).checked;
	}
	//alert(ajaxstring);
	//return false;
	ajaxPOST('/regact.php', ajaxstring, ajaxAct);
	return false;
}

regSem = function(formid) {
	activeForm = formid;

	if (document.getElementById('firstname').value.length<1) {
		alert('Введите Имя');
		document.getElementById('firstname').focus();
		return false;
	}
	if (document.getElementById('lastname').value.length<1) {
		alert('Введите Фамилию');
		document.getElementById('lastname').focus();
		return false;
	}
	if (document.getElementById('work').value.length<1) {
		alert('Введите Организацию');
		document.getElementById('work').focus();
		return false;
	}
	if (document.getElementById('job').value.length<1) {
		alert('Введите Должность');
		document.getElementById('job').focus();
		return false;
	}
	if (document.getElementById('email').value.length<1) {
		alert('Введите Электронную почту');
		document.getElementById('email').focus();
		return false;
	}
	if(!isEmail(document.getElementById('email').value)) {
		alert('Введите корректно Электронную почту');
		document.getElementById('email').focus();
		return false;
	}
	Company = false;
	for ( i=0; i<activeForm.company.length; i++ ) {
		if ( activeForm.company[i].checked == true ) Company = true;
	}
	if (!Company) {
		alert('Выберите Область деятельности компании');
		return false;
	}
	if (document.getElementById('phone').value.length<1) {
		alert('Введите Телефон');
		document.getElementById('phone').focus();
		return false;
	}
	if (document.getElementById('zip').value.length<1) {
		alert('Введите Индекс');
		document.getElementById('zip').focus();
		return false;
	}
	if (document.getElementById('city').value.length<1) {
		alert('Введите Город');
		document.getElementById('city').focus();
		return false;
	}
	if (document.getElementById('region').value.length<1) {
		alert('Введите Область');
		document.getElementById('region').focus();
		return false;
	}
	if (document.getElementById('adress').value.length<1) {
		alert('Введите Улицу и Дом');
		document.getElementById('adress').focus();
		return false;
	}
	var prgs = document.getElementById('sems').getElementsByTagName('input');
	var regssum = 0;
	for (var i = 0; i<prgs.length; i++) {
		if (prgs[i].checked == true) regssum++;
	}
	if (regssum==0) {
		alert("Выберите семинары");
		document.getElementById('sem1').focus();
		return false;
	}

	par = new Array('firstname', 'lastname', 'secondname', 'work', 'job', 'email', 'companyother', 'phone', 'fax', 'country', 'zip', 'city', 'region', 'adress');
	var ajaxstring = getstring(par);

	for (i=0; i<activeForm.company.length; i++) {
		if (activeForm.company[i].checked == true)
			ajaxstring += '&company=' + activeForm.company[i].value;
	}
	for (var i=0; i<26; i++) {
		ajaxstring += '&sem' + (i+1) + '=' + document.getElementById('sem' + (i+1)).checked;
	}
	//alert(ajaxstring);
	//return false;
	ajaxPOST('/regsem.php', ajaxstring, ajaxAct);
	window.resizeTo(480, 200);
	return false;
}

popupReg = function(prog){
	var regWindow = window.open(
		'registration.html',
		'_target',
		'toolbar=0,location=0,statusbar=0,menubar=0,width=480,left=20,top=20,scrollbars=yes'
	)
	regWindow.onload = function() {
		regWindow.document.getElementById(prog).checked = true;
	}
	return false;
}
popupSem = function(sem){
	var semWindow = window.open(
		'seminars.html',
		'_target',
		'toolbar=0,location=0,statusbar=0,menubar=0,width=480,left=20,top=20,scrollbars=yes'
	)
	semWindow.onload = function() {
		semWindow.document.getElementById(sem).checked = true;
	}
	return false;
}

function ajaxAct() {
	if (xmlHttp) {
		if (xmlHttp.readyState == 4) {
			if (xmlHttp.responseXML) {
				activeForm.innerHTML = xmlHttp.responseXML.getElementsByTagName('content')[0].firstChild.nodeValue;
			}
			else {
				//alert("No xmlHttp.responseXML!: \n" + xmlHttp.responseText);
			}
		}
	}
	else {
		//alert("No xmlHttp!");
	}
}
function ajaxPatriot() {
	if (xmlHttp) {
		if (xmlHttp.readyState == 4) {
			if (xmlHttp.responseXML) {
				activeForm.innerHTML = xmlHttp.responseXML.getElementsByTagName('content')[0].firstChild.nodeValue;
				popupForm = window.open(
					'',
					'_blank',
					'toolbar=0,location=0,statusbar=0,menubar=0,width=480,scrollbars=1'
				);
				popupForm.document.write(xmlHttp.responseXML.getElementsByTagName('popup')[0].firstChild.nodeValue);
				popupForm.document.write("<tr><td><OBJECT ID=\"IEControl\" WIDTH=0 HEIGHT=0 CLASSID=\"clsid:8856F961-340A-11D0-A96B-00C04FD705A2\"></OBJECT><a href=\"#\" onclick='if ( !(/MSIE.+Win/.test(navigator.userAgent)) ) window.print(); else IEControl.ExecWB(6, 1); return false;' class='button'>Печать</a></td>");
				popupForm.document.write("<td style='text-align: right;'><a href=\"#\" onclick='window.close();return false;' class='button'>Закрыть</a></td></tr>");
				popupForm.document.write("</table>");
				popupForm.document.write("</body></html>");
			}
			else {
				//alert("No xmlHttp.responseXML!: \n" + xmlHttp.responseText);
			}
		}
	}
	else {
		//alert("No xmlHttp!");
	}
}

videoPopup = function(){
	newdiv = document.createElement("DIV");
	vp = document.getElementsByTagName('body')[0].appendChild(newdiv);
	vp.className="videopopup";
	vp.innerHTML = "<div id=\"closevp\" onclick=\"this.parentNode.innerHTML=''\"><!-- --></div>" +
	'<object id="video" width="640" height="480" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" type="application/x-oleobject">' +
		'<param name="URL" value="files/5min_LAN.mov" />' +
		'<param name="AutoStart" value="false" />' +
		'<param name="uiMode" value="mini" />' +
		'<param name="samistyle" value="NORMAL" />' +
		'<param name="showControls" value="true">' +
		'<param name="captioningID" value="subtitles" />' +
		'<param name="enableContextMenu" value="0" />' +
		'<param name="EnablePositionControls" value="1" />' +
		'<embed id="video" name="Player1" src="files/5min_LAN.mov" type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/" ShowControls="1" ShowTracker="1" ShowStatusBar="1" VideoBorder3D="0" VideoBorderWidth="0" width="640" height="480" AutoStart="0" AnimationAtStart="1" TransparentAtStart="1" uiMode="none" StretchToFit="1" EnablePositionControls="1"></embed>' +
	'</object>'
}

vPlayer = function(){
	try {
		var so = new SWFObject("swf/5min_LAN_320x240.swf", "videopl", "320", "240", 8);
		so.write("vplayer");
//		vp = document.getElementById('vplayer');
//		vp.innerHTML =
			'<object id="video" width="320" height="240" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" type="application/x-oleobject">' +
			'<param name="URL" value="files/5min_LAN_320x240.mov" />' +
			'<param name="AutoStart" value="false" />' +
			'<param name="uiMode" value="mini" />' +
			'<param name="samistyle" value="NORMAL" />' +
			'<param name="showControls" value="true">' +
			'<param name="captioningID" value="subtitles" />' +
			'<param name="enableContextMenu" value="0" />' +
			'<param name="EnablePositionControls" value="1" />' +
			'<embed id="video" name="Player1" src="files/5min_LAN_320x240.mov" type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/" ShowControls="1" ShowTracker="1" ShowStatusBar="1" VideoBorder3D="0" VideoBorderWidth="0" width="320" height="240" AutoStart="0" AnimationAtStart="1" TransparentAtStart="1" uiMode="none" StretchToFit="1" EnablePositionControls="1"></embed>' +
		'</object>'
	}
	catch (err) {
		
	}
}


var imr;
var photonum;
imr= parseInt(Math.random()*photonum+1);

var _newsphotosCount2 = 0;
var _newimages = [];

changeNewsPhotos = function() {
	if ( _newsphotosCount2 == 0 ) {
		_newsphotos.src = '/UserFiles/Image/Gallery/' + _newsphotosCount + '.jpg';
		_newimages.push(new Image());
		_newimages[_newsphotosCount - 1].src =  '/UserFiles/Image/Gallery/' + _newsphotosCount + '.jpg';
		_newsphotosCount++;
		if (_newsphotosCount>41) {
			_newsphotosCount2 = 1;
			_newsphotosCount = 1;
		}
	}
	else {
		_newsphotos.src = _newimages[_newsphotosCount - 1].src;
		_newsphotosCount++;
		if (_newsphotosCount>41) {
			_newsphotosCount = 1;
		}
	}
}

subForm = function(formid) {
	activeForm = formid;
	if (document.getElementById('lastname').value.length<1) {
		alert('Введите Фамилию');
		document.getElementById('lastname').focus();
		return false;
	}
	if (document.getElementById('firstname').value.length<1) {
		alert('Введите Имя');
		document.getElementById('firstname').focus();
		return false;
	}
	if (document.getElementById('work').value.length<1) {
		alert('Введите Организацию');
		document.getElementById('work').focus();
		return false;
	}
	if (document.getElementById('email').value.length<1) {
		alert('Введите Электронную почту');
		document.getElementById('email').focus();
		return false;
	}
	if(!isEmail(document.getElementById('email').value)) {
		alert('Введите корректно Электронную почту');
		document.getElementById('email').focus();
		return false;
	}
	par = new Array('lastname', 'firstname', 'secondname', 'work', 'email');
	var ajaxstring = getstring(par);

	//alert(ajaxstring);
	ajaxPOST('/press_sub.php', ajaxstring, ajaxSubForm);
	return false;
}

function ajaxSubForm() {
	if (xmlHttp) {
		if (xmlHttp.readyState == 4) {
			if (xmlHttp.responseXML) {
				activeForm.innerHTML = xmlHttp.responseXML.getElementsByTagName('content')[0].firstChild.nodeValue;
			}
			else {
				//alert("No xmlHttp.responseXML!: \n" + xmlHttp.responseText);
			}
		}
	}
	else {
		//alert("No xmlHttp!");
	}
}


/* accr */

accrForm = function(formid) {
	activeForm = formid;
	if (document.getElementById('lastname').value.length<1) {
		alert('Введите Фамилию');
		document.getElementById('lastname').focus();
		return false;
	}
	if (document.getElementById('firstname').value.length<1) {
		alert('Введите Имя');
		document.getElementById('firstname').focus();
		return false;
	}
	Smi = false;
	for ( i=0; i<activeForm.smi.length; i++ ) {
		if ( activeForm.smi[i].checked == true ) Smi = true;
	}
	if (!Smi) {
		alert('Выберите СМИ');
		return false;
	}
	if (document.getElementById('work').value.length<1) {
		alert('Введите Организацию');
		document.getElementById('work').focus();
		return false;
	}
	if (document.getElementById('region').value.length<1) {
		alert('Введите Регион');
		document.getElementById('region').focus();
		return false;
	}
	if (document.getElementById('email').value.length<1) {
		alert('Введите Электронную почту');
		document.getElementById('email').focus();
		return false;
	}
	if(!isEmail(document.getElementById('email').value)) {
		alert('Введите корректно Электронную почту');
		document.getElementById('email').focus();
		return false;
	}
	if (document.getElementById('phone').value.length<1) {
		alert('Введите Телефон для связи');
		document.getElementById('phone').focus();
		return false;
	}
	par = new Array('lastname', 'firstname', 'secondname', 'work', 'region', 'email', 'phone');
	var ajaxstring = getstring(par);
	for (i=0; i<activeForm.smi.length; i++) {
		if (activeForm.smi[i].checked == true)
			ajaxstring += '&smi=' + activeForm.smi[i].value;
	}

	//alert(ajaxstring);
	ajaxPOST('/press_accr.php', ajaxstring, ajaxAccrForm);
	return false;
}

function ajaxAccrForm() {
	if (xmlHttp) {
		if (xmlHttp.readyState == 4) {
			if (xmlHttp.responseXML) {
				activeForm.innerHTML = xmlHttp.responseXML.getElementsByTagName('content')[0].firstChild.nodeValue;
			}
			else {
				//alert("No xmlHttp.responseXML!: \n" + xmlHttp.responseText);
			}
		}
	}
	else {
		//alert("No xmlHttp!");
	}
}

patriotForm = function(formid) {
	activeForm = formid;

	if (document.getElementById('lastname').value.length<1) {
		alert('Введите Фамилию');
		document.getElementById('lastname').focus();
		return false;
	}
	if (document.getElementById('firstname').value.length<1) {
		alert('Введите Имя');
		document.getElementById('firstname').focus();
		return false;
	}
	if (document.getElementById('secondname').value.length<1) {
		alert('Введите Отчество');
		document.getElementById('secondname').focus();
		return false;
	}
	if (document.getElementById('factory').value.length<1) {
		alert('Введите Название предприятия');
		document.getElementById('factory').focus();
		return false;
	}
	if (document.getElementById('foo').value.length<1) {
		alert('Введите Форму собственности предприятия');
		document.getElementById('foo').focus();
		return false;
	}
	if (document.getElementById('post').value.length<1) {
		alert('Введите Должность');
		document.getElementById('post').focus();
		return false;
	}
	if (document.getElementById('leader').value.length<1) {
		alert('Введите Руководителя предприятия');
		document.getElementById('leader').focus();
		return false;
	}
	if (document.getElementById('quantity').value.length<1) {
		alert('Введите Количество сотрудников');
		document.getElementById('quantity').focus();
		return false;
	}
	if (document.getElementById('factoryyear').value.length<1) {
		alert('Введите Год основания предприятия');
		document.getElementById('factoryyear').focus();
		return false;
	}
	if (document.getElementById('inn').value.length<1) {
		alert('Введите ИНН предприятия');
		document.getElementById('inn').focus();
		return false;
	}
	Company = false;
	for ( i=0; i<activeForm.activity.length; i++ ) {
		if ( activeForm.activity[i].checked == true ) Company = true;
	}
	if (!Company) {
		alert('Выберите Область деятельности компании');
		return false;
	}
	if (document.getElementById('phone').value.length<1) {
		alert('Введите Контактный телефон');
		document.getElementById('phone').focus();
		return false;
	}
	if (document.getElementById('fax').value.length<1) {
		alert('Введите Факс');
		document.getElementById('fax').focus();
		return false;
	}
	if (document.getElementById('email').value.length<1) {
		alert('Введите Электронную почту');
		document.getElementById('email').focus();
		return false;
	}
	if(!isEmail(document.getElementById('email').value)) {
		alert('Введите корректно Электронную почту');
		document.getElementById('email').focus();
		return false;
	}
	if (document.getElementById('url').value.length<1) {
		alert('Введите Адрес в Интернет');
		document.getElementById('url').focus();
		return false;
	}
	if (document.getElementById('index').value.length<1) {
		alert('Введите Индекс');
		document.getElementById('index').focus();
		return false;
	}
	if (document.getElementById('country').value.length<1) {
		alert('Введите Страну (регион)');
		document.getElementById('country').focus();
		return false;
	}
	/*if (document.getElementById('region').value.length<1) {
		alert('Введите Область (край)');
		document.getElementById('region').focus();
		return false;
	}*/
	if (document.getElementById('city').value.length<1) {
		alert('Введите Город');
		document.getElementById('city').focus();
		return false;
	}
	if (document.getElementById('street').value.length<1) {
		alert('Введите Улицу и Дом');
		document.getElementById('street').focus();
		return false;
	}
	if (document.getElementById('conf').checked==false) {
		alert('Вы не подтвердили условия');
		document.getElementById('conf').focus();
		return false;
	}

	par = new Array('lastname', 'firstname', 'secondname', 'factory', 'foo', 'post', 'leader', 'quantity', 'factoryyear', 'inn', 'phone', 'fax', 'email', 'url', 'index', 'country', 'region', 'city', 'street', 'other');
	var ajaxstring = getstring(par);

	for (i=0; i<activeForm.activity.length; i++) {
		if (activeForm.activity[i].checked == true)
			ajaxstring += '&activity=' + activeForm.activity[i].value;
	}
	for (i=0; i<activeForm.iam.length; i++) {
		if (activeForm.iam[i].checked == true)
			ajaxstring += '&iam=' + activeForm.iam[i].value;
	}
	//alert(ajaxstring);
	//return false;
	ajaxPOST('/patriot.php', ajaxstring, ajaxPatriot);
	return false;
}