// This function fetches the country code for a given locale.
// Required input parameters are: locale - Name of the locale. For example, the locale for nissan.co.uk is en_GB, for nissan.ch in french language is fr_CH.
// Example: getLocaleCountry('de_CH') return the country code 'ch'.
function getLocaleCountry(locale)
{
	var countryParam	= locale.substring(locale.indexOf('_')+1, locale.length).toLowerCase();
	return countryParam;
}

// This function fetches the language code for a given locale.
// Required input parameters are: locale - Name of the locale. For example, the locale for nissan.co.uk is en_GB, for nissan.ch in french language is fr_CH.
// Example: getLocaleCountry('de_CH') return the language code 'de'.
function getLocaleLanguage(locale){
	var langParam		= locale.substring(0, locale.indexOf('_')).toLowerCase();
	return langParam;
}

// This function opens nissan site in a new window for a given country and language.
// Required input parameters are: locale - Name of the locale. For example, the locale for nissan.co.uk is en_GB, for nissan.ch in french language is fr_CH.
//								  windowParameters - Properties of the new window opened by this application. For example, height=460,width=800,status=1,toolbar=1,menubar=1, location=1 scrollbars=1 resizable=1.
// Example: gotoNissanSite('de_CH', 'height=460,width=800,status=1,toolbar=1,menubar=1, location=1 scrollbars=1 resizable=1') opens the nissan site for country Switzerland and language German.
function gotoNissanSite(locale,windowParameters){
	if(windowParameters == null){
		//var param			= "height=460,width=800,status=1,toolbar=1,menubar=1, location=1 scrollbars=1 resizable=1";

		//Code is added by Satyam for scrollbar and change window size
		var param			= "height=460,width=800,status=1,toolbar=1,menubar=1,location=1,scrollbars=1,resizable=1";
	}
	else {
		var param			= windowParameters;
	}

	var baseURL			= "http://www.nissan.";
	var langParam		= getLocaleLanguage(locale);
	var countryParam	= getLocaleCountry(locale);

	if(countryParam =='gb') countryParam = 'co.uk';
	var url = baseURL + countryParam;
	window.open(url, "nissan", param);
}

// This function opens dealer list page in a new window for a given country and language.
// Required input parameters are: locale - Name of the locale. For example, the locale for nissan.co.uk is en_GB, for nissan.ch in french language is fr_CH.
//								  windowParameters - Properties of the new window opened by this application. For example, height=460,width=800,status=1,toolbar=1,menubar=1, location=1 scrollbars=1 resizable=1.
// Example: gotoNissanDealer('de_CH', 'height=460,width=800,status=1,toolbar=1,menubar=1, location=1 scrollbars=1 resizable=1') opens the dealer list page for country Switzerland and language German.
function gotoNissanDealer(locale,windowParameters){
	if(windowParameters == null){
		//var param			= "height=460,width=800,status=1,toolbar=1,menubar=1, location=1 scrollbars=1 resizable=1";

		//Code is added by Satyam for scrollbar and change window size
		var param			= "height=460,width=800,status=1,toolbar=1,menubar=1,location=1,scrollbars=1,resizable=1";
	}
	else {
		var param			= windowParameters;
	}
	var baseURL	= "http://www.nissan.";
	var langParam		= getLocaleLanguage(locale);
	var countryParam	= getLocaleCountry(locale);

	if(countryParam=='fr') 			var url = 'http://www.nissanfrance-promotions.com/dealer/dealer-list.jsp';
	else if(countryParam=='at') 	var url = 'http://dealers.nissan.at/dealer-list.jsp';
	else if(countryParam=='pt') 	var url = 'http://dealers.nissan.pt/dealer-list.jsp';
	else if(countryParam=='ru') 	var url = 'http://www.nissan.ru/home/contact/dealer-locator/index.html';
	else if(locale=='de_CH') 		var url = 'http://dealers.nissan.ch/ch-de/dealer-list.jsp';
	else if(locale=='fr_CH') 		var url = 'http://dealers.nissan.ch/ch-fr/dealer-list.jsp';
	// BEGIN modified by Duke, Satyam to confirm if ok
	else if(countryParam=='es') 	var url = 'http://dynamic.nissan.es/home/contact/dealerlocator/index.html?ln=/es_ES';
	else if(locale=='de_DE') 		var url = 'http://www.nissan.de/home/contact/dealerlocator/index.html?ln=/de_DE';
	else if(locale=='ru_UA') 		var url = 'http://www.nissan.ua/home/contact/dealer-locator/index.html?ln=/ru_UA';
	else if(locale=='sk_SK') 		var url = 'http://dealers.nissan.sk/dealer-list.jsp';
	else if(locale=='fi_FI') 		var url = 'http://dealers.nissan.fi/dealer-list.jsp';
	else if(locale=='no_NO') 		var url = 'http://dealers.nissan.no/dealer-list.jsp';
	else if(locale=='da_DK') 		var url = 'http://dealers.nissan.dk/dealer-list.jsp';
	else if(locale=='sv_SE') 		var url = 'http://dealers.nissan.se/dealer-list.jsp';
	else if(locale=='hu_HU') 		var url = 'http://dealers.nissan.hu/';
	else if(locale=='it_IT') 		var url = 'http://dynamic.nissan.it/home/contact/dealerlocator/index.html';
	// END modified by Duke, Satyam to confirm if ok
	else if(locale=='fr_CH') 		var url = 'http://dealers.nissan.ch/ch-fr/dealer-list.jsp';
	else if(locale=='en_GB'){
		javascript:openURLAdvanced('nissan_gb&ln=/en_GB','GB');
		return;
	}
	else if(locale=='nl_NL'){
		javascript:openURLAdvanced('nissan_nl&ln=/nl_NL','NL');
		return;
	}
	// BEGIN modified by Duke, Satyam to confirm if ok
	/*else if(locale=='it_IT'){
		javascript:openURLAdvanced('nissan_it&ln=/it_IT','IT');
		return;
	}
	else if(locale=='sk_SK'){
		javascript:openURLAdvanced('nissan_sk&ln=/sk_SK','SK');
		return;
	}
	else if(locale=='de_DE'){
		javascript:openURLAdvanced('nissan_de&ln=/de_DE','DE');
		return;
	}*/
	// END modified by Duke, Satyam to confirm if ok
	else return;

	window.open(url, "nissan", param);
}

