function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}


function FensterOeffnen (url, wn) {
  hwnd = window.open(url, wn, "width=690,height=520,left=100,top=200,status=no");
  hwnd.focus();
}

function GalerieOeffnen (img_filename) {
  hwnd = window.open('galerie.php?img='+img_filename, "galerie", "width=840,height=700,left=10,top=20,status=no");
  hwnd.focus();
}

function getStartPoint(id) {
    switch (id) {
        case 'navigation_spielinfo': return 0;
        case 'navigation_mein_stall': return 181;
        case 'navigation_turniere': return 362;
        case 'navigation_handel': return 543;
        case 'navigation_clubhof': return 724;
        case 'navigation_community': return 905;
        case 'navigation_stoeber_ecke': return 1086;
        case 'navigation_register': return 1262;
        
        case 'arzt_button_behandeln': return 0;
		case 'arzt_button_blutprobe': return 150;
		case 'arzt_button_kastrieren': return 450;
		case 'arzt_button_vorsorge': return 600;
		case 'arzt_button_impfen': return 300;
		
		case 'ueben': return 0;
		case 'lizenz': return 150;
		case 'turnier1': return 300;
		case 'turnier2': return 450;
        default: return 0;
    }
}

function restoreImg(myLink) {
    var myDiv = myLink.getElementsByTagName('div')[0];
    var myStartPos = getStartPoint(myDiv.id);
    var myHeight = myDiv.style.height.substr(0, myDiv.style.height.length-2);
    if (myDiv.style.backgroundPosition!='-'+myStartPos+'px -'+(myHeight*2)+'px'
        && !(myStartPos=='0' && myDiv.style.backgroundPosition==+myStartPos+'px -'+(myHeight*2)+'px')) {
        myDiv.style.backgroundPosition = '-'+myStartPos+'px 0px';
    }
}
function hoverImg(myLink) {
    var myDiv = myLink.getElementsByTagName('div')[0];
    var myHeight = myDiv.style.height.substr(0, myDiv.style.height.length-2);
    var myStartPos = getStartPoint(myDiv.id);
    if (myDiv.style.backgroundPosition!='-'+myStartPos+'px -'+(myHeight*2)+'px' 
        && !(myStartPos=='0' && myDiv.style.backgroundPosition==+myStartPos+'px -'+(myHeight*2)+'px')) {
        myDiv.style.backgroundPosition = '-'+myStartPos+'px -'+myHeight+'px';
    }
}
function selectImg(myLink) {
    var myDiv = myLink.getElementsByTagName('div')[0];
    var myStartPos = getStartPoint(myDiv.id);
    var myHeight = myDiv.style.height.substr(0, myDiv.style.height.length-2);
    myDiv.style.backgroundPosition = '-'+myStartPos+'px -'+(myHeight*2);
}

var isIE = document.all;

function get_click_layer()
{
	if (!is_control_pressed)
	{
		var my_body = document.getElementsByTagName('body')[0];
		var my_div = document.getElementById('click_layer');
		if (my_div)
		{
			my_div.style.height = my_body.scrollHeight+'px';
			my_div.style.display = 'block';
			var my_div = document.getElementById('click_layer2');
			var scroll = isIE?document.body.scrollTop:window.pageYOffset;
			my_div.style.top = (scroll+200)+'px';
			my_div.style.display = 'block';
		}
	}
}

if (window.adgroupid == undefined) {
window.adgroupid = Math.round(Math.random() * 1000);
}
var is_control_pressed = false;

function proc_key_down(evt) 
{
	switch (evt.keyCode)
	{
		case 16:
		case 17:
		case 18:
			is_control_pressed = true;
	}
}

function proc_key_up(evt)
{
	switch (evt.keyCode)
	{
		case 16:
		case 17:
		case 18:
			is_control_pressed = false;
	}
}

