


// Password functions Password functions Password functions Password functions Password functions Password functions
function hw1_APP()
{
	var x = readCookie('guestcookie2');
	
	if (x) {
	window.location="apartment2_appliencemanuals_guest.html"
	}
    else{
		ae_prompt( hw2_APP, 'The requested page is reserved for our guests. Please type in your password:', '');
	}
}
function hw1_PRAC()
{
 	var x = readCookie('guestcookie2');
	
	if (x) {
	window.location="apartment2_practicalinformation_guest.html"
	}
    else{
		ae_prompt( hw2_PRAC, 'The requested page is reserved for our guests. Please type in your password:', '');
	}
}
function hw1_REST()
{
   	var x = readCookie('guestcookie2');
	if (x) {
	window.location="apartment2_restaurantguide_guest.html"
	}
    else{
		ae_prompt( hw2_REST, 'The requested page is reserved for our guests. Please type in your password:', '');
	}
}


function hw2_APP(n)
{
	if(n=='guest'){
    var hello = document.getElementById('hello');
	createCookie('guestcookie2','guest');
	
   window.location="apartment2_appliencemanuals_guest.html"
   }
    else if(n==''){
    var hello = document.getElementById('hello');
   
   }
	else{
    var hello = document.getElementById('hello');
	 ae_prompt( hw2_APP, 'Incorrect password! Please try again.', '');
	}
}
function hw2_PRAC(n)
{   if(n=='guest'){
    var hello = document.getElementById('hello');
	createCookie('guestcookie2','guest');
   window.location="apartment2_practicalinformation_guest.html"
   }
    else if(n==''){
    var hello = document.getElementById('hello');
   
   }
	else{
    var hello = document.getElementById('hello');
	 ae_prompt( hw2_APP, 'Incorrect password! Please try again.', '');
	}
}
function hw2_REST(n)
{   if(n=='guest'){
    var hello = document.getElementById('hello');
	createCookie('guestcookie2','guest');
   window.location="apartment2_restaurantguide_guest.html"
   }
    else if(n==''){
    var hello = document.getElementById('hello');
   
   }
	else{
    var hello = document.getElementById('hello');
	 ae_prompt( hw2_APP, 'Incorrect password! Please try again.', '');
	}
}

// ae_prompt function sources 
var ae_cb = null;
function ae$(a) { return document.getElementById(a); } 
function ae_prompt(cb, q, a) {
ae_cb = cb;
ae$('aep_t').innerHTML ='';
ae$('aep_prompt').innerHTML = q;
ae$('aep_text').value = a; 
ae$('aep_ovrl').style.display = ae$('aep_ww').style.display = ''; 
ae$('aep_text').focus(); 
ae$('aep_text').select(); 
}
function ae_clk(m) { 
ae$('aep_ovrl').style.display = ae$('aep_ww').style.display = 'none'; 
if (!m) ae_cb(null); else ae_cb(ae$('aep_text').value);
}
// ae_prompt function sources 


//cookie functions
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}


