function Main(numberOfColumnsOfResults,numberOfColumnsInResultsTable,numberOfRowsOfResults,numberOfDays){
this._numberOfDays = numberOfDays;
this._enable = true;
// we need to find rowCount of fixtures since HTML cannot provide it ...
this._rowCount = 0;
for(var d=0;d<this._numberOfDays;d++){
	var e = 0;
	while(document.getElementById("i_itemNameLeft"+d+"_"+e) != null){
		e++;
		this._rowCount++;
		}
	}
this._model = new Model();
this._controller = new Controller(this._model);
this._error = new ErrorProcessor()
this._numberOfColumnsOfResults = numberOfColumnsOfResults;
this._numberOfColumnsInResultsTable = numberOfColumnsInResultsTable;
this._numberOfRowsOfResults = numberOfRowsOfResults;
// collect details about browser and OS - this will be needed to provide browser specific solutions
this.browserDetails();
this.browserFilter();
this._sortQueryData = new QueryStringManager(this._numberOfDays,this._rowCount);
this._sortQueryData.loadString(this);
}
// browserFilter is ther only part of this code that is browser specific - caters for DOM and DOMless browsers...
Main.prototype.browserFilter = function(){
if(document.getElementById){
	this._view_dom = new ViewDom(
	this._numberOfDays,
	this._rowCount,
	this._model,
	this._controller,
	this._error,
	this._numberOfColumnsOfResults,
	this._numberOfColumnsInResultsTable,
	this._numberOfRowsOfResults);
	this._browserView = this._view_dom;
	//alert('view_DOM');
	}
	else{
	this._view_not_dom = new ViewNotDom(
	this._numberOfDays,
	this._rowCount,
	this._model,
	this._controller,
	this._error,
	this._numberOfColumnsOfResults,
	this._numberOfRowsOfResults);
	this._browserView = this._view_not_dom;
	//alert('view_not_DOM');
	}
}
Main.prototype.send = function(){
if(this._enable){
	this._enable = false;
	this._browserView.aqquire();
	}
	else{
	alert("Please make sure you allow updating to finish before you press UPDATE TABLE again");
	}
}
Main.prototype.reset = function(){
// turn this off for now...
//browserView.reset();
this._model.transmit();
}
// this stops users trying to enter a value into the league table on the rhs
// no need to validate anything as this is not a 'correct data entry procedure' - just send straight to error processing
Main.prototype.disallowKeyEntry = function(formItem){
this._error.disallowKeyEntry(formItem);
}
// allow us to stop non numeric data to be entered into the text boxes
Main.prototype.textBoxManager = function(formItem,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(formItem);
			}
		}
	}	
}
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;	
}
Main.prototype.browserDetails = function(){
	this.navInfo = window.navigator.userAgent;
	this.browserInfo = navigator.appName;
	//alert(this.browserInfo)
	if(this.navInfo.indexOf("Mac") != -1){this.platform = "Mac OS";}
	else{this.platform = "Windows"}
	if(this.browserInfo.indexOf("Microsoft") >= 0){this.browser = "Internet Explorer"}
	else if(this.browserInfo.indexOf("Netscape") >= 0){this.browser = "Netscape Navigator"}
	else{this.browser = "Miscellaneous browser"}
// print a report to the screen of details of machine and browser	
//this.browserReport();
}
Main.prototype.browserReport = function(){
var readout = "Browser details: \n\n";
readout = readout + "The browser is " + this.browser + "\n" + "The platform is " + this.platform;
//alert(readout)
}
Main.prototype.mailTo = function(){
this._browserView.mailTo(this._sortQueryData)
}