// This function opens the microsite home page in a same window for a given country, language and microsite name.
// Required input parameters are: locale - Name of the locale. For example, the locale for nissan.co.uk is en_GB, for nissan.ch in french language is fr_CH.
// Example: gotoHome('nl_NL', 'qashqai') opens the microsite home page for country Nedherland and language Nedherlands.
function gotoHome(locale, micrositeName){
	var baseURL			= "http://www.nissan.";
	var langParam		= getLocaleLanguage(locale);
	var countryParam	= getLocaleCountry(locale);
	var lnParam			= '';
	if(locale=='de_CH' || locale=='fr_CH') lnParam='?ln=/' + locale;

	if(countryParam =='gb') countryParam = 'co.uk';
	var url = baseURL + countryParam + '/home/microsite/' + micrositeName + '/fullscreen/index.html' + lnParam;
	location.href = url;
}

// This function opens the brochure page in a new window for a given country, language and vehicle code.
// Required input parameters are:	locale - Name of the locale. For example, the locale for nissan.co.uk is en_GB, for nissan.ch in french language is fr_CH.
//									vehicleCode - Vehicle Code for which the brochure is requested. For example, vehicleCode can be like K12, X83.
//								    windowParameters - Properties of the new window opened by this application. For example, height=460,width=800,status=1,toolbar=1,menubar=1, location=1 scrollbars=1 resizable=1.
// Example: gotoBrochure('de_CH', 'X83', 'height=460,width=800,status=1,toolbar=1,menubar=1, location=1 scrollbars=1 resizable=1') opens the brochure page for country Switzerland, language German and VehicleCode X83.
function gotoBrochure(locale, vehicleCode,windowParameters){
	if(windowParameters == null){
		//var param			= "height=460,width=800,status=1,toolbar=1,menubar=1, location=1 scrollbars=1 resizable=1";

		//Code is added by Satyam for scrollbar and change window size
		var param			= "height=460,width=800,status=1,toolbar=1,menubar=1,location=1,scrollbars=1,resizable=1";
	}
	else {
		var param			= windowParameters;
	}
	var baseURL			= "http://www.nissan.";
	var langParam		= getLocaleLanguage(locale);
	var countryParam	= getLocaleCountry(locale);
	var lnParam			= '';
	if(locale=='de_CH' || locale=='fr_CH') lnParam='&ln=/' + locale;

	if(countryParam =='gb') countryParam = 'co.uk';
	var url = baseURL + countryParam + '/home/contact/brochure/step1.html?brochure-request=' + vehicleCode + lnParam;
	window.open(url, "nissan", param);
}

