function validate(form_id,email) {
   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   var address = document.forms[form_id].elements[email].value;
   if(reg.test(address) == false) {
     $('<span class="err">Введите корректный e-mail адрес</span><br/><br/>').prependTo($('#checkout_have_account'));
      return false;
   }
}

$(document).ready(function() {
//if(!($.browser.msie && $.browser.version=="6.0")){

    //Select costum style
    $('#my-dropdown').sSelect();
//}
    $('.highslide-image').parent().addClass('zoom');
    
    //Opera overflow hack
    if ($.browser.opera) {
        $("body").css({'overflowY':'hidden', 'overflowX':'hidden','position':'absolute', 'width':'100' + '%'});
    }
        //Top-menu
    $('.top-menu a').click(function(){
                $('.top-menu a.active').removeClass('active');
                $(this).addClass('active');
    }  );
    //Info-menu
    $('.info-menu a:first').addClass('size');
    $('.info-menu a').click(function(){
       $('.info-menu a.active').removeClass('active');
       $(this).addClass('active');
    });
    //Menu
    $('.menu>ul>li:nth-child(1)').addClass('d');
    $('.menu>ul>li:nth-child(2)').addClass('m');
    $('.menu>ul>li:nth-child(4)').addClass('n');
    $('.menu>ul>li:nth-child(5)').addClass('r');
    $('.menu>ul>li:nth-child(3)').addClass('u');

    $('.menu').append('<sub></sub><sup></sup>');
    $('.menu a').click(function(){
       $('.menu a.active').removeClass('active');
       $(this).addClass('active');
    });
    //Submenu
    $('.menu .d li:last').addClass('noborder');
    $('.menu .d li:last').append('<span class="hhh"></span>');
    $('.menu .m li:last').addClass('noborder');
     $('.menu .m li:last').append('<span class="mmm"></span>');
    $('.menu .n li:last').addClass('noborder');
    $('.menu .r li:last').addClass('noborder');
    $(".menu>ul>li").hover(function () {
       $(this).addClass('vis');
       },
       function () {
       $(this).removeClass('vis');
       }
    );
    //Size search
    $('.size-search p span').append('<sup></sup>').prepend('<sub></sub>');
    //Cart
    $('.cart p:first').addClass('cap');
    //Item
    $('.item img').parent().addClass('img');
    $('.item .short-info p:nth-child(4)').addClass('cena');
    $('.item .short-info a:nth-child(1)').addClass('sku');
    $('.products').wrapInner('<div class="pr-mid"><div class="pr-right"></div></div>');
        for(var k=0; k<$('.products .item').length; k++){
        if(k%3 == 1){k=k+1; $('<div class="clr"></div>').insertAfter('.products .item:eq('+k+')');};
    }
    $(".item .sku").hover(
       function () {
       $(this).parent().prev().attr('id','hov');
       },
       function () {
       $(this).parent().prev().removeAttr('id','hov');
       }
    );
    //product page
    $('.item-info p:first').addClass('name');
    $('.item-info select').parent().addClass('select');
    $('.item-info span').parent().addClass('prise');
    $('.more-img img').wrap('<div></div>');
    $('.description p:last').addClass('text-desc');
    $('<br/>').insertAfter('.description p.text-desc span');
    $('.contact-form tr:last').addClass('ta-right');
    //registration page
    $('#reg_fields_tbl td:nth-child(1)').addClass('tdl');
    $('#checkout_logininfo td:nth-child(1)').addClass('tdl');
    $('#checkout_addresses_shipping td:nth-child(1)').addClass('tdl');
    $('.asterisk').parent().addClass('bold');
    //Shopping cart
    $('#cart_content_tbl tr:first').addClass('th');
    $('.basket tr:last').addClass('tl');
    $('.basket .tl').prev().addClass('tbl');
    $('.basket tr td:nth-child(1)').addClass('im');
    $('.basket tr td:nth-child(2)').addClass('nm');
    $('.basket tr td:nth-child(3)').addClass('ar');
    $('.basket tr td:nth-child(4)').addClass('sz');
    $('.basket tr td:nth-child(5)').addClass('co');
    $('.basket tr td:nth-child(6)').addClass('qu');
    $('.basket tr td:nth-child(7)').addClass('pr');
    $('.basket tr td:nth-child(8)').addClass('up');
    $('.basket tr.th td').wrapInner('<span></span>');
    //Homepage
       $(".home>div").hover(
       function () {
       $(this).addClass('bu');
       $(this).find('.z2').show();
       $(this).find('.z1').show();
       $(this).find('.z4').show();
       $(this).find('.z5').show();
       $(this).find('.z6').show();
       $(this).find('.z7').show();
       $(this).find('.z8').show();
       },
       function () {
       $(this).removeClass('bu');
       $(this).find('.z2').hide();
       $(this).find('.z1').hide();
       $(this).find('.z4').hide();
       $(this).find('.z5').hide();
       $(this).find('.z6').hide();
       $(this).find('.z7').hide();
       $(this).find('.z8').hide();
       }
    );

    $('.home').wrapInner('<div class="hmbg1"><div class="hmbg2"></div></div>').append('<div class="hmbg3"></div>');
   //Footer
   $('.f-menu li:first').addClass('nomarg');
   //Clear form input on focus
   $('textarea').clearOnFocus();
   $('input:text').clearOnFocus();
   //Modal box
    $('.modal p:first').addClass('ta-left');
    $('#log-in').click(function(){
    $('.modal').parent().show();
    return false;
    });
    $('.fixed-in').click(function(){
    $('.modal').parent().hide();
    });
    $('.close').click(function(){
    $('.modal').parent().hide();
    });
    //Specific resolution styles
    function ResizeCSS(){
    	if($('body').width() < 1200){
		$('.wrap-in').css("padding","0");
		$('.short-info').css("width","110px");
		$('.cena').css("font-size","13px");
		$('.products').css("padding","20px 0 0 0");
		$('.short-info').css("padding-left","10px");
        }
        if($('body').width() > 1200){
		$('.wrap-in').css("padding","0 50px");
        $('.short-info').css("width","130px");
        $('.cena').css("font-size","14px");
        $('.products').css("padding","20px 0 0 20px");
        $('.short-info').css("padding-left","15px");
        }
    }
	ResizeCSS();
        $(window).resize(function(){
        ResizeCSS();
    });

    //Menu active classes
    if (window.location.href == 'http://super-obuv.com.ua/category/obuv-dlja-malchikov/') {
     $('.m>a').addClass('active');
    }

     if (window.location.href == 'http://super-obuv.com.ua/category/pinetki_zb/') {
     $('.m>a').addClass('active');
    }
      if (window.location.href == 'http://super-obuv.com.ua/category/sportivnye_yi/') {
     $('.m>a').addClass('active');
    }
      if (window.location.href == 'http://super-obuv.com.ua/category/botinki_h4/') {
     $('.m>a').addClass('active');
    }
     if (window.location.href == 'http://super-obuv.com.ua/category/tufli_ao/') {
     $('.m>a').addClass('active');
    }
    if (window.location.href == 'http://super-obuv.com.ua/category/sapogi_tq/') {
        $('.m>a').addClass('active');
       }
    if (window.location.href == 'http://super-obuv.com.ua/category/mokasiny_j4/') {
          $('.m>a').addClass('active');
         }
    if (window.location.href == 'http://super-obuv.com.ua/category/bosonozhki_zw/') {
          $('.m>a').addClass('active');
         }
     if (window.location.href == 'http://super-obuv.com.ua/category/pinetki/') {
     $('.d>a').addClass('active');
    }
       if (window.location.href == 'http://super-obuv.com.ua/category/sportivnye/') {
     $('.d>a').addClass('active');
    }
        if (window.location.href == 'http://super-obuv.com.ua/category/botinki/') {
     $('.d>a').addClass('active');
    }
    if (window.location.href == 'http://super-obuv.com.ua/category/tufli/') {
    $('.d>a').addClass('active');
   }
       if (window.location.href == 'http://super-obuv.com.ua/category/sapogi/') {
    $('.d>a').addClass('active');
   }
    if (window.location.href == 'http://super-obuv.com.ua/category/mokasiny/') {
   $('.d>a').addClass('active');
  }
        if (window.location.href == 'http://super-obuv.com.ua/category/bosonozhki/') {
   $('.d>a').addClass('active');
  }
          if (window.location.href == 'http://super-obuv.com.ua/category/obuv-dlja-devochek/') {
     $('.d>a').addClass('active');
    }
     if (window.location.href == 'http://super-obuv.com.ua/category/novinki/') {
     $('.n>a').addClass('active');
    }
      if (window.location.href == 'http://super-obuv.com.ua/category/rasprodazha/') {
     $('.r>a').addClass('active');
    }
     if (window.location.href == 'http://super-obuv.com.ua/category/dlja-mamy/') {
     $('.u>a').addClass('active');
    }
     if (window.location.href == 'http://super-obuv.com.ua/auxpage_about/') {
     $('.top-menu a:first').addClass('active');
    }
     if (window.location.href == 'http://super-obuv.com.ua/blog/') {
     $('.top-menu ul li:nth-child(2) a').addClass('active');
    }
     if (window.location.href == 'http://super-obuv.com.ua/auxpage_payment/') {
     $('.top-menu ul li:nth-child(3) a').addClass('active');
    }
     if (window.location.href == 'http://super-obuv.com.ua/auxpage_delivery/') {
     $('.top-menu ul li:nth-child(4) a').addClass('active');
    }
      if (window.location.href == 'http://super-obuv.com.ua/feedback/') {
     $('.top-menu ul li:nth-child(5) a').addClass('active');
    }
    if (window.location.href == 'http://super-obuv.com.ua/auxpage_sizes/') {
     $('.info-menu ul li:nth-child(1) a').addClass('active');
    }
    if (window.location.href == 'http://super-obuv.com.ua/auxpage_gde-primerit/') {
     $('.info-menu ul li:nth-child(2) a').addClass('active');
    }
    if (window.location.href == 'http://super-obuv.com.ua/auxpage_garantii-kachestva/') {
     $('.info-menu ul li:nth-child(3) a').addClass('active');
    }

    $('.goto').attr('value','').parent().prev().addClass('zxc');
    $("form[action='/contact_info/']").addClass('xxx').attr('id','gh');
    $("form[name='editAddress']").addClass('xxx');
    $("form[name='address_selection_form']").addClass('xxx');
    $("input[name='save']").addClass('lk').attr('value','');
    $("input[name='address[zip]']").addClass('zip');
    $("input[name='shipping_address[zip]']").addClass('zip');
    $(".xxx").wrap("<div class='contact-form' id='reg_fields_tbl'></div>");
    $('#gh table tbody td:nth-child(2)').append('<sub></sub>').prepend('<sup></sup>');
    $('#subscribed4news').parent().parent().remove();
    $('.detailedform').prev().find('input:last').addClass('pnt').attr('value','');
    $('#printforms').attr('value','');
    $("#log-in").addClass('ghf');
                    if($.browser.msie && $.browser.version=="6.0") {
                   if ($.cookie('ieshown')==null) {
                        $('#upie6').show();
                     }
                     else if ($.cookie('ieshown')=='true') {
                        $('#upie6').hide();
                     }
                     $('.clox').click(function(){
                         $.cookie('ieshown','true',{ expires: 3 });
                         $('#upie6').hide();
                     });
                       $('#upie6 a').click(function(){
                         $.cookie('ieshown','true',{ expires: 3 });
                         $('#upie6').hide();
                     });
                    }
 });
