/**
 * FlashObject v1.3d: Flash detection and embed - http://blog.deconcept.com/flashobject/
 *
 * FlashObject is (c) 2006 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof com=="undefined"){var com=new Object();}
if(typeof com.deconcept=="undefined"){com.deconcept=new Object();}
if(typeof com.deconcept.util=="undefined"){com.deconcept.util=new Object();}
if(typeof com.deconcept.FlashObjectUtil=="undefined"){com.deconcept.FlashObjectUtil=new Object();}
com.deconcept.FlashObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a,_b){
if(!document.createElement||!document.getElementById){return;}
this.DETECT_KEY=_b?_b:"detectflash";
this.skipDetect=com.deconcept.util.getRequestParameter(this.DETECT_KEY);
this.params=new Object();
this.variables=new Object();
this.attributes=new Array();
this.useExpressInstall=_7;
if(_1){this.setAttribute("swf",_1);}
if(id){this.setAttribute("id",id);}
if(w){this.setAttribute("width",w);}
if(h){this.setAttribute("height",h);}
if(_5){this.setAttribute("version",new com.deconcept.PlayerVersion(_5.toString().split(".")));}
this.installedVer=com.deconcept.FlashObjectUtil.getPlayerVersion(this.getAttribute("version"),_7);
if(c){this.addParam("bgcolor",c);}
var q=_8?_8:"high";
this.addParam("quality",q);
var _d=(_9)?_9:window.location;
this.setAttribute("xiRedirectUrl",_d);
this.setAttribute("redirectUrl","");
if(_a){this.setAttribute("redirectUrl",_a);}
};
com.deconcept.FlashObject.prototype={setAttribute:function(_e,_f){
this.attributes[_e]=_f;
},getAttribute:function(_10){
return this.attributes[_10];
},addParam:function(_11,_12){
this.params[_11]=_12;
},getParams:function(){
return this.params;
},addVariable:function(_13,_14){
this.variables[_13]=_14;
},getVariable:function(_15){
return this.variables[_15];
},getVariables:function(){
return this.variables;
},createParamTag:function(n,v){
var p=document.createElement("param");
p.setAttribute("name",n);
p.setAttribute("value",v);
return p;
},getVariablePairs:function(){
var _19=new Array();
var key;
var _1b=this.getVariables();
for(key in _1b){_19.push(key+"="+_1b[key]);}
return _19;
},getFlashHTML:function(){
var _1c="";
if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){
if(this.getAttribute("doExpressInstall")){
this.addVariable("MMplayerType","PlugIn");
}
_1c="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\"";
_1c+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";
var _1d=this.getParams();
for(var key in _1d){_1c+=[key]+"=\""+_1d[key]+"\" ";}
var _1f=this.getVariablePairs().join("&");
if(_1f.length>0){_1c+="flashvars=\""+_1f+"\"";}
_1c+="/>";
}else{
if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");}
_1c="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\">";
_1c+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";
var _20=this.getParams();
for(var key in _20){_1c+="<param name=\""+key+"\" value=\""+_20[key]+"\" />";}
var _22=this.getVariablePairs().join("&");
if(_22.length>0){_1c+="<param name=\"flashvars\" value=\""+_22+"\" />";
}_1c+="</object>";}
return _1c;
},write:function(_23){
if(this.useExpressInstall){
var _24=new com.deconcept.PlayerVersion([6,0,65]);
if(this.installedVer.versionIsValid(_24)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){
this.setAttribute("doExpressInstall",true);
this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));
document.title=document.title.slice(0,47)+" - Flash Player Installation";
this.addVariable("MMdoctitle",document.title);}
}else{this.setAttribute("doExpressInstall",false);}
if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){
var n=(typeof _23=="string")?document.getElementById(_23):_23;
n.innerHTML=this.getFlashHTML();
}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}}};
com.deconcept.FlashObjectUtil.getPlayerVersion=function(_26,_27){
var _28=new com.deconcept.PlayerVersion(0,0,0);
if(navigator.plugins&&navigator.mimeTypes.length){
var x=navigator.plugins["Shockwave Flash"];
if(x&&x.description){_28=new com.deconcept.PlayerVersion(x.description.replace(/([a-z]|[A-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}
}else{
try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
for(var i=3;axo!=null;i++){
axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+i);
_28=new com.deconcept.PlayerVersion([i,0,0]);}}
catch(e){}
if(_26&&_28.major>_26.major){return _28;}
if(!_26||((_26.minor!=0||_26.rev!=0)&&_28.major==_26.major)||_28.major!=6||_27){
try{
_28=new com.deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
}catch(e){}}}
return _28;
};
com.deconcept.PlayerVersion=function(_2c){
this.major=parseInt(_2c[0])||0;
this.minor=parseInt(_2c[1])||0;
this.rev=parseInt(_2c[2])||0;
};
com.deconcept.PlayerVersion.prototype.versionIsValid=function(fv){
if(this.major<fv.major){return false;}
if(this.major>fv.major){return true;}
if(this.minor<fv.minor){return false;}
if(this.minor>fv.minor){return true;}
if(this.rev<fv.rev){return false;}
return true;
};
com.deconcept.util={getRequestParameter:function(_2e){
var q=document.location.search||document.location.hash;
if(q){var _30=q.indexOf(_2e+"=");
var _31=(q.indexOf("&",_30)>-1)?q.indexOf("&",_30):q.length;
if(q.length>1&&_30>-1){
return q.substring(q.indexOf("=",_30)+1,_31);}}return "";
},removeChildren:function(n){
while(n.hasChildNodes()){
n.removeChild(n.firstChild);}}};
if(Array.prototype.push==null){
Array.prototype.push=function(_33){
this[this.length]=_33;
return this.length;};}
var getQueryParamValue=com.deconcept.util.getRequestParameter;
var FlashObject=com.deconcept.FlashObject;

QTObject = null;
QTObject = function(mov, id, w, h, ver) {
	this.mov = mov;
	this.id = id;
	this.width = w;
	this.height = h;
	this.version = ver || 6.5; // default to 6.5
	this.redirect = "";
	this.sq = document.location.search.split("?")[1] || "";
	this.altTxt = "<p>This content requires the QuickTime Plugin. <a href='../noquicktime.html'>Install QuickTime here.</a> </p>";
	this.bypassTxt = "<p>Already have QuickTime Player? <a href='?detectqt=false&"+ this.sq +"'>Click here if you have QuickTime "+ this.version +" installed.</a></p>";
	this.params = new Object();
	this.doDetect = getQueryParamValue('detectqt');
}
QTObject.installedVersion = 0;
QTObject.prototype.addParam = function(name, value) {
	this.params[name] = value;
}

QTObject.prototype.getParams = function() {
    return this.params;
}

QTObject.prototype.getParam = function(name) {
    return this.params[name];
}

QTObject.prototype.getParamTags = function() {
    var paramTags = "";
    for (var param in this.getParams()) {
        paramTags += '<param name="' + param + '" value="' + this.getParam(param) + '" />';
    }
    if (paramTags == "") {
        paramTags = null;
    }
    return paramTags;
}

QTObject.prototype.getHTML = function() {
    var qtHTML = "";
	if (navigator.plugins && navigator.plugins.length) { // not ie
        qtHTML += '<embed type="video/quicktime" src="' + this.mov + '" width="' + this.width + '" height="' + this.height + '" id="' + this.id + '"';
        for (var param in this.getParams()) {
            qtHTML += ' ' + param + '="' + this.getParam(param) + '"';
        }
        qtHTML += '></embed>';
    }
    else { // pc ie
        qtHTML += '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="' + this.width + '" height="' + this.height + '" id="' + this.id + '">';
        this.addParam("src", this.mov);
        if (this.getParamTags() != null) {
            qtHTML += this.getParamTags();
        }
        qtHTML += '</object>';
    }
    return qtHTML;
}


QTObject.prototype.getVariablePairs = function() {
    var variablePairs = new Array();
    for (var name in this.getVariables()) {
        variablePairs.push(name + "=" + escape(this.getVariable(name)));
    }
    if (variablePairs.length > 0) {
        return variablePairs.join("&");
    }
    else {
        return null;
    }
}

QTObject.prototype.write = function(elementId) {
	if(detectQuickTime(this.version) || this.doDetect=='false') {
		if (elementId) {
			document.getElementById(elementId).innerHTML = this.getHTML();
		} else {
			document.write(this.getHTML());
		}
	} else {
		if (this.redirect != "") {
			document.location.replace(this.redirect);
		} else {
			if (elementId) {
				document.getElementById(elementId).innerHTML = "<div class='noQuickTime'>"+this.altTxt +""+ this.bypassTxt+"</div>";
			} else {
				document.write("<div class='noQuickTime'>"+this.altTxt +""+ this.bypassTxt+"</div>");
			}
		}
	}		
}
function getQuickTimeVersion() {
	var qtObj = false;
	if (navigator.plugins && navigator.plugins.length) {
		for (var i=0; i < navigator.plugins.length; i++) {
			var plugin = navigator.plugins[i];
			if (plugin.name.indexOf("QuickTime") > -1) {
				QTObject.installedVersion = parseFloat(plugin.name.substring(18));
			}
		}
	} else {
		execScript('on error resume next: set qtObj = CreateObject("QuickTimeCheckObject.QuickTimeCheck.1")\nif IsObject(qtObj) then\nif qtObj.IsQuickTimeAvailable(0) then\nQTObject.installedVersion = Round((Hex(qtObj.QuickTimeVersion) / 1000000), 1)\nend if\nend if', 'VBScript');
	}
	return QTObject.installedVersion;
}
function detectQuickTime(ver) {	
	if (getQuickTimeVersion() >= ver) {
		return true;
	} else {
		return false;
	}
}


	function changeSearchCat(form){
		//alert(value);
		form.submit();
	}
	function submitForm(form){
		document[form].submit();
	}
	function changePage(st,ln){
		document.forms[0].pagest.value = st;
		document.forms[0].pagelen.value = ln;
		document.forms[0].submit();
	}
	function changeYear(year){
		document.forms[0].pagest.value = 0;
		document.forms[0].year.value = year;
		document.forms[0].form.value = "browse";
		document.forms[0].submit();
	}
	function changeMonth(month){
		document.forms[0].pagest.value = 0;
		document.forms[0].month.value = month;
		document.forms[0].form.value = "browse";
		document.forms[0].submit();
	}
	function changeCat1(cat1){
		document.forms[0].pagest.value = 0;
		document.forms[0].cat1.value = cat1;
		document.forms[0].form.value = "browse";
		document.forms[0].submit();
	}
	function changeCat2(cat2){
		document.forms[0].pagest.value = 0;
		document.forms[0].cat1.value = cat2;
		document.forms[0].form.value = "browse";
		document.forms[0].submit();
	}
	function search(){
		document.forms[0].pagest.value = 0;
		document.forms[0].month.value = 0;
		document.forms[0].form.value = "search";
		document.forms[0].submit();
	}
	
	function findObj(theObj, theDoc){
		var p, i, foundObj;
		if(!theDoc) theDoc = document;
		if((p = theObj.indexOf("?")) > 0 && parent.frames.length){
			theDoc = parent.frames[theObj.substring(p+1)].document;
			theObj = theObj.substring(0,p);
		}
		if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
		for (i=0; !foundObj && i < theDoc.forms.length; i++)
			foundObj = theDoc.forms[i][theObj];
		for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++)
			foundObj = findObj(theObj,theDoc.layers[i].document);
		if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
		return foundObj;
	}
	
	function showHideLayers(){
		var i, visStr, obj, objStyle, args = showHideLayers.arguments;
		
		for (i=0; i<(args.length-1); i+=2){
			
			if ((obj = findObj(args[i])) != null){
				
				visStr = args[i+1];
				if (obj.style){
					//alert(args[i] + " has a style!");
					objStyle = obj.style;
					if(visStr == 'show') visStr = 'block';
					else if(visStr == 'hide') visStr = 'none';
				}
				objStyle.display = visStr;
			}
  		}
	}
	
	
	function changeStandingsYear(season_id,standings_id){
		window.location.href = 'standings.php?season_id=' + season_id + '&standings_id=' + standings_id;
	}

	function changeRaceResultsSeason(season_id){
		window.location.href = 'raceresults.php?season_id=' + season_id;
	}
	
	function changeSeason(page,season_id){
		window.location.href = page + '?season_id=' + season_id;
	}
	
	
	/* Initiate Scripts */