// This function opens the test drive page in a new window for a given country, language and vehicle code.
// Required input parameters are:	locale - Name of the locale. For example, the locale for nissan.co.uk is en_GB, for nissan.ch in french language is fr_CH.
//									vehicleCode - Vehicle Code for which the test drive is requested. For example, vehicleCode can be like K12, X83.
//								    windowParameters - Properties of the new window opened by this application. For example, height=460,width=800,status=1,toolbar=1,menubar=1, location=1 scrollbars=1 resizable=1.
// Example: gotoTestDrive('de_CH', 'X83', 'height=460,width=800,status=1,toolbar=1,menubar=1, location=1 scrollbars=1 resizable=1') opens the test drive page for country Switzerland, language German and VehicleCode X83.
function gotoTestDrive(locale, vehicleCode,windowParameters){
	if(windowParameters == null){
		//var param			= "height=460,width=800,status=1,toolbar=1,menubar=1, location=1 scrollbars=1 resizable=1";

		//Code is added by Satyam for scrollbar and change window size
		var param			= "height=460,width=800,status=1,toolbar=1,menubar=1,location=1,scrollbars=1,resizable=1";
	}
	else {
		var param			= windowParameters;
	}
	var baseURL			= "http://www.nissan.";
	var langParam		= getLocaleLanguage(locale);
	var countryParam	= getLocaleCountry(locale);
	var lnParam			= '';
	if(locale=='de_CH' || locale=='fr_CH') lnParam='&ln=/' + locale;

	if(countryParam =='gb') countryParam = 'co.uk';
	var url = baseURL + countryParam + '/home/contact/testdrive/step1.html?testdrive-request=' + vehicleCode + lnParam;
	window.open(url, "nissan", param);
}

// This function opens the terms and conditions page in a new window for a given country and language.
// Required input parameters are:	locale - Name of the locale. For example, the locale for nissan.co.uk is en_GB, for nissan.ch in french language is fr_CH.
//									vehicleCode - Vehicle Code for which the test drive is requested. For example, vehicleCode can be like K12, X83.
//								    windowParameters - Properties of the new window opened by this application. For example, height=460,width=800,status=1,toolbar=1,menubar=1, location=1 scrollbars=1 resizable=1.
// Example: gotoTermsAndConditions('de_CH', 'X83', 'height=460,width=800,status=1,toolbar=1,menubar=1, location=1 scrollbars=1 resizable=1') opens the terms and conditions page for country Switzerland and language German.
function gotoTermsAndConditions(locale,windowParameters){
	if(windowParameters == null){
		//var param			= "height=460,width=800,status=1,toolbar=1,menubar=1, location=1 scrollbars=1 resizable=1";

		//Code is added by Satyam for scrollbar and change window size
		var param			= "height=460,width=800,status=1,toolbar=1,menubar=1,location=1,scrollbars=1,resizable=1";
	}
	else {
		var param			= windowParameters;
	}
	var baseURL			= "http://www.nissan.";
	var langParam		= getLocaleLanguage(locale);
	var countryParam	= getLocaleCountry(locale);
	var lnParam			= '';
	if(locale=='de_CH' || locale=='fr_CH') lnParam='?ln=/' + locale;

	if(countryParam =='gb') countryParam = 'co.uk';
	var url = baseURL  + countryParam + '/home/common/legal/index.html' + lnParam;
	window.open(url, "nissan", param);
}

// This function opens car builder page in a new window for a given country and language, for a given vehicle
// Required input parameters are: locale - Name of the locale. For example, the locale for nissan.co.uk is en_GB, for nissan.ch in french language is fr_CH.
//								  windowParameters - Properties of the new window opened by this application. For example, height=460,width=800,status=1,toolbar=1,menubar=1, location=1 scrollbars=1 resizable=1.
//									vehicleType - Type of the vehicle. For example passenger, lcv, 4x4...
//									vehicleCode - Code of the vehicle. For example, vehicleCode can be like K12, X83.
//							    windowParameters - Properties of the new window opened by this application. For example, height=460,width=800,status=1,toolbar=1,menubar=1, location=1 scrollbars=1 resizable=1.
// Example: gotoCarBuilderModel('de_CH', 'passenger', 'X83', 'height=460,width=800,status=1,toolbar=1,menubar=1, location=1 scrollbars=1 resizable=1') opens the carbuilder for country Switzerland, language German, vehicle type passenger and vehicle code X83.
function gotoCarBuilderModel(locale,vehicleType, vehicleCode,windowParameters) {
	if(windowParameters == null){
		//var param			= "height=460,width=800,status=1,toolbar=1,menubar=1, location=1 scrollbars=1 resizable=1";

		//Code is added by Satyam for scrollbar and change window size
		var param			= "height=460,width=800,status=1,toolbar=1,menubar=1,location=1,scrollbars=1,resizable=1";
	}
	else {
		var param			= windowParameters;
	}
	var baseURL			= "http://www.nissan.";
	var langParam		= getLocaleLanguage(locale);
	var countryParam	= getLocaleCountry(locale);
	var lnParam			= '';
	if(locale=='de_CH' || locale=='fr_CH') lnParam='?ln=/' + locale;

	if(countryParam =='gb') countryParam = 'co.uk';
	var url = baseURL  + countryParam + '/home/vehicles/carbuilder/' + vehicleType + '/' + vehicleCode + '/bodies.html' + lnParam;

	window.open(url, "nissan", param);
}

