var addOnload = function(o, strFunc, isReturn)
{
	var oldOnload;

	oldOnload = o.onload;

	o.onload = function()
	{
		if (oldOnload) oldOnload();
		if(isReturn)
		{
			return eval(strFunc);
		}
		else
		{
			eval(strFunc);
		}
	}
}

var addExternals = function()
{
	var a;
	var i;

	a = document.getElementsByTagName("a");

	try
	{
		for(i = 0; i < a.length; i++)
		{
			if(a[i].attributes["rel"])
			{
				if(a[i].getAttribute("rel") == "external")
				{
					a[i].setAttribute("target", "_blank");
					a[i].onclick = function()
					{
						if(typeof urchinTracker == "function")
						{
							urchinTracker(this.href);
						}
					}
				}
			}
		}
 }
 catch(e)
 { }
}

var InsertLogos = function()
{
	var FlashLogos = { movie:"Content/Flash/logos.swf",width:157,height:130,majorversion:9,build:0,bgcolor:"#FFFFFF"};
	elBody = document.getElementsByTagName('body')[0];
	
	if (elBody != null)
	{
		if (elBody.className != "show-guide")
		{
			UFO.create(FlashLogos, "image-two");
		}
	}
}

var InsertCountdown = function(days)
{
	var tgt;

	tgt = document.getElementById("image-one");

	if(tgt)
	{
		if(String(days) != "undefined")
		{
			ufo = { movie:"Content/Flash/promotion.swf", width:135, height:430, majorversion:8, build:0, menu:false, flashvars:"days=" + days};
			UFO.create( ufo, "image-one");
		}
		else
		{
			ufo = { movie:"Content/Flash/promotion.swf", width:135, height:430, majorversion:8, build:0, menu:false};
			UFO.create( ufo, "image-one");
		}
	}
	
	tgt = document.getElementById("image-one-still");

	if(tgt)
	{
		if(String(days) != "undefined")
		{
			ufo = { movie:"Content/Flash/promotion.swf", width:135, height:430, majorversion:8, build:0, menu:false, flashvars:"days=" + days};
			UFO.create( ufo, "image-one-still");
		}
		else
		{
			ufo = { movie:"Content/Flash/promotion.swf", width:135, height:430, majorversion:8, build:0, menu:false};
			UFO.create( ufo, "image-one-still");
		}
	}
}

window.onload = function()
{

	tgt = document.getElementById("bikes");

	if(tgt)
	{
		ufo = { movie:"Content/Flash/Header3.swf", width:941, height:155, majorversion:8, build:0, menu:false};
		UFO.create( ufo, "bikes");
	}
	
	tgt = document.getElementById("bikes-still");

	if(tgt)
	{
		ufo = { movie:"Content/Flash/Header-still2.swf", width:941, height:155, majorversion:8, build:0, menu:false};
		UFO.create( ufo, "bikes-still");
	}
	
	tgt = document.getElementById("related-one");

	if(tgt)
	{
		ufo = { movie:"Content/Flash/home-image-loop.swf", width:333, height:153, majorversion:8, build:0, menu:false};
		UFO.create( ufo, "related-one");
	}
	
	InsertLogos();
	addExternals();
}


