function $(obj_id) {
	return document.getElementById(obj_id);
}
function navigateTo(url) {
	window.location.href = url;
}
function toggleSubcat(id) {
	var t = $('subcat_' + id).style;
	t.display = (t.display == 'none' ? 'block' : 'none');
}
function openWindow(url, w, h) {
	open(url, "", 'menubar=no,directories=no,location=no,resizable=no, target=viv, scrollbars=no, width='+(w+20) +',height='+(h+20));
}


function showPhoto(n, src, txt)
{
    for (var x = 1; x <= thumbs_total; x++)  $('thumb_link_' + x).className = '';
    $('thumb_link_' + n).className = 'Cur';
    $('cur_photo').src = src;
    $('note').innerHTML = txt;
}
function toggleCalc()
{
    $('calc').style.display = ($('calc').style.display == 'block' ? 'none' : 'block');
}
  function OpenWindow(url, w, h) {
        var scr = 'yes';
        if (OpenWindow.arguments.length > 3) scr = 'no';
        open(url, "", 'menubar=no,directories=no,location=no,resizable=no, target=viv scrollbars=no,width='+w +',height='+h);
    }

function checkForm(myForm) 
{
    
    var msg = "";
    
    if (!myForm.email.value) {
        msg+='не заполнено поле "E-mail"\n';
    
    }
    
     
    if (!myForm.subject.value) {
        msg+='не заполнено поле "Тема"\n';
    
    }
    if (!myForm.message.value) {
        msg+='не заполнено поле "Сообщение"\n';
    
    }
    
    estr = myForm.email.value;
        var pattern = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z]{2,4})+$/i;
        emailok = estr.search(pattern);
        if(emailok == -1)
        {
            msg+='Введите корректный адрес электронной почты.\n';
            
            
        }
        
    if(msg!="") {
        alert(msg);
        return false;
     } else {
        return true; 
    } 
}
