function dwhh_openVA(src, titel, w, h){
	var wd = w + 46;
	var hg = h + 26;
	var size = "width=" + wd + ",height=" + hg + ",left=0,top=0";
	videofenster = window.open('', 'video', size); 
	/*videofenster.moveTo(100,70);*/
	videofenster.focus();
	with (videofenster) {
		document.open();
		document.write('<html><head>');
		document.write('<title>Video</title></head>');
		document.write('<body>');

		document.write('<object id="MediaPlayer" width=' + w + ' height=' + h + ' classid="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95" standby="Loading Windows Media Player components..." type="application/x-oleobject" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112">');
		document.write('<param name="filename" value="http://www.welthungerhilfe.de/'+src+'">');
		document.write('<param name="Showcontrols" value="True">');
		document.write('<param name="ShowPositionControls" value="True">');
		document.write('<param name="autoStart" value="True">');
		document.write('<param name="DisplaySize" VALUE="0">');
		document.write('<embed type="application/x-mplayer2" src="http://www.welthungerhilfe.de/'+src+'" name="MediaPlayer" width=' + w + ' height=' + h + '></embed>');
		document.write('</object>');
	
		document.write('</body></html>');
		document.close();
		document.title = "Video";
	}
}


function show_themenbild(src, info){
	document.getElementById("defaultbild").src=src;
	document.getElementById("defaultinfo").innerHTML=info;
}


var linguatec_baseurl = "http://vrweb.linguatec.net/vrweb/popup1?", linguatec_conf = {
icon :  '01',
iconcolor :  'grey',
guilang :  'de',
lang :  'de-de',
srctype :  'html',
readcontent :  'elements',
srccharset :  'iso-8859-1',
sitetopic :  '',
simpleparse :  '0',
readelementsname :  '',
cache : '1',

readelementsclass :  'readit',
exclelementsname :  '',
exclelementsclass :  '',
customerid :  '11089',
cache :  '0',
sndtype :  '1',
sndquality :  '4',
sndspeed :  '100',
sndpitch :  '100',
sndgender :  'W'
};

linguatec_build_url = function()
{
	
	linguatec_conf.srcurl = encodeURIComponent(window.location);
	var gstr = [];
	for(var i in linguatec_conf)
	{
		gstr.push(i+"="+linguatec_conf[i]);
	}
	
	return linguatec_baseurl + gstr.join('&');
	
}



var baseFS = 0.75, dlhooks = [];

function setFS(ipt)
{
	var mxfs = 18;
	var mnfs = 9;
	var basefs = 12;
	
	var elem = document.getElementById('mainContent') || document.getElementById('fpbody');
	var myFS = parseFloat(elem.style.fontSize) || 12;
	
	
	
	
	var newFS = myFS + ipt * 10;
	var myFS = ipt==null?basefs:newFS > mxfs?mxfs:newFS < mnfs?mnfs:newFS;

	elem.style.fontSize = myFS + "px";
}

function setKontrast()
{
	if(document.getElementById("kssheet"))
	{
		document.body.removeChild(document.getElementById("kssheet"));
		return;
	}

	var tmp = document.createElement("link");
	tmp.href = "fileadmin/templates/relaunch/css/kontrast.css";
	tmp.media = "screen, projection";
	tmp.rel = "stylesheet";
	tmp.type = "text/css";
	tmp.id = "kssheet";
	document.body.appendChild(tmp);
}


// <!--START NETIGATE SCRIPT -->
var delay='3';  // How many seconds before window opens
var thelink = 'https://www.netigate.se/s.asp?s=19219X1159'; // Replace for the actual link
var cookiename = 'we_net_0001'; // Name of cookie, no need to change unless for testing
var showtopercent = 100; // How many percent of visitors to show survey
var expDays = 10; // Expiration for cookie
function showWin() { document.getElementById("winDisplay").style.display = "block"; }
function closeWin() { document.getElementById("winDisplay").style.display = "none"; }
function closeWin2() { DeleteCookie('we_net_0001'); document.getElementById("winDisplay").style.display = "none"; }

function GetCookie (name) {
 var arg = name + "=";
 var alen = arg.length;
 var clen = document.cookie.length;
 var i = 0;
 while (i < clen) {
   var j = i + alen;
   if (document.cookie.substring(i, j) == arg)
   	 return getCookieVal (j); //Cookie nicht einlesen
   i = document.cookie.indexOf(" ", i) + 1;
   if (i == 0) break;
 }
 return null;
}

