function CheckContactForm(){
	var pass = '';
	if(!document.getElementById('username').value.match(/^[а-яА-Яa-zA-Z-]+$/)){
		pass += 'Ошибка: некорректно введено имя!\n';
	}
	if(!document.getElementById('compname').value.match(/^[а-яА-Яa-zA-Z-]+$/)){
		pass += 'Ошибка: не указана организация!\n';
	}
	if(document.getElementById('email').value != '' && !document.getElementById('email').value.match(/[a-zA-Z\.\_]+@[a-zA-Z\.\_]+$/)){
		pass += 'Ошибка: некорректно введен e-mail!\n';
	}	
	if(document.getElementById('phone').value != '' && document.getElementById('phone').value.match(/[^0-9]$/)){
		pass += 'Ошибка: телефон может состоять только из цифр!\n';
	}	
	if(pass != ''){
		alert(pass);
	} else {
		document.contact_form.submit();
	}
}

function CheckContactFormEn(){
	var pass = '';
	if(!document.getElementById('username').value.match(/^[а-яА-Яa-zA-Z-]+$/)){
		pass += 'Warrning: name is incorrect!\n';
	}
	if(!document.getElementById('compname').value.match(/^[а-яА-Яa-zA-Z-]+$/)){
		pass += 'Warrning: company is incorrect!\n';
	}
	if(document.getElementById('email').value != '' && !document.getElementById('email').value.match(/[a-zA-Z\.\_]+@[a-zA-Z\.\_]+$/)){
		pass += 'Warrning: e-mail is incorrect!\n';
	}	
	if(document.getElementById('phone').value != '' && document.getElementById('phone').value.match(/[^0-9]$/)){
		pass += 'Warrning: phone number is incorrect!\n';
	}		
	if(pass != ''){
		alert(pass);
	} else {
		document.contact_form.submit();
	}
}

/*
	function init(gr_id){
		var stretchers = $$('div.menu_content'); 
		var togglers = $$('div.mnr');
		
		preLoad = new Image(); preLoad.src = '/templates/ipr/images/mnla.gif';
		
		var myAccordion = new Fx.Accordion(togglers, stretchers, { opacity: true, alwaysHide: true,
		 transition: Fx.Transitions.quadOut, show: gr_id, duration: 400,
			
			onActive: function(toggler, stretcher){
				toggler.className="mnrAc";
			},
				onBackground: function(toggler, stretcher){
				toggler.className="mnr";
			}
		});
		document.getElementById('menuR').style.visibility = 'visible';
	}

function show_menu(id,evt)

{
var inf = document.getElementById('ili'+id);
var innerHeight_ = window.innerHeight ? window.innerHeight : document.documentElement.offsetHeight;
evt = (evt) ? evt : ((window.event) ? window.event : null);
inf.style.left=evt.clientX +'px';
inf.style.top=evt.clientY + document.documentElement.scrollTop + 'px';
inf.style.display = "block";
}
*/
/*
function popup_img(filename, width, height)
{
   var newImage = new Image();
   newImage.src = filename;
   newWin = window.open(filename,'image', "width="+width+",height="+height+",resizable=no,scrollbars=no,status=no");
}

function popup_img(link, ww, hh) {
	var title =  'Image';
	w=window.open(link,'',(ww ? 'width='+ww+',' : '')+(hh ? 'height='+hh+',' : '')+'toolbar=0,scrollbars=0');
	if (link.indexOf('.html')==-1) {
		if (document.layers) title='';
		w.document.open();
		w.document.write('<html><head><title>'+title+'</title><meta http-equiv=Content-Type content="text/html; charset=windows-1251"></head>');
		w.document.write('<body bgcolor=white marginwidth=0 marginheight=0 topmargin=0 leftmargin=0><table width=100% height=100% border=0 cellspacing=0 cellpadding=0><tr><td align=center><img src='+link+(ww ? ' width='+ww : '')+(hh ? ' height='+hh : '')+' border=0 alt=""></td></tr></table></body></html>');
		w.document.close();
	}
	w.focus();
}*/

$(document).ready(function(){
	if(screen.width > 1024){
		$('#news3').css('display', 'block');
	}
	if(screen.width > 1440){
		$('#news4').css('display', 'block');
	}
	if(screen.width > 1600){
		$('#news5').css('display', 'block');
	}
	if(document.getElementById('gallery')) {
		$("#gallery a").fancybox({
			hideOnContentClick: true,
			overlayShow: true,
			overlayOpacity: 0.5,
			zoomSpeedIn: 2100,
			zoomSpeedOut:600
		});   
	}
});
 $(document).ready(function(){
        $('.hide').click(function(){
            $(this).parent().children('div.hideContent').slideToggle("slow");
            $(this).toggleClass("active"); return false;
            return false;
        });
    });

