// JavaScript Document

var	checkInterval = null;
var timer1 = null;
var timer2 = null;
var timer3 = null;
var timer4 = null;
	function imageLine(current)
	{
		var	checkInterval = null,
			imageLineInterval = null;
			if(current=='')currentImage = -1;
		/*
			Variablen die man in
			verschiedenen Funktionen benötigt
		*/
	
		
		loadingImages = new Array();
		
		this.run = function()
		{
			checkInterval = window.setInterval('this.checkIfLoaded();', 100);
			for(i = 0;i < images.length;i++)
			{
				image = images[i];
				loadingImages.push(new Image);
				loadingImages[i].src = image;

			}
		}
		
		this.checkIfLoaded = function()
		{
			allLoaded = true;
			for(i = 0;i < loadingImages.length;i++)
			{
				loadingImage = loadingImages[i];
				if(!loadingImage.complete)
					allLoaded = false;
			}
			if(allLoaded)
			{
				window.clearInterval(checkInterval);
				this.startImageLine();
				timer1 = window.setInterval('this.startImageLine();', 5000);
			}
		}
		
		this.startImageLine = function()
		{
			this.showImage();
			if(currentImage == (loadingImages.length - 1)){
				currentImage = 0;
			}	
			else{
				currentImage += 1;
			}
			
			
			element = document.getElementById('imageline');
			element.style.height = loadingImages[currentImage].height + 'px';
			element.style.width = loadingImages[currentImage].width + 'px';
			element.style.backgroundImage = 'url(' + loadingImages[currentImage].src + ')';
			
			
			
			document.getElementById? ref = "document.getElementById" : ref = "document.all";
			eval(ref + '(textteaser)' + '.innerHTML = text[currentImage]');
			eval(ref + '(titelteaser)' + '.innerHTML = titel[currentImage]');
			
			document.getElementById('flag1').className = "deactive";
			document.getElementById('flag2').className = "deactive";
			document.getElementById('flag3').className = "deactive";
			document.getElementById(flags[currentImage]).className = "active";			
			
			
			//timer2 = window.setTimeout('this.hideImage();', 9500);
		}
		
		this.hideImage = function()
		{
			element = document.getElementById('imageline');
			for(i = 0;i <= 100;i++)
				window.setTimeout('element.style.filter = "Alpha(opacity=' + (100 - i) + ')"; element.style.MozOpacity = ' + (1 - i / 100) + '; element.style.opacity = ' + (1 - i / 100) + ';', i * 5);
		}
		
		this.showImage = function()
		{
			element = document.getElementById('imageline');
			//for(i = 0;i <= 100;i++)
				i = 100;
				element.style.filter = "Alpha(opacity=' + i + ')"; element.style.MozOpacity = ' + i / 100 + '; element.style.opacity = ' +  i / 100';
				//window.setTimeout('element.style.filter = "Alpha(opacity=' + i + ')"; element.style.MozOpacity = ' + i / 100 + '; element.style.opacity = ' +  i / 100 + ';', i * 5);
		}
		
		this.run();
	}

	
function stop_imageLine(){
	if(checkInterval!=null)window.clearInterval(checkInterval);
	if(timer1!=null)window.clearInterval(timer1);
	if(timer2!=null)window.clearTimeout(timer2);
}	



function showHideDL(ID,selfID){
		if(document.getElementById(ID).className != "divShow"){
			document.getElementById(ID).className = "divShow";
			if(selfID)document.getElementById(selfID).className = "divHide";
		}	
		else{
			document.getElementById(ID).className = "divHide";	
			if(selfID)document.getElementById(selfID).className = "divShow";	
		}	
}


function showHideStars(uid,name){
	
	var hauptbild = "hauptbild_"+uid;
	var img1 = "img1_"+uid;
	var img2 = "img2_"+uid;
	var img3 = "img3_"+uid;
	var img4 = "img4_"+uid;
	var img5 = "img5_"+uid;
	//alert(alluids.length);
	
	//alert(document.getElementById(hauptbild).id);
	
	if(document.getElementById(hauptbild).className == "divHide"){
	
		for(i=0;i<alluids.length;i++){
			//alert(alluids[i]);
			//alert('hauptbild_'+alluids[i]);
			document.getElementById('hauptbild_'+alluids[i]).className = "hauptbild divShow";
			document.getElementById('img1_'+alluids[i]).className = "img1 divShow";
			document.getElementById('img2_'+alluids[i]).className = "img2 divShow";
			document.getElementById('img3_'+alluids[i]).className = "img3 divShow";
			document.getElementById('img4_'+alluids[i]).className = "img4 divShow";
			document.getElementById('img5_'+alluids[i]).className = "img5 divShow";
		}
		//if(hauptbild)document.getElementById(hauptbild).className = "hauptbild divShow";
	}
	
	
	//alert(hauptbild);
	if(hauptbild)document.getElementById(hauptbild).className = "divHide";
	if(img1)document.getElementById(img1).className = "divHide";
	if(img2)document.getElementById(img2).className = "divHide";
	if(img3)document.getElementById(img3).className = "divHide";
	if(img4)document.getElementById(img4).className = "divHide";
	if(img5)document.getElementById(img5).className = "divHide";

}


function writeDiv(div,hbild){
	document.getElementById? ref = "document.getElementById" : ref = "document.all";

	var text = '<a href="uploads/tx_ccstars/'+hbild+'" rel="lytebox[stars]" title="David Castan"><img src="uploads/tx_ccstars/'+hbild+'" width="215" height="323" border="0"  class="paddingBottomNull" alt="" title="" /></a>';
	eval(ref + '(div)' + '.innerHTML = text');

}	

function writeBreadcrum(div,text){
	document.getElementById? ref = "document.getElementById" : ref = "document.all";
	eval(ref + '(div)' + '.innerHTML = text');
}

function writeBreadcrumError(div,text){
	document.getElementById? ref = "parent.document.getElementById" : ref = "document.all";
	eval(ref + '(div)' + '.innerHTML = text');
}