var baseurl = 'http://www.raiffeisenevolution.com/';
//var baseurl = 'http://raiffeisen.idsolutions.at/';


function menushow(element) {
  ulelement = element.firstChild;
  if (ulelement.tagName == 'A') {
    act = ulelement;
  }
  else {
    act = false;
  }
    if (act) {	
    	act.style.backgroundPosition='0 0';
    	act.style.color='#908271';
  }
  if (document.getElementById('playpauselink')) {
	  document.getElementById('playpauselink').style.zIndex = '0';
  }
}

function menuhide(element) {
  ulelement = element.firstChild;
  if (ulelement) {
    if (ulelement.tagName == 'A') {
      act = ulelement;
    }
    else {
      act = false;
    }
    if (act) {
    	act.style.backgroundPosition='0 -67px';
		if (act.className !='active')
    		act.style.color='#e9ebef';
    }
  }
  if (document.getElementById('playpauselink')) {
	  document.getElementById('playpauselink').style.zIndex = '1';
  }  
}

var onLoadAction = false;

function onLoadFunction() {
	if (onLoadAction == false) {
		if (document.getElementById('container')) {	
			if ((document.getElementById('container').offsetHeight)>(document.getElementById('bottomhelp').offsetHeight-29)) {
				//alert(document.getElementById('container').offsetHeight);
				//alert(document.getElementById('bottomhelp').offsetHeight);
				document.getElementById('bottommenu').style.height = (document.getElementById('container').offsetHeight)-(document.getElementById('bottomhelp').offsetHeight)-29+"px";
				document.getElementById('fullcontainer').style.height = document.getElementById('container').offsetHeight+"px";
				//alert(document.getElementById('bottommenu').style.height);
			}
		}
	}
	onLoadAction = true;
}
function displayDivDP(objectname) {
	if (document.getElementById(objectname).style.display == 'none') {
		document.getElementById(objectname).style.display = '';
	}
	else {
		document.getElementById(objectname).style.display = 'none';
	}
}
function displayDiv(objectname) {
	if (document.getElementById(objectname).style.visibility == 'hidden') {
		document.getElementById(objectname).style.visibility = 'visible';
	}
	else {
		document.getElementById(objectname).style.visibility = 'hidden';
	}
}
function displayDivValue(objectname,objectvalue) {
	if (document.getElementById(objectname).style.visibility == 'hidden') {
		document.getElementById(objectname).style.visibility = 'visible';
	}
	else {
		document.getElementById(objectname).style.visibility = 'hidden';
		document.getElementById(objectname+'Value').value = objectvalue;
		document.getElementById(objectname+'Span').innerHTML = objectvalue;	
	}
}
function displayDivValueFrage(objectname,objectvalue,zusatztext) {
	if (document.getElementById(objectname).style.visibility == 'hidden') {
		document.getElementById(objectname).style.visibility = 'visible';
	}
	else {
		document.getElementById(objectname).style.visibility = 'hidden';
		document.getElementById(objectname+'Value').value = objectvalue;
		document.getElementById(objectname+'Span').innerHTML = objectvalue;	
	}
	//document.getElementById('fragezusatz').value = zusatztext;
	document.getElementById('fieldsSubmit').style.visibility = 'visible';
}
function openDiv(divid){

	document.getElementById('fieldsEmail').style.display = 'none';
	document.getElementById('fieldsPost').style.display = 'none';
	document.getElementById('fieldsTelefon').style.display = 'none';
	document.getElementById(divid).style.display = '';
	document.getElementById('fieldsBottom').style.display = '';
	/*
	if (objectvalue == 'Email') {
		document.getElementById('fieldsEmail').style.display = '';
		document.getElementById('fieldsPost').style.display = 'none';
		document.getElementById('fieldsTelefon').style.display = 'none';
	}

	if (objectvalue == 'Post') {	
		document.getElementById('fieldsEmail').style.display = 'none';
		document.getElementById('fieldsPost').style.display = '';
		document.getElementById('fieldsTelefon').style.display = 'none';
		document.getElementById('fieldsBottom').style.display = '';
	}	
	if (objectvalue == 'Telefon') {
		document.getElementById('fieldsEmail').style.display = 'none';
		document.getElementById('fieldsPost').style.display = 'none';
		document.getElementById('fieldsTelefon').style.display = '';
		document.getElementById('fieldsBottom').style.display = '';
	}	*/
}
function stopPlayAnimation() {
	 if (autoChangeImage==true) 
	 {	
		document.getElementById('playpause_image').src='fileadmin/template01/img/pause.gif';
		autoChangeImage=false; 
	 }
	 else
	 {
		document.getElementById('playpause_image').src='fileadmin/template01/img/play.gif';
		autoChangeImage=true;
	 }
}

