/* copyright YouAndMe Communications
## YouAndMe Communications
## Kai-Stefan Luithardt
## Lochwaldweg 13, 70771 Leinfelden-Echterdingen, info@you-and-me.de, Tel: 0711 78285719
## www.you-and-me.de
##
## Projekt      : Weiss Transformation Processes
## Datei        : menu.js
## Funktion     : Menüerstellung
## Erstellung   : 03.04.03
## Bemerkungen  : counter:  <img src="http://weltfamilie.de/tinc?key=cK5hTyH7&no=1">
## Anpassungen  :
## Aufgaben     :
##
## ------------------------------------------------------------------------------------------
*/

/*--------------------------------------------------------------------------------------------
  Deklarationen
  --------------------------------------------------------------------------------------------*/
		
if(!document.createElement)alert("Sorry, this site only works with DOM-Browsers\nlike Navigator 7ff, Mozilla, Internet Explorer 5ff\n\nPlease change the Browser :-)");
var bod, bodtest;
var win_h;
var win_w;
var u;//aktuelles left
var v;//aktuelle Höhe
var top;var to_w=735;var to_x=0;var to_y=0;
var bottom;var bo_h=16;var bo_w=735;var bo_d=5;
var menu;var m_x=5; var m_y=132; var m_d=0; var m_w=158;
var content; var co_d=132;var co_o=20;var co_w=to_w-2*co_o-m_w;var co_z=5;
var title; var ti_d=98; var ti_h=40;//ti_h=20;
var lang; var lang_o=5; var lang_d=102;
var ls; var ls_o=35; var ls_d=57;
var la=new Array("flag_engl.gif","flag_germ.gif","flag_ital.gif");
var lc=new Array("choose a language","Sprachwahl","come prima");
var lp=new Array("[printable version of this page]","[diese Seite für Ausdruck]","[print this page]");
var lpb=new Array("[Back to normal view]","zurück zur Normalansicht]","[back to normal view]");
var lb=0;//aktuelle Spracheinstellung
var lss=false;//Sprachauswahl aktiv

/*
m[lb]=[Bezeichnung],
      [URL],
						[Anzahl der Indents],
						[von der Bezeichnung abweichender Seitentitel],
						[ID],
						[ParentID],
						[show Footer],
						[show Counter],
						[allow printable],
						[show update date])
Available:
48..
*/
var m=new Array();var ml=10;
m[0]=new Array(
"Home","/index.htm",0,"Welcome to Weiss Transformation Processes",17,0,1,0,1,0,
"Welcome","/content/en_welcome.htm",0,"Welcome to The Weiss Transformation Processes",41,0,1,1,1,0,
"Latest News","/content/en_latestnews.htm",0,"The Weiss Transformation Processes - Latest News",10,0,1,0,0,0,
"Jann Weiss","",0,"",12,0,0,0,1,0,
  "Articles","/content/en_jannweissarticles.htm",1,"Jann Weiss - Articles",43,12,0,0,1,1,
		"Animal Talk","/content/en_jannweissanimaltalk.htm",1,"Jann Weiss - Animal Talk",42,12,0,0,1,1,
  "Schedule","/content/en_jannweissschedule.htm",1,"Jann Weiss - Schedule",13,12,0,0,1,0,
"Dolphin Conference","/content/en_dolconf_overview.htm",0," ",18,0,0,0,0,0,
"Soul Partnership","/content/en_soulpartnership.htm",0," ",44,0,0,0,0,0,
"Weiss Transformation Processes","/content/en_theprocesses.htm",0," ",1,0,1,0,0,0,
		"The Processes","",1,"The Weiss Transformation Processes - The Processes",5,1,1,0,1,0,
		  "Basic Process","/content/en_basicprocess.htm",2,"The Weiss Transformation Processes - Basic Process",6,1,1,0,1,0,
				"Time Process","/content/en_timeprocess.htm",2,"The Weiss Transformation Processes - Time Process",45,1,1,0,1,0,
				"DNA Process","/content/en_dnaprocess.htm",2,"The Weiss Transformation Processes - DNA Activation Process",7,1,1,0,1,0,
				"Reality Shifting Process","/content/en_realityshiftingprocess.htm",2,"The Weiss Transformation Processes - Reality Shifting Process",46,1,1,0,1,0,
				"Angelic Support Process","/content/en_angelicsupportprocess.htm",2,"The Weiss Transformation Processes - Angelic Support Process",9,1,1,0,1,0,
  "FAQs","/content/en_faqs.htm",1,"The Weiss Transformation Processes - Frequently Asked Questions",47,1,1,0,1,0,
		"Contacts","/content/en_contact.htm",1,"The Weiss Transformation Processes - Contacts",16,1,1,0,1,1,
"Support Products","/content/en_supportproducts.htm",0,"The Weiss Transformation Processes - Support Products",14,0,0,0,0,1,
"Links","/content/en_links.htm",0,"The Weiss Transformation Processes - Links",15,0,0,0,1,1
);

