function Main(language){
this._ct=new ContentText();
this._txt=this._ct[language];
this._enable = true;
this._feed = true;
if(this._feed){this._loading=true;}else{this._loading=false;}
this._tbs=new Tabs();
this._numGroups = 8;
this._error = new ErrorProcessor(this._txt);
this._inpt=new Inpt(this);
//this._fromGrpToKO=["Argentina", "Serb.Mon", "Brazil", "England", "Russia", "Mexico", "Germany", "France", "Spain", "Italy", "Nigeria", "Sweden", "Japan", "Greece", "Portugal", "Uruguay"];
this._originalKOArray = this._txt.KOarr;
this._koArray = this._txt.KOarr;		
//Ed's group stage will poplate the knock out stage. (everytime a change is made!)
this._po=new PO(this._inpt,this,this._txt);
this.createKO();
//this._po=new PO("",this._inpt,this,"nothing");
this._outpt=new Outpt(this,this._numGroups,this._error);

this._snapShotObj = new SnapShotObj();
this._model = new Model(this._txt);
this._controller = new Controller(this._model);
//this._error = new ErrorProcessor(language);
// create a new input object to determine whether query string or cookie data is to be loaded...
if(this._feed){this._inpt.furnish();}
this.browserFilter();
}
// browserFilter is the only part of this code that is browser specific - caters for DOM and DOMless browsers...
Main.prototype.createKO = function(){
this._ko=new KO(this._koArray,this._inpt,this,this._error,this._txt)
}
Main.prototype.browserFilter = function(){
if(document.getElementById){
	this._view_dom = new ViewDom(
	this._model,
	this._controller,
	this._error,
	this._snapShotObj,
	this,
	this._txt
	);
	this._browserView = this._view_dom;
	// process feeds after loading
	if(this._feed){this._inpt.process();}
	}
}
Main.prototype.send = function(e,preloading){
// get form information from hidden fields...
//if(preloading==1&&e.name=="i8"){this._loading=false;}
fm = this.collectFormFormatData(e);
fm.rowCount = 0;
for(var d=0;d<fm.numDays;d++){
	var x = 0;
	while(document.getElementById("i"+fm.formID+"_itemNameLeft"+d+"_"+x) != null){
		x++;
		fm.rowCount++;
		}
	}
if(this._enable){
	this._enable = false;
	this._browserView.aqquire(fm,preloading);
	}
	else{
	// alert the user not to press update until processing has finished...
	this._error.print(2);
	}
}
Main.prototype.collectFormFormatData = function(e){
var f = new Object();
var fm = document.getElementById(e.id);
f.name = e.name;
f.formID = Number(fm.formID.value);
f.fixtureRows = Number(fm.fixtureRows.value);
f.numDays = Number(fm.numDays.value);
f.numColResults = Number(fm.numColResults.value);
f.numRowResults = Number(fm.numRowResults.value);
f.totNumColResults = Number(fm.totNumColResults.value);
f.outputForm = e.outputForm;
return f;
}
Main.prototype.reset = function(){
// turn this off for now...
//browserView.reset();
this._model.transmit();
}
// allow us to stop non numeric data to be entered into the text boxes
Main.prototype.textBoxManager = function(element,event){
if(event){
	var code;
	// get the keyCode of the key pressed
	if(event.keyCode){
		code = event.keyCode;
		}
	// 	get the 'which' of the key pressed - NN4 style
	else if(event.which){
		code = event.which;
		}
	if(code==13){
		this.send()
		}
	else{
	//  get the actual key's character from the code and do a reg exp on it - if it's not a number, don't validate it
	/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	var character = String.fromCharCode(code);
		this.isANumber = this.checkAllNumKeys(code);
		if(!this.isANumber && code!=8){
			this._error.disallowKeyEntry(element);
			}
		}
	}	
}
Main.prototype.enable = function(){
this._enable = true;
// processes the next group's scores (upon loading)
if(!this._loading){this._view_dom.showHide()}
if(this._feed){this._inpt.process();}
}
Main.prototype.sendToAFriend = function(){
this._outpt.sendToAFriend();
}
Main.prototype.checkAllNumKeys = function(code){
for(var i=48;i<=57;i++){
	if(code==i){
		return true;
		break;
		}
	}
for(var j=96;j<=105;j++){
	if(code==j){
		return true;
		break;
		}
	}
return false;	
}