var http = null;
if (window.XMLHttpRequest) {
	http = new XMLHttpRequest();
} else if (window.ActiveXObject) {
	http = new ActiveXObject("Microsoft.XMLHTTP");
}
function submitContact(tabLink) {
	if (http != null){
		var params ='tx_idsprojects_pi1[vorname]='+document.getElementById('vorname').value+
					'&tx_idsprojects_pi1[nachname]='+document.getElementById('nachname').value+
					'&tx_idsprojects_pi1[firmenname]='+document.getElementById('firmenname').value+
					'&tx_idsprojects_pi1[information]='+document.getElementById('infoBoxValue').value+
					'&tx_idsprojects_pi1[email]='+document.getElementById('email').value+
					'&tx_idsprojects_pi1[telefon]='+document.getElementById('telefon').value+
					'&tx_idsprojects_pi1[zimmer1]='+document.getElementById('zimmer1').checked+
					'&tx_idsprojects_pi1[zimmer2]='+document.getElementById('zimmer2').checked+
					'&tx_idsprojects_pi1[zimmer3]='+document.getElementById('zimmer3').checked+
					'&tx_idsprojects_pi1[zimmer4]='+document.getElementById('zimmer4').checked+
					'&tx_idsprojects_pi1[zimmer5]='+document.getElementById('zimmer5').checked+
					'&tx_idsprojects_pi1[penthouse]='+document.getElementById('penthouse').checked+
					'&tx_idsprojects_pi1[reihenhaus]='+document.getElementById('reihenhaus').checked+
					'&tx_idsprojects_pi1[buero]='+document.getElementById('buero').checked+
					'&tx_idsprojects_pi1[retail]='+document.getElementById('retail').checked+
					'&tx_idsprojects_pi1[telefon_tel]='+document.getElementById('telefon_tel').value+
					'&tx_idsprojects_pi1[email_tel]='+document.getElementById('email_tel').value+
					'&tx_idsprojects_pi1[strasse]='+document.getElementById('strasse').value+
					'&tx_idsprojects_pi1[plz]='+document.getElementById('plz').value+
					'&tx_idsprojects_pi1[ort]='+document.getElementById('ort').value+
					'&tx_idsprojects_pi1[land]='+document.getElementById('land').value+
					'&tx_idsprojects_pi1[telefon_post]='+document.getElementById('telefon_post').value+
					'&tx_idsprojects_pi1[interessetext]='+document.getElementById('interessetext').value+
					'&tx_idsprojects_pi1[frage]='+document.getElementById('frageBoxValue').value+
					'&tx_idsprojects_pi1[fragezusatz]='+document.getElementById('fragezusatz').value;

		document.getElementById('ids_project_content').innerHTML = "<div class='load-ajax'><img src='fileadmin/template01/img/ajax-loader.gif' /></div>";
		http.open("POST", tabLink,true);
		
		http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		
		
		http.onreadystatechange = outputTab;
		http.send(params);
		
		onLoadAction = false;
		onLoadFunction();
	}	

}
function displayTab(tabLink,linkid) {
	if (http != null){
		document.getElementById('ids_project_content').innerHTML = "<div class='load-ajax'><img src='fileadmin/template01/img/ajax-loader.gif' /></div>";
		
		var allATags = document.getElementById('reiter').getElementsByTagName('a');
		for(var i = 0; i < allATags.length; i++)
		{
			if (allATags[i].className == 'activelong') allATags[i].className = 'long';
			if (allATags[i].className == 'active') allATags[i].className = ''; 
		}	
		if (document.getElementById(linkid).className == 'long') document.getElementById(linkid).className = 'activelong';
		if (document.getElementById(linkid).className == '') document.getElementById(linkid).className = 'active'; 
		http.open("GET", tabLink,true);
		http.onreadystatechange = outputTab;
		http.send(null);
		
		onLoadAction = false;
		onLoadFunction();
		
		//if (linkid =='topslink') document.getElementById('beratungHeadlineTop').style.display ='';
		//	else  document.getElementById('beratungHeadlineTop').style.display ='none';
	}	

}
function displayTop(topLink,linkid) {
	if (http != null){
		document.getElementById('ids_project_topcontent').innerHTML = "<div class='load-ajax-top'><img src='fileadmin/template01/img/ajax-loader.gif' /></div>";
		
		var allATags = document.getElementById('ids_project_topmenu').getElementsByTagName('a');
		for(var i = 0; i < allATags.length; i++)
			{ allATags[i].className = '';  }
		document.getElementById(linkid).className = 'active';
		
		http.open("GET", topLink,true);
		http.onreadystatechange = outputTop;
		http.send(null);
		
		onLoadAction = false;
		onLoadFunction();;
	}
}
function outputTab() {
	
	if (http.readyState == 4) {
		
		document.getElementById('ids_project_content').innerHTML = http.responseText;

		jQuery(document).ready(function() {
			jQuery("#featureCarouselProject").featureCarousel({
				// include options like this:
				// (use quotes only for string values, and no trailing comma after last option)
				// option: value,
				autoPlay: 7000,
				topPadding: 44,
				sidePadding: 12,
				smallFeatureOffset:52,
				largeFeatureWidth: 365,
				largeFeatureHeight: 221,
				smallFeatureWidth: 148,
				smallFeatureHeight: 123
			});
		});
		
		jQuery(document).ready(function(){
			//To switch directions up/down and left/right just place a "-" in front of the top/left attribute
			//Full Caption Sliding (Hidden to Visible)
			jQuery('.imagehome').hover(function(){
				jQuery(".cover", this).stop().animate({top:'123px'},{queue:false,duration:160});
			}, function() {
				jQuery(".cover", this).stop().animate({top:'200px'},{queue:false,duration:160});
			});
		});	
		
	}	
}
function outputTop() {
	if (http.readyState == 4) {
		document.getElementById('ids_project_topcontent').innerHTML = http.responseText;
		
	}
}

