function setnbg(id,flag){
	if(flag){
		obj = document.getElementById('idh'+id);
		obj2 = document.getElementById('idh'+id+"over");
		obj.style.display = "none";
		obj2.style.display = "block";
	}else{
		obj = document.getElementById('idh'+id);
		obj2 = document.getElementById('idh'+id+"over");
		obj2.style.display = "none";
		obj.style.display = "block";
	}

}
function checkEmailform(obj){

	if(obj.subj.value == '') {
		alert("Напишите тему письма");
		obj.subj.focus();
		return false;
	}
	if(obj.email.value == '') {
		alert("Напишите имейл, по которому с Вами смогут связаться");
		obj.email.focus();
		return false;
	} else {
		rez = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(obj.email.value);
		if(!rez){alert("Имейл некоректен, исправте пожалуйста");
			obj.email.focus();
			return false;
		}
	}
	if(obj.mess.value == '' || obj.mess.value == ' ') {
		alert("Письмо не может быть пустым");
		obj.mess.focus();
		return false;
	}
	return true;
}
function img_over(obj){
/* 	if(ie6){
		//obj.style.display="none";
		obj.className = '';
		obj2 = obj.parentNode;
		t_html = obj2.innerHTML;
		obj2.className = 'selected';
		alert(t_html);
	}else */
	obj.src = obj.src.replace('.png','_over.png');
}
var t_html='';
function img_out(obj){
/* 	if(ie6){
		//obj.style.display="block";
		obj2 = obj.parentNode;
		obj2.innerHTML = t_html;
		obj2.className = 'unselected';
		alert(obj2.outerHTML);
	}else */
	obj.src = obj.src.replace('_over.png','.png');
	
}
function setWidth(fix_width){
	id = 'footer';
	obj = document.getElementById(id);
	k = document.body.offsetWidth - fix_width;
	obj.style.width = k+'px';
	if(!ie6) return;
	id = 'mainbar';
	fix_width -= 20;
	obj = document.getElementById(id);
	k = document.body.offsetWidth - fix_width;
	obj.style.width = k+'px';
}
//==================crossbrowser class adding============
	var u = navigator.userAgent.toLowerCase();
	var ie6 = false;
//	alert(u);
	is = function(t){return (u.indexOf(t)!=-1)};
	addClass = function(el,val){
		if(!el.className) {
			el.className = val;
		} else {
			var newCl = el.className;
			newCl+=(" "+val);
			el.className = newCl;
		}
	}
	var el = document.getElementsByTagName('html')[0];
	if(is('chrome')) addClass(el,'chrome');
	if(is('msie')) addClass(el,'msie');
	if(is('msie 7')) addClass(el,'msie7');
	if(is('msie 8')) addClass(el,'msie8');
	if(is('opera/9')) addClass(el,'opera9');
	if(is('opera')) addClass(el,'opera');
	if(is('firefox/2')) addClass(el,'gecko ff2');
	if(is('firefox/3')) addClass(el,'gecko ff3');
	if(is('gecko/')) addClass(el,'gecko');
	if(is('safari/')) addClass(el,'safari');
	if(is('mozilla/')) addClass(el,'gecko');
	if(is('msie 6')){ 
			ieAll=true;
		if(!is('msie 7') && !is('msie 8')){ 
			ie6=true;
			addClass(el,'msie6');
		}
	}

//==================crossbrowser class adding fine============
function bodySize(){
	if(ieAll) {
		sObj = document.getElementsByTagName('body')[0].style;
		sObj.width = (document.documentElement.clientWidth<1000) ? '1000px' : '100%';
//		alert(sObj.width);
	}
}

function init(){
	if(typeof ieAll !== 'undefined' && ieAll) { bodySize(); }
}

	
start_several=function(){
	setWidth(470);	
	init();
	}
start_correct=function(){
//alert('1');
	setWidth(470);	
	if(ieAll) { bodySize(); }
	}
window.onload=start_several;
window.onresize=start_correct;