arrLoadFunctions = [browserCheck];
function addLoadFunction(){
	for(var i = 0; i < arguments.length; ++i){
		arrLoadFunctions[arrLoadFunctions.length] = arguments[i];
	}
}


function initiate(){
	for(var i = 0; i < arrLoadFunctions.length; ++i){
		arrLoadFunctions[i]();
	}
}
window.onload = initiate;

function sf() {
	if (document.f.searchterm != null) {
	document.f.searchterm.focus();
	}
	else {};
};
function writeCookie(name, value, hours)
{
  var expire = "";
  if(hours != null)
  {
    expire = new Date((new Date()).getTime() + hours * 3600000);
    expire = "; expires=" + expire.toGMTString();
  }
  document.cookie = name + "=" + escape(value) + expire;
}
function readCookie(name)
{
  var cookieValue = "";
  var search = name + "=";
  if(document.cookie.length > 0)
  { 
    offset = document.cookie.indexOf(search);
    if (offset != -1)
    { 
      offset += search.length;
      end = document.cookie.indexOf(";", offset);
      if (end == -1) end = document.cookie.length;
      cookieValue = unescape(document.cookie.substring(offset, end))
    }
  }
  return cookieValue;
}

function inStr(findString, checkString)
{
	return checkString.indexOf(findString)>0?true:false;
}
function isBrowser(browserName)
{
	return inStr(browserName, navigator.userAgent)
}
function browserCheck(accepted)
{
	var BrowserAlert = findObj("BrowserCheck");
	var container = findObj("container");
	if(!readCookie("BTCCBrowserCheck")) {
		if(!isBrowser("Firefox") && !isBrowser("MSIE")) {
			BrowserAlert.style.display = "block";
			container.style.display = "none";
		} else {
			BrowserAlert.style.display = "none";
			container.style.display = "block";
		}
	}
	if(accepted != null) {
		BrowserAlert.style.display = "none";
		container.style.display = "block";
	}
	writeCookie("BTCCBrowserCheck", "true", "9999999");
}
