//------------------------------------------------------------------------------

// Detrimine Locale from URL string

var locale = decodeURIComponent(window.location.pathname).substr(0,7);

//------------------------------------------------------------------------------

// Brochure

function brochurerequest() {
	if (locale == '/en_us/') {
		window.open('http://brochure.buell.co.uk/','brochure', 'toolbar=no,scrollbars=yes,width=610,height=500,resizable=yes');
	} else if (locale == '/en_ca/') {
		window.open('http://brochure.buell.co.uk/','brochure', 'toolbar=no,scrollbars=yes,width=610,height=500,resizable=yes');
	} else if (locale == '/fr_ca/') {
		window.open('http://brochure.buell.co.uk/','brochure', 'toolbar=no,scrollbars=yes,width=610,height=500,resizable=yes');
	} else if (locale == '/en_uk/') {
		window.open('http://brochure.buell.co.uk/','brochure', 'toolbar=no,scrollbars=yes,width=610,height=500,resizable=yes');
	} else if (locale == '/de_ch/') {
		window.open('http://infomaterial.buell.ch/','brochure', 'toolbar=no,scrollbars=yes,width=610,height=500,resizable=yes');
	} else if (locale == '/fr_ch/') {
		window.open('http://brochure.buell.ch/','brochure', 'toolbar=no,scrollbars=yes,width=610,height=500,resizable=yes');
	} else if (locale == '/de_de/') {
		window.open('http://infomaterial.buell.de/','brochure', 'toolbar=no,scrollbars=yes,width=610,height=500,resizable=yes');
	} else if (locale == '/it_ch/') {
		window.open('http://catalogo.buell.ch/','brochure', 'toolbar=no,scrollbars=yes,width=610,height=500,resizable=yes');
	} else if (locale == '/it_it/') {
		window.open('http://catalogo.buell.it/','brochure', 'toolbar=no,scrollbars=yes,width=610,height=500,resizable=yes');
	} else if (locale == '/nl_be/') {
		window.open('http://brochure.buell.nl/','brochure', 'toolbar=no,scrollbars=yes,width=610,height=500,resizable=yes');
	} else if (locale == '/fr_fr/') {
		window.open('http://brochure.buell.fr/','brochure', 'toolbar=no,scrollbars=yes,width=610,height=500,resizable=yes');
	} else if (locale == '/fr_be/') {
		window.open('http://brochure.buell.be/','brochure', 'toolbar=no,scrollbars=yes,width=610,height=500,resizable=yes');
	} else if (locale == '/en_au/') {
		window.open('http://brochure.buell.co.uk/','brochure', 'toolbar=no,scrollbars=yes,width=610,height=500,resizable=yes');
	} else if (locale == '/es_es/') {
		window.open('http://folleto.buell.es/','brochure', 'toolbar=no,scrollbars=yes,width=610,height=500,resizable=yes');
	} else if (locale == '/es_mx/') {
		window.open('http://brochure.buell.co.uk/','brochure', 'toolbar=no,scrollbars=yes,width=610,height=500,resizable=yes');
	} else if (locale == '/es_xx/') {
		window.open('http://brochure.buell.co.uk/','brochure', 'toolbar=no,scrollbars=yes,width=610,height=500,resizable=yes');
	} else if (locale == '/pt_br/') {
		window.open('http://brochure.buell.co.uk/','brochure', 'toolbar=no,scrollbars=yes,width=610,height=500,resizable=yes');
	} else {
		window.open('http://brochure.buell.co.uk/','brochure', 'toolbar=no,scrollbars=yes,width=610,height=500,resizable=yes');
	}
}
// Test Drive

