<!--

function switchSubMenu(id) {
	var div = document.getElementById('div_'+id);
	var img = document.getElementById('img_'+id);
	if (div.style.display=='') {
		div.style.display = 'none';
		img.src = 'img/arrow_sub_off.gif';
	} else {
		div.style.display = '';
		img.src = 'img/arrow_sub_on.gif';
	}
	return false;
}

var wnd;
function askMe() {
    if (wnd)
        wnd.close();
    wnd = window.open('askme_popup.php', 'askme','status=no,modal=yes,width=500,height=550');
}

function checkAskMeFields() {
    if (!checkFields('name','email','question'))
        return false;
    if (window.RegExp && !isValidEmail(document.getElementById('email').value)) {
        alert("Неверный формат E-Mail");
        return false;
    }
    return true;
}

function checkSubscribeFields() {
    if (!checkFields('username','useremail'))
        return false;
    if (window.RegExp && !isValidEmail(document.getElementById('useremail').value)) {
        alert("Неверный формат E-Mail");
        return false;
    }
    return true;
}

function checkFields() {
    var i, a=checkFields.arguments;
    for(i=0;i<a.length;i++) {
        obj = document.getElementById(a[i]);
        if(!obj.value.length) {
            alert("Пустое поле "+obj.name);
            return false;
        }
    }
    return true;
}

function isValidEmail(str) {
    return str.match(new RegExp("^([a-zA-Z0-9_]|\\-|\\.)+@(([a-zA-Z0-9_]|\\-)+\\.)+[a-zA-Z]{2,4}$"));
}

function checkCartFields(nm,year) {
    if (!checkFields(nm,year))
        return false;
    var yr = document.getElementById(year).value;
    tm=new Date();
    var curYear=tm.getYear();
    curYear+=curYear<200?1900:0;
    if (!parseInt(yr) || parseInt(yr)<1000 || parseInt(yr)>curYear) {
        alert('Неверный год рождения');
        return false;
    }
    return true;
}

		function jsSearchFocus() {
			if (document.getElementById('search_str').value == "поиск продукции") {
				document.getElementById('search_str').value = "";
			}
		}

		function jsSearchBlur() {
			if (document.getElementById('search_str').value == "") {
				document.getElementById('search_str').value = "поиск продукции";
			}
		}

//-->
