if (typeof MY10 == "undefined" || !MY10) {
	var MY10 = {};
}

MY10.util = {
	
	getLocale : function(){
		
	},
	
	/**
	 * This method checks the current url to see if it contains a match to the 
	 * passed in name. 
	 * 
	 * @method getRequestParam
	 * @param  {String} name  the url that we are parsing
	 * @return {String}       the match
	 */
	getRequestParam : function (name) {
		if (!name) {return;}
		zname = name.replace(/\[/g,"\[").replace(/\]/g,"\]");
		var regexS = "[\\?&]"+name+"=([^&#]*)";
		var regex = new RegExp(regexS);
		var results = regex.exec(window.location.href);
		var res = results == null ? null : results[1];
		return !!res && res.match(/^(true|1)$/) ? true :
			(!!res && res.match(/^(false|0)$/) ? false : 
			(!!res && res.match(/^(null|undefined)$/) ? null : res));
	},
	
	getSWFAddressHash : function () {
		var swfAddressPath = SWFAddress.getPath();			
		if(swfAddressPath == "/" || !swfAddressPath)			
			return [null, null];						
		else
			return swfAddressPath.split("/").splice(1,2);						
	},
	
	/**
	 * This method gets promo content and returns variable promos for mkt / model. Returns an array of 
	 * promos in pos 0 and a boolean in pos 1 to indicate if promos were matched for a particular model.
	 * @method getPromos
	 * @param {String} model
	 * @param {String} family
	 * @return {Array} promos object, model match Boolean 
	 */
	getPromos : function (view){
		var proCountry = {};
		var changePro = true;
		var country;
		var promos;
		
		switch(view[1]){
			case pvsView[1]:
			changePro = false;
			break;
		}
		pvsView = view;
		
		//set GMA/MCM country list. These markets get GMA/MCM instead of default INT promos
		//proCountry['aa'] = "AA"; // -- daniel
		proCountry['au'] = "AU";
		proCountry['be'] = "BE";
		proCountry['lu'] = "BE";
		proCountry['nl'] = "BE";
		proCountry['ca'] = "CA";
		proCountry['ch'] = "CH";
		proCountry['de'] = "DE";
		proCountry['at'] = "DE";
		proCountry['es'] = "ES";
		proCountry['fr'] = "FR";
		proCountry['mx'] = "MX"; // -- daniel
		proCountry['uk'] = "GB";
		proCountry['gb'] = "GB";
		proCountry['it'] = "IT";
		proCountry['us'] = "US";
		//proCountry['zz'] = "ZZ"; // -- daniel
		
		if(!proCountry[market])
			country = "XX";
		else
			country = proCountry[market];
			
		MY10.data.promos(language,country);
		
		if(country != "US" && country != "XX"){
			switch(view[0]){
				case "family":
					promos = proOtherVars['default_family'];
				break;
				
				case "model":
					promos = proOtherVars['default_model'];
				break;
				
				case undefined || "" || null:
					promos = proOtherVars['default_family'];
				break;
			}
		}
		else if(country == "XX"){
			promos = proOtherVars['default'];			
		}
		else{
			switch(view[0]){
				case "family":
					promos = proUsVars[view[1]];
				break;
				
				case "model":
					promos = proUsVars[view[1].toUpperCase()];
				break;
				
				case undefined || "" || null:
					promos = proUsVars['default'];
				break;
			}
		}
		//load default promos for mkt if no model specific ones are available
		if(null == promos || "" == promos){
				if (country !== "US") {
					promos = proOtherVars['default'];
				}
				else {
					promos = proUsVars['default'];
				}
				changePro = false;									
		}
		return [promos,changePro];
	},
	
	pageLink: function(pageUrl, windowName, winProperties){        
	    var winNew = window.open(pageUrl,windowName,winProperties);
	    
	    if (!winNew) { // the window didn’t open... call from flash	      			
			MY10.util.getSwf(swfId).openLinkFromSwf(pageUrl);
	    }
	    else {
	        winNew.focus();
	    }
	},
	
	getSwf: function(id){	   
		if (navigator.appName.indexOf("Microsoft") != -1) {	       
			return window[id];
	    }
	    else {		      
			return document[id];
	  	}
	}	
	
};