function tesrtdrive() {
	if (locale == '/en_us/') {
		window.open('http://testrides.buell.co.uk/','testride', 'toolbar=no,scrollbars=yes,width=840,height=600,resizable=yes');
	} else if (locale == '/en_ca/') {
		window.open('http://testrides.buell.co.uk/','testride', 'toolbar=no,scrollbars=yes,width=840,height=600,resizable=yes');
	} else if (locale == '/fr_ca/') {
		window.open('http://testrides.buell.co.uk/','testride', 'toolbar=no,scrollbars=yes,width=840,height=600,resizable=yes');
	} else if (locale == '/en_uk/') {
		window.open('http://testrides.buell.co.uk/','testride', 'toolbar=no,scrollbars=yes,width=840,height=600,resizable=yes');
	} else if (locale == '/de_ch/') {
		window.open('http://testride.buell.ch/','testride', 'toolbar=no,scrollbars=yes,width=610,height=500,resizable=yes');
	} else if (locale == '/fr_ch/') {
		window.open('http://test.buell.ch/','testride', 'toolbar=no,scrollbars=yes,width=610,height=500,resizable=yes');
	} else if (locale == '/de_de/') {
		window.open('http://testride.buell.de/','testride', 'toolbar=no,scrollbars=yes,width=610,height=500,resizable=yes');
	} else if (locale == '/it_ch/') {
		window.open('http://ride.buell.ch/','testride', 'toolbar=no,scrollbars=yes,width=610,height=500,resizable=yes');
	} else if (locale == '/it_it/') {
		window.open('http://testride.buell.it/','testride', 'toolbar=no,scrollbars=yes,width=610,height=500,resizable=yes');
	} else if (locale == '/nl_be/') {
		window.open('http://testrides.buell.nl/','testride', 'toolbar=no,scrollbars=yes,width=840,height=600,resizable=yes');
	} else if (locale == '/fr_fr/') {
		window.open('http://testride.buell.fr/','testride', 'toolbar=no,scrollbars=yes,width=610,height=500,resizable=yes');
	} else if (locale == '/fr_be/') {
		window.open('http://testrides.buell.be/','testride', 'toolbar=no,scrollbars=yes,width=840,height=600,resizable=yes');
	} else if (locale == '/en_au/') {
		window.open('http://testrides.buell.co.uk/','testride', 'toolbar=no,scrollbars=yes,width=840,height=600,resizable=yes');
	} else if (locale == '/es_es/') {
		window.open('http://testrides.buell.es/','testride', 'toolbar=no,scrollbars=yes,width=840,height=600,resizable=yes');
	} else if (locale == '/es_mx/') {
		window.open('http://testrides.buell.co.uk/','testride', 'toolbar=no,scrollbars=yes,width=840,height=600,resizable=yes');
	} else if (locale == '/es_xx/') {
		window.open('http://testrides.buell.co.uk/','testride', 'toolbar=no,scrollbars=yes,width=840,height=600,resizable=yes');
	} else if (locale == '/pt_br/') {
		window.open('http://testrides.buell.co.uk/','testride', 'toolbar=no,scrollbars=yes,width=840,height=600,resizable=yes');
	} else {
		window.open('http://testrides.buell.co.uk/','testride', 'toolbar=no,scrollbars=yes,width=840,height=600,resizable=yes');
	}
}
// Dealer Locator