// This function opens car builder page in a new window for a given country and language.
// Required input parameters are: locale - Name of the locale. For example, the locale for nissan.co.uk is en_GB, for nissan.ch in french language is fr_CH.
//								  windowParameters - Properties of the new window opened by this application. For example, height=460,width=800,status=1,toolbar=1,menubar=1, location=1 scrollbars=1 resizable=1.
// Example: gotoCarBuilder('de_CH', 'height=460,width=800,status=1,toolbar=1,menubar=1, location=1 scrollbars=1 resizable=1') opens the car builder page for country Switzerland and language German.
function gotoCarBuilder(locale,windowParameters){
	if(windowParameters == null){
		//var param			= "height=460,width=800,status=1,toolbar=1,menubar=1, location=1 scrollbars=1 resizable=1";

		//Code is added by Satyam for scrollbar and change window size
		var param			= "height=460,width=800,status=1,toolbar=1,menubar=1,location=1,scrollbars=1,resizable=1";
	}
	else {
		var param			= windowParameters;
	}
	var baseURL			= "http://www.nissan.";
	var langParam		= getLocaleLanguage(locale);
	var countryParam	= getLocaleCountry(locale);
	var lnParam			= '';
	if(locale=='de_CH' || locale=='fr_CH') lnParam='?ln=/' + locale;

	if(countryParam =='gb') countryParam = 'co.uk';
	var url = baseURL  + countryParam + '/home/vehicles/carbuilder/index.html' + lnParam;
	window.open(url, "nissan", param);
}

// This function opens the vehicle features page in a new window for a given country, language, vehicle type and vehicle code.
// Required input parameters are:	locale - Name of the locale. For example, the locale for nissan.co.uk is en_GB, for nissan.ch in french language is fr_CH.
//									vehicleType - Type of the vehicle. For example passenger, lcv, 4x4...
//									vehicleCode - Code of the vehicle. For example, vehicleCode can be like K12, X83.
//								    windowParameters - Properties of the new window opened by this application. For example, height=460,width=800,status=1,toolbar=1,menubar=1, location=1 scrollbars=1 resizable=1.
// Example: gotoFeatures('de_CH', 'passenger', 'X83', 'height=460,width=800,status=1,toolbar=1,menubar=1, location=1 scrollbars=1 resizable=1') opens the vehicle features page for country Switzerland, language German, vehicle type passenger and vehicle code X83.
function gotoFeatures(locale, vehicleType, vehicleCode,windowParameters){
	if(windowParameters == null){
		//var param			= "height=460,width=800,status=1,toolbar=1,menubar=1, location=1 scrollbars=1 resizable=1";

		//Code is added by Satyam for scrollbar and change window size
		var param			= "height=460,width=800,status=1,toolbar=1,menubar=1,location=1,scrollbars=1,resizable=1";
	}
	else {
		var param			= windowParameters;
	}
	var baseURL			= "http://www.nissan.";
	var langParam		= getLocaleLanguage(locale);
	var countryParam	= getLocaleCountry(locale);
	var lnParam			= '';
	if(locale=='de_CH' || locale=='fr_CH') lnParam='?ln=/' + locale;

	if(countryParam =='gb') countryParam = 'co.uk';
	var url = baseURL  + countryParam + '/home/vehicles/' + vehicleType + '/'+ vehicleCode + '/grades-and-specs/index.html' + lnParam;
	window.open(url, "nissan", param);
}



