var  dealerLocator = new function() {
	
	this.prodUrl = /www\.michelinag\.com/;
		
	this.launch = function() {
		var testUrl = "http://staging.dl.michelinag.com";		
		var liveUrl = "http://dl.michelinag.com";
		var urlParams="";
		
//		this.currUrl = "http://" + window.location.host

		if(dealerLocator.prodUrl.test(window.location.host)) {
 			url = liveUrl;
		} else {
			url = testUrl;
		}

		if(arguments[0] != null) {
			if(arguments[0].length > 1) {
				var zipCode = arguments[0];
				var postalMatch = /^[a-zA-Z][0-9][a-zA-Z]\s?[0-9][a-zA-Z][0-9]$/; // choose Canada if we have a postal code.
				var countryCode = postalMatch.test(zipCode) ? "CA" : "US";
				urlParams="?selCountry="+countryCode+"&txtDistance=75&txtPostalCode="+zipCode;
			} 
		}

		// Added by Jegan Raman on 12/09/09 - Canadian link issue - JIRA # NAMSP-760 - Start
		
		if(arguments[1] != null) {
			if(arguments[1].length > 1) {
				var countryCode = arguments[1];
				urlParams="?selCountry="+countryCode+"&txtDistance=75";
			} 
		}
		// Added by Jegan Raman on 12/09/09 - Canadian link issue - JIRA # NAMSP-760 - End

		url = url + urlParams;
		
		window.open(url,null,"width=800,height=700,resizable=yes,status=yes,toolbar=yes,menubar=yes,location=no,scrollbars=1");		
		return false;
	}
	this.launchFlash = function() {
		this.launch();
	}
}