function dealerlocator() {
	if (locale == '/en_us/') {
		window.open('http://go.mappoint.net/harleydavidson/PrxInput.aspx?&LL=en-US&AD4=USA&FS=&FC=&brand=b&adv=0','dealer', 'toolbar=no,scrollbars=yes,width=610,height=500,resizable=yes');
	} else if (locale == '/en_ca/') {
		window.open('http://go.mappoint.net/harleydavidson/PrxInput.aspx?&LL=en-US&AD4=CAN&FS=&FC=&brand=b&adv=0','dealer', 'toolbar=no,scrollbars=yes,width=610,height=500,resizable=yes');	
	} else if (locale == '/fr_ca/') {
		window.open('http://go.mappoint.net/harleydavidson/PrxInput.aspx?&LL=fr-FR&AD4=CAN&FS=&FC=&brand=b&adv=0','dealer', 'toolbar=no,scrollbars=yes,width=610,height=500,resizable=yes');
	} else if (locale == '/en_uk/') {
		window.open('http://go.mappoint.net/harleydavidson/PrxInput.aspx?&LL=en-US&AD4=GBR&FS=&FC=&brand=b&adv=0','dealer', 'toolbar=no,scrollbars=yes,width=610,height=500,resizable=yes');
	} else if (locale == '/de_ch/') {
		window.open('http://go.mappoint.net/harleydavidson/PrxInput.aspx?&LL=de-DE&AD4=CHE&FS=&FC=&brand=b&adv=0','dealer', 'toolbar=no,scrollbars=yes,width=610,height=500,resizable=yes');
	} else if (locale == '/fr_ch/') {
		window.open('http://go.mappoint.net/harleydavidson/PrxInput.aspx?&LL=fr-FR&AD4=CHE&FS=&FC=&brand=b&adv=0','dealer', 'toolbar=no,scrollbars=yes,width=610,height=500,resizable=yes');
	} else if (locale == '/de_de/') {
		window.open('http://go.mappoint.net/harleydavidson/PrxInput.aspx?&LL=de-DE&AD4=DEU&FS=&FC=&brand=b&adv=0','dealer', 'toolbar=no,scrollbars=yes,width=610,height=500,resizable=yes');
	} else if (locale == '/it_ch/') {
		window.open('http://go.mappoint.net/harleydavidson/PrxInput.aspx?&LL=it-IT&AD4=CHE&FS=&FC=&brand=b&adv=0','dealer', 'toolbar=no,scrollbars=yes,width=610,height=500,resizable=yes');
	} else if (locale == '/it_it/') {
		window.open('http://go.mappoint.net/harleydavidson/PrxInput.aspx?&LL=it-IT&AD4=ITA&FS=&FC=&brand=b&adv=0','dealer', 'toolbar=no,scrollbars=yes,width=610,height=500,resizable=yes');
	} else if (locale == '/nl_be/') {
		window.open('http://go.mappoint.net/harleydavidson/PrxInput.aspx?&LL=nl-NL&AD4=BEL&FS=&FC=&brand=b&adv=0','dealer', 'toolbar=no,scrollbars=yes,width=610,height=500,resizable=yes');
	} else if (locale == '/fr_fr/') {
		window.open('http://go.mappoint.net/harleydavidson/PrxInput.aspx?&LL=fr-FR&AD4=FRA&FS=&FC=&brand=b&adv=0','dealer', 'toolbar=no,scrollbars=yes,width=610,height=500,resizable=yes');
	} else if (locale == '/fr_be/') {
		window.open('http://go.mappoint.net/harleydavidson/PrxInput.aspx?&LL=fr-FR&AD4=BEL&FS=&FC=&brand=b&adv=0','dealer', 'toolbar=no,scrollbars=yes,width=610,height=500,resizable=yes');
	} else if (locale == '/en_au/') {
		window.open('http://go.mappoint.net/harleydavidson/PrxInput.aspx?&LL=en-US&AD4=AUS&FS=&FC=&brand=b&adv=0','dealer', 'toolbar=no,scrollbars=yes,width=610,height=500,resizable=yes');
	} else if (locale == '/es_es/') {
		window.open('http://go.mappoint.net/harleydavidson/PrxInput.aspx?&LL=es-ES&AD4=ESP&FS=&FC=&brand=b&adv=0','dealer', 'toolbar=no,scrollbars=yes,width=610,height=500,resizable=yes');
	} else if (locale == '/es_mx/') {
		window.open('http://go.mappoint.net/harleydavidson/PrxInput.aspx?&LL=es-ES&AD4=MEX&FS=&FC=&brand=b&adv=0','dealer', 'toolbar=no,scrollbars=yes,width=610,height=500,resizable=yes');
	} else if (locale == '/es_xx/') {
		window.open('http://go.mappoint.net/harleydavidson/PrxInput.aspx?&LL=es-ES&AD4=MEX&FS=&FC=&brand=b&adv=0','dealer', 'toolbar=no,scrollbars=yes,width=610,height=500,resizable=yes');
	} else if (locale == '/pt_br/') {
		window.open('http://go.mappoint.net/harleydavidson/PrxInput.aspx?&LL=es-ES&AD4=BRA&FS=&FC=&brand=b&adv=0','dealer', 'toolbar=no,scrollbars=yes,width=610,height=500,resizable=yes');
	} else {
		window.open('http://go.mappoint.net/harleydavidson/PrxInput.aspx?&LL=en-US&AD4=USA&FS=&FC=&brand=b&adv=0','dealer', 'toolbar=no,scrollbars=yes,width=610,height=500,resizable=yes');
	}
}