function SetCookie (name, value) {
 var argv = SetCookie.arguments;
 var argc = SetCookie.arguments.length;
 var expires = (argc > 2) ? argv[2] : null;
 var path = (argc > 3) ? argv[3] : null;
 var domain = (argc > 4) ? argv[4] : null;
 var secure = (argc > 5) ? argv[5] : false;
 /* Kein Cookie mehr schreiben */
 document.cookie = name + "=" + escape (value) +
   ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
   ((path == null) ? "" : ("; path=" + path)) +
   ((domain == null) ? "" : ("; domain=" + domain)) +
   ((secure == true) ? "; secure" : "");
  
}

function DeleteCookie (name) {
 var exp = new Date();
 exp.setTime (exp.getTime() - 1);
 var cval = GetCookie (name);
 document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}

var exp = new Date();
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));

function amt(){
 var count = GetCookie(cookiename)
 if(count == null) {
   SetCookie(cookiename,'1')
   return 1;
 } else {
   var newcount = parseInt(count) + 1;
   DeleteCookie(cookiename);
   SetCookie(cookiename,newcount,exp);
   return count;
 }
}

function getCookieVal(offset) {
 var endstr = document.cookie.indexOf (";", offset);
 if (endstr == -1)
 endstr = document.cookie.length;
 return unescape(document.cookie.substring(offset, endstr));
}

function checkCount() {
 var count = GetCookie(cookiename);
 var ran_number=Math.floor(Math.random()*100);
   if (ran_number < showtopercent)
   {
			if (count == null){
          count=1;
          SetCookie(cookiename, count, exp);
          setTimeout('showWin()',delay*1000);
      } else {
					count++;
          SetCookie(cookiename, count, exp);
          
    	}
  }
}
// <!--END NETIGATE SCRIPT -->


