// JavaScript Document

var mehrVisible = false;

var synonym,sprich, text_long, link_to, about, orig_search_txt, orig_usr_txt,orig_pass_txt,orig_heftcode_txt, orig_search_txt_sitemap, orig_search_txt_mt, orig_search_txt_404, orig_email_address2 = false ; 
var suche_status = false;

function search_indicator(id) {
	if (suche_status == false) {
		if (document.getElementById('suche_text') != null && document.getElementById('suche_text') != undefined) {orig_search_txt = document.getElementById('suche_text').value;}
		if (document.getElementById('suche_user') != null && document.getElementById('suche_user') != undefined) {orig_usr_txt = document.getElementById('suche_user').value;}
		if (document.getElementById('suche_pw') != null && document.getElementById('suche_pw') != undefined) {orig_pass_txt = document.getElementById('suche_pw').value;}
		if (document.getElementById('suche_heftcode') != null && document.getElementById('suche_heftcode') != undefined) {orig_heftcode_txt = document.getElementById('suche_heftcode').value;}
		if (document.getElementById('suche_text_sitemap') != null && document.getElementById('suche_text_sitemap') != undefined) {orig_search_txt_sitemap = document.getElementById('suche_text_sitemap').value;}
		if (document.getElementById('suche_text_mehrThema') != null && document.getElementById('suche_text_mehrThema') != undefined) {orig_search_txt_mt = document.getElementById('suche_text_mehrThema').value;}
		if (document.getElementById('email_address2') != null && document.getElementById('email_address2') != undefined) {orig_email_address2 = document.getElementById('email_address2').value;}
		if (document.getElementById('error404Search') != null && document.getElementById('error404Search') != undefined) {orig_search_txt_404 = document.getElementById('error404Search').value;}
		suche_status = true;
	}

	if (document.getElementById(id) != null && document.getElementById(id) != undefined) {
		if (document.getElementById(id).value == orig_search_txt || document.getElementById(id).value == orig_usr_txt || document.getElementById(id).value == orig_pass_txt || document.getElementById(id).value == orig_heftcode_txt || document.getElementById(id).value == orig_search_txt_sitemap || document.getElementById(id).value == orig_search_txt_mt || document.getElementById(id).value == orig_search_txt_404 || document.getElementById(id).value == orig_email_address2) {
			document.getElementById(id).value = '';
		}
		document.getElementById(id).style.color = '#000000';
	}
}

function resetInputText(id, txt) {
	if (document.getElementById(id) != null && document.getElementById(id) != undefined && document.getElementById(id).value == '') {
		document.getElementById(id).value = txt;
		document.getElementById(id).style.color = '#A4A4A4';
	}
}

function toolPosition(id, bild)
{
	var action = document.getElementById(id);
	action.onmousemove = evt;
}
function text_evt(evt) 
{
    evt = (evt) ? evt : ((window.event) ? window.event : "");
    var elem = (evt.target) ? evt.target : evt.srcElement;
	var text='<h2 class="font_20 font_normal black">' + elem.name + '</h2><span class="bold">Synonyme:</span> ' + synonym + '<br><span class="bold">Sprich:</span> ' + sprich+'<p style="width:260px; overflow:hidden">' +text_long+ '</p>' + link_to;
	if ( evt.clientY <=220)
	{
		bild = '<div><div class=\'tooltip_footer_2\'></div><div class=\'tooltip_inner_2\' style="text-align: left;" ><div style="margin-left: 15px; width:270px; overflow:hidden;"> '+  text + ' </div> </div></div>';
		return overlib(bild ,  MOUSEOFF,STICKY,CAPTION, RIGHT, SNAPX, 10, SNAPY, 10,FULLHTML);
	}
	else
	{
		bild='<div ><div class=\'tooltip_inner_1\' style="text-align: left; "> <div style="; margin-left: 15px; width:270px; overflow:hidden;"> '+  text + ' </div> </div><div class=\'tooltip_footer_1\'></div></div>';
		return overlib(bild,  MOUSEOFF,STICKY,CAPTION,RIGHT, ABOVE, SNAPX, 10, SNAPY, 10,FULLHTML);
	}
}
  
