function init()
{

if(typeof(window.fade_init) == "function") 
	{
	fade_init (0,1);
	}
}


var w3p_sm_active;

function w3p_sm_over (kat)
{
if (w3p_sm_active)
	w3p_sm_active.style.display = "none";

if (!document.getElementById('subsubmenu_'+kat))
	return;

w3p_sm_active = document.getElementById('subsubmenu_'+kat);

w3p_sm_active.style.display = "block";

}

function w3p_sm_out ()
{
// alert ("out");
if (w3p_sm_active)
	w3p_sm_active.style.display = "none";

// document.getElementById('subsubmenu_'+kat).style.display = "none";
}





function podcast(filmid)
{
theurl = w3p_path_backroot+"multiple-sklerose-podcast/videoplayer/index.php";
if (filmid)
	{
	if (filmid == "alle")
		theurl += "?w3pvcat="+filmid;
	else
		theurl += "?w3pvid="+filmid;
	}

win_podcast = window.open (theurl,"podcast","scrollbars=no,resizable=no,menubar=no,status=no,width=790,height=545");		
win_podcast.focus ();
}

// * artikel bewerten

var w3p_articlerate = -1;

function w3p_articleRateOver(rate,rated)
{
if (w3p_articlerate > -1)
	rated = w3p_articlerate;
	
for (z=1;z<=5;z++)
	{
	if (z<=rate)
		document.getElementById("articlerate"+z).src = w3p_path_backroot+'images/symbol_rating_rate.gif';
	else if (document.getElementById("articlerate"+z).src.indexOf('symbol_rating_rated.gif') != -1)
		document.getElementById("articlerate"+z).src = w3p_path_backroot+'images/symbol_rating_rated.gif';
	else
		document.getElementById("articlerate"+z).src = w3p_path_backroot+'images/symbol_rating_unrated.gif';
	}
}

function w3p_articleRateOut(rated)
{
if (w3p_articlerate > -1)
	rated = w3p_articlerate;

for (z=1;z<=5;z++)
	{
	if (z<=rated)
		document.getElementById("articlerate"+z).src = w3p_path_backroot+'images/symbol_rating_rated.gif';
	else
		document.getElementById("articlerate"+z).src = w3p_path_backroot+'images/symbol_rating_unrated.gif';
	}
}

function w3p_articleRateSet(anr,rate)
{

w3p_makeDynRequest(w3p_path_backroot+'w3p_includes/templates/template_article_rate_async.w3ml.php?rate='+rate+'&anr='+anr);
}

function w3p_articleRateReturn ()
{
// alert (http_request.responseText);
rate = 0;
if (http_request.readyState == 4)
	{
    if (http_request.status == 200) 
		{
		rate = http_request.responseText;

		if (rate == -1)
			{
			rate = w3p_articlerate;
			for (z=1;z<=5;z++)
				{
				if (z<=rate)
					document.getElementById("articlerate"+z).src = w3p_path_backroot+'images/symbol_rating_rated.gif';
				else
					document.getElementById("articlerate"+z).src = w3p_path_backroot+'images/symbol_rating_unrated.gif';
				}
			document.getElementById("articleRatingConfirm").innerHTML = '<span class="textcolor_4">Diesen Artikel haben Sie bereits bewertet!</span>';
			}
		else
			{
			w3p_articlerate = rate;
			for (z=1;z<=5;z++)
				{
				if (z<=rate)
					document.getElementById("articlerate"+z).src = w3p_path_backroot+'images/symbol_rating_rated.gif';
				else
					document.getElementById("articlerate"+z).src = w3p_path_backroot+'images/symbol_rating_unrated.gif';
				}
			document.getElementById("articleRatingConfirm").innerHTML = "Danke für Ihre Bewertung!";
			}
			
    	}
	else
		{
        // alert('Ein Fehler ist aufgetreten: '+http_request.status);
	    }
	}
}
// **** asynchron


var http_request = false;

