	var s_current_tab = 1;
	function ChangeTab(tab_id)
	{
		if (tab_id == s_current_tab)
			return true;
			
		document.getElementById('s_tab_' + s_current_tab).className = 'tab_passive';
		document.getElementById('s_tab_' + tab_id).className = 'tab_active';
		
		document.getElementById('s_tab_content_' + s_current_tab).style.display = 'none';
		document.getElementById('s_tab_content_' + tab_id).style.display = 'block';
		
		document.getElementById('s_tab_' + s_current_tab).style.zIndex = s_current_tab;
		document.getElementById('s_tab_' + tab_id).style.zIndex = 10;
		
		s_current_tab = tab_id
	}
	
	var s_current_size = 0;
	function ChooseSize(size_id)
	{
		ob = document.getElementById('baloon_preorder_' + s_current_size);
		if (ob){
			ob.style.display = "none";
		}	
		ob = document.getElementById('baloon_preorder_' + size_id);
		if (ob){
			ob.style.display = "";
		}
		s_current_size = size_id;
	}
	
	
	function change_size_div() {
		for(var i=0;i<document.form2.size.length;i++)
		{
			document.form2.size[i].checked=false;
		}
		document.form2.right_size.value=0;
		obj_fl = get_obj('color_'+document.form2.old_color.value);
		obj_fl.style.display = "none";
		obj_fl = get_obj('color_'+document.form2.color.value);
		obj_fl.style.display = "";
		document.form2.old_color.value=document.form2.color.value;
	}
	
	function get_obj(id_name) {
		if (document.getElementById) {
			return document.getElementById(id_name);
		} else if (document.all) {
			return document.all[id_name];
		} else {
			return null;
		}
	}
	
	function validate() {
		if (document.form2.right_size.value==0) {
			alert("Выберите размер");
			return false;
		};
	 	for(var i=0;i<document.form2.size.length;i++)
		{
			if(document.form2.size[i].checked) {
				if (document.form2.size[i].value==1) {
					alert("Этот размер не может быть заказан!");
					return false;
				};
				return true;
			}
		}
	}

function open_window(link,w,h,s,name) {  
	var win = "width="+w+",height="+h+",menubar=no,location=no,resizable=no,scrollbars="+s;
	newWin = window.open(link,name,win);
};

function validate_reforum() {
	if (document.reforum_form.forumlogin.value.length<1) {
		alert("Вы не заполнили поле с именем пользователя!");
		return false;
	};
	if (document.reforum_form.forumpassword.value.length<1) {
		alert("Вы не заполнили поле с паролем!");
		return false;
	};
	if (document.reforum_form.forummessage.value.length<1) {
		alert("Вы не написали само сообщение!");
		return false;
	};
	return true;
};

function validate_newforum() {
	if (document.newforum_form.forumlogin.value.length<1) {
		alert("Вы не заполнили поле с именем пользователя!");
		return false;
	};
	if (document.newforum_form.forumpassword.value.length<1) {
		alert("Вы не заполнили поле с паролем!");
		return false;
	};
	if (document.newforum_form.forumname.value.length<1) {
		alert("Вы не написали название темы!");
		return false;
	};
	if (document.newforum_form.forummessage.value.length<1) {
		alert("Вы не написали само сообщение!");
		return false;
	};
	return true;
};

function change_page() { 
	if (document.form1.ch_page.value=="no") {
		return false;
	} else {
	link="showsales.php?page="+document.form1.ch_page.value;
	document.location.href=link;
	};
};

function validate_order() {
	if (document.form1.name.value.length<1) {
		alert("Введите имя!");
		return false;
	};
	i=0;
	s=document.form1.homephone.value;
	while (i<s.length) {
	if (s.substr(i,1)=="-") {
		alert("Проверьте номер домашнего телефона!");
		return false;
	};
	i++;
	};
	i=0;
	s=document.form1.workphone.value;
	while (i<s.length) {
	if (s.substr(i,1)=="-") {
		alert("Проверьте номер рабочего телефона!");
		return false;
	};
	i++;
	};
	i=0;
	s=document.form1.mobphone.value;
	while (i<s.length) {
	if (s.substr(i,1)=="-") {
		alert("Проверьте номер мобильного телефона!");
		return false;
	};
	i++;
	};
	if (document.form1.family.value.length<1) {
		alert("Введите фамилию!");
		return false;
	};
	if (document.form1.address.value.length<1) {
		alert("Введите адрес доставки!");
		return false;
	};
	if (document.form1.address.value.length>240) {
		alert("Адрес доставки ограничен 240 символами!");
		return false;
	};
	if (document.form1.homephone.value.length<4 & document.form1.workphone.value.length<4 & document.form1.mobphone.value.length<4) {
		alert("Введите хотя бы один контактный телефон!");
		return false;
	};
	if (document.form1.oplata[0].checked==false & document.form1.oplata[1].checked==false & document.form1.oplata[2].checked==false) {
		alert("Выберите способ оплаты!");
		return false;
	};
	if (document.form1.rost.value.length<1) {
		alert("Заполните графу Рост!");
		return false;
	};
	if (document.form1.grud.value.length<1) {
		alert("Заполните графу Грудь!");
		return false;
	};
	if (document.form1.taliya.value.length<1) {
		alert("Заполните графу Талия!");
		return false;
	};
	if (document.form1.bedra.value.length<1) {
		alert("Заполните графу Бедра!");
		return false;
	};
	if (document.form1.obuv.value.length<1) {
		alert("Заполните графу Размер обуви!");
		return false;
	};
	return true;
}

