function doRefresh(url){
	document.location = 'http://www.realtoyota.ca/';
}
function createCookie(name,value,days) 
{
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
	//alert ('JS COOKIE IS: ' + document.cookie);
}
function PageQuery(q) {
	if(q.length > 1) this.q = q.substring(1, q.length);
	else this.q = null;
	this.keyValuePairs = new Array();
	if(q) {
		for(var i=0; i < this.q.split("&").length; i++) {
			this.keyValuePairs[i] = this.q.split("&")[i];
		}
	}
	this.getKeyValuePairs = function() { return this.keyValuePairs; }
	this.getValue = function(s) {
		for(var j=0; j < this.keyValuePairs.length; j++) {
			if(this.keyValuePairs[j].split("=")[0] == s)
			return this.keyValuePairs[j].split("=")[1];
		}
		return false;
	}
	this.getParameters = function() {
		var a = new Array(this.getLength());
		for(var j=0; j < this.keyValuePairs.length; j++) {
			a[j] = this.keyValuePairs[j].split("=")[0];
		}
		return a;
	}
	this.getLength = function() { return this.keyValuePairs.length; } 
}

function queryString(key){
	var page = new PageQuery(window.location.search); 
	return unescape(page.getValue(key)); 
}

function popUp(URL) {
	var day = new Date();
	var id = day.getTime();
	window.open(URL, id, 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=800,height=768');
}

var exitmessage = "When you click \"OK\", a new browser window will open, allowing you to access this independent website.\r\rThe Ontario Toyota Dealers encourage users to read the privacy statements and legal terms and conditions of all third party sites.";

function exitclubtoyota()
{
	exitDialog ("https://clubtoyota.toyota.ca/tohp/experience/en/home/index.jsp?wosid=uDIvnoOxS2OjhdkMiYT7A0&woiid=9");
}

function pricemytoyota()
{
	exitDialog ("http://www.toyota.ca/cgi-bin/WebObjects/WWW.woa/9/wo/Home.Vehicles.Configurator-uDIvnoOxS2OjhdkMiYT7A0/7.11?configurator%2ehtml");
}

function exitDialog (URL) {
	if (window.confirm(exitmessage))
	{
		day = new Date();
		id = day.getTime();
		eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=800,height=500');");
	}
}
 function getFlashMovie(movieName) {
  var isIE = navigator.appName.indexOf("Microsoft") != -1;
  return (isIE) ? window[movieName] : document[movieName];
 }
 function clearFlashObject() {
  getFlashMovie("otda").doClear();
 }
 
getPlayerVersion = function()
{
	var _23 = new PlayerVersion([0,0,0]);
	if (navigator.plugins && navigator.mimeTypes.length)
	{
		var x = navigator.plugins["Shockwave Flash"];
		if (x && x.description)
		{
			_23 = new PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));
		}
	}
	else
	{
		if (navigator.userAgent && navigator.userAgent.indexOf("Windows CE") >= 0)
		{
			var axo=1; var _26=3; while(axo)
			{
				try {
					_26++;
					axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + _26);
					_23 = new PlayerVersion([_26,0,0]);
				}
				catch(e)
				{
					axo = null;
				}
			}
		}
		else
		{
			try
			{
				var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
			}
			catch(e)
			{
				try
				{
					var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
					_23 = new PlayerVersion([6,0,21]);
					axo.AllowScriptAccess="always";
				}
				catch(e)
				{
					if (_23.major == 6)
					{
						return _23;
					}
				}
				try
				{
					axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
				}
				catch(e)
				{
				}
			}
			if (axo!=null)
			{
				_23 = new PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
			}
		}
	}
	return _23;
};

PlayerVersion = function(_29)
{
	this.major = (_29[0] != null) ? parseInt(_29[0]) : 0;
	this.minor = (_29[1] != null) ? parseInt(_29[1]) : 0;
	this.rev = (_29[2] != null) ? parseInt(_29[2]) : 0;
};