function w3p_makeDynRequest(url) 
{

http_request = false;

if (window.XMLHttpRequest) 
	{ 
	// not IE
    http_request = new XMLHttpRequest();

    if (http_request.overrideMimeType) 
		{
        http_request.overrideMimeType('text/xml');
    	}
	} 
else if (window.ActiveXObject) 
	{ 
	// IE
    try {
        http_request = new ActiveXObject("Msxml2.XMLHTTP");
    	} catch (e) 
			{
        	try 
				{
            	http_request = new ActiveXObject("Microsoft.XMLHTTP");
		        } catch (e) {}
    	}
	}

if (!http_request) 
	{
    alert('XMLHTTP-Instanz konnte nicht erzeugt werden.');
    return false;
	}

http_request.onreadystatechange = w3p_articleRateReturn;

http_request.open('GET', url, true);
http_request.send(null);
}

function checkform_vkinput (objekt)
{
if (objekt.value == "Suche")
	objekt.value = "";
return;
}


function cb_chat_tab(objekt)
{
if (objekt == "termine")
	{
	document.getElementById("a_termine").className = "cb_chat_aktiv";
	document.getElementById("a_protokolle").className = "";

	document.getElementById("inhalt_termine").style.display = "block";
	document.getElementById("inhalt_protokolle").style.display = "none";
	}
else
	{
	document.getElementById("a_protokolle").className = "cb_chat_aktiv";
	document.getElementById("a_termine").className = "";
	document.getElementById("inhalt_termine").style.display = "none";
	document.getElementById("inhalt_protokolle").style.display = "block";
	}

}


function gruende (nr)
{
theurl = w3p_path_backroot+"specials/7gruende/index.php";
if (nr)
	theurl = theurl + "?grund="+nr;
	
fenster_2 = window.open (theurl,"fenster2","scrollbars=no,resizable=no,menubar=no,status=no,width=406,height=539");		
fenster_2.focus ();
}

function openwin1 (url,x,y,element)
	{
	if (document.layers)
		{
		open_win1(url,x,y,element); fenster_1.focus();
		}
	else
		{
		if ( window.fenster_1 )
			{
			fenster_1.close ();
			while (!fenster_1.closed)
				{
				}
			open_win1(url,x,y,element);
			}
		else
			open_win1(url,x,y,element);
		}
	}
function open_win1 (url,x,y,element)
{
fenster_1 = window.open (url,"fenster1","menubar=no,scrollbars=no,status=yes,resizable=yes,width=" + x +",height=" + y + element);		
fenster_1.focus ();
}

function openwin2 (url,x,y,element)
	{
	if (document.layers)
		{
		open_win2(url,x,y,element); fenster_2.focus();
		}
	else
		{
		if ( window.fenster_2 )
			{
			fenster_2.close ();
			while (!fenster_2.closed)
				{
				}
			open_win2(url,x,y,element);
			}
		else
			open_win2(url,x,y,element);
		}
	}
function open_win2 (url,x,y,element)
{
fenster_2 = window.open (url,"fenster2","menubar=no,scrollbars=yes,resizable=no,width=" + x +",height=" + y + element);		
fenster_2.focus ();
}

function termine_switchAnk (nr)
{
ankuend = document.getElementById('termine_ankuend_topics');
ankuend = ankuend.getElementsByTagName('p');
for (z=0;z<ankuend.length;z++)
	{
	ankuend[z].className = 'termine_ankuend_hide';
	document.getElementById('termine_ankuend_img_'+(z+1)).src = '../images/tag_a_plus.gif';
	}
ankuend[nr-1].className = 'termine_ankuend_show';
document.getElementById('termine_ankuend_img_'+nr).src = '../images/tag_a_minus.gif';
// alert (ankuendimg[nr-1]);
}


function w3p_articleTree(nr,anz,objekt)
{
// alert (document.getElementById('articletree_item_content_'+nr));
if (document.getElementById('articletree_item_content_'+nr).style.display == "block")
	{
	document.getElementById('articletree_item_content_'+nr).style.display = "none";
	objekt.className = "navigation vor";
	}
else
	{
	document.getElementById('articletree_item_content_'+nr).style.display = "block";
	objekt.className = "navigation top";
	}
}

function w3p_articleTreeAll (anz,objekt)
{

if (objekt.className == "navigation top")
	{
	for (z=1;z<anz;z++)
		{
		document.getElementById('articletree_item_content_'+z).style.display = "none";
		}
	objekt.className = "navigation vor";
	objekt.innerHTML = "Alle anzeigen";
	}
else
	{

	for (z=1;z<anz;z++)
		{
		document.getElementById('articletree_item_content_'+z).style.display = "block";
		}
	objekt.className = "navigation top";
	objekt.innerHTML = "Alle verbergen";
	}
}
