// JavaScript Document
millisec = 200;
var object = "";
function fadeout(id, millisec) {
    if(document.getElementById(id).style.opacity == 1) { 
        opacity(id, 100, 0, millisec); 
    }
	//object ="";
}
function fadein(id, millisec) { 
    if(document.getElementById(id).style.opacity == 0) {
        opacity(id, 0, 100, millisec); 
    } 
}
function shiftOpacity(id, millisec) {
    //if an element is invisible, make it visible, else make it ivisible
    if((document.getElementById(id).style.opacity == 0) || (!document.getElementById(id).style.opacity)) {
		//if (object != ""){fadeout(object,200);}
        opacity(id, 0, 100, millisec);
		if ((object != "") && (object != id)){opacity(object, 100, 0, millisec);}
		object = id;
    } else {
        opacity(id, 100, 0, millisec);
		object = "";
 	}
}
function shiftOpacityL(id, millisec) {
    //if an element is invisible, make it visible, else make it ivisible
    if((document.getElementById(id).style.opacity == 0) || (!document.getElementById(id).style.opacity)) {
		//if (object != ""){fadeout(object,200);}
        opacity(id, 0, 60, millisec);
		if ((object != "") && (object != id)){opacity(object, 100, 0, millisec);}
		object = id;
    } else {
        opacity(id, 60, 0, millisec);
		object = "";
 	}
}



function chgimg(obj,src){
	obj.src=src;
}
function showme(id) {
//  if(document.getElementById(id).style.visibility == 'visible') {
// 	document.getElementById(id).style.visibility = 'hidden';
//  }
//  else{
  		document.getElementById(id).style.visibility = 'visible';
//  }
} 
function hideme(id) {
//  if(document.getElementById(id).style.visibility == 'visible') {
// 	document.getElementById(id).style.visibility = 'hidden';
//  }
//  else{
  		document.getElementById(id).style.visibility = 'hidden';
//  }
}
function init(){
	
	
}
function reinit(){
/*if(document.all){
	location.href = window.location;
	}*/
}
function mailMe(sDom, sUser){
  sDom = sDom.replace(/ö/g,"oe");
  sDom = sDom.replace(/ü/g,"ue");
  sDom = sDom.replace(/ä/g,"ae");
  document.write("<a href=\"mail"+"to:"+sUser.replace(/%23/g,".")+"@"+sDom.replace(/%23/g,".")+"\">"+sUser.replace(/%23/g,".")+"@"+sDom.replace(/%23/g,".")+"</a>"); 
}
function showWindow(url){
var myWindow = window.open(url,'myWindow',"width=920,height=700");
myWindow.focus();
}

/*-----------------------------------------------------------
	Toggles element's display value
	Input: any number of element id's
	Output: none
	---------------------------------------------------------*/
function toggleDisp() {
	for (var i=0;i<arguments.length;i++){
		var d = $(arguments[i]);
		if (d.style.display == 'none')
			d.style.display = 'block';
		else
			d.style.display = 'none';
	}
}
/*-----------------------------------------------------------
	Toggles tabs - Closes any open tabs, and then opens current tab
	Input:     1.The number of the current tab
					2.The number of tabs
					3.(optional)The number of the tab to leave open
					4.(optional)Pass in true or false whether or not to animate the open/close of the tabs
	Output: none
	---------------------------------------------------------*/
function toggleTab(num,numelems,opennum,animate) {
	if ($('tabContent'+num).style.display == 'none'){
		for (var i=1;i<=numelems;i++){
			if ((opennum == null) || (opennum != i)){
				var temph = 'tabHeader'+i;
				var h = $(temph);
				if (!h){
					var h = $('tabHeaderActive');
					h.id = temph;
				}
				var tempc = 'tabContent'+i;
				var c = $(tempc);
				if(c.style.display != 'none'){
					if (animate || typeof animate == 'undefined')
						Effect.toggle(tempc,'appear',{duration:0.5, queue:{scope:'menus', limit: 3}});
					else
						toggleDisp(tempc);
				}
			}
		}
		var h = $('tabHeader'+num);
		if (h)
			h.id = 'tabHeaderActive';
		h.blur();
		var c = $('tabContent'+num);
		c.style.marginTop = '2px';
		if (animate || typeof animate == 'undefined'){
			Effect.toggle('tabContent'+num,'appear',{duration:0.5, queue:{scope:'menus', position:'end', limit: 3}});
		}else{
			toggleDisp('tabContent'+num);
		}
	}
}


var ScrollUp=0;
var ScrollDown="int";