window.onload = function()
{
	
	if($('winDisplay')) checkCount(); // NETIGATE SCRIPT
	
	if($('frauen_400x240')) {
		var so = new SWFObject("fileadmin/media/videos/frauen2010/400x240.swf?video=http://www.welthungerhilfe.de/fileadmin/media/videos/frauen2010/400x240.flv", "WHH", "400", "240", "6", "#ffffff");
		so.addParam("video", "http://www.welthungerhilfe.de/fileadmin/media/videos/frauen2010/400x240.flv");	
		so.addParam("wmode", "transparent");	
		so.write("frauen_400x240"); 
	}if($('wuerfel_400x240')) {
		var so = new SWFObject("fileadmin/media/videos/wuerfel2009/400x240.swf?video=http://www.welthungerhilfe.de/fileadmin/media/videos/wuerfel2009/400x240.flv", "WHH", "400", "240", "6", "#ffffff");
		so.addParam("video", "http://www.welthungerhilfe.de/fileadmin/media/videos/wuerfel2009/400x240.flv");	
		so.addParam("wmode", "transparent");	
		so.write("wuerfel_400x240"); 
	}else if($('wuerfel_500x300')) {
		var so = new SWFObject("fileadmin/media/videos/wuerfel2009/500x300.swf?video=http://www.welthungerhilfe.de/fileadmin/media/videos/wuerfel2009/500x300.flv", "WHH", "500", "300", "6", "#ffffff");
		so.addParam("video", "http://www.welthungerhilfe.de/fileadmin/media/videos/wuerfel2009/500x300.flv");	
		so.addParam("wmode", "transparent");	
		so.write("wuerfel_500x300"); 
	}else if($('wuerfel_649x301')) {
		var so = new SWFObject("fileadmin/media/videos/wuerfel2009/649x301.swf?video=http://www.welthungerhilfe.de/fileadmin/media/videos/wuerfel2009/649x301.flv", "WHH", "649", "301", "6", "#ffffff");
		so.addParam("video", "http://www.welthungerhilfe.de/fileadmin/media/videos/wuerfel2009/649x301.flv");	
		so.addParam("wmode", "transparent");	
		so.write("wuerfel_649x301"); 
	}else if($('teaser_image_w09')) {
		var so = new SWFObject("fileadmin/media/videos/wuerfel2009/649x301.swf?video=http://www.welthungerhilfe.de/fileadmin/media/videos/wuerfel2009/649x301.flv", "WHH", "649", "301", "6", "#ffffff");
		so.addParam("video", "http://www.welthungerhilfe.de/fileadmin/media/videos/wuerfel2009/649x301.flv");	
		so.addParam("wmode", "transparent");	
		so.write("teaser_image_w09"); 
	}else if($('klima_400x240')) {
		var so = new SWFObject("fileadmin/media/videos/klima/400x240.swf?video=http://www.welthungerhilfe.de/fileadmin/media/videos/klima/welthungerhilfe-klima_400x240.flv", "WHH", "400", "240", "6", "#ffffff");
		so.addParam("video", "http://www.welthungerhilfe.de/fileadmin/media/videos/klima/welthungerhilfe-klima_400x240.flv");	
		so.addParam("wmode", "transparent");	
		so.write("klima_400x240"); 
	}else if($('klima_450x250')) {
		var so = new SWFObject("fileadmin/media/videos/klima/450x250.swf?video=http://www.welthungerhilfe.de/fileadmin/media/videos/klima/welthungerhilfe-klima_450x250.flv", "WHH", "450", "250", "6", "#ffffff");
		so.addParam("video", "http://www.welthungerhilfe.de/fileadmin/media/videos/klima/welthungerhilfe-klima_450x250.flv");	
		so.addParam("wmode", "transparent");	
		so.write("klima_450x250"); 
	}else if($('klima_500x120')) {
		var so = new SWFObject("fileadmin/media/videos/klima/500x120.swf?video=http://www.welthungerhilfe.de/fileadmin/media/videos/klima/welthungerhilfe-klima_500x120.flv", "WHH", "500", "120", "6", "#ffffff");
		so.addParam("video", "http://www.welthungerhilfe.de/fileadmin/media/videos/klima/welthungerhilfe-klima_500x120.flv");	
		so.addParam("wmode", "transparent");	
		so.write("klima_500x120"); 
	}else if($('klima_500x150')) {
		var so = new SWFObject("fileadmin/media/videos/klima/500x150.swf?video=http://www.welthungerhilfe.de/fileadmin/media/videos/klima/welthungerhilfe-klima_500x150.flv", "WHH", "500", "150", "6", "#ffffff");
		so.addParam("video", "http://www.welthungerhilfe.de/fileadmin/media/videos/klima/welthungerhilfe-klima_500x150.flv");	
		so.addParam("wmode", "transparent");	
		so.write("klima_500x150"); 
	}else if($('klima_500x281')) {
		var so = new SWFObject("fileadmin/media/videos/klima/500x281.swf?video=http://www.welthungerhilfe.de/fileadmin/media/videos/klima/welthungerhilfe-klima_500x281.flv", "WHH", "500", "281", "6", "#ffffff");
		so.addParam("video", "http://www.welthungerhilfe.de/fileadmin/media/videos/klima/welthungerhilfe-klima_500x281.flv");	
		so.addParam("wmode", "transparent");	
		so.write("klima_500x281"); 
	}else if($('teaser_video_frauen_500x281')) {
		var so = new SWFObject("fileadmin/media/videos/Frauen/500x281.swf?video=http://www.welthungerhilfe.de/fileadmin/media/videos/Frauen/frauen_500x281.flv", "WHH", "500", "281", "6", "#ffffff");
		so.addParam("video", "http://www.welthungerhilfe.de/fileadmin/media/videos/Frauen/500x281.flv");	
		so.addParam("wmode", "transparent");	
		so.write("teaser_video_frauen_500x281"); 
	}else if($('teaser_video_frauen_649x301')) {
		var so = new SWFObject("fileadmin/media/videos/Frauen/649x301.swf?video=http://www.welthungerhilfe.de/fileadmin/media/videos/Frauen/frauen_649x301.flv", "WHH", "649", "301", "6", "#ffffff");
		so.addParam("video", "http://www.welthungerhilfe.de/fileadmin/media/videos/Frauen/649x301.flv");	
		so.addParam("wmode", "transparent");	
		so.write("teaser_video_frauen_649x301"); 
	}
	
	
	
	
	for(i = 0; i < dlhooks.length; i++)
	{
		dlhooks[i]();
	}
	
	//pdf dings für spendenformular
	
	if(window.location.pathname.indexOf("2486") > -1 || 
	window.location.pathname.indexOf("spendenformular_partnerschaft") > -1 ||
	window.location.pathname.indexOf("spenden_formular") > -1 ||
	window.location.pathname.indexOf("2461") > -1
	
	)
	{
		var plinks = $$("a.druck, a.printbtnunten");
		
		for(var i = 0; i < plinks.length; i++)
		{
			plinks[i].href = "/fileadmin/media/pdf/spenden/DWHH_Dauerauftragsformular_2007.pdf";
		}
	}
	
	
	var sf = $$("#suche form")[0];
	if(sf)
	{
		sf.appendChild(new Element("input",{'type':'hidden','name':'tx_indexedsearch[order]','value':'crdate'}));
		sf.appendChild(new Element("input",{'type':'hidden','name':'tx_indexedsearch[desc]','value':'0'}));
	}
	
	
	if(typeof loadME == "function")
	{
		loadME();
	}

	var tmp = $$("a");
	for(var i = 0, o; o = tmp[i]; i++)
	{
			//o.target = "";
			
			o.addEvents({'focus': function(e) {
					this.blur();
			}
		});
	}
	
	

	if(document.location.hash.indexOf("PRINTPREV") > -1)
	{
		ss = document.getElementsByTagName("link");
		for(var i in ss)
		{
			//console.log(typeof ss[i].media);
			if(typeof ss[i].media == "string" && ss[i].media.indexOf("screen") > -1)
			{
				ss[i].href = "/fileadmin/templates/relaunch08/css/dwhh_print.css";
			}
			else if(typeof ss[i].media == "string" && ss[i].media.indexOf("print") > -1)
			{
				//ss[i].media = "screen";
			}
		}
	}
	
	/*
		08.09.2008 MT
		Vorlesebutton erzeugen. Ich wollte nicht den Code vom Hersteller nehmen,
		stattdessen mein eigener. Weiter oben das Config-Objekt
	*/
	if($('printMenu'))
	{
		var metanavi = "";
		if(1 || document.location.hash.indexOf("VORLESEBUTTON") > -1)
		{
			if($(document.body).hasClass('english_site'))
			{
				
				linguatec_conf.guilang = 'en';
				linguatec_conf.lang =  'en-gb';
				
			}
			
			
			var vltest = new Element("a",{'class':'vorlesen','href':'#',
				'events':{'click' : function(_e){
				new Event(_e).stop();
				
				window.open(
				linguatec_build_url()
				,'',"width=500,height=155,left="+((screen.width - 275) / 2)+",top="+((screen.height - 255) / 2)
				);
				
				}}});
			vltest.appendText('vorlesen').inject($("printMenu"));
			
			metanavi = '<li><a class="vorlesen" title="Vorlesen" href="#" onclick="window.open(\''+linguatec_build_url()+'\',\'\',\'width=500,height=155,left='+((screen.width - 275) / 2)+',top='+((screen.height - 255) / 2)+'\'); return false;">Vorlesen</a></li>';
		}
	}
	
	/* Metanavi Update 2009*/
	if($('feeds'))
	{
		$('feeds').innerHTML = metanavi	+ '<li><a class="druck" title="Druckversion" href="javascript:printme();">Druckversion</a></li>'
										+ '<li><a class="sitemap" title="Sitemap" href="/sitemap.html">Druckversion</a></li>'
										+ '<li><a class="rss" title="RSS-Feed" href="feed://www.welthungerhilfe.de/index.php?id=1914&type=100">RSS-Feed</a></li>';
	}
	var nava = $$('#navigation .nava a');
	nava.each(function(navafix, i) {
		navafix.innerHTML = navafix.innerHTML.split(" ").join("&nbsp;");		 
	});
	
	var subnaviheight = $$('#navigation .sn_bg');
	subnaviheight.each(function(snh, i) {
		var blub_id = snh.id.split("sn_bg_").join("");	
		var blub_height = $('sn_links_'+blub_id).getCoordinates().height-2;
		var blub_top = $('sn_links_'+blub_id).getCoordinates().height;
		$('sn_bgl_'+blub_id).setStyle("height", blub_top+"px");
		$('sn_bgm_'+blub_id).setStyle("height", blub_height+"px");
		$('sn_bgr_'+blub_id).setStyle("height", blub_top+"px");
		$('sn_bgu_'+blub_id).setStyle("top", blub_top+"px");
	});
	
	if($('left'))
	{
		var elems = document.getElementById("left").getElementsByTagName("div");
		for(var i = 0; i < elems.length; i++)
		{
			if(elems[i].className == "spalten")
			{
				var pel = elems[i];
			}
			
			if(elems[i].className == "spalte_rechts")
			{
				if(elems[i].childNodes.length == 0)
				{
					pel.removeChild(elems[i]);
					
				}
				
			}
		}
	}
	
	if($('spendeninfos')) {
		$('spendeninfos').addEvent("mouseenter", function(event) {
			$("altinfo").setStyle("display","block");
			$("spendeninfo").setStyle("background","#287a28");
		});
		$('spendeninfos').addEvent("mouseleave", function(event) {
			$("altinfo").setStyle("display","none");
			$("spendeninfo").setStyle("background","#339933");
		});
		$('spendeninfos').addEvent("click", function(event) {
			openPopup();
		});
	}
	
	// Weihnachten
	if($('spenden'))
	{
		if($('spenden').getStyle('min-height') == "100px") 
		{
			$('spenden').addEvent("mouseenter", function(event) {
				//$("spenden").setStyle("background-image","url(http://www.welthungerhilfe.de/fileadmin/templates/relaunch08/img/snow3c.gif)");
			});
			$('spenden').addEvent("mouseleave", function(event) {
				//$("spenden").setStyle("background-image","url(http://www.welthungerhilfe.de/fileadmin/templates/relaunch08/img/snow3.gif)");
			});
		}
	}
	
}