// created by DUKE
// fonction goes to the PLP of NOVA
// Satyam to confirm if ok
function gotoPLP(locale, vehicleType, vehicleCode, windowParameters){
	if(windowParameters == null){
		//var param			= "height=460,width=800,status=1,toolbar=1,menubar=1, location=1 scrollbars=1 resizable=1";

		//Code is added by Satyam for scrollbar and change window size
		var param			= "height=460,width=800,status=1,toolbar=1,menubar=1,location=1,scrollbars=1,resizable=1";
	}
	else {
		var param			= windowParameters;
	}
	var baseURL			= "http://www.nissan.";
	var langParam		= getLocaleLanguage(locale);
	var countryParam	= getLocaleCountry(locale);
	var lnParam			= '';
	
	if(locale=='de_CH' || locale=='fr_CH') lnParam='?ln=/' + locale;

	if(countryParam =='gb') countryParam = 'co.uk';
	var url = baseURL  + countryParam + '/home/vehicles/' + vehicleType + '/'+ vehicleCode + '/index.html' + lnParam;
	window.open(url, "nissan", param);
}
// end created by DUKE




// This function opens the vehicle grades page in a new window for a given country, language, vehicle type and vehicle code.
// Required input parameters are:	locale - Name of the locale. For example, the locale for nissan.co.uk is en_GB, for nissan.ch in french language is fr_CH.
//									vehicleType - Type of the vehicle. For example passenger, lcv, 4x4...
//									vehicleCode - Code of the vehicle. For example, vehicleCode can be like K12, X83.
//								    windowParameters - Properties of the new window opened by this application. For example, height=460,width=800,status=1,toolbar=1,menubar=1, location=1 scrollbars=1 resizable=1.
// Example: gotoGrades('de_CH', 'passenger', 'X83', 'height=460,width=800,status=1,toolbar=1,menubar=1, location=1 scrollbars=1 resizable=1') opens the vehicle grades page for country Switzerland, language German, vehicle type passenger and vehicle code X83.
function gotoGrades(locale, vehicleType, vehicleCode,windowParameters){
	if(windowParameters == null){
		//var param			= "height=460,width=800,status=1,toolbar=1,menubar=1, location=1 scrollbars=1 resizable=1";

		//Code is added by Satyam for scrollbar and change window size
		var param			= "height=460,width=800,status=1,toolbar=1,menubar=1,location=1,scrollbars=1,resizable=1";
	}
	else {
		var param			= windowParameters;
	}
	var baseURL			= "http://www.nissan.";
	var langParam		= getLocaleLanguage(locale);
	var countryParam	= getLocaleCountry(locale);
	var lnParam			= '';
	if(locale=='de_CH' || locale=='fr_CH') lnParam='?ln=/' + locale;

	if(countryParam =='gb') countryParam = 'co.uk';
	var url = baseURL  + countryParam + '/home/vehicles/' + vehicleType + '/'+ vehicleCode + '/grades-and-specs/index.html' + lnParam;
	window.open(url, "nissan", param);
}

// This function opens the vehicle specs page in a new window for a given country, language, vehicle type and vehicle code.
// Required input parameters are:	locale - Name of the locale. For example, the locale for nissan.co.uk is en_GB, for nissan.ch in french language is fr_CH.
//									vehicleType - Type of the vehicle. For example passenger, lcv, 4x4...
//									vehicleCode - Code of the vehicle. For example, vehicleCode can be like K12, X83.
//								    windowParameters - Properties of the new window opened by this application. For example, height=460,width=800,status=1,toolbar=1,menubar=1, location=1 scrollbars=1 resizable=1.
// Example: gotoSpecs('de_CH', 'passenger', 'X83', 'height=460,width=800,status=1,toolbar=1,menubar=1, location=1 scrollbars=1 resizable=1') opens the vehicle specs page for country Switzerland, language German, vehicle type passenger and vehicle code X83.
function gotoSpecs(locale, vehicleType, vehicleCode,windowParameters){
	if(windowParameters == null){
		//var param			= "height=460,width=800,status=1,toolbar=1,menubar=1, location=1 scrollbars=1 resizable=1";

		//Code is added by Satyam for scrollbar and change window size
		var param			= "height=460,width=800,status=1,toolbar=1,menubar=1,location=1,scrollbars=1,resizable=1";
	}
	else {
		var param			= windowParameters;
	}
	var baseURL			= "http://www.nissan.";
	var langParam		= getLocaleLanguage(locale);
	var countryParam	= getLocaleCountry(locale);
	var lnParam			= '';
	if(locale=='de_CH' || locale=='fr_CH') lnParam='?ln=/' + locale;

	if(countryParam =='gb') countryParam = 'co.uk';
	var url = baseURL  + countryParam + '/home/vehicles/' + vehicleType + '/'+ vehicleCode + '/grades-and-specs/index.html' + lnParam;
	window.open(url, "nissan", param);
}

