/*
Developed by dAxpHpNIzER
Copyright (C) Lukas Wojcik 2011
*/

var adpicid = "p1";
var adpicid2 = 1;

function startAd()
{
 setTimeout("changeAdPic()",10000);
}

function changeAdPic()
{
 setTimeout("changeAdPic()",10000);
 if(adrotator == false)
 {
  return;
 }
 if(adpicid == "p1")
 {
  adpicid = "p2";
  adpicid2 = 2;
 }
 else if(adpicid == "p2")
 {
  adpicid = "p3";
  adpicid2 = 3;
 }
 else if(adpicid == "p3")
 {
  adpicid = "p4";
  adpicid2 = 4;
 }
 else if(adpicid == "p4")
 {
  adpicid = "p5";
  adpicid2 = 5;
 }
 else if(adpicid == "p5")
 {
  adpicid = "p6";
  adpicid2 = 6;
 }
 else if(adpicid == "p6")
 {
  adpicid = "p7";
  adpicid2 = 7;
 }
 else if(adpicid == "p7")
 {
  adpicid = "p1";
  adpicid2 = 1;
 }
  document.getElementById('p1').src = 'img/p2.png';
  document.getElementById('p2').src = 'img/p2.png';
  document.getElementById('p3').src = 'img/p2.png';
  document.getElementById('p4').src = 'img/p2.png';
  document.getElementById('p5').src = 'img/p2.png';
  document.getElementById('p6').src = 'img/p2.png';
  document.getElementById('p7').src = 'img/p2.png';
  document.getElementById(adpicid).src = 'img/p1.png';
  document.getElementById('scrollpic').src = 'img/scroll/' + adpicid2 + '_' + lng + '.jpg';
 } 

function adpicOver(id)
{
 document.body.style.cursor = 'pointer';
 document.getElementById(id).src = 'img/p3.png';
}

function adpicOut(id)
{
 document.body.style.cursor = 'default';
 if(id == adpicid)
 {
  document.getElementById(id).src = 'img/p1.png';
 }
 else
 {
  document.getElementById(id).src = 'img/p2.png';
 }
}

function adssOver()
{
 document.body.style.cursor = 'pointer';
}

function adssOut()
{
 document.body.style.cursor = 'default';
}

function adpicClick(id)
{
 document.getElementById(adpicid).src = 'img/p2.png';
 adpicid = 'p' + id;
 adpicid2 = id;
 document.getElementById('p' + id).src = 'img/p1.png';
 document.getElementById('scrollpic').src = 'img/scroll/' + adpicid2 + '_' + lng + '.jpg';
}

function adstartstop()
{
 if(adrotator == true)
 {
  adrotator = false;
  document.getElementById('pp').src = 'img/play.png';
 }
 else
 {
  adrotator = true;
  document.getElementById('pp').src = 'img/pause.png';
 }
}

function adstop2()
{
  adrotator = false;
}

function hover1x(id, st)
{
 document.getElementById(id).style.background = 'url(./templates/Stats4UStyle/img/btnverlauf' + st + 'x2.gif)';
 return;
}

function hover2x(id, st)
{
 document.getElementById(id).style.background = 'url(./templates/Stats4UStyle/img/btnverlauf' + st + '.gif)';
 return;
}

function hover3x(id, st)
{
 document.getElementById(id).style.background = 'url(./templates/Stats4UStyle/img/btnverlauf' + st + 'x3.gif)';
 document.getElementById(id).disabled = true;
 return;
}

function hover4x(id, st)
{
 document.getElementById(id).style.background = 'url(./templates/Stats4UStyle/img/btnverlauf' + st + 'x3.gif)';
 return;
}

xpic1 = new Image(3,20); 
xpic1.src = "./templates/Stats4UStyle/img/btnverlauf1.gif"; 
pic1x2 = new Image(3,20); 
pic1x2.src = "./templates/Stats4UStyle/img/btnverlauf1x2.gif"; 
pic1x3 = new Image(3,20); 
pic1x3.src = "./templates/Stats4UStyle/img/btnverlauf1x3.gif"; 
picxx1 = new Image(230,65); 
picxx1.src = "./img/wizard_normal.gif"; 
picxx2 = new Image(230,65); 
picxx2.src = "./img/wizard_onmouseover.gif"; 
picxx3 = new Image(230,65); 
picxx3.src = "./img/wizard_onclick.gif"; 

function doCopy(theField)
{
 var copytoclip = 1
 var tempval = eval("document." + theField)
 tempval.focus()
 tempval.select()
 if(document.all && copytoclip == 1)
 {
  therange = tempval.createTextRange();
  therange.execCommand("Copy");
 }
 return;
}

var onclicked_wizard = false;

