
function FormSubmit(FormName, FieldName, FieldDisplayName) 
{
	for(i=0;i<FieldName.length;i++)
	{
		if(eval("document." + FormName + "." + FieldName[i] + ".value.length") == 0) 
		{
			alert("Введите, пожалуйста, " + FieldDisplayName[i] + ".");
			return false;
		}
	}
	
	eval("document." + FormName + ".submit()");
	return true;
}







function menu(id)
{
var menu = document.getElementById('menu_' + id).style;
if (menu.display == 'none')
{
menu.display = 'block';
}
else
{
menu.display = 'none';
}
}








function address() {


	if(document.order.name.value.length == 0) {
		alert("Введите, пожалуйста, Ваше имя.");
		return false;
	}
	
	if(document.order.tel.value.length == 0) {
		alert("Введите, пожалуйста, контактный телефон.");
		return false;
	}
	
	if(document.order.adr.value.length == 0) {
		alert("Введите, пожалуйста, адрес доставки.");
		return false;
	}
	
	if(document.order.mail.value.length == 0) {
		alert("Введите, пожалуйста, Ваш email.");
		return false;
	}
	
	var filter  = /([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+(\>)?\s*$/;
    var to = document.order.mail.value;

    // split by comma or semi-colon
    var to_array = to.split(/[;,]/g);

    for(i=0; i<to_array.length; i++){
        if(to_array[i].length == 0) {
            next;
        }
        if(! filter.test(to_array[i])) {
            alert("Введите, пожалуйста, корректный адрес электронной почты.");
            return false;
        }
    }

	
	return true;
}









function view(image) 
{
  document.photo.src=image;
}