function verify_city() {
	document.form1.info.value="";
	if (document.form1.city.value=="another") {
		if (document.form1.oplata[0].checked==true) {
			document.form1.info.value="Извините, для Вашего города оплата наличными невозможна! Выберите другой способ оплаты!";
			document.form1.oplata[0].checked=false;
		};
		if (document.form1.oplata[1].checked==true) {
			document.form1.info.value="Доставка Вашего заказа будет стоить $30";
		};
		if (document.form1.oplata[2].checked==true) {
			document.form1.info.value="Доставка Вашего заказа будет стоить $30. Оплата с помощью пластиковой карты будет произведена сразу же после завершения оформления заказа";
		};
	}; 
	if (document.form1.city.value=="Москва") {
		document.form1.info.value="Доставка Вашего заказа будет стоить 300 руб.";
		if (document.form1.cost.value>50) {
			document.form1.info.value="Доставка Вашего заказа будет осуществлена бесплатно.";
		};
		if (document.form1.oplata.value=="Кредитной картой") {
			document.form1.info.value=document.form1.info.value+" Оплата с помощью пластиковой карты будет произведена сразу же после завершения оформления заказа";
		};
	};
	if (document.form1.city.value=="Подмосковье") {
		document.form1.info.value="Доставка Вашего заказа будет стоить от 900 до 2000 рублей в зависимости от удаленности.";
		if (document.form1.cost.value>50) {
			document.form1.info.value="Доставка Вашего заказа будет стоить от 500 до 1500 рублей в зависимости от удаленности.";
		};
		if (document.form1.oplata.value=="Кредитной картой") {
			document.form1.info.value=document.form1.info.value+" Оплата с помощью пластиковой карты будет произведена сразу же после завершения оформления заказа";
		};
	};
	if (document.form1.oplata[0].checked==true) {
		document.getElementById("demotr").style.visibility="visible";

	};
	if (document.form1.oplata[1].checked==true) {
		document.form1.demo.checked=false;
		document.getElementById("demotr").style.visibility="hidden";
	};
	if (document.form1.oplata[2].checked==true) {
		document.form1.demo.checked=false;
		document.getElementById("demotr").style.visibility="hidden";
	};
	return true;
}

function verify_oplata() {
	document.form1.info.value="";
	document.form1.oplata[0].checked=false;
	document.form1.oplata[1].checked=false;
	document.form1.oplata[2].checked=false;
	return true;
}

			function validate_regform() {
			if (document.form1.name.value.length<1) {
				alert("Введите имя!");
				return false;
			};
			i=0;
			s=document.form1.homephone.value;
			while (i<s.length) {
				if (s.substr(i,1)=="-") {
					alert("Проверьте номер домашнего телефона!");
					return false;
				};
				i++;
			};
			i=0;
			s=document.form1.workphone.value;
			while (i<s.length) {
				if (s.substr(i,1)=="-") {
					alert("Проверьте номер рабочего телефона!");
					return false;
				};
				i++;
			};
			i=0;
			s=document.form1.mobphone.value;
			while (i<s.length) {
				if (s.substr(i,1)=="-") {
					alert("Проверьте номер мобильного телефона!");
					return false;
				};
				i++;
			};
			if (document.form1.family.value.length<1) {
				alert("Введите фамилию!");
				return false;
			};
			if (document.form1.login.value.length<5) {
				alert("Логин не должен быть короче 5 символов!");
				return false;
			};
			if (document.form1.password.value.length<5) {
				alert("Пароль не должен быть короче 5 символов!");
				return false;
			};
			if (document.form1.address.value.length<5) {
				alert("Введите адрес доставки!");
				return false;
			};
			if (document.form1.address.value.length>240) {
				alert("Адрес доставки ограничен 240 символами!");
				return false;
			};
			if (document.form1.homephone.value.length<4 & document.form1.workphone.value.length<4 & document.form1.mobphone.value.length<4) {
				alert("Введите хотя бы один контактный телефон!");
				return false;
			};
			if (document.form1.city.value=="empty") {
				alert("Выберите регион проживания!");
				return false;
			};
			return true;
		}
		
function goodvotefunc(votelink) {  
	votelink=votelink+document.form2.goodvote.value;
	document.location.href=votelink;
};

function showkvit(link,w,h,name) {  
	var win = "width="+w+",height="+h+",menubar=no,location=no,resizable=no,scrollbars=no";
	link=link+"?summ="+document.kvitform.summ.value+"&comment="+document.kvitform.comment.value;
	newWin = window.open(link,name,win);
};

function showhide(obj_name) {
	obj_fl = get_obj(obj_name);
	if (obj_fl.style.top == '-10000px') {
		obj_fl.style.position = "";
		obj_fl.style.left = "0px";
		obj_fl.style.top = "0px";
	}
	else {
		obj_fl.style.position = "absolute";
		obj_fl.style.left = "-10000px";
		obj_fl.style.top = "-10000px";
	}
}
