	function closePopup()
	 {
	   $('#opaco').toggleClass('hidden').removeAttr('style');
	   $('#popup').toggleClass('hidden');
	   return false;
	 }
	function showPopup(popup_type)
	 {
	   if($.browser.msie)
	   {
		 $('#opaco').height($(document).height()).toggleClass('hidden');
	   }
	   else
	   {
		 $('#opaco').height($(document).height()).toggleClass('hidden').fadeTo('slow', 0.7);
	   }

	   $('#popup')
		 .html($('#popup_' + popup_type).html())
		 .alignCenter()
		 .toggleClass('hidden');

	   return false;
	 }
	 
	 function OpenMenu(){
	   $('.menuitem').live('click',function(){
		    $(this).next('ul#submenu').slideToggle();
		    return false;
	   });
     $('ul#submenu li.active').parent().css('display','block');
   }
	 
jQuery(document).ready(function(){	
	//=========================================
	$('.menuitem').live('click',function(){
		$(this).next('ul#submenu').slideToggle();
		return false;
	});
	$('ul#submenu li.active').parent().css('display','block');

	//=========================================
  
  
  function isValidEmail(email) 	{
	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
		if(reg.test(email) == false)
		{
			return false;
		}
	return true;
	}
	//=========================================
	$.fn.alignCenter = function() {
      var marginLeft = Math.max(40, parseInt($(window).width()/2 - $(this).width()/2)) + 'px';
      var marginTop = Math.max(40, parseInt($(window).height()/2 - $(this).height()/2)) + 'px';
      return $(this).css({'margin-left':marginLeft, 'margin-top':marginTop});
    };
	//=========================================
	
	/*$('#send_feed').live('click',function(){
	alert("Ok");
	});*/
	
	$('.btn').live('click',function(e){
	var error = "";
	if($(this).attr('id') == 'send_feed') var that = '#get_it';
	else var that = '#f_form';
	var name  = $(that).find('#name_input').val();
	var email = $(that).find('#email_input').val();
	var phone = $(that).find('#phone_input').val();
	var text  = $(that).find('#question_input').val();
	if(isValidEmail(email) !== true){
	error += "Неверный формат E-Mail. \n";
	}
	if(name ==""){ error += "Не заполнено поле Имя. \n";}
	if(text ==""){ error += "Не заполнено поле Вопрос.";}
	if(error !=="")
	alert(error);
	else{
		$.get('/ru/q/',{email: email, name: name, phone: phone, text:text},
				function(data){
					if (data!=0) {
							$(that).find('#name_input').val("");
							$(that).find('#email_input').val("");
							$(that).find('#phone_input').val("");
							$(that).find('#question_input').val("");
						alert(data);
					}
				});
		}
		return false;
	});
	//=========================================
	$('.btn_sbi').click(function(){
	var error = "";
	var name  = $('#name_sbi').val();
	var email = $('#email_sbi').val();
	var news = $('#news_sbi').val();
	var price = $('#price_sbi').val();	
	if(isValidEmail(email) !== true){
	error += "Неверный формат E-Mail. \n";
	}
	if(name ==""){ error += "Не заполнено поле Имя. \n";}
	if(error !=="")
	alert(error);
	else{
		$.get('/ru/subscription/',{email: email, name: name ,news: news, price: price}, 
				function(data){
					if (data!=0) {
						$('#name_sbi').val("");
						$('#email_sbi').val("");
						alert(data);		
					}
				});
		}
		return false;
	} );	
	//=========================================
	jQuery('a.lightbox').lightBox();
	/*$('#topmenu a').cornerz({radius: 4, background: '#41b9e9', fixIE: 'padding'});*/
	$('.question .btn').cornerz({radius: 4, background: '#e7ecef'});
	$('.btn_sbi').cornerz({radius: 4, background: '#fff'});
	$('.corner, .item_pic, .catalog_pic, .button').cornerz({radius: 5});
	$('.item_pic1, .item_pic3, .item_page').cornerz({radius: 8,  background: '#fff'});
	$('.catalog_cost').cornerz({corners: 'br tr', radius:4});
	
	/*$('.item_pic3').hover(function(){
		$(this).cornerzRemove();
		$(this).cornerz({borderColor: '#f37421'});
	},function(){
		$(this).cornerzRemove();
		$(this).cornerz({borderColor: '#e7ecef'});
	});*/
	
	$("#topmenu li a img").not('.active').hover(function(){
		var src = '/data/img/menu/' + $(this).attr('id') + '_a.png';
		$(this).attr('src', src);
	},function(){
		var src = '/data/img/menu/' + $(this).attr('id') + '.png';
		$(this).attr('src', src);
	});
	
	$('#topmenu li:last').css({background: 'none'});
	$(".table_choice tr:last td").css({'border': 'none', 'padding-bottom': '0px'});
	$(".catalog_item:first").css({'padding-top': '0px'});
	$(".catalog_item:last").css({'border': 'none', 'padding-bottom': '0px'});
	
	// Tabs
	/*$('#tabs, #tabs_b').tabs();
	$('#tabs li, #tabs_b li').cornerz({radius: 5, corners: "tl tr"});
	$('#tabs li a, #tabs_b li a').click(function(){
		$(this).blur();
	});*/
	
	// Slider
	/*$('#slider_people, #slider_days').slider({
		range: false,
		value: 20
	//	values: [17, 67]
	});
	$('#slider a, #logo').click(function(){
		$(this).blur();
	});*/

//close pop-up box


});