window.onkeydown = proc_key_down;
function remove_click_layer() 
{
/*	var my_body = document.getElementsByTagName('body')[0];
	my_body.removeChild(document.getElementById('click_layer'));
	my_body.removeChild(document.getElementById('click_layer2'));*/
	var my_div = document.getElementById('click_layer');
	if (my_div)
	{
		my_div.style.display = 'none';
	}
	var my_div = document.getElementById('click_layer2');
	if (my_div)
	{
		my_div.style.display = 'none';
	}
}

function set_onclick_layer()
{
	var my_links = document.getElementsByTagName('a');
	for (var i=0; i<my_links.length; i++)
	{
		if (!my_links[i].onclick && my_links[i].href!='' && my_links[i].href.substr(my_links[i].href.length-1, 1)!='#' && my_links[i].href.substr(my_links[i].href.length-4, 4)!='#top' && my_links[i].href.substr(0, 11)!='javascript:' && my_links[i].target=='')
		{
			my_links[i].onclick = get_click_layer;
/*			eval('my_links[i].onclick = function() {get_click_layer(); '+my_links[i].onclick+'}');*/
		}
	}
}

window.onunload = get_click_layer;
	var isIE6 = ((navigator.userAgent.indexOf("MSIE 6.") != -1) && (navigator.userAgent.indexOf("Opera") == -1) && (navigator.userAgent.indexOf("MSIE 7.") == -1));
	var index = 0;

if (window.adgroupid == undefined) {
window.adgroupid = Math.round(Math.random() * 1000);
}
	function loadhorse(id)
	{
		var horseimg = document.getElementById('horseimg').getElementsByTagName('img')[0];
		if (isIE6)
		{
			horseimg.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'/images/horsepics_base_4/'+horseid[id]+'.png\', sizingMethod=\'scale\')';
		}
		else
		{
			horseimg.src = '/images/horsepics_base_4/'+horseid[id]+'.png';
		}
		document.getElementById('horsename2').innerHTML = horsename[id];
		document.getElementById('description'+id).style.display='block';
	}
	function next()
	{
		document.getElementById('description'+index).style.display='none';
		index++;
		if (horseid.length<=index)
		{
			index = 0;
		}
		loadhorse(index);
	}
	function prev()
	{
		document.getElementById('description'+index).style.display='none';
		index--;
		if (index<0)
		{
			index = horseid.length-1;
		}
		loadhorse(index);
	}
	var glow_direction = '+';
	var glow_opacity = 0;
	function glow_streicheltext()
	{
		if (glow_direction=='+')
		{
			glow_opacity++;
		}
		else
		{
			glow_opacity--;
		}
		if (glow_opacity>10)
		{
			glow_opacity = 10;
			glow_direction = '-'; 
		}
		else if (glow_opacity<0)
		{
			glow_opacity = 0;
			glow_direction = '+'; 
		}
		if (document.getElementById('streicheltext'))
		{
			document.getElementById('streicheltext').style.MozOpacity = (glow_opacity/10);
		}
	}
	function popit(content)
{
	TagToTip(content,BALLOON,false,STICKY,true,DELAY, 0,BGCOLOR,'',BORDERWIDTH,0,CLICKCLOSE,true);
	set_onclick_layer();
}
function popit2(content)
{
	TagToTip(content,STICKY,true,DELAY, 0,CLICKCLOSE,true);
	set_onclick_layer();
}
function popit3(content)
{
	TagToTip(content,BALLOON,false,STICKY,true,DELAY, 0,BGCOLOR,'',BORDERWIDTH,0,CENTERWINDOW,true,FOLLOWSCROLL,true,CLICKCLOSE,false);
	set_onclick_layer();
}
function help(slot,text)
{
	document.getElementById('help_tag'+slot).innerHTML = ""+text;
}

function interact_user(text)
{
	tt_Hide();
	document.getElementById('interacttext').innerHTML=text;
	

		window.setTimeout("popit3('interact')",250);

}
function ask_user(whereto, question)
{
	tt_Hide();
	document.getElementById('request_yes').href=whereto;
	document.getElementById('requesttext').innerHTML=question;
	
	window.setTimeout("popit3('requester')",250);

}
	
	