var iMajorVersion = 8; // Major version of Flash required
var iMinorVersion = 0; // Minor version of Flash required
var iRevision = 0;    // Minor version of Flash required
var sPathname = unescape(window.location.href);


/**
 * Öffnet ein Popupfenster
 *
 * @param string der Link zur darzustellenden Seite
 * @param int die Höhe des Popups
 * @param int die Breite des Popups
 * @return void
 */
function openPopup(psLink, windowName, piHeight, piWidth, pbAppendParams)
{
	iWidth = (0 == piWidth) ? 500 : piWidth;
	iHeight = (0 == piHeight) ? 500 : piHeight;
	
	var padding = (navigator.appName == "Microsoft Internet Explorer") ? 10 : 0;

	var screenw = screen.availWidth;
	var screenh = screen.availHeight;
	
	var winw = (iWidth + padding);
	var winh = (iHeight + padding);
	
	var posx = (screenw - winw) / 2;
	var posy = (screenh - winh) / 2; 
	pbAppendParams = (typeof(pbAppendParams) == "undefined") ? 1 : 0;
	var sParams = (pbAppendParams) ? "&sLayout=popup" : "";

	win = window.open(psLink+sParams, windowName,'width='+iWidth+',height='+iHeight+',top='+posy+',left='+posx+',scrollbars=yes');
	win.focus();
}


/**
 * Öffnet den Web-Assistenten
 * 
 * @param string
 * @param string
 */
function openWebAssistant(x,y)
{
	window.open("http://servicefunctions.bosch.com/user/webassistant/search.asp?country="+x+"&lang="+y,
				"webassistant",
				"width=575,height=475,left=100,top=200,resizable=yes,scrollbars=yes,status=yes,location=yes");
}


/**
 * Suchfunktion für Produktseiten
 *
 * @param	string Name des Formulars
 * @param	string Name des Select-Felds
 */
function search(psForm, psFormElem)
{
	var search = eval("document."+psForm+"."+psFormElem+".value");
	if('' != search)
	{
		location.href = search;
	}
}


// Version check based upon the values entered above
if(!DetectFlashVer(iMajorVersion, iMinorVersion, iRevision))
{
	// flash not installed - proceed to fallback pages
	switch(sPathname)
	{
		default:
			break;
		case 'http://rb-kwin.bosch.com/sg/en/automotivetechnology/overview/':
			location.href = 'index.html';
			break;
		case 'http://rb-kwin.bosch.com/sg/en/safety_comfort/drivingsafety/capscombinedactivepassivesafety/':
			location.href = 'index.html';
			break;
		case 'http://rb-kwin.bosch.com/sg/en/safety_comfort/drivingsafety/capscombinedactivepassivesafety/evolutionofsafety/':
			location.href = 'index.html';
			break;
		case 'http://rb-kwin.bosch.com/sg/en/powerconsumptionemissions/hybrid_technology/hybrid_systems/':
			location.href = 'index.html';
			break;
		case 'http://rb-kwin.bosch.com/sg/en/safety_comfort/driving_comfort/driverassistancesystems/adaptivecruisecontrolacc/':
			location.href = 'index.html';
			break;
		case 'http://rb-kwin.bosch.com/sg/en/safety_comfort/driving_comfort/driverassistancesystems/adaptivecruisecontrolacc/application_range/':
			location.href = 'index.html';
			break;
		case 'http://rb-kwin.bosch.com/sg/en/safety_comfort/driving_comfort/driverassistancesystems/parkingaid/':
			location.href = 'index.html';
			break;
		case 'http://rb-kwin.bosch.com/sg/en/safety_comfort/driving_comfort/seatcomfort/seatadjustment/':
			location.href = 'index.html';
			break;
		case 'http://rb-kwin.bosch.com/sg/en/safety_comfort/driving_comfort/seatcomfort/electrical_drive_units/':
			location.href = 'index.html';
			break;
		case 'http://rb-kwin.bosch.com/sg/en/safety_comfort/driving_comfort/seatcomfort/pneumatic_pumps/':
			location.href = 'index.html';
			break;
		case 'http://rb-kwin.bosch.com/sg/en/safety_comfort/driving_comfort/seatcomfort/sensorics_and_electronics/':
			location.href = 'index.html';
			break;
		case 'http://rb-kwin.bosch.com/sg/en/safety_comfort/drivingsafety/wipersystems/rainsensor/operatingprinciple/':
			location.href = 'index.html';
			break;
		case 'http://rb-kwin.bosch.com/sg/en/automotivetechnology/overview/newsspecial/automaticcruisecontrol/':
			location.href = 'index.html';
			break;
		case 'http://rb-kwin.bosch.com/sg/en/automotivetechnology/overview/newsspecial/nightvision/accidentrisk/':
			location.href = 'index.html';
			break;
		case 'http://rb-kwin.bosch.com/sg/en/automotivetechnology/overview/newsspecial/nightvision/bettervisibility/':
			location.href = 'index.html';
			break;
		case 'http://rb-kwin.bosch.com/sg/en/automotivetechnology/overview/newsspecial/hybridtechnology/':
			location.href = 'index.html';
			break;
		case 'http://rb-kwin.bosch.com/sg/en/powerconsumptionemissions/hybrid_technology/':
			location.href = 'index.html';
			break;
		case 'http://rb-kwin.bosch.com/sg/en/safety_comfort/driving_comfort/driverassistancesystems/nightvision/':
			location.href = 'index.html';
			break;
		case 'http://rb-kwin.bosch.com/sg/en/safety_comfort/driving_comfort/driverassistancesystems/nightvision/':
			location.href = 'index.html';
			break;
		case 'http://rb-kwin.bosch.com/sg/en/safety_comfort/driving_comfort/driverassistancesystems/nightvision/better_visibility/':
			location.href = 'index.html';
			break;
		case 'http://rb-kwin.bosch.com/sg/en/safety_comfort/driving_comfort/driverassistancesystems/nightvision/better_visibility/':
			location.href = 'index.html';
			break;
		case 'http://rb-kwin.bosch.com/sg/en/automotivetechnology/overview/newsspecial/startstopp_startermotor/':
			location.href = 'index.html';
			break;
		case 'http://rb-kwin.bosch.com/sg/en/safety_comfort/driving_comfort/driverassistancesystems/parkingaid/parkingassistant/':
			location.href = 'index.html';
			break;
		case 'http://rb-kwin.bosch.com/sg/en/powerconsumptionemissions/electric_controls/starterforpassengercars/startstopstarter/function/':
			location.href = 'index.html';
			break;
		case 'http://rb-kwin.bosch.com/sg/en/safety_comfort/driving_comfort/driverassistancesystems/adaptivecruisecontrolacc/operatingconcept/':
			location.href = 'index.html';
			break;
		case 'http://rb-kwin.bosch.com/sg/en/automotivetechnology/overview/newsspecial/cleandiesel/':
			location.href = 'index.html';
			break;
		case 'http://rb-kwin.bosch.com/sg/en/automotivetechnology/overview/newsspecial/100mio_motronic/':
			location.href = 'index.html';
			break;
	}
}