function wizardbutton(a)
{
 if(a == 1 && onclicked_wizard == false)
 {
  document.getElementById('wizardimg').src = './img/wizard_onmouseover.gif';
 }
 else if(a == 2 && onclicked_wizard == false)
 {
  document.getElementById('wizardimg').src = './img/wizard_normal.gif';
 }
 else if(a == 3)
 {
  document.getElementById('wizardimg').src = './img/wizard_onclick.gif';
  onclicked_wizard = true;
 }
 return;
}

function selectColor(color) 
{
 document.getElementById('bwfcds').value = color;
 colorize('actual', color);
 return;
}

function selectColor2(color) 
{
 document.getElementById('bwfcds2').value = color;
 colorize('actual2', color);
 return;
}

function selectColor3(color) 
{
 document.getElementById('bwfcds3').value = color;
 colorize('actual3', color);
 return;
}

function colorize(id, farbcode)
{
 if(farbcode.length == 6)
 {
  document.getElementById(id).style.backgroundColor = "#" + farbcode;
  document.getElementById(id).style.color = "#" + farbcode;
 }
 return;
}

 function SetCookie2(name, value)
 { 
  var argv = SetCookie2.arguments; 
  var argc = SetCookie2.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; 
  document.cookie = name + "=" + escape (value) + 
  ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
  ((path == null) ? "" : ("; path=" + path)) + 
  ((domain == null) ? "" : ("; domain=" + domain)) + 
  ((secure == true) ? "; secure" : "");
 }


var d=document
var ok=d.getElementById
var ns=(navigator.appName.indexOf("Netscape")!=-1)
function KeepTopLeft(startX,startY)
{
	function GetElement()
	{
		var el=d.getElementById("menu1")
		el.Position=function(x,y)
		{
			el.style.left=x
			el.style.top=y
		}
		el.x=startX
		el.y=startY
		return el
	}
	self.stayTopLeft=function()
	{
	 if(locked == false)
	 {
		E.Position(E.x,E.y+=((ns?pageYOffset:d.body.scrollTop)+startY-E.y)/4)
	 }
	}
	var E=GetElement()
	setInterval("stayTopLeft()",10)
}

function printLock()
{
 if(locked == false)
 {
  document.getElementById('menuLock').innerHTML = '<a href="#" onClick=\"setLock(true);return false;"><img src="./img/unlock.png" border="0"></a>';
 }
 else if(locked == true)
 {
  document.getElementById('menuLock').innerHTML = '<a href="#" onClick="setLock(false);return false;"><img src="./img/lock.png" border="0"></a>';
 }
 return;
}

function setLock(to)
{
 if(to == true)
 {
  locked = true;
  var exp = new Date(); 
  exp.setTime(exp.getTime() + (60*60*24));
  SetCookie('locked', "0", exp);
 }
 else if(to == false)
 {
  locked = false;
  var exp = new Date(); 
  exp.setTime(exp.getTime() + (60*60*24));
  SetCookie('locked', "", exp);
 }
 printLock();
 return;
}

var startat = 1;
var startbis = 100;

function printInformation()
{
 for(var i=1;i<100;i++)
 {
  if(document.getElementById('info_' + i) != null)
  {
   document.getElementById('info_' + i).style.display = 'none';
  }
  else
  {
   i = 100;
  }
 }
 if(information == true)
 {
  document.getElementById('information_icon').innerHTML = '<a href="#" onClick="setInformation(false);return false;"><img src="./img/info.png" style="vertical-align:bottom" width="32" height="32" border="0"></a>';
  for(var i=startat;i<startbis;i++)
  {
   if(document.getElementById('info_' + i) != null)
   {
    document.getElementById('info_' + i).style.display = 'block';
   }
   else
   {
    i = startbis;
   }
  }
 }
 else if(information == false)
 {
  document.getElementById('information_icon').innerHTML = '<a href="#" onClick="setInformation(true);return false;"><img src="./img/info2.png" style="vertical-align:bottom;opacity:0.4;filter:alpha(opacity=40)" width="32" height="32" border=\"0\"></a>';
  for(var i=startat;i<startbis;i++)
  {
   if(document.getElementById('info_' + i) != null)
   {
    document.getElementById('info_' + i).style.display = 'none';
   }
   else
   {
    i = startbis;
   }
  }
 }
 return;
}

function setInformation(to)
{
 if(to == true)
 {
  information = true;
  var exp = new Date(); 
  exp.setTime(exp.getTime() + (60*60*24));
  SetCookie2('information', "", exp);
 }
 else if(to == false)
 {
  information = false;
  var exp = new Date(); 
  exp.setTime(exp.getTime() + (60*60*24));
  SetCookie2('information', "0", exp);
 }
 printInformation();
 return;
}
