/* hlf-java.js   */
<!-- 

/* ================================================================================= 
Two cookies are set:
	1. Language: either "de" for german or "en" for english. It is automatically set when the first access to the page happens. By default, in other words when no cookie exist, the language is set to "english".
	2. Visite: the system sets the date and time of the last visit. It is used to manage the greetings. The cookie is to expire after six (6) months. ===> still needs to be set correctly <==== (for test purposes, the cookie was set to expire after the session)
====================================================================================
*/ 

function _start() {             // function reads the value of the cookie
	/* read cookie  */
	/* Greetings  	*/

	var cook = document.cookie;
	var visit = document.cookie.indexOf("Visite");
	var temp1 = document.cookie.indexOf("Language");
	var temp  = cook.substr((temp1+9),2);
	if (visit == -1) {  
		   var franz="not needed"; }    
	else {
		alert("Welcome back to HLF Aviation. \n \nYour last visit was on: \n"  + cook.substr((visit+7),16) ) ; }

	/* What language   	*/
	if (temp == "de") 
	 	{var langue = "deutsch";
		var sprache ="de"; }
	 else
	 	{var langue = "english";
		var sprache = "en"; }
	
	var now = new Date();
	var exp = new Date(now.getTime() + (1000*60*60*24*1));
//	var exp = new Date(now.getTime() - 1);
//	document.cookie = name + "=" + escape(value);
	document.cookie = "Visite" + "=" + Date()  + ";" + "expires=" + exp.toGMTString() + ";" + "path=/" ;
	}

/* ==================================================================================== 
Following function is used to change the language from one to the other. After each change, the document.cookie is reset to tha actual value.
====================================================================================
*/	
	
function change_sprache() {	
	
	var now = new Date();
	var exp = new Date(now.getTime() + (1000*60*60*24*1));
	var temp1 = document.cookie.indexOf("Language");

	if(temp1 < 0) 
		{ var decision = "en"; }
	else {
		var decision = document.cookie.substr((temp1+9),2); }
		
	if (decision == "en") {
		sprache ="de";  
	document.cookie = "Language" + "=" + "de"  ;  }     
	else {
		sprache = "en";
	document.cookie = "Language" + "=" + "en"  ; }      
}



	
function nadine(fname,tframe) {
   var temp5 = parent.document.cookie.indexOf("Language") ;
		var fname2 =  fname + "-d.html" ;  
		parent.frame3.location.href = fname2 ; 
  }

// -->
/* -----    end of Javascript     ----  */