function text_Position(id, syn, spr, spr_link, txt_long, lk_to, name)
{
	var action = document.getElementById(id);
	action.onmousemove = text_evt;
	
	synonym = syn;
	sprich = spr + ' | <a href="' + spr_link + '"  class="link_color">Vorlesen lassen</a>';
	text_long = txt_long;
	link_to = '<a href="' + lk_to + '" class="link_color bold">&raquo; mehr &uuml;ber ' + name + ' </a>' ;
}


function about_evt(evt) 
{
    evt = (evt) ? evt : ((window.event) ? window.event : "");
    var elem = (evt.target) ? evt.target : evt.srcElement;
	
   
    if ( evt.clientY <=220)
	{
		bild = '<div><div class=\'tooltip_footer_2\'></div><div class=\'tooltip_inner_2\' style="text-align: left;" ><div style="; margin-left: 15px; "> '+  about + ' </div> </div></div>';
		return overlib(bild ,  MOUSEOFF,STICKY,CAPTION, RIGHT, SNAPX, 10, SNAPY, 10,FULLHTML);
		
	}
	else
	{
		bild='<div ><div class=\'tooltip_inner_1\' style="text-align: left; "> <div style="; margin-left: 15px; width:">'+  about + ' </div> </div><div class=\'tooltip_footer_1\'></div></div>';
		return overlib(bild,  MOUSEOFF,STICKY,CAPTION,RIGHT, ABOVE, SNAPX, 10, SNAPY, 10,FULLHTML);
		
	}
}
  
function about_Position(id, about_text)
{
	var action = document.getElementById(id);
	action.onmousemove = about_evt;
	
	about= about_text;
}



function change_suche(id)
{
	var i, count=4;
	
	for (i = 1; i <= count; i++)
	{
		if (i== id)
		{
			$('link_suche_' + i).style.paddingBottom = '5px';
			$('suche_' + i).style.display = 'block';
		}
		else
		{
			$('link_suche_' + i).style.paddingBottom = '4px';
			$('suche_' + i).style.display = 'none';
		}
	}	
}


function change_wortwolke(id, bg_color)
{
	var i, farbe, count=2;
	
	switch (bg_color)
	{
		default:
		farbe = '#03649B';
		break;
		
		case 'orange':
		farbe = '#EB5F01';
		break;
		
		case 'green':
		farbe = '#3D8732';
		break;
	}
	
	for (i = 1; i <= count; i++)
	{
		if (i== id)
		{
			$('link_w_' + i).style.paddingBottom = '6px';
			$('wortwolke_' + i).style.display = 'block';
			$('link_w_' + i).style.fontWeight = 'bold';
			$('link_w_' + i).style.color = 'black';
			$('link_w_' + i).style.backgroundImage = 'url(/img/bg_hell.gif)';
			
		}
		else
		{
			$('link_w_' + i).style.paddingBottom = '5px';
			$('wortwolke_' + i).style.display = 'none';
			$('link_w_' + i).style.fontWeight = 'normal';
			$('link_w_' + i).style.color = farbe;
			$('link_w_' + i).style.backgroundImage = 'url(/img/bg_' + bg_color + '.gif)';
		}
		
		
	}	
	
}

function change_tipp(id, bg_color)
{
	var i, count=3;
	
	for (i = 1; i <= count; i++)
	{
		if (i== id)
		{
			$('tipp_w_' + i).style.paddingBottom = '6px';
			$('tipp_' + i).style.display = 'block';
			$('tipp_w_' + i).style.fontWeight = 'bold';
			$('tipp_w_' + i).style.backgroundImage = 'url(/img/bg_hell.gif)';
		}
		else
		{
			$('tipp_w_' + i).style.paddingBottom = '5px';
			$('tipp_' + i).style.display = 'none';
			$('tipp_w_' + i).style.fontWeight = 'normal';
			$('tipp_w_' + i).style.backgroundImage = 'url(/img/bg_' + bg_color + '.gif)';
		}
	}	
}


inProgress = false;
function toggle_box(elementId, myDuration) {
	
	if (elementId && !inProgress) {
		inProgress = true;
		if (myDuration == undefined)
			myDuration = 0.5;
		if ($(elementId).style.display == 'none')  {
			Effect.BlindDown(elementId, {duration: myDuration, afterFinish:function(){inProgress = false;}}); 
			$(elementId+'_img').src="/img/icon_minus.gif";
		}
		else {
			Effect.BlindUp(elementId, {duration: myDuration, afterFinish:function(){inProgress = false;}});
			$(elementId + '_img').src="/img/icon_plus.gif";
		}
	}
	return false;
}