var mp=new Array();for(var i=0;i<m[lb].length;i+=ml)mp[m[lb][i+4]]=i;//Zeiger auf die m
var mv;//alle sichtbaren Menüpunkte
var mvc;//counter der sichtbaren Menüpunkte
var m_current;//aktueller Menüpunkt
var m_lookup;//zu bearbeitender Menüpunkt

var lt=new Array();//Monatsnamen für die Anzeige des letzten Updates
lt[0]=new Array("January","February","March","April","May","June","July","August","September","October","November","December","Revised");
lt[1]=new Array("Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember", "letzte Änderung");
var updatedate=new Date(document.lastModified);
var updatetext=lt[lb][12]+" "+lt[lb][updatedate.getMonth()]+" "+updatedate.getFullYear();

/*--------------------------------------------------------------------------------------------
  start
  --------------------------------------------------------------------------------------------*/
		
function start(){
  m_current=m_pos;
		bod=document.getElementById("body");
		document.getElementById("me").style.display="none";
		document.getElementById("me").style.backgroundColor="#ffffff";
		document.getElementById("me").appendChild(makeFooter());
  lang=document.createElement("DIV");
  lang.id="lang";
  lang.className="lang";
  bod.appendChild(lang);
  ls=document.createElement("DIV");
  ls.id="ls";
  ls.className="ls";
  bod.appendChild(ls);
  top=document.createElement("DIV");
  top.id="top";
  top.className="top";
  top.style.width=to_w;
  top.style.top=to_y;
  bod.appendChild(top);
  bottom=document.createElement("DIV");
  bottom.id="bottom";
  bottom.className="bottom";
  bottom.style.width=bo_w;
  bottom.style.height=bo_h;
  bod.appendChild(bottom);
  content=document.createElement("DIV");
  content.id="content";
  content.className="content";
  content.style.width=co_w;
		bod.appendChild(content);
		title=document.createElement("DIV");
  title.id="title";
  title.className="title";
  title.style.width=co_w;
  bod.appendChild(title);
		menu=document.createElement("DIV");
  menu.id="menu";
  menu.className="menu";
		menu.style.width=m_w;
  bod.appendChild(menu);
  buildLang();buildLs();
  size();
		top.style.visibility="visible";
		bottom.style.visibility="visible";
		content.style.visibility="visible";
		title.style.visibility="visible";
		menu.style.visibility="visible";
		buildMenu();
		buildTitle();
		buildContent();
		buildCounter();
}

/*--------------------------------------------------------------------------------------------
  DIV-Steuerung
  --------------------------------------------------------------------------------------------*/
function size(){
  win_h=document.all?document.all.body.clientHeight:window.innerHeight;//Fenstergröße
  win_w=document.all?document.all.body.clientWidth:window.innerWidth;//Fenstergröße
  u=Math.floor((win_w-to_w)/2);
  v=Math.floor(win_h-to_y-bo_h-bo_d);
  top.style.left=u;
  top.style.height=v;
  bottom.style.left=u;
  bottom.style.top=v+to_y;
  content.style.left=u+co_o+m_w;
  content.style.top=to_y+co_d;
  content.style.height=v-co_d+bo_h-co_z;
		title.style.left=u+co_o+m_w;
  title.style.top=to_y+ti_d;
  title.style.height=ti_h;
  lang.style.left=u+lang_o;
  lang.style.top=to_y+lang_d;
  ls.style.left=u+ls_o;
  ls.style.top=to_y+ls_d;
		menu.style.left=u+m_x;
  menu.style.top=to_y+m_y;
  menu.style.height=v-m_d-m_y;
}

