
var altesBild = "";
var alteFarbe = "";
var b = 0;
var global_win = 0;

var TINY={};




function T$(i)
{
	return document.getElementById(i)
}


function T$$(e,p)
{
	return p.getElementsByTagName(e)
}


TINY.slider = function()
{
	function slide(n,p)
	{
		this.n = n;
		this.init(p);
	}
	
	
	slide.prototype.init = function(p)
	{
		var s=T$(p.id), u=this.u=T$$('ul',s)[0], c=T$$('li',u), l=c.length, i=this.l=this.c=0;
		if(p.navid&&p.activeclass){this.g=T$$('li',T$(p.navid)); this.s=p.activeclass}
		this.a=p.auto||0; this.p=p.resume||0; this.v=p.vertical||0; s.style.overflow='hidden';
		for(i;i<l;i++)
		{
			if(c[i].parentNode==u)
			{
				this.l++;
			}
		}
		if(this.v)
		{
			u.style.top=0; this.h=p.height||c[0].offsetHeight; u.style.height=(this.l*this.h)+'px';
		}
		else
		{
			u.style.left=0; this.w=p.width||c[0].offsetWidth; u.style.width=(this.l*this.w)+'px';
		}
		this.pos(p.position || 0,this.a?1:0);
	},
	
	
	slide.prototype.auto = function()
	{
		this.u.ai=setInterval(new Function(this.n+'.move(1,1)'),this.a*1000)
	},
	
	
	slide.prototype.move = function(d,a)
	{
		var n=this.c+d, i=d==1 ? n==this.l ? 0 : n : n<0 ? this.l-1:n;			
		this.pos(i,a)
	},
	
	
	slide.prototype.pos = function(p,a)
	{
		clearInterval(this.u.ai);
		clearInterval(this.u.si);
		var o=this.v ? parseInt(this.u.style.top) : parseInt(this.u.style.left), t=this.v ? p*this.h : p*this.w, d=t>Math.abs(o) ? 1 : -1;
		t=t*-1;
		this.c=p;
		if(this.g)
		{
			for(var i=0;i<this.l;i++)
			{
				this.g[i].className=i==p ? this.s : ''
			}
		}
		
		this.u.si=setInterval(new Function(this.n+'.slide('+t+','+d+','+a+')'), 16);
		
		hiliteMiniwin(p);
	},
	
	
	slide.prototype.slide = function(t,d,a)
	{
		
		var o = this.v?parseInt(this.u.style.top):parseInt(this.u.style.left);
		if(o==t)
		{
			clearInterval(this.u.si); if(a||(this.a&&this.p)){this.auto()}
			//alert("Slide an Pos X gestoppt");
		}
		else
		{
			//var v = o-Math.ceil(Math.abs(t-o)*.2)*d+'px';
			var v = o-Math.ceil(Math.abs(t-o)*.1)*d+'px';
			this.v ? this.u.style.top=v : this.u.style.left=v
		}
		
	};
	
	return{slide:slide};
}();

/*
    * Tween.regularEaseIn
    * Tween.regularEaseOut
    * Tween.regularEaseInOut
    * Tween.strongEaseIn
    * Tween.strongEaseOut
    * Tween.strongEaseInOut
    * Tween.backEaseOut
    * Tween.backEaseIn
    * Tween.backEaseInOut
    * Tween.bounceEaseOut
    * Tween.bounceEaseIn
    * Tween.bounceEaseInOut
    * Tween.elasticEaseIn
    * Tween.elasticEaseOut
    * Tween.elasticEaseInOut
*/

// var t = new Tween(object,property,easing,start,end,duration,suffixe);


//var autoslide = setInterval("slideshow()", 4000);
//var slideNo = -1;

function slideshow()
{
	slideNo ++;
	if(slideNo > 5) slideNo = 0;
	
	var tween = new Tween(document.getElementById('sliderul').style, 'left', Tween.regularEaseOut, (slideNo * -976), ((slideNo + 1) * -976), 0.5, 'px');
	tween.start();
	window.status = "start: " + (slideNo * -976) + " | end: " + ((slideNo + 1) * -976);
}



function hiliteMiniwin(x)
{
	global_win = x;
	var listItems = document.getElementById("miniwins").getElementsByTagName("li");
	
	for(var i = 0; i < 6; i ++)
	{
		//document.getElementById('win' + i).style.backgroundImage = "url('pix/miniwin_top.jpg')";
		document.getElementById('miniwin' + i).style.backgroundImage = "url('pix/miniwin_bottom_2.jpg')";
		document.getElementById('p' + i).style.color = "#555555";
		document.getElementById('ul' + i).style.listStyle = "url('pix/list_point_2.png')";
		// Listpoints
		/*
		for(var j = 0; j < 3; j ++)
		{
			listItems[((i * 3) + j)].style.color = "#666666";
		}
		*/
	}
	
	//document.getElementById('win' + x).style.backgroundImage = "url('pix/miniwin_top_hi.jpg')";
	document.getElementById('miniwin' + x).style.backgroundImage = "url('pix/miniwin_bottom_2_hi.jpg')";
	document.getElementById('p' + x).style.color = "#bb0000";
	document.getElementById('ul' + x).style.listStyle = "url('pix/list_point_2_hi.png')";
	// Listpoints
	/*
	for(var j = 0; j < 3; j ++)
	{
		listItems[((x * 3) + j)].style.color = "#884444";
	}
	*/
	
	/*
	b = x - 1;
	if(x == 0) b = 5;
	
	// window.status = ('p ' + x + '  b: ' + b);
	
	document.getElementById('win' + b).style.backgroundImage = altesBild;
	document.getElementById('p' + b).style.color = alteFarbe;
				
	// momentane Situation speichern
	altesBild = document.getElementById('win' + x).style.backgroundImage;
	alteFarbe = document.getElementById('p' + x).style.color;
	
	// neues Bild setzen
	document.getElementById('win' + x).style.backgroundImage = "url('../pix/miniwin_top_hi.jpg')";
	document.getElementById('p' + x).style.color = "#ffffff";
	*/
}



function changeMiniwin(id, mode)
{
	if(id != global_win)
	{
		if(mode == "over")
		{
			document.getElementById('miniwin' + id).style.backgroundImage = "url('pix/miniwin_bottom_2_hi.jpg')";
		}
		else
		{
			document.getElementById('miniwin' + id).style.backgroundImage = "url('pix/miniwin_bottom_2.jpg')";
		}
	}
}

