if (typeof sIFR == "function") {
  sIFR.bHideBrowserText = true;
  sIFR.setup();
};

$(document).ready(function() {
  
  $('#nav ul li ul li:first-child').addClass('d-top');
  $('#nav ul li').hover(function() {
    $(this).addClass('hover');
    $(this).find('a').addClass('hover');
  }, function() {
    $(this).removeClass('hover');
    $(this).find('a').removeClass('hover');
  });
  
  if (typeof sIFR == "function") {
    sIFR.replaceElement(".price h2 span", named({sFlashSrc: "/i/off.swf", sColor: "#DA251D", sWmode: "opaque"}));
    sIFR.replaceElement(".services h2 span", named({sFlashSrc: "/i/off.swf", sColor: "#DA251D", sWmode: "opaque"}));
    sIFR.replaceElement("h1 span", named({sFlashSrc: "/i/off.swf", sColor: "#000", sWmode: "transparent"}));
    sIFR.replaceElement("h2 span", named({sFlashSrc: "/i/off.swf", sColor: "#8F8F8F", sWmode: "opaque"}));
  };
  
  if ($('body').is('.front')) {
    $('h1 span:first-child').next().css({position: 'relative', marginTop: '-5px'});
    
    $('.splash li').hover(function() {
      var id = this.className.match(/box-\d/) + "";
      $(this).parent().find('.rounded').removeClass('rounded br');
      $(this).parent().parent().find('.cur').removeClass('cur');
      $(this).find('a').addClass('rounded br');
      $(this).addClass('cur');
      $(this).parent().parent().children('.' + id).addClass('cur');
    }, function() {
      // Stuff to do when the mouse leaves the element;
    });
    
    $('.serv-ind li a').hover(function() {
      $(this).parent().parent().find('.cur').removeClass('cur');
      $(this).parent().addClass('cur');
    }, function() {
      // Stuff to do when the mouse leaves the element;
    });
    
    $('.products .pagination li').hover(function() {
      var id = this.className.match(/box-\d/) + "";
      $(this).parent().find('.cur').removeClass('cur');
      $(this).parent().parent().parent().find('.cur').removeClass('cur');
      $(this).addClass('cur');
      $(this).parent().parent().parent().children('.' + id).addClass('cur');
    }, function() {
      // Stuff to do when the mouse leaves the element;
    });
    
  };
  
});


function myForm(e) {

	var error = 0;
	
	if(!$('#o_name').val())      { alert ("Заполните обазятельное поле \"Имя\""); error = 1; }
	else if(!$('#o_phone').val()) { alert ("Заполните обазятельное поле \"Телефон\""); error = 1; }
	
	if(error)
		return false;
	else
		e.submit();
};

