function access(id){
	if(document.getElementById){
		var path=document.getElementById(id).style;
	}else if(navigator.appName=='Microsoft Internet Explorer' || navigator.appName=='Opera'){
		var path=eval('id'+'.style');
	}else if(navigator.appName=='Netscape'){
		var path=eval('document.'+'id');
	}
	return (path);
}

function displayReq(imya,id,num){
	var adrs=eval('document.forms.'+imya);
	var path=access(id);
	path.display=(adrs.pay.selectedIndex==num)?'block':'none';
}

function forZav(id){	
	var adr = eval('document.forms.'+id);
	if(adr.crooms.selectedIndex>=1 && adr.food.selectedIndex==0){
		adr.food.options[1].selected=true;
	}
}
		
function forZav2(id){	
	var adr=eval('document.forms.'+id);
	if(adr.crooms.selectedIndex>=1 && adr.food.selectedIndex==0){
    	alert('В стоимость этого номера уже включен шведский стол!');
		adr.food.options[1].selected = true;
		adr.food.focus();
    	return false;
	}else{
		return true;
	}
}

var i=1;
function displayYes(id){
	var path=access(id);
	if(i==1){
		path.display='block';
	}else{
		path.display=(path.display=='none')?'block':'none';
	}
	i++;
}

function test(imya){		
	var adr=eval('document.forms.'+imya);
	if(adr.data1.selectedIndex>adr.data2.selectedIndex && adr.month1.options[adr.month1.selectedIndex].text==adr.month2.options[adr.month2.selectedIndex].text){
		alert('Уточните период проживания!');
		adr.data1.focus();
   		return false;
	}
	if(adr.pay.selectedIndex==1 && adr.req.value==""){
		alert('Укажите реквизиты организации, которая будет оплачивать услуги гостиницы!');
		adr.req.focus();
    	return false;
	}
	if(adr.name1.value==""){
		alert('Укажите фамилию!');
		adr.name1.focus();
    	return false;
	}
	if(adr.email.value==""){
		alert('Укажите адрес электронной почты!');
		adr.email.focus();
    	return false;
	}
	if((adr.email.value.indexOf('@', 0)<1)||(adr.email.value.indexOf('@', 0) == adr.email.value.length-1)||(adr.email.value.length<6)){
		alert('Пожалуйста введите правильный адрес электронной почты!');
		adr.email.focus();
    	return false;
	}
	if((adr.email.value.indexOf('.', 0)<1)||(adr.email.value.indexOf('.', 0)==adr.email.value.length-1)){
		alert('Пожалуйста введите правильный адрес электронной почты!');
		adr.email.focus();
    	return false;
	}
	return true;
}