function moveUp()
{
	if (ScrollUp>0){
    new Effect.MoveBy('picsInside', 160, 0 , 
                              {
                                  duration: 0.4,  
                                  transition: Effect.Transitions.slowstop
                              });
	ScrollDown++;
	ScrollUp--;
	if(ScrollUp==0){
		$('is_ico_arrowup').src='/img/is_ico_arrowup_d.png';
	}
	if(ScrollDown>0){
		$('is_ico_arrowdown').src='/img/is_ico_arrowdown.png';
	}
	}
}

function moveDown()
{
	if (ScrollDown == "int"){
	tmpScrollDown = $('picsInside').offsetHeight / parseInt( $('picsBox').style.height.replace(/px/,'') );
		if (tmpScrollDown > 1){
			ScrollDown = Math.ceil(tmpScrollDown);
		}
		else{
			ScrollDown = 0;
		}
	}
	if( ( $('picsInside').offsetHeight > parseInt($('picsBox').style.height.replace(/px/,"")) ) && (ScrollDown > 0) ){
    new Effect.MoveBy('picsInside', -160, 0 , 
                              {
                                  duration: 0.4,  
                                  transition: Effect.Transitions.slowstop
                              });
	
	
	
	ScrollDown--;
	ScrollUp++;
	if(ScrollUp>0){
		$('is_ico_arrowup').src='/img/is_ico_arrowup.png';
	}
	if(ScrollDown==0){
		$('is_ico_arrowdown').src='/img/is_ico_arrowdown_d.png';
	}
	}
}
var ScrollUpG=0;
var ScrollDownG="int";

function moveUpG()
{
	if (ScrollUpG>0){
    new Effect.MoveBy('picsInsideG', 160, 0 , 
                              {
                                  duration: 0.4,  
                                  transition: Effect.Transitions.slowstop
                              });
	ScrollDownG++;
	ScrollUpG--;
	if(ScrollUpG==0){
		$('is_ico_arrowupG').src='/img/is_ico_arrowup_d.png';
	}
	if(ScrollDownG>0){
		$('is_ico_arrowdownG').src='/img/is_ico_arrowdown.png';
	}
	}
}

function moveDownG()
{
	if (ScrollDownG == "int"){
	tmpScrollDownG = $('picsInsideG').offsetHeight / parseInt( $('picsBoxG').style.height.replace(/px/,'') );
		if (tmpScrollDown > 1){
			ScrollDownG = Math.ceil(tmpScrollDown);
		}
		else{
			ScrollDownG = 0;
		}
	}
	if( ( $('picsInsideG').offsetHeight > parseInt($('picsBoxG').style.height.replace(/px/,"")) ) && (ScrollDownG > 0) ){
    new Effect.MoveBy('picsInsideG', -160, 0 , 
                              {
                                  duration: 0.4,  
                                  transition: Effect.Transitions.slowstop
                              });
	
	
	
	ScrollDownG--;
	ScrollUpG++;
	if(ScrollUpG>0){
		$('is_ico_arrowupG').src='/img/is_ico_arrowup.png';
	}
	if(ScrollDownG==0){
		$('is_ico_arrowdownG').src='/img/is_ico_arrowdown_d.png';
	}
	}
}
function chgarrow(obj,src){
	if (obj.src.indexOf("_d") == -1){
	obj.src=src;
	}
}


//sets classes to first and last items in listmenue
//obj = menue-id
function styleListMenue(obj){
	var myLists = document.getElementById(obj).getElementsByTagName('ul');
	for (var  i = 0; i < myLists.length; i++) {
		var tempList = new Array();
		for (m=0;m < myLists[i].childNodes.length;m++){
			if (myLists[i].childNodes[m].nodeName.toLowerCase() == 'li'){
				tempList.push(myLists[i].childNodes[m]);
			}
		}
	tempList[0].className = "first-item-in-menu";
	tempList[tempList.length-1].className = "last-item-in-menu";
	}
	
	var rootList = document.getElementById(obj);
		var tempList = new Array();
		for (i=0; i< rootList.childNodes.length; i++){
			if (rootList.childNodes[i].nodeName.toLowerCase() == 'li'){
				tempList.push(rootList.childNodes[i]);
			}
		}
	tempList[0].className = "first-item-in-menu";
	tempList[tempList.length-1].className = "last-item-in-menu";
}


//set flash properties
function flashobj(flashId) {
  if (navigator.appName.indexOf("Microsoft") !=-1) {
    return window[flashId]
  }
  else {
    return document[flashId]
  }
}

function setFlashVar(flashId, flash_variable, flash_value) {
  flashobj(flashId).SetVariable(flash_variable, flash_value);
}
function fromFlash(command) {
	if (command == "hidemenue") {
			listMenuRootResult.hideAll();
			hideme('overmenueresult');
			setFlashVar('ah_karte','disabled','false');
		}	
}