function gotoFleet(locale, vehicleType, vehicleCode,windowParameters){
	if(windowParameters == null){
		//var param			= "height=460,width=800,status=1,toolbar=1,menubar=1, location=1 scrollbars=1 resizable=1";

		//Code is added by Satyam for scrollbar and change window size
		var param			= "height=460,width=800,status=1,toolbar=1,menubar=1,location=1,scrollbars=1,resizable=1";
	}
	else {
		var param			= windowParameters;
	}
	var baseURL			= "http://www.nissan-offers.";
	var langParam		= getLocaleLanguage(locale);
	var countryParam	= getLocaleCountry(locale);
	var lnParam			= '';
	if(locale=='de_CH' || locale=='fr_CH') lnParam='?ln=/' + locale;
	
	switch (vehicleCode){
  	case "T31":
  	 var vehicleName="x-trail";
  	break;
  	default:
  	 var vehicleName="x-trail";
  	break;
	}

	if(countryParam =='gb') {var url ='http://www.nissan.co.uk/home/services/fleet/index.html?ln=/en_GB'}

	//var url = baseURL  + countryParam + '/' + vehicleType + '/'+ vehicleName + '/' + lnParam;
	window.open(url, "nissan", param);
}

// This function opens the multimap page locating the dealer in a new window for a given site, country, dealername and dealeraddress.
// Required input parameters are:	mmClientName	- Site name
//									mmDbName		- Country code
//									formName		- Form field name where dealer name is given as input
//									formValue		- Dealer name
//									vehValue		-
//								    windowParameters - Properties of the new window opened by this application. For example, height=460,width=800,status=1,toolbar=1,menubar=1, location=1 scrollbars=1 resizable=1.
// Example: gotoFindADealer('nissan_de','DE','addr3',document.dealerSearch.addr3.value,'',, 'height=460,width=800,status=1,toolbar=1,menubar=1, location=1 scrollbars=1 resizable=1') opens the multimap page locating the dealer.
function gotoFindADealer(mmClientName,mmDbName,formName,formValue,vehValue,windowParameters){
	if(windowParameters == null){
		//var param			= "height=460,width=800,status=1,toolbar=1,menubar=1, location=1 scrollbars=1 resizable=1";

		//Code is added by Satyam for scrollbar and change window size
		var param			= "height=460,width=800,status=1,toolbar=1,menubar=1,location=1,scrollbars=1,resizable=1";
	}
	else {
		var param			= windowParameters;
	}
	var baseURL	= "http://www.nissan.";

	if(mmDbName=='gb') mmDbName = 'co.uk';
	var inputName = formName ;
	var inputValue = escape(formValue);
	var vehVal = vehValue ; // Added for 1 point 1 change
	var recordlimit = 5;

	if (mmDbName=="DE")
	{
		if (inputName=="addr3")
		{

			if ((formValue.toLowerCase() == "bad marienberg"))
			{
 				inputValue = "56470"; inputName="pc";
			}
			else if (formValue.toLowerCase() == "coswig") { inputValue = "06869"; inputName="pc"; }
			else if (escape(formValue).toLowerCase() == ('%d6strich-winkel')) { inputValue = "65375"; inputName="pc"; }
			else if (formValue.toLowerCase() == "ostrich-winkel") { inputValue = "65375"; inputName="pc"; }
			else if (formValue.toLowerCase() == "linsengericht") { inputValue = "63589"; inputName="pc"; }
			else if (formValue.toLowerCase() == "moers") { inputValue = "47443"; inputName="pc"; }
			else if (formValue.toLowerCase() == "nauen") { inputValue = "14641"; inputName="pc"; }
			else if (formValue.toLowerCase() == "alfeld") { inputValue = "31061"; inputName="pc"; }
			else if (formValue.toLowerCase() == "naumburg") { inputValue = "06618"; inputName="pc"; }
			else if (formValue.toLowerCase() == "soest") { inputValue = "59494"; inputName="pc"; }
			else if (formValue.toLowerCase() == "staffelstein") { inputValue = "96231"; inputName="pc"; }
			else if (formValue.toLowerCase() == "stolberg") { inputValue = "52222"; inputName="pc"; }
			else if (formValue.toLowerCase() == "winsen") { inputValue = "21423"; inputName="pc"; }
			else if (escape(formValue).toLowerCase() == ('m%fchlhausen')) { inputValue = "99974"; inputName="pc"; }
			else if (formValue.toLowerCase() == "muhlhausen") { inputValue = "99974"; inputName="pc"; }
			else if (formValue.toLowerCase() == "oberhausen") { inputValue = "46149"; inputName="pc"; }
			else if (escape(formValue).toLowerCase() == ('%d6ttersdorf')) { inputValue = "07907"; inputName="pc"; }
			else if (formValue.toLowerCase() == "ottersdorf") { inputValue = "07907"; inputName="pc"; }
			else if (formValue.toLowerCase() == "roth") { inputValue = "91154"; inputName="pc"; }
			else if (escape(formValue).toLowerCase() == ('sch%f6nebeck')) { inputValue = "39218"; inputName="pc"; }
			else if (formValue.toLowerCase() == "schonebeck") { inputValue = "39218"; inputName="pc"; }
			else if (formValue.toLowerCase() == "singen") { inputValue = "78224"; inputName="pc"; }
			else if (formValue.toLowerCase() == "sulzbach") { inputValue = "66280"; inputName="pc"; }
			else if (formValue.toLowerCase() == "thalheim") { inputValue = "09380"; inputName="pc"; }
			else if (formValue.toLowerCase() == "wedemark") { inputValue = "30900"; inputName="pc"; }
			else if (formValue.toLowerCase() == "auerbach") { inputValue = "08209"; inputName="pc"; }
			else if (formValue.toLowerCase() == "bergen") { inputValue = "18528"; inputName="pc"; }
			else if (formValue.toLowerCase() == "brake") { inputValue = "26919"; inputName="pc"; }
			else if (formValue.toLowerCase() == "burg") { inputValue = "39288"; inputName="pc"; }
			else if (formValue.toLowerCase() == "forst") { inputValue = "03149"; inputName="pc"; }
			else if (formValue.toLowerCase() == "frankenthal") { inputValue = "67227"; inputName="pc"; }
			else if (formValue.toLowerCase() == "gronau") { inputValue = "48599"; inputName="pc"; }
			else if (formValue.toLowerCase() == "hagen") { inputValue = "58135"; inputName="pc"; }
			else if (formValue.toLowerCase() == "halle") { inputValue = "33790"; inputName="pc"; }
			else if (formValue.toLowerCase() == "hof") { inputValue = "95030"; inputName="pc"; }
			else if (escape(formValue).toLowerCase() == ('k%f6then')) { inputValue = "06366"; inputName="pc"; }
			else if (formValue.toLowerCase() == "kothen") { inputValue = "06366"; inputName="pc"; }
			else if (formValue.toLowerCase() == "krumbach") { inputValue = "86381"; inputName="pc"; }
			else if (formValue.toLowerCase() == "haren") { inputValue = "49733"; inputName="pc"; }


			// The below code has been added for DE to return missing dealers
			// This will not be required once radius search is used

			if (formValue.toLowerCase()=="berlin")			{	recordlimit = "15";		}
			else if (formValue.toLowerCase()=="duisburg") 	{	recordlimit = "10";		}
			else if (formValue.toLowerCase()=="hamburg") 	{	recordlimit = "12";		}
			else if ( formValue.toLowerCase()=="koln") 		{	recordlimit = "7";		}
			else if (escape(formValue).toLowerCase() == ('k%f6ln')) {	recordlimit = "7";	}
		}
	}
	// RP stop

	// Below if statement added for 1 point 1 code and reclimit made dynamic for DE change
	if (vehValue=='passenger' || vehValue=='lcv' || vehValue=='4x4')
	{
		if (vehValue=='passenger')
		{
			var url = "http://www.multimap.com/clients/places.cgi?place=&reclimit=" + recordlimit + "&height=290&width=408&" + "client=" + mmClientName + "&" + "db=" + mmDbName + "&" + inputName + "=" + inputValue + "&f_" + vehVal + "_vehicle=y";
		} else {
			var url = "http://www.multimap.com/clients/places.cgi?place=&reclimit=" + recordlimit + "&height=290&width=408&" + "client=" + mmClientName + "&" + "db=" + mmDbName + "&" + inputName + "=" + inputValue + "&f_" + vehVal + "=y";
		}
	} else {
		var url = "http://www.multimap.com/clients/places.cgi?place=&reclimit=" + recordlimit + "&height=290&width=408&" + "client=" + mmClientName + "&" + "db=" + mmDbName + "&" + inputName + "=" + inputValue;
	}

	window.open(url,'windowName',param);
}

