var alteVersion = false;

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 == '/unternehmen_karriere.php')		    doc = '/unternehmen_uebersicht.php';
					else if (doc == '/produkte_building.php')				doc = '/produkte_uebersicht.php';
                    else if (doc == '/produkte_building_leistungen.php')	doc = '/produkte_uebersicht.php';
                    else if (doc == '/produkte_hlk.php')					doc = '/produkte_uebersicht.php';
                    else if (doc == '/produkte_hlk_leistungen.php')			doc = '/produkte_uebersicht.php';
//					else if (doc == '/produkte_wscad5_leistungen.php')		doc = '/produkte_uebersicht.php';
// 		    		else if (doc == '/produkte_wscad5.php')					doc = '/produkte_uebersicht.php';
                    else if (doc == '/produkte_wscad5_projectwizard.php')	doc = '/produkte_uebersicht.php';
                    else if (doc == '/produkte_wscad5_exfimport.php')		doc = '/produkte_uebersicht.php';
					else if (doc == '/produkte_wscad5_steinhauer.php')	    doc = '/produkte_uebersicht.php';
					else if (doc == '/produkte_wscad_mlt.php')  			doc = '/produkte_uebersicht.php';
					else if (doc == '/produkte_wscad5_schnittstellen.php')  doc = '/produkte_uebersicht.php';
					else if (doc == '/produkte_wscad5_dds-cad.php')  		doc = '/produkte_uebersicht.php';
					else if (doc == '/seminare_pg5.php')					doc = '/seminare_uebersicht.php';
					else if (doc == '/seminare_pa5.php')					doc = '/seminare_uebersicht.php';
					else if (doc == '/seminare_pk5.php')					doc = '/seminare_uebersicht.php';
					else if (doc == '/seminare_ck5.php')					doc = '/seminare_uebersicht.php';
					else if (doc == '/seminare_mb5.php')					doc = '/seminare_uebersicht.php';
					else if (doc == '/seminare_termine.php')				doc = '/seminare_uebersicht.php';
					else if (doc == '/seminare_ds5.php')					doc = '/seminare_uebersicht.php';
					else if (doc == '/seminare_inhouse.php')				doc = '/seminare_uebersicht.php';
					else if (doc == '/seminare_bergkirchen.php')			doc = '/seminare_uebersicht.php';
					else if (doc == '/seminare_fulda.php')					doc = '/seminare_uebersicht.php';
					else if (doc == '/seminare_mettingen.php')				doc = '/seminare_uebersicht.php';					
					else if (doc == '/seminare_tuebingen.php')				doc = '/seminare_uebersicht.php';					
				}
                                 if (fromLang == 'english' && toLang == 'deutsch')
				{
					if	(doc == '/produkte_wscadit_uebersicht.php')			doc = '/produkte_uebersicht.php';
					else if (doc == '/produkte_wscadit_zusatzmodule.php')			doc = '/produkte_uebersicht.php';
					else if (doc == '/produkte_wscadwin_automatikversion.php')		doc = '/produkte_uebersicht.php';
					else if (doc == '/produkte_wscadwin_grundversion.php')			doc = '/produkte_uebersicht.php';
//					else if (doc == '/produkte_wscadwin_leistung.php')			doc = '/produkte_uebersicht.php';
                    else if (doc == '/produkte_wscadwin_megaversion.php')			doc = '/produkte_uebersicht.php';
//                  else if (doc == '/produkte_wscadwin_neu.php')				doc = '/produkte_uebersicht.php';
//                  else if (doc == '/produkte_wscadwin_uebersicht.php')			doc = '/produkte_uebersicht.php';
					else if (doc == '/downloads_support/bibliotheken.php')		doc = '/downloads_support/archiv.php';
					else if (doc == '/downloads_support/datenbanken.php')		doc = '/downloads_support/archiv.php';
					else if (doc == '/downloads_support/kombiniert.php')		doc = '/downloads_support/archiv.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();
}

