
	  
	  function toggleBranch(id) {
	if($('id_' + id) != null) {
		if($('id_' + id).hasClassName('open')) {
			$('id_' + id).removeClassName('open');
			$('id_' + id).addClassName('closed');
		} else if($('id_' + id).hasClassName('closed')) {
			$('id_' + id).removeClassName('closed');
			$('id_' + id).addClassName('open');
		}
	}
	/*	if($('innerCatWrapper_' + id).hasClass('open')) {
			$('innerCatWrapper_' + id).removeClass('open');
			$('innerCatWrapper_' + id).addClass('close');
			if($('h3_' + id) != null) {
				$('h3_' + id).removeClass('open');
				$('h3_' + id).addClass('close');
			}
			if($('h4_' + id) != null) {
				$('h4_' + id).removeClass('open');
				$('h4_' + id).addClass('close');
			}
		} else {
			$('innerCatWrapper_' + id).removeClass('close');
			$('innerCatWrapper_' + id).addClass('open');
			if($('h3_' + id) != null) {
				$('h3_' + id).removeClass('close');
				$('h3_' + id).addClass('open');
			}
			if($('h4_' + id) != null) {
				$('h4_' + id).removeClass('close');
				$('h4_' + id).addClass('open');
			}
		}
	}*/
}

function toggleBulatsLayer(id) {
	if($('layer_'+id).hasClassName('invisible')) {
		for(var i = 1; i<= 1; i++) {
		    $('layer_'+i).addClassName('invisible');
		}

   	$('layer_'+id).removeClassName('invisible');
   	$('layer_frame').removeClassName('invisible');
   } else {
      $('layer_'+id).addClassName('invisible');
      $('layer_frame').addClassName('invisible');
   }
}

function openWindow(url,width,Height,scrolling) {
	var fenster = window.open(url, "_blank", "width=" + width + ", height=" + Height + ", resizable=no, scrollbars=" + scrolling);
	fenster.focus();
}
function open360()
{
	domain = document.domain;
	reg = /(wysiwyg)/i;
	found = domain.match( reg );
	reg2 = /(staging)/i;
	found2 = domain.match( reg2 );

	if(found == null && found2 == null) {
		openWindow('/360.html?xtatc=INT-6-0','895','590');
	} else {
		openWindow('/360.html','895','590');
	}
}

function sendmailto(mail1,mail2)
{
	document.location.replace('mailto:'+mail1+'@'+mail2);
}



/*****************************
			Routenplaner
*****************************/

function checkRouting()
{
	f = document.getElementById("route_calculator");
	saddr = f.street.value + ",+" + f.city.value + ",+" + "Deutschland";
	f.saddr.value = saddr;
	return false;
}


/******************************
		Gutschein Popup
******************************/

function gutschein($uniquekey) {
	popup = window.open("/online-gutschein/online-gutschein.html?id=" + $uniquekey, "Gutschein", "left=10, top=10, width=600, height=850");
	popup.focus();
	//popup.print(); Darf er erst bei ge?ffnetem Fenster machen...
}

function villageMovie() {
	popup = window.open("/englisch-ueben/wall-street-institute-online-community/village-movie.html", "popup", "left=100, top=100, width=500, height=300");
	popup.focus();
	//popup.print(); Darf er erst bei ge?ffnetem Fenster machen...
}



function checksonstiges(that)
{
   if ( that.value == 11 )
   {
      document.getElementById('sonstigesdiv').style.display = '';
   }
   else
   {
      document.getElementById('sonstigesdiv').style.display = 'none';
      document.getElementById('sonstiges').value = '';
   }
}

var sessionName;
var sessionID;
function initWebsite(sess_name, sess_id)
{
   sessionName = sess_name;
   sessionID   = sess_id;
}



function ajaxCallPhpFunc (namespace, phpFunction, stringParameters, onComplete) {

   //var stringParameters = sessionName + '=' + sessionID + '&' + stringParameters;
   var stringParameters = stringParameters;

   var myAjax = new Ajax.Request( '/includes/php/ajax/phpCallFunction.php?namespace=' + namespace + '&phpFunction=' + phpFunction, {
      method: 'post',
      asynchronous: true,
      parameters: stringParameters,
      onComplete: onComplete
   });
}

function ajaxCallPhpFuncCampa (namespace, phpFunction, stringParameters, onComplete) {

   //var stringParameters = sessionName + '=' + sessionID + '&' + stringParameters;
   var stringParameters = stringParameters;

   var myAjax = new Ajax.Request( '/includes/php/ajax/phpCallFunctionCampa.php?namespace=' + namespace + '&phpFunction=' + phpFunction, {
      method: 'post',
      asynchronous: true,
      parameters: stringParameters,
      onComplete: onComplete
   });
}

/* */

function mach_rewrite_link(url) {
	url = url.replace(/�/g, "ae");
	url = url.replace(/�/g, "ue");
	url = url.replace(/�/g, "oe");

	url = url.replace(/�/g, "Ae");
	url = url.replace(/�/g, "Ue");
	url = url.replace(/�/g, "Oe");

	url = url.replace(/\\/g, "");
	url = url.replace(/'/g, "");
	url = url.replace(/&quot;/g, "");
	url = url.replace(/&amp;/g, "");
	url = url.replace(/<br>/g, "");
	url = url.replace(/[()]/g, "");
	url = url.replace(/[^a-zA-Z0-9]/g, "-");

	url = url.toLowerCase();

	return (url);
}

/******************************
		E-Mail-Adresse verstecken
******************************/

function sendmailto(mail1,mail2)
{
	document.location.replace('mailto:'+mail1+'@'+mail2);
}


/* Funktion f�r Dropdown in Center-Marginalkasten*/
function goToCenterpage(at_ad_id) {
	domain = document.domain;
	reg = /(wysiwyg)/i;
	found = domain.match( reg );
	reg2 = /(staging)/i;
	found2 = domain.match( reg2 );
	//alert(found + ' ' + found2);
	if(found == null && found2 == null) {
		if(document.getElementById('centerauswahl').value != '') {
			var link = 'englischkurs-' + mach_rewrite_link(document.getElementById('centerauswahl')[document.getElementById('centerauswahl').selectedIndex].text) + '.html,c' + document.getElementById('centerauswahl').value + '&xtatc=INT-'+ at_ad_id + '-0';
		}
	} else {
		if(document.getElementById('centerauswahl').value != '') {
			var link = 'englischkurs-' + mach_rewrite_link(document.getElementById('centerauswahl')[document.getElementById('centerauswahl').selectedIndex].text) + '.html,c' + document.getElementById('centerauswahl').value;
		}
	}
	window.location.href = '/englisch-sprachschulen/' + link;
}


function goToDetailPage(at_ad_id) {
	domain = document.domain;
	reg = /(wysiwyg)/i;
	found = domain.match( reg );
	reg2 = /(staging)/i;
	found2 = domain.match( reg2 );
	//alert(found + ' ' + found2);
	if(found == null && found2 == null) {
		var auswahl = document.getElementById('centerauswahl');
		if(auswahl) {
			var str = auswahl.options[auswahl.selectedIndex].value;
			if(str == '/360.html') {
				var link = null;
			} else {
				var ca = str.split(",");
				if(ca[0] == 'center') {
					// Center
					var link = '/englisch-sprachschulen/englischkurs-' + mach_rewrite_link(document.getElementById('centerauswahl')[document.getElementById('centerauswahl').selectedIndex].text) + '.html,c' + ca[1] + '&xtatc=INT-'+ at_ad_id + '-0';
				} else if(ca[0] == 'town') {
					// Stadt
					var link = '/englisch-sprachschulen/englischkurse-in-' + mach_rewrite_link(document.getElementById('centerauswahl')[document.getElementById('centerauswahl').selectedIndex].text) + '.html,s' + ca[1] + '&xtatc=INT-'+ at_ad_id + '-0';
				}
			}
		}
	} else {
		var auswahl = document.getElementById('centerauswahl');
		if(auswahl) {
			var str = auswahl.options[auswahl.selectedIndex].value;
			if(str == '/360.html') {
				var link = null;
			} else {
				var ca = str.split(",");
				if(ca[0] == 'center') {
					// Center
					var link = '/englisch-sprachschulen/englischkurs-' + mach_rewrite_link(document.getElementById('centerauswahl')[document.getElementById('centerauswahl').selectedIndex].text) + '.html,c' + ca[1];
				} else if(ca[0] == 'town') {
					// Stadt
					var link = '/englisch-sprachschulen/englischkurse-in-' + mach_rewrite_link(document.getElementById('centerauswahl')[document.getElementById('centerauswahl').selectedIndex].text) + '.html,s' + ca[1];
				}
			}
		}
	}
	if(link != null) {
		window.location.href = link;
	} else {
		open360();
	}
}



function goToBundesland() {
	if(document.getElementById('centerauswahl').value != '') {
		var link = '/unsere-center/region-bayern.html,r' + document.getElementById('centerauswahl').value;
		window.location.href = link;
	}
}

/*function goToCenter() {
	if(document.getElementById('centerauswahl').value != '') {
		var link = '/unsere-center/center.html,c' + document.getElementById('centerauswahl').value;
		window.location.href = link;
	}
}*/



/******************************
		Englischtest
******************************/

function etNextQuestion() {
	document.englischtest.submit();
}

function hideETButton() {
	$('etSubmitButton').style.display = 'none';

}

/******************************
		lp-bulats
******************************/

/***********************************
		Forms - Woher kennen Sie uns
************************************/

function fillKnownFrom(selectObject) {
	var selIndex = selectObject.options[selectObject.selectedIndex].value;
	if( selIndex == 0 )
		return;
	
	var myAjax = new Ajax.Request( '/includes/php/ajax/fillKnownFrom.php', {
		method: 'post',
		asynchronous: true,
		parameters: { index: selIndex },
		onComplete: function(transport) {
			var woher = $("woher");
			var json = transport.responseText.evalJSON();
			
			woher.innerHTML = '<option value="0">Bitte w&auml;hlen...</option>';
			
			var count = 0;
			json.each(function(k, v) {
				var option = new Element("option");
				option.value = k.id;
				option.text = k.value;
				woher.options[woher.options.length] = option;
				count++;
			});
			if( count >= 1 ) {
				$("woherForm").style.display = "";
			}
			else {
				$("woherForm").style.display = "none";
			}
		}
	});
}
