function Inpt(main){
this._main = main;
this._sendCount = 1;
// Check if there is a query string or cookie or default to zeros.
// Then split the input for group and knockout stages.
	//if (String(this.checkForInput()).length!=224) alert("here : "+String(this.checkForInput()).length);/*alert("An error has occurred. Please delete the your cookies.");*/
	this.splitInput(String(this.checkForInput()));
}
Inpt.prototype.checkForInput = function(){
	if(location.search.length>0){ // There's a Query String.
	//document.getElementById("msg").innerHTML = "Found: a query string.";
		return location.search.substring(1);
	}
	/*else if(document.cookie.indexOf("BBCWorldCupPredictor")!=-1){ // or there's a cookie.
		//document.getElementById("msg").innerHTML = "Found: a cookie.";
		var cookieVals=document.cookie.split("=");
		var str = cookieVals[1].split(";");
		return str[0];
	}*/
	
	else{	// or it's a blank predictor default to 224 zeros.*/
	//document.getElementById("msg").innerHTML = "Found: neither query string or cookie.";
	//return GLOBAL_STRING;

//"0555-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|00000000000000000000000000000000";    
    return GLOBAL_STRING //"-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|00000000000000000000000000000000"; 
	}
}
Inpt.prototype.splitInput=function(loadstr){
	this.grpBinStr=loadstr.substring(0,192);  // Group Stage
	this.koBinStr=loadstr.substring(192,222); // Knockout
	this.poBinStr=loadstr.substring(222,224); // 3rd place Play off
}
Inpt.prototype.furnish=function(){
var arr = this.skin();
var num = 0;
var i=1;
while(i<=8){
	var q=0;
	while(q<=5){
		document.getElementById('i'+i+'_itemLeft0_'+q).value = arr[num];
		num++;
		document.getElementById('i'+i+'_itemRight0_'+q).value = arr[num];
		num++;
		q++;
		}
	i++;
	}
}
Inpt.prototype.skin=function(){
var arr = [];
var a = 0;
for(var i=0;i<this.grpBinStr.length;i=(i+2)){
	arr[a] = this.grpBinStr.slice(i,(i+2))
	if(arr[a].substring(0,1)==0){arr[a] = arr[a].substring(1,2)}
	if(arr[a] =="-|"){arr[a] = ""}
	a++;
	}
return arr;
}
Inpt.prototype.process=function(){
if(this._sendCount<9){
	this._main.send(document.getElementById("i"+this._sendCount),1);
	this._sendCount++;
	}
}