function printTime(){
	wochentag = new Array("Sonntag", "Montag", "Dienstag", "Mittwoch",
                          "Donnerstag", "Freitag", "Samstag");	
	monat = new Array("Januar", "Februar", "M&auml;rz", "April", "Mai", "Juni",
                      "Juli", "August", "September", "Oktober", "November", "Dezember");
	jetzt 			= new Date();
	weekday 		= jetzt.getDay();
	day				= jetzt.getDate();
	month 			= jetzt.getMonth();
	year 			= jetzt.getYear()+1900;
	hour				= jetzt.getHours();
	minutes		= jetzt.getMinutes();
	timeString 	= wochentag[weekday]+", "+day+". "+monat[month]+" "+year+", "+hour+":"+minutes+" Uhr";
	$('time').innerHTML = timeString;
}

function evt(evt) 
{
    evt = (evt) ? evt : ((window.event) ? window.event : "");
    var elem = (evt.target) ? evt.target : evt.srcElement;
	
   
	
	var bild= '<img src="' + elem.name + '" alt="' + elem.name+ '" title="' + elem.name + '" id="' + elem.name + '_img" class="db">';
	
	
	
    if ( evt.clientY <=220)
	{
		//bild = '<div><div class=\'tooltip_footer_2\'></div><div class=\'tooltip_inner_2\' ><div class=\'tooltip_img\' ><table border="1" bgcolor="#00CC99" ><tr><td>' + bild + '</td></tr></table></div></div></div>';
		bild='<div><table border="0" cellpadding="0" cellspacing="0"><tr><td class="table_tooltip_02_l"></td><td class="table_tooltip_02_r"></td></tr><tr><td class="table_tooltip_02_lo">'+bild+'</td><td class="table_tooltip_02_ro"></td></tr></table></div>';
		return overlib(bild ,  MOUSEOFF, RIGHT, SNAPX, 10, SNAPY, 10,FULLHTML);
		
	}
	else
	{
		//bild='<div ><div class=\'tooltip_inner_1\' ><div class=\'tooltip_img\' ><table border="1" bgcolor="#00CC99"><tr><td>' + bild + '</td></tr></table></div></div><div class=\'tooltip_footer_1\'></div></div>'
		;
		bild='<div><table border="0" cellpadding="0" cellspacing="0"><tr><td class="table_tooltip_01_lo">'+bild+'</td><td class="table_tooltip_01_ro"></td></tr><tr><td class="table_tooltip_01_l"></td><td class="table_tooltip_01_r"></td></tr></table></div>';
		return overlib(bild,  MOUSEOFF, RIGHT, ABOVE, SNAPX, 10, SNAPY, 10,FULLHTML);
		
	}
}

function toggleMehr(){
	if(mehrVisible ){
			document.getElementById('mehr').style.display='none';
			mehrVisible =false;
	}
	else{
			document.getElementById('mehr').style.display='block';	
			mehrVisible =true;
	}
}
function invisibleMehr(){
	document.getElementById('mehr').style.display='none';
	mehrVisible =false;
}

function resizePopupalt(bild) {
	var pwidth;
	var pheight;
	pwidth = bild.width + 67;
	pheight = bild.height + 280;
	window.resizeTo(pwidth, pheight);
}

function resizePopup(bild) {
		var width, height, newWidth, newHeight;
	 if (self.innerHeight) { 
		 	width = window.innerWidth;
			height = window.innerHeight;
	 } else if (document.documentElement && document.documentElement.clientHeight) {
			width = document.documentElement.clientWidth;
		 	height = document.documentElement.clientHeight;
		} else if (document.body) {
	 		width = document.body.clientWidth;
			height = document.body.clientHeight;
	 }
	
	 if (width > 0) {
        if (bild.width < 230) {
              newWidth = 288 - width;
        } else {
               newWidth = bild.width - width + 58;
        }	 	
		newHeight = bild.height - height + 180
		window.resizeBy(newWidth, newHeight)
	}
 }