//открытие ссылки в новом окне

function ShowWindows(a_resizable, a_width, a_height, a_toolbar){
var objElement
objElement=event.srcElement
while (objElement.tagName!="A"){objElement=objElement.parentElement;}
if (objElement.tagName=="A"){
var str_resizable="no";
var int_width=500;
var int_height=500;
var str_toolbar="no";
var int_deltaHeight=60;

if (a_resizable!=undefined){str_resizable=a_resizable};
if (a_width!=undefined){int_width=a_width};
if (a_height!=undefined){int_height=a_height};
if (a_toolbar!=undefined){str_toolbar=a_toolbar};
if (str_toolbar=="yes") {int_deltaHeight=150;};

int_left=(screen.width-15-int_width)/2;
if (int_width>screen.width-15){
	int_width=screen.width-15;
	int_left=0;
}
int_top=(screen.height-int_deltaHeight-int_height)/2;
if (int_height>screen.height-int_deltaHeight){
	int_height=screen.height-int_deltaHeight;
	int_top=0;
}
window.open(objElement.href,objElement.target,"resizable=" + str_resizable + ",scrollbars=" + str_resizable + ",toolbar=" + str_toolbar + ",width="+int_width+",height="+int_height+",left="+int_left+", top="+int_top);
event.returnValue = false;
}
}



//подсветка кнопки

function ImgHover(a_FileName){
	if (event.srcElement.tagName=="IMG"){
		if (a_FileName!=undefined){
			if (event.srcElement.DefSrcFileName==undefined){event.srcElement.DefSrcFileName=event.srcElement.src;};
			event.srcElement.src=a_FileName;
		}
		else{
			event.srcElement.src=event.srcElement.DefSrcFileName;
		}
	}
}

//смена бакграунда у незаполненого поля формы при клике

function errfocus() {

if (window.event.srcElement.className=="inp_o_err") {window.event.srcElement.className="inp_o_err_f"};
}

//Тестирует строку на целое цисло и показывает ошибку
function testNum(obj, err) {
  if (obj.value.match(/[^\d-]/)!=null) {
    alert(err);
    obj.focus();
    return false;
  } else
    return true;
}


//Тестирует строку на предмет пустотности и показывает ошибку
function testS(obj, err) {
  if (obj.value.length == 0) {
    alert(err);
    obj.focus();
    return false;
  } else
    return true;
}

//Тестирует является ли строка e-mail адресом и показывает ошибку
function testEmail(obj, err) {
  if (is_email(obj.value)== null) {
    alert(err);
    obj.focus();
    return false;
  } else
    return true;
}

//Проверяет, является ли строка e-mail адресом
function is_email(str) {
  return str.match(/^.+@.+\..+$/);
}



$(document).ready(function() {

	
		var regexp = /\d/gi;
		
		
	$(".menu-brand").mouseover(function() {		
			var brand_id = $(this).attr('id');
			var brand_id = brand_id.match(regexp);
		  $('#menu-brand-'+brand_id).show();
	  }).mouseout(function(){
			var brand_id = $(this).attr('id');
			var brand_id = brand_id.match(regexp);
			
			$('#menu-brand-'+brand_id).hide();
	  });
});