
var alteVersion = true;

var newWin;

function switchLanguage(fromLang, toLang) 
{
	if (newWin) newWin.close();
	
	
	if (alteVersion) {
		/*
		statische Weiterleitung zur Startseite der alten englischen Version
		*/
		
		var path = 'http://www.wscad.de/english/home_eng.html';
	}
	else {
		/*
		dynamische Weiterleitung zur entsprechenden Seite
		*/
		
		var url  = String(window.location);
		var def  = url.indexOf(fromLang + '/');
		var root = url.slice(0, def);
		var doc  = url.slice(def + fromLang.length);
		
		
				/*
				AUSNAHMEN:
				Umleitungen zu Alternativ-Seiten, wenn Zielseiten nicht existieren:
				*/
	
				
				/*
				Deutsch -> Englisch
				*/
				if (fromLang == 'deutsch' && toLang == 'english')
				{
					if		(doc == '/downloads_support/it_updates.php')	doc = '/downloads_support/uebersicht.php';
					else if (doc == '/produkte_hlk.php')					doc = '/produkte_wscadwin_uebersicht.php';
					else if (doc == '/produkte_wscadit_basisversion.php')	doc = '/produkte_uebersicht.php';
					else if (doc == '/produkte_wscadit_leistung.php')		doc = '/produkte_uebersicht.php';
					else if (doc == '/produkte_wscadit_lightversion.php')	doc = '/produkte_uebersicht.php';
					else if (doc == '/produkte_wscadit_zusatzmodule.php')	doc = '/produkte_uebersicht.php';
					else if (doc == '/produkte_wscadit_profiversion.php')	doc = '/produkte_uebersicht.php';
					else if (doc == '/produkte_wscadit_uebersicht.php')		doc = '/produkte_uebersicht.php';
					else if (doc == '/seminare_a44xl.php')					doc = '/seminare_uebersicht.php';
					else if (doc == '/seminare_m44l.php')					doc = '/seminare_uebersicht.php';
					else if (doc == '/seminare_m44xs.php')					doc = '/seminare_uebersicht.php';
					else if (doc == '/seminare_pit24xl.php')				doc = '/seminare_uebersicht.php';
					else if (doc == '/seminare_m44xl.php')					doc = '/seminare_uebersicht.php';
					else if (doc == '/seminare_termine.php')				doc = '/seminare_uebersicht.php';
				}
				
		var path = root + toLang + doc;
	}
	

	window.location.href = path;
}

function popUpImg (img, size, title) 
{
	if (newWin) newWin.close();
	var url = encodeURI('popup.php?title=' + title + '&img=' + img);
	var id = 'pop';// + String(Math.random()).substr(2);
  	newWin = window.open(url, id, size);
	newWin.focus();
}

function popUpStatic (url, size) 
{
	if (newWin) newWin.close();
  	newWin = window.open(url, 'pop', size);
	newWin.focus();
}