function displayPopup(landid) {
	if (document.getElementById("popup_"+landid)) {
		document.getElementById("popup_1").style.visibility = 'hidden';
		document.getElementById("popup_2").style.visibility = 'hidden';
		document.getElementById("popup_3").style.visibility = 'hidden';
		document.getElementById("popup_4").style.visibility = 'hidden';
		document.getElementById("popup_5").style.visibility = 'hidden';
		document.getElementById("popup_6").style.visibility = 'hidden';
		document.getElementById("popup_7").style.visibility = 'hidden';
		document.getElementById("popup_8").style.visibility = 'hidden';
		document.getElementById("popup_9").style.visibility = 'hidden';
		document.getElementById("popup_10").style.visibility = 'hidden';
		document.getElementById("popup_11").style.visibility = 'hidden';
		document.getElementById("popup_12").style.visibility = 'hidden';

		document.getElementById("popup_"+landid).style.visibility = 'visible';
	}

	if (landid == 1) document.getElementById('reference_image').style.backgroundPosition = '420px 361px';
	if (landid == 2) document.getElementById('reference_image').style.backgroundPosition = '543px 368px';
	if (landid == 3) document.getElementById('reference_image').style.backgroundPosition = '507px 203px';
	if (landid == 4) document.getElementById('reference_image').style.backgroundPosition = '468px 303px';
	if (landid == 5) document.getElementById('reference_image').style.backgroundPosition = '556px 345px';
	if (landid == 6) document.getElementById('reference_image').style.backgroundPosition = '492px 417px';
	if (landid == 7) document.getElementById('reference_image').style.backgroundPosition = '492px 425px';
	if (landid == 8) document.getElementById('reference_image').style.backgroundPosition = '593px 432px';
	if (landid == 9) document.getElementById('reference_image').style.backgroundPosition = '620px 365px';
	if (landid == 10) document.getElementById('reference_image').style.backgroundPosition = '666px 474px';
	if (landid == 11) document.getElementById('reference_image').style.backgroundPosition = '593px 0px';
	if (landid == 12) document.getElementById('reference_image').style.backgroundPosition = '649px 228px';

	document.getElementById('reference_image').style.backgroundImage = 'url(fileadmin/template01/img/referenzmaps/re_'+landid+'s.jpg)';
}
function hidePopup(landid) {
	if (document.getElementById("popup_"+landid)) {
		document.getElementById("popup_"+landid).style.visibility = 'hidden';
	}
	document.getElementById('reference_image').style.backgroundImage = 'none';
}
function setBackground(itemid) {
	if (document.getElementById("bgitem_"+itemid)) {
		document.getElementById("bgitem_"+itemid).style.backgroundColor='#DBD7CE';
	}
}
function hideBackground(itemid) {
	if (document.getElementById("bgitem_"+itemid)) {
		document.getElementById("bgitem_"+itemid).style.backgroundColor='#FFF';
	}
}
function goToPage(linkurl) {
	self.location.href = baseurl+linkurl;	
}
function goToNews(itemid) {
	var allATags = document.getElementById("bgitem_"+itemid).getElementsByTagName('a');
	for(var i = 0; i < allATags.length; i++)
	{
		document.location.href = allATags[i].href;
	}	
}