// This function opens the Nissan offers page in a new window for a given country and language.
// Required input parameters are: locale - Name of the locale. For example, the locale for nissan.co.uk is en_GB, for nissan.ch in french language is fr_CH.
//								  windowParameters - Properties of the new window opened by this application. For example, height=460,width=800,status=1,toolbar=1,menubar=1, location=1 scrollbars=1 resizable=1.
// Example: gotoNissanOffers('de_CH', 'height=460,width=800,status=1,toolbar=1,menubar=1, location=1 scrollbars=1 resizable=1') opens the dealer list page for country Switzerland and language German.
function gotoNissanOffers(locale,windowParameters){
	if(windowParameters == null){
		//var param			= "height=460,width=800,status=1,toolbar=1,menubar=1, location=1 scrollbars=1 resizable=1";

		//Code is added by Satyam for scrollbar and change window size
		var param			= "height=460,width=800,status=1,toolbar=1,menubar=1,location=1,scrollbars=1,resizable=1";
	}
	else {
		var param			= windowParameters;
	}
	var baseURL	= "http://www.nissan.";
	var langParam		= getLocaleLanguage(locale);
	var countryParam	= getLocaleCountry(locale);

	if (locale=='en_GB')   var url = 'http://www.nissan-offers.co.uk/dealer-locator';
	else return;

	window.open(url, "nissan", param);
}