function cleardiv(div){with(div){
  if(lastChild){removeChild(lastChild);cleardiv(div);return false;}
  return false;
}}

/*--------------------------------------------------------------------------------------------
  Menüsteuerung
  --------------------------------------------------------------------------------------------*/
		
function buildMenu(up){
  try{if(!isNaN(up))m_current=up;}catch(e){}
  cleardiv(menu);
		mv=new Array();mvc=0;m_lookup=m_current;
		buildMenuDepth();
		var out="";for(var j=0;j<mvc;j++)out+=mv[j]+"\n";
		//alert(out);
  for(var i=0;i<m[lb].length;i+=ml){
				var span=document.createElement("DIV");
				span.className="menudiv";
				for(var j=0;j<mvc;j++){
		  		if(m[lb][i+5]==mv[j]){
						  a=document.createElement("A");
								a.className="menua";
								a.appendChild(document.createTextNode(m[lb][i]));
    				if(m[lb][i+1]!=""){
		    		  a.onmouseover=colorUp;
								  a.onmouseout=colorDown;
				      a.href=m[lb][i+1];
    				}else{
				      a.href="javascript: buildMenu("+m[lb][i+4]+");";
				    }
								span.appendChild(a);
								if(m[lb][i+5]==0)span.style.paddingTop="7px";
				    span.style.paddingLeft=(8*m[lb][i+2])+"px";
						}
				}
				//alert(span.innerHTML);
				menu.appendChild(span);
		}
}

function buildMenuDepth(){
  mv[mvc++]=m_lookup;
		if(m_lookup!=0){
		  var t=m[lb][mp[m_lookup]+5];
		  m_lookup=t;
				buildMenuDepth();
		}
}

function colorUp(){
  this.style.color="#FFFFFF";//"#6C7CBF";
}

function colorDown(){
  this.style.color="#E4F5FF";
}


/*--------------------------------------------------------------------------------------------
  Titel + Inhalt einfügen
  --------------------------------------------------------------------------------------------*/

function buildTitle(){
  if(!isNaN(m_pos)){
		  var u=mp[m_pos];
		  cleardiv(title);
				var t=(m[lb][u+3]!="")?m[lb][u+3]:m[lb][u];
		  title.appendChild(document.createTextNode(t));
				if(m[lb][u+9]==1){
				  var t=document.createElement("DIV");
						t.id="ud";
						t.style.position="absolute";
						t.style.top="24px";
						t.style.left="410px";
						t.style.height="30px";
						t.style.width="120px";
						t.style["font-family"]="Arial, Helvetica, sans-serif";
						t.style.fontSize="9px";
						t.style.color="#333569";
						t.style.margin="0px";
						t.style.padding="0px";
						t.appendChild(document.createTextNode(updatetext));
						title.appendChild(t);
				}
		}
}

function buildContent(){
  cleardiv(content);
		content.innerHTML=document.getElementById("me").innerHTML;
		/*if(!isNaN(m_pos)){
		  var u=mp[m_pos];
  	 if(m[lb][u+5]!=""){	
				  var div=document.createElement("DIV");
		    div.style.textAlign="center";
		    div.style.paddingTop="14px";
		    var a=document.createElement("A");
		    a.href=m[lb][u+5];
						a.target="_blank";
		    a.appendChild(document.createTextNode(lp[lb]));
		    div.appendChild(a);
		    content.appendChild(div);
				}
		}*/
		if(m[lb][mp[m_pos]+8]==1){
  		var div=document.createElement("DIV");
		  div.style.textAlign="center";
		  div.style.paddingTop="14px";
		  var a=document.createElement("A");
		  a.href="javascript: printIt();";
    a.appendChild(document.createTextNode(lp[lb]));
		  div.appendChild(a);
		  content.appendChild(div);
		}
}

/*--------------------------------------------------------------------------------------------
  Sprachauswahl
  --------------------------------------------------------------------------------------------*/

function buildLang(){
return;
  cleardiv(lang);
  var img=document.createElement("IMG");
  img.src="/images/gui/"+la[lb];
  img.border=0;
  img.onclick=showLs;
  lang.appendChild(img);
		var span=document.createElement("SPAN");
		span.appendChild(document.createTextNode(lc[lb]));
		span.style["paddingLeft"]="3px";
		span.style["verticalAlign"]="top";
		lang.appendChild(span);
}