function showSubmenu(){
	if(document.getElementById("ueberUns")){
		if(document.getElementById("ueberUns").style.display == "block"){
			document.getElementById("ueberUns").style.display = "none";

			document.getElementById("mehrLink").style.backgroundPosition = "205px -23px";
		}
		else{
			document.getElementById("ueberUns").style.display = "block";
			document.getElementById("mehrLink").style.backgroundPosition = "205px 5px";
		}
	}
}

	
	

function dwhhmediabox(myhash, inittab){
	

		var myhash = myhash;
		var opentab = inittab;
	

		this.switchtab = function(tab)
		{
			if(tab == opentab)
			{
				return;
			}
			
			var oldtab = document.getElementById("mb_tab_"+myhash+"_"+opentab);
			var newtab = document.getElementById("mb_tab_"+myhash+"_"+tab);

			var oldcontent = document.getElementById("mb_content_"+myhash+"_"+opentab);
			var newcontent = document.getElementById("mb_content_"+myhash+"_"+tab);
			
			oldtab.className = "";
			newtab.className = "active";
			
			oldcontent.className = "mb_content";
			newcontent.className = "mb_content active";
			
			opentab = tab;
			
		}
}

function printme(){
	
	if(document.location.hash.length > 0)
	{
		newurl = document.location.hash + "#PRINTPREV=TRUE";
	}
	else
		{
			newurl = document.location.hash + "#PRINTPREV=TRUE";
		}
		
	window.open(newurl);
	
}


