//------------------------------------------------------------
// class Navigation
//------------------------------------------------------------

// constructor
function navigation(active){
	this.active = active;
	this.list = new Array();
	this.navhtml = "";
	this.poslist = new Array();
	
	this.initNav(this.active);
	
}

// create navigation links
navigation.prototype.initNav = function(){

	var home = (this.active == "Home")? new activeNavLink("Home") : new navLink("Home");
	this.list.push(home.getHTML());
	this.poslist.push("Home");
	
	var home = (this.active == "Portrait")? new activeNavLink("Portrait") : new navLink("Portrait");
	this.list.push(home.getHTML());
	this.poslist.push("Portrait");
	
	var home = (this.active == "Science")? new activeNavLink("Science") : new navLink("Science");
	this.list.push(home.getHTML());
	this.poslist.push("Science");
	
	var home = (this.active == "Referenzen")? new activeNavLink("Referenzen") : new navLink("Referenzen");
	this.list.push(home.getHTML());
	this.poslist.push("Referenzen");
	
	var home = (this.active == "TaubenWeb")? new activeNavLink("TaubenWeb") : new navLink("TaubenWeb");
	this.list.push(home.getHTML());
	this.poslist.push("TaubenWeb");	
	
	var home = (this.active == "Impressum")? new activeNavLink("Impressum") : new navLink("Impressum");
	this.list.push(home.getHTML());
	this.poslist.push("Impressum");
	
	var home = (this.active == "Kontakt")? new activeNavLink("Kontakt") : new navLink("Kontakt");
	this.list.push(home.getHTML());
	this.poslist.push("Kontakt");
	
	this.navhtml = this.createHTML();
}

// return done html navigation
navigation.prototype.getNav = function(){
	return this.navhtml;
}

// trigger a link
navigation.prototype.call = function(id){
	$('#'+this.active).hide();
	$('#'+this.active+"_link").addClass("navlink").removeClass("navlinkactive");

	var tmp1 = new navLink(this.active);
	for (var i = 0; i < this.poslist.length; i++){
		if(this.active == this.poslist[i]){
			this.list[i] = tmp1.getHTML();
		}
	}

	this.active = id;
	$('#'+id).show();
	$('#'+id+"_link").addClass("navlinkactive").removeClass("navlink");
	
	var tmp = new activeNavLink(id);
	for (var i = 0; i < this.poslist.length; i++){
		if(id == this.poslist[i]){
			this.list[i] = tmp.getHTML();
		}
	}
	this.navhtml = this.createHTML();
	
	var navHTML = "<div class='navi' onmouseover='edge.fold();'>" + this.getNav()+ "</div>";
	edge.setHTML(navHTML);
}

// returns the actual shown site
navigation.prototype.getActive = function(){
	return this.active;
}

// returns the html code for the navigation
navigation.prototype.createHTML = function(){
	var html = "";
	for (var i = 0; i < this.list.length; i++){
		html += this.list[i];
	}
	return html;
}


//------------------------------------------------------------
// class navLink
//------------------------------------------------------------

// constructor
function navLink(lname){
	this.displ = "";
	if(lname == "Home"){
		this.displ = "Herzlich Willkommen";
	}else{
		this.displ = lname;
	}
	this.html = "<a href='javascript:navi.call(\""+lname+"\");head.updateList(\""+this.displ+"\")' class='navlink' id='"+lname+"_link'>//"+lname+"</a><br>";
	
}
// return link
navLink.prototype.getHTML = function(){
	return this.html;
}

//------------------------------------------------------------
// class activeNavLink
//------------------------------------------------------------

// constructor
function activeNavLink(lname){
	this.html = "<span class='navlinkactive' id='"+lname+"_link'>//"+lname+"</span><br>";
}
// return link
activeNavLink.prototype.getHTML = function(){
	return this.html;
}


