// Check SearchValue:
function checkSearch() {
	var SearchValue = document.getElementById('SearchValue');
	if (SearchValue.value.toLowerCase() == 'suche' || SearchValue.value.toLowerCase() == 'search' || SearchValue.value == '') {
		SearchValue.value = '';
		SearchValue.focus();
		return false;
	}
}


// Open Print-Page:
function pagePrint() {
	var printwin = window.open("printpage.html", "printpage", "width=670, height=600, scrollbars=yes, resizable=yes");
	printwin.focus();
}


// ASP-Login:
function changePWinput() {
	document.getElementById('asploginpw').innerHTML = '<input type="password" name="web4password" id="asploginpassword" value=""/>';
	document.web4loginform.web4password.focus();
	document.web4loginform.web4password.focus();
}

function aspLoginCont(ContID) {
	document.web4loginform.web4logincontentid.value = ContID;
}

function aspLogin() {
	var web4comp = web4formatCompany(document.web4loginform.web4companyid.value);
	document.web4loginform.action = "http://" + web4comp.toString() + ".asp3.web4biz.de/web4system/web4.sh/WService=web4biz/content/index_main.html"; 
	var web4bizmain = 'web4bizmain' + web4comp + 'asp3';
	document.web4loginform.target = web4bizmain;
	web4bizmain = window.open('',web4bizmain,'status=no, resizable=yes, scrollbars=no, toolbar=no, location=no');
	web4bizmain.focus();		
}


// open Intranet:
function goI() {
	var intra = window.open('http://www2.ic4b.de/intranet/index.html','intranet');
	intra.focus();
}

function isMethodType(s){
	return /\b(function|object)\b/i.test(s);
}

var aktiv;
var aktivIn;
var aktivOut;
var animInArray = new Array();
var animOutArray = new Array();
var animInStep = 10;
var animOutStep = 10;
/*
function repaintAnimArray(){
	if(animInArray.length > 0 || animOutArray.length > 0 ){
		for (var i in animInArray){
			if( animInArray[i] ){
				var LeftPos = "";
				if (isMethodType(typeof getComputedStyle) && getComputedStyle){
					var curLeftPos = getComputedStyle(animInArray[i] , "backgroundPosition");
					LeftPos = curLeftPos.backgroundPosition;
					LeftPos = LeftPos.replace( /px 0/g, "" );
				}else{
					LeftPos = animInArray[i].currentStyle.backgroundPositionX;
					LeftPos = LeftPos.replace( /px/g, "" );
				}
				var intValue = parseInt( LeftPos );
				if( ( intValue + animInStep ) < 0 ){
					newLeftPos = intValue + animInStep;
					animInArray[i].style.backgroundPosition =  newLeftPos + "px 0px";
				}else{
					animInArray[i].style.backgroundPosition =  "0px 0px";
					animInArray.pop();
				}
			}
		}
		
		for (var i in animOutArray){
			if( animOutArray[i] ){
				if (isMethodType(typeof getComputedStyle) && getComputedStyle){
					var curLeftPos = getComputedStyle(animOutArray[i] , "backgroundPosition");
					LeftPos = curLeftPos.backgroundPosition;
					LeftPos = LeftPos.replace( /px 0/g, "" );
				}else{
					var LeftPos = animOutArray[i].currentStyle.backgroundPositionX;
					LeftPos = LeftPos.replace( /px/g, "" );
				}
				var intValue = parseInt( LeftPos );
				if( ( intValue - animOutStep ) > (-217) ){
					newLeftPos = intValue - animOutStep;
					animOutArray[i].style.backgroundPosition =  newLeftPos + "px 0px";
				}else{
					animOutArray[i].style.backgroundPosition =  "-217px 0px";
					animOutArray.shift();
				}
			}
		}
		
		aktiv = window.setTimeout( "repaintAnimArray()", 10 );
	}
}
*/

function repaintAnimInArray(){
	var tempInArray = new Array();
	var counterIn = 0;
	if( animInArray.length > 0 ){
		for (var i in animInArray){
			counterIn = counterIn + 1;
			if( animInArray[i] ){
				var LeftPos = "";
				if (isMethodType(typeof getComputedStyle) && getComputedStyle){
					var curLeftPos = getComputedStyle(animInArray[i] , "backgroundPosition");
					LeftPos = curLeftPos.backgroundPosition;
					LeftPos = LeftPos.replace( /px 0/g, "" );
				}else{
					LeftPos = animInArray[i].currentStyle.backgroundPositionX;
					LeftPos = LeftPos.replace( /px/g, "" );
				}
				var intValue = parseInt( LeftPos );
				/* alert(intValue); */
				if( ( intValue + animInStep ) < 0 ){
					newLeftPos = intValue + animInStep;
					animInArray[i].style.backgroundPosition =  newLeftPos + "px 0px";
				}else{
					animInArray[i].style.backgroundPosition =  "0px 0px";
					/* animInArray.shift(); */
					tempInArray.push(counterIn);
				}
			}
		}
		for (var a = 0; a < tempInArray.length; a++){
			animInArray.pop();
		}
		if(animInArray.length > 0 ){
			aktivIn = window.setTimeout( "repaintAnimInArray()", 35 );
		}
	}else{
		window.clearInterval(aktivIn);
	}
}

function repaintAnimOutArray(){
	var tempOutArray = new Array();
	var counterOut = 0;
	if( animOutArray.length > 0 ){
		for (var i in animOutArray){
			counterOut = counterOut + 1;
			if( animOutArray[i] ){
				if (isMethodType(typeof getComputedStyle) && getComputedStyle){
					var curLeftPos = getComputedStyle(animOutArray[i] , "backgroundPosition");
					LeftPos = curLeftPos.backgroundPosition;
					LeftPos = LeftPos.replace( /px 0/g, "" );
				}else{
					var LeftPos = animOutArray[i].currentStyle.backgroundPositionX;
					LeftPos = LeftPos.replace( /px/g, "" );
				}
				var intValue = parseInt( LeftPos );
				if( ( intValue - animOutStep ) > (-217) ){
					newLeftPos = intValue - animOutStep;
					animOutArray[i].style.backgroundPosition =  newLeftPos + "px 0px";
				}else{
					animOutArray[i].style.backgroundPosition =  "-217px 0px";
					/* animOutArray.shift(); */
					tempOutArray.unshift(counterOut);
				}
			}
		}
		
		for (var a = 0; a < tempOutArray.length; a++){
			
			animOutArray.pop();
		}
		if( animOutArray.length > 0 ){
			aktivOut = window.setTimeout( "repaintAnimOutArray()", 25 );
		}
	}else{
		window.clearInterval(aktivOut);
	}
}
var inCounter = 0;
function animBGIn( htmlelem ){
	window.clearInterval(aktivIn);
	animInArray.unshift( htmlelem );

	repaintAnimInArray();
}
function animBGout( htmlelem ){
	animOutArray.unshift( htmlelem );
	window.clearInterval(aktivOut);
	repaintAnimOutArray();

}