function openPopup(){
	//alert('A');
	
	window.open('/fileadmin/templates/relaunch/popup.html','',"width=275,height=255,left="+((screen.width - 275) / 2)+",top="+((screen.height - 255) / 2));
}

function submit_einstiegsform(){
	
	document.getElementById("einsteigsform").submit();
}


/* Navigation 2009 */
var openNr = 0;
var openCal = 0;
var to, to2;

function openSub(nr){
	if(to)window.clearTimeout(to);
	closeSub(0);
	if($("menuwrap_"+nr))
	{
		$("menuwrap_"+nr).style.visibility = "visible";
		openNr = nr;
	}
	if($("sn_"+nr))
	{
		$("sn_"+nr).style.visibility = "visible";
		openNr = nr;
	}
}

function closeSub(del){	
	if($("menuwrap_"+openNr))
	{
		if(del==0){
			if(openNr>0)document.getElementById("menuwrap_"+openNr).style.visibility = "hidden";
		}else{
			to = window.setTimeout("closeSub(0)", 500);
		}
	}
	if($("sn_"+openNr))
	{
		if(del==0){
			if(openNr>0)document.getElementById("sn_"+openNr).style.visibility = "hidden";
		}else{
			to = window.setTimeout("closeSub(0)", 500);
		}
	}
}

function keepOpen(){
	if(to)window.clearTimeout(to);
}


function check_rhythmus(){
	if($('crhythmus').value != "einmalig") {
		$('einsteigsform').setAttribute('action','spendenformular_partnerschaft.html');
	}else{
		$('einsteigsform').setAttribute('action','spenden_formular.html');
	}
}