//------------------------------------------------------------------------------

// Open Link in Parent Window from Pop Up Window

	function loadinparent(url){
		self.opener.location = url;
		this.window.close();
		}

//------------------------------------------------------------------------------

// Info Request pop up

function inforrequest() {
	if (locale == '/en_us/') {
		window.open(locale+'info-request/InfoRequest.asp','request', 'toolbar=no,scrollbars=yes,width=620,height=500,resizable=yes');
	} else if (locale == '/en_ca/') {
		window.open(locale+'info-request/InfoRequest.asp','request', 'toolbar=no,scrollbars=yes,width=620,height=500,resizable=yes');
	} else if (locale == '/fr_ca/') {
		window.open(locale+'info-request/InfoRequest.asp','request', 'toolbar=no,scrollbars=yes,width=620,height=500,resizable=yes');
	} else if (locale == '/en_uk/') {
		window.open(locale+'info-request/InfoRequest.asp','request', 'toolbar=no,scrollbars=yes,width=620,height=500,resizable=yes');
	} else if (locale == '/de_ch/') {
		window.open(locale+'info-request/inforequestconsent.asp','request', 'toolbar=no,scrollbars=yes,width=620,height=500,resizable=yes');
	} else if (locale == '/fr_ch/') {
		window.open(locale+'info-request/InfoRequest.asp','request', 'toolbar=no,scrollbars=yes,width=620,height=500,resizable=yes');
	} else if (locale == '/de_de/') {
		window.open(locale+'info-request/inforequestconsent.asp','request', 'toolbar=no,scrollbars=yes,width=620,height=500,resizable=yes');
	} else if (locale == '/it_ch/') {
		window.open(locale+'info-request/InfoRequest.asp','request', 'toolbar=no,scrollbars=yes,width=620,height=500,resizable=yes');
	} else if (locale == '/it_it/') {
		window.open(locale+'info-request/InfoRequest.asp','request', 'toolbar=no,scrollbars=yes,width=620,height=500,resizable=yes');
	} else if (locale == '/nl_be/') {
		window.open(locale+'info-request/InfoRequest.asp','request', 'toolbar=no,scrollbars=yes,width=620,height=500,resizable=yes');
	} else if (locale == '/fr_fr/') {
		window.open(locale+'info-request/InfoRequest.asp','request', 'toolbar=no,scrollbars=yes,width=620,height=500,resizable=yes');
	} else if (locale == '/fr_be/') {
		window.open(locale+'info-request/InfoRequest.asp','request', 'toolbar=no,scrollbars=yes,width=620,height=500,resizable=yes');
	} else if (locale == '/en_au/') {
		window.open(locale+'info-request/InfoRequest_selector.asp','request', 'toolbar=no,scrollbars=yes,width=620,height=500,resizable=yes');
	} else if (locale == '/es_es/') {
		window.open(locale+'info-request/InfoRequest.asp','request', 'toolbar=no,scrollbars=yes,width=620,height=500,resizable=yes');
	} else {
		window.open(locale+'info-request/InfoRequest.asp','request', 'toolbar=no,scrollbars=yes,width=620,height=500,resizable=yes');
	}
}


//------------------------------------------------------------------------------

// Buell Quest pop up

function buellquest() {
	window.open(locale+'gear/gps/index.asp','buellquest', 'toolbar=no,scrollbars=yes,width=640,height=500,resizable=yes');
}

//------------------------------------------------------------------------------
