// start of global variables
// countrylist with rollovereffects to reset them
var countrylist = new  Array("aegypten","argentinien","australien","belgien","bolivien","bosnien-herzegowina","brasilien","bulgarien","belgien","chile","china","costa_rica","daenemark","deutschland","dominikanische_republik","ecuador","estland","finnland","frankreich","ghana","griechenland","guatemala","grossbritanien","honduras","indonesien","irland","island","italien","japan","kanada","kolumbien","kroatien","lettland","litauen","malaysia","mexiko","neuseeland","niederlande","norwegen","oesterreich","panama","paraguay","peru","polen","portugal","rumaenien","russland","schweden","schweiz","slowakei","slowenien","spanien",
"suedafrika","thailand","tschechische_republik","tuerkei","ungarn","usa","venezuela","zypern"); 

// start of crossbrowser functions
function DynaObject(div_id){ 
// generates a browser specific expression to access an object of the document
	if (!div_id || div_id.length==0) 
    	div_obj = document;
	else 
    	if (document.getElementById) 
      		div_obj = document; 
		 else 
			if (document.layers) 
          		div_obj = eval("document."+div_id+".document");
       		else 
				if (document.all) 
          			div_obj = eval("document.all."+div_id+".document");
      
    	return div_obj;
}     

function DynaStyle(div_id) {
// generates a browser specific expression to access the styles of an object
	// alert(div_id)
		if (!div_id || div_id.length==0) {
    	if (document.getElementById) {
        	div_obj = document.style;
       } else 
	   	if (document.layers) {
      		div_obj = document;
       	} else 
			if (document.all) {
           		div_obj = document.all.style;
       		}
    } else    
    	if (document.getElementById) {
        	div_obj = document.getElementById(div_id).style;
       	} else 
			if (document.layers) {
          		div_obj = eval("document."+div_id);
       		} else 
				if (document.all) {
          			div_obj = eval("document.all."+div_id+".style");
       			}
    return div_obj;
}

function DynaPos(div_id,pleft,ptop) {
// generates a a browser specific expression to change the "left" and "top" position of a "layer"
	if (document.all) {
		DynaStyle(div_id).posLeft=pleft;
		DynaStyle(div_id).posTop=ptop;
	} else {
		DynaStyle(div_id).left=pleft;
		DynaStyle(div_id).top=ptop;
	}	

}
// start of menu function
var mm_nabc="black"; //background color main menu not active
var mm_abc="#336699"; //background color main menu active
var sm_nabc="#336699" //background color sub menu not active
var smt_abc="white"; // background Color sub menu active
var smt_ac="#663300"; // color of active submenu topic
var max_nos="9"; // max no. of submenues

//parse url for variables menu and subtopic
var qs = location.search.substring(1);
var nv = qs.split('&');
var url = new Object();
for(i = 0; i < nv.length; i++)
{
  eq = nv[i].indexOf('=');
  url[nv[i].substring(0,eq).toLowerCase()] = unescape(nv[i].substring(eq + 1));
}
menuopen();
// alert(url.menu);alert(url.subtopic);

function hideall() {
// hide all submenues and reset bgcolor main menue//
	for (i=1; i<=max_nos; i++) {
		var sid="s"+i;
		var mid="m"+i;
		DynaStyle(sid).visibility = "hidden";
		DynaStyle(mid).background = mm_nabc;
		DynaStyle(mid).color = "white";
	}
}
function menuopen() {
	// alert(url.menu);alert(url.subtopic);
	if (url.menu && url.subtopic) {
		showsub(url.menu);
		showtopic(url.menu,url.subtopic)
	}
}

function showsub(id) { 
// show active submenu and color main menue point//
	var sid="s"+id;
	var mid="m"+id;
	hideall();
	DynaStyle(sid).visibility = "visible"; //show submenu
	DynaStyle(mid).background=mm_abc; // mark main menue active topic with same bgcolor as submenu
	restart_newsticker();
	
}

function showtopic(sid,tid) { 
// show active submenu and color main menue point//
	var stid="s"+sid+"t"+tid;
	DynaStyle(stid).background= smt_abc; // mark active topic bgcolor 
	DynaStyle(stid).color=smt_ac; //mark active topic color
}

function restart_newsticker() {
	// when mousebutton is clicked on main menu topic
	i=-1;
	curr="";
	
}

function ci(id) {
	// show container with worldmap rollover
	var sid=id+"_o";
	if (document.getElementById(sid)) { // is there a rollover container?
		DynaStyle(sid).visibility = "visible"; //then show rollover
	} 
}

function ri() {
	// hide all containers with worldmap rollover and use countrylist array to catch them all
	var i=0;
	for (i = 0; i < countrylist.length; i++) {
		sid=countrylist[i]+"_o";
		if (document.getElementById(sid)) { // is there a rollover container?
			DynaStyle(sid).visibility = "hidden";
		}
	}
}


function popup(id) { //open new window and resize it
	ri(id);
	var wwidth	= 620; //width of new window
	var wheight	= 700; //height of new window
	var toppos	= 0; // position from top
	var leftpos = (screen.availWidth-wwidth-20)/2; // pos.from left, in the middle here we go
	parameter	= ('width='+wwidth+',height='+wheight+',left='+leftpos+',top='+toppos);
	parameter	= parameter+(',directories=0,location=0,menubar=0,personalbar=0,toolbar=0,status=0,scrollbars=1,resizable=1');
	if (window.name=="country") { //if window exists close it
		country.close();
	}
	country=window.open(id,'Länderinformationsseite',parameter);
    country.focus();
}