function buildLs(){
  var t=document.createElement("TABLE");
  t.className="tlang";
  var tb=document.createElement("TBODY");
  for(var i=0;i<la.length;i++){
    var tr=document.createElement("TR");
    var td=document.createElement("TD");
    var img=document.createElement("IMG");
    img.src="/images/gui/"+la[i];
				//if(lb*1==i)img.className="aimg";
				img.id=i;
				img.onclick=changeLs;
				td.appendChild(img);tr.appendChild(td);tb.appendChild(tr);
  }
  t.appendChild(tb);if(ls.lastChild)ls.removeChild(ls.lastChild);ls.appendChild(t);
}

function showLs(){
  ls.style.visibility=lss?"hidden":"visible";lss=lss?false:true;
}

function changeLs(){
  //alert("Changing the language will come with the second step");
  lb=this.id; build_ls(); buildlang(); 
  showLs();
		//testing background
		/*
		top.className="top"+this.id;

		var t="url(/images/gui/back_frame_top";
		switch(this.id){
		  case "1":t+="swirlleft";break;
				case "2":t+="swirlright";break;
		}
		t+=".gif)";
		
		top=document.getElementById("top");
		top.style.visibility="hidden";
		//top.style.backgroundImage=t; 
		alert(top.style['background-image']+"\n- "+top.style.backgroundImage+" -");
		top.style.visibility="visible";
*/
}

function buildCounter(){
  if(m[lb][mp[m_pos]+7]==0)return;
  var t=document.createElement("DIV");
		t.id="counter";
		t.className="counter";
		var img=document.createElement("IMG");
		img.src="http://weltfamilie.de/tinc?key=cK5hTyH7&no=1";//alt: "http://weltfamilie.de/tinc?key=cK5hTyH7&no=1";
		t.appendChild(img);
		lang.appendChild(t);
}

function printIt(){
		toggleAll(false);
		var t=document.getElementById("me");
		t.style.display="block";
		
		var div=document.createElement("H5");
		div.id="printtitle";
		div.innerHTML=title.innerHTML;
		t.insertBefore(div,t.firstChild);
		
		var div=document.createElement("DIV");
		div.id="printtop";	div.className="print";div.style.paddingBottom="16px";
		var a=document.createElement("A");
		a.href="javascript:printBack();";a.appendChild(document.createTextNode(lpb[lb]));
		div.appendChild(a);
		t.insertBefore(div,t.firstChild);

		var div=document.createElement("DIV");
		div.id="printbottom";	div.className="print";div.style.paddingTop="16px";
		var a=document.createElement("A");
		a.href="javascript:printBack();";a.appendChild(document.createTextNode(lpb[lb]));
		div.appendChild(a);
		t.appendChild(div);
  document.getElementById("me").style.visibility="visible";
		//bod.style.overflow="auto";
}

function printBack(){
		  if(document.all){
		    var t=document.getElementById("me");
		    t.style.display="none";
		    t.removeChild(document.getElementById("printtop"));
		    t.removeChild(document.getElementById("printbottom"));
		    t.removeChild(document.getElementById("printtitle"));
		    toggleAll(true);
      document.getElementById("me").style.visibility="hidden";
				}else{
				   document.location.href=document.location.href;
				}
}

function toggleAll(action){
  var t=new Array(
		  "top",
				"bottom",
				"menu",
				"content",
				"title",
				"counter",
				"ud");
		var u=(action==true)?"visible":"hidden";
		for(var i=0;i<t.length;i++)try{document.getElementById(t[i]).style.visibility=u;}catch(e){}
}
function makeFooter(){
  if(m[lb][mp[m_pos]+6]==1){
	  	var t=document.createElement("TABLE");
		  t.width="99%";
		  var u=document.createElement("TBODY");
		  var v=document.createElement("TR");
		  var w=document.createElement("TD");
		  w.className="footer";
  		w.appendChild(document.createTextNode("THE WEISS TRANSFORMATION PROCESSES ™"));// ™ - &#8482;
		  w.appendChild(document.createElement("BR"));
		  w.appendChild(document.createTextNode("Spiritual Healing and Evolution Through Soul-Partnership"));
		  v.appendChild(w);u.appendChild(v);t.appendChild(u);
		}else{
		  var t=document.createElement("SPAN");
		}
  return t;
}
