var compatibility = {

	gameId : undefined,
	vendorId : undefined,
	language : undefined,
	progressBar : undefined,
	phonesText : undefined,
	
	init : function( gameId, progressBar, phonesText, language ) {
		this.gameId = gameId;
		this.progressBar = progressBar;
		this.phonesText = phonesText;
		this.language = language;
		
		var vendorsSel = document.getElementById('vendors');
		var options = vendorsSel.options;
		vendorsSel.onchange = function() {
			var vendorId = options[ vendorsSel.selectedIndex ].value;
			compatibility.setVendor( vendorId );
		};
	},
	
	setVendor : function( vendorId ) {
		if(vendorId < 0 || vendorId == this.vendorId) {
			return;
		}
		this.vendorId = vendorId;
		this.doxhr();
	},
	
	doxhr : function() {
		$(compatibility.progressBar).show();
		$(compatibility.phonesText).hide();
		$(this.phonesText).load('/compatibility.txt?game_id='+this.gameId+'&vendor='+this.vendorId+'&lang='+this.language, {},
		function() {
			if(window.pageTracker) {
				window.pageTracker._trackPageview('/compatibility.txt');
			}
			compatibility.retrieved( compatibility.request );
			$(compatibility.phonesText).show();
			$(compatibility.progressBar).hide();
		});
		return false;
	},

	retrieved : function( data ) {
	},
		
	failed : function() {
	}		
}