// This function is used for sitestat calculation
// Required input parameters are:	ns_flashn		- String
//									mmClientName	- String
// Example: ns_flashcounter() opens the nissan site for country Switzerland and language German.
function ns_flashcounter(ns_flashn, mmClientName){

	var ns_flash="http://fr.sitestat.com/nissan/"+mmClientName+"/s?"+ns_flashn+"&ns_type=flash";
	var ns_flashTag; 
	var axel = Math.random(); 
	var rand = axel * 1000000000000000000; 
	var prx = "?"; 
	ns_flash += "&rand="+rand+prx; 
	ns_flashTag = new Image(); 
	ns_flashTag.src = ns_flash; 

//	document.ns_flashp.src=ns_flashn;
}

// This function is used for Equancy calculation
// Required input parameters are:	catVal - String
//									typeVal - String
//									siteVal - String
//									urlVal - String
// Example: spotlight() 
function spotlight(catVal,typeVal,siteVal,urlVal) { 
	if(urlVal == null) { 
		urlVal = "http://ad.uk.doubleclick.net/activity"; 
	} 
	if(typeVal == null) { 
		typeVal = "trust657"; 
	} 
	if(siteVal == null) { 
		siteVal = "913803"; 
	} 
	var spotlighttag; 
	var Tag; 
	var axel = Math.random(); 
	var ord = axel * 1000000000000000000; 
	var prx = "?"; 
	spotlighttag=urlVal+";src="+siteVal+";type="+typeVal+";cat="+catVal+";ord="+ord+prx; 
	Tag = new Image(); 
	Tag.src = spotlighttag; 
}

function adverserve(param) { 
  //window.alert('adverserve '+param)
  oas_rand=String(Math.random()).substr(2,10);
  var rep ='Adverserve_nissanxtrail'
  cid='RMID';
  oid='';
  rev='';
  dsc='';
  //document.write('<IMG SRC=http://adv.adverserve.net/RealMedia/ads/track.ads/'+rep+'/'+param+'/CID='+cid+'&OID='+oid+'&REV='+rev+'&DSC='+dsc+'/?1'+oas_rand+' BORDER=0 WIDTH=1 HEIGHT=1>') ;   
  adverservetag = 'http://adv.adverserve.net/RealMedia/ads/track.ads/'+rep+'/'+param+'/CID='+cid+'&OID='+oid+'&REV='+rev+'&DSC='+dsc+'/?1'+oas_rand;
  var Tag;
  Tag = new Image(); 
	Tag.src = adverservetag; 
}


// This function is used to open the multimap site in a new window for a given site name and country code.
// Required input parameters are:	mmClientName	- Site Name
//									mmDbName		- Country Code
// Example: openURLAdvanced('nissan_gb&ln=/en_GB','GB')
function openURLAdvanced(mmClientName,mmDbName){
	//Code is added by Satyam for scrollbar and change window size
	var param			= "height=476,width=600,status=1,toolbar=1,menubar=1,location=1,scrollbars=1,resizable=1";

	var url = "http://www.multimap.com/clients/places.cgi?place=&reclimit=5&" + "client=" + mmClientName + "&" + "db=" + mmDbName;
	//window.open(url,'windowName',476,600,1,1,1);
	window.open(url,'windowName',param);
}

