window.focus();
google_ad_client = "pub-7685873532544336";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_type = "text";
google_ad_channel ="";
google_color_border = "FFFFFF";
google_color_link = "0000FF";
google_color_bg = "FFFFFF";
google_color_text = "000000";
google_color_url = "008000";

e1 = null;
e2 = null;
InID = 'p1';
OutID = null;
ChildInID = "p11";
ChildOutID = null;
ChoiseInID = new Array();
ChoiseOutID = new Array();
ChoiseID = new Array();

Buttons = false;

if ((document.referrer.length > 0) && (document.images) && (document.referrer.toLowerCase().indexOf('saugeil.net') < 0) && (document.referrer.toLowerCase().indexOf('ebesucher.de') < 0) && (document.referrer.toLowerCase().indexOf('hit-tausch.de') < 0) && (document.referrer.toLowerCase().indexOf('auto-surf.de') < 0))
{ 
	refstat=new Image(1,1);
	refstat.src="http://www.webhits.de/cgi/refstat?df=89621&ref="+escape(document.referrer);
}

function showNewsBox( ms )
{
	bid = document.getElementById("newsbox");
	bid.style.display = "block";
	setTimeout( 'hideNewsBox()', ms );
}

function hideNewsBox()
{
	bid = document.getElementById("newsbox");
	bid.style.display = "none";
}

function showHelp(header,text)
{
	e1 = document.getElementById("s1");
	e2 = document.getElementById("s2");
	
	e1.style.display = "block";
	e1.firstChild.nodeValue = header;
	e2.style.display = "block";
	e2.firstChild.nodeValue = text;
}

function hideHelp()
{
	e1.firstChild.nodeValue = "Hilfe zur Anmeldung";
	e2.firstChild.nodeValue = "Klicke jetzt auf das nächste leere Feld links und fülle das Formular sorgfältig aus! Fakeanmeldungen werden bei händischer Prüfung sofort ohne weitere Mitteilung gelöscht, um unsere Datenbank sauber zu halten!";
}

function show(id)
{ 
	OutID = InID;
	document.getElementById(OutID).style.display = "none";
	InID = id;
	document.getElementById(id).style.display = "block";
}
function showChild(id)
{
	ChildOutID = ChildInID;
	document.getElementById(ChildOutID).style.display = "none";
	if (Buttons)
	{
		ButtonID = "sub"+ChildOutID.substr(1);
		document.getElementById(ButtonID).style.background = "#aa0000";
	}
	ChildInID = InID+id;
	document.getElementById(ChildInID).style.display = "block";
	if(Buttons)
	{
		ButtonID = "sub"+ChildInID.substr(1);
		document.getElementById(ButtonID).style.background = "#0000ff";
	}
}

function showLast()
{
	show(OutID);
}
function menu(id, count)
{
	for ( i = 1; i < count+1; i++ )
	{
		document.getElementById("mp"+i).style.top = "4";
	}
	document.getElementById("m"+id).style.top = "0";
	show(id);
	showChild(1);
}
function openURL( url, name, w, h)
{
	window.open( url, name, 'width='+w+',height='+h);
}

function openProfile( url)
{
	window.open( url, 'profil', 'toobar=no,resizable=yes,width=580,height=600');
}

function openNews( newsid )
{
	window.open( '/showNews/'+newsid, 'magazin', 'toobar=no,resizable=yes,width=550,height=600');
}
function getFocus()
{
	window.focus();
}
function showPayment(tpl)
{
	openURL("/?member_tpl="+tpl,'PaymentWindow',500,500);
}

function memberChat(url)
{
	window.open( url, 'memberchat', 'toobar=no,resizable=no,width=670,height=450');
}

function choise( id, group )
{
	ChoiseID[group] = id;
	ChoiseOutID[group] = ChoiseInID[group];
	if ( ChoiseOutID[group] != null )
	{
		document.getElementById(ChoiseOutID[group]).style.background = "#fff";
	}
	document.getElementById(id).style.background = "#FAEEEE";
	ChoiseInID[group] = id;
}

function switchColor( id, group, col )
{
	if ( id != ChoiseID[group] )
	{
		document.getElementById(id).style.background = col;
	}
}

function switchImg( id, url )
{
	document.getElementById(id).src = url;
}

function load ( params )
{
	document.location.href = "index.php?" + params;
}

function ask_load( params, question )
{
	retvalue = confirm(question);
	if ( retvalue)
	{
		load( params );
	}
}

function standby()
{
	document.getElementById('standby').style.display = "none";
}

function getObjFocus( id )
{
	document.getElementById(id).focus();
}

function insert(aTag, eTag, elementTag) 
{
  if (elementTag.length == 0) {
  	elementTag = "foren:message";
  }
  var input = document.forms['write'].elements[elementTag];
  input.focus();
  /* für Internet Explorer */
  if(typeof document.selection != 'undefined') {
    /* Einfügen des Formatierungscodes */
    var range = document.selection.createRange();
    var insText = range.text;
    range.text = aTag + insText + eTag;
    /* Anpassen der Cursorposition */
    range = document.selection.createRange();
    if (insText.length == 0) {
      range.move('character', -eTag.length);
    } else {
      range.moveStart('character', aTag.length + insText.length + eTag.length);      
    }
    range.select();
  }
  /* für neuere auf Gecko basierende Browser */
  else if(typeof input.selectionStart != 'undefined')
  {
    /* Einfügen des Formatierungscodes */
    var start = input.selectionStart;
    var end = input.selectionEnd;
    var insText = input.value.substring(start, end);
    input.value = input.value.substr(0, start) + aTag + insText + eTag + input.value.substr(end);
    /* Anpassen der Cursorposition */
    var pos;
    if (insText.length == 0) {
      pos = start + aTag.length;
    } else {
      pos = start + aTag.length + insText.length + eTag.length;
    }
    input.selectionStart = pos;
    input.selectionEnd = pos;
  }
  /* für die übrigen Browser */
  else
  {
    /* Abfrage der Einfügeposition */
    var pos;
    var re = new RegExp('^[0-9]{0,3}$');
    while(!re.test(pos)) {
      pos = prompt("Einfügen an Position (0.." + input.value.length + "):", "0");
    }
    if(pos > input.value.length) {
      pos = input.value.length;
    }
    /* Einfügen des Formatierungscodes */
    var insText = prompt("Bitte geben Sie den zu formatierenden Text ein:");
    input.value = input.value.substr(0, pos) + aTag + insText + eTag + input.value.substr(pos);
  }
}
