window.onload = Load;

/* Starting Onload Scripts */

function Load()
{
	document.getElementById('website-title').onclick = function()
	{
		window.location = aHome;
	}
	
	/****/
	
	if(/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent))
	{
		var ffversion = new Number(RegExp.$1);
		
		if(ffversion >= 3.6)
		{
			document.getElementById('plus-bar').className = "plus-bar";
			document.getElementById('plus-msg').innerHTML = '<b>Gostou? Quer mais? Então clique neste botão aqui do lado <span>&gt;&gt;</span>&nbsp;</b>';
		}
	}

	if(/MSIE (\d+\.\d+);/.test(navigator.userAgent))
	{
		var ieversion = new Number(RegExp.$1);
		
		if(ieversion >= 8)
		{
			document.getElementById('plus-bar').className = "plus-bar";
			document.getElementById('plus-msg').innerHTML = '<b>Gostou? Quer mais? Então clique neste botão aqui do lado <span>&gt;&gt;</span>&nbsp;</b>';
		}
	}

	if(/Opera[\/\s](\d+\.\d+)/.test(navigator.userAgent))
	{
		var oprversion = new Number(RegExp.$1);
		
		if(oprversion >= 8)
		{
			document.getElementById('plus-bar').className = "plus-bar";
			document.getElementById('plus-msg').innerHTML = '<b>Gostou? Quer mais? Então clique neste botão aqui do lado <span>&gt;&gt;</span>&nbsp;</b>';
		}
	}

	if(/Chrome[\/\s](\d+\.\d+)/.test(navigator.userAgent))
	{
		document.getElementById('plus-bar').className = "plus-bar";
		document.getElementById('plus-msg').innerHTML = '<b>Gostou? Quer mais? Então clique neste botão aqui do lado <span>&gt;&gt;</span>&nbsp;</b>';
	}
	
	/****/
	
	document.getElementById('q').onfocus = function()
	{
		if (this.value == 'Buscar...')
		{
			this.value = '';
		}
	}
	document.getElementById('q').onblur = function()
	{
		if (this.value == '')
		{
			this.value = 'Buscar...';
		}
	}
	
	/****/
	
	if (aLocation == 'home')
	{
		StartFeatured = setInterval (StartFeatured, 10);
	}
	
	if (aLocation == 'single')
	{
		document.getElementById('e').onfocus = function()
		{
			if (this.value == 'Digite aqui seu email para receber...')
			{
				this.value = '';
			}
		}
		document.getElementById('e').onblur = function()
		{
			if (this.value == '')
			{
				this.value = 'Digite aqui seu email para receber...';
			}
		}
	}
}

/* Setting Variables & Preload */

var X = 0;

var preload = new Array();
	
preload[0] = new Image();
preload[1] = new Image();
preload[2] = new Image();
	
preload[0].src = aImage[0];
preload[1].src = aImage[1];
preload[2].src = aImage[2];

/* Featured Script Functions */

function StartFeatured()
{
	document.getElementById('brief').innerHTML = 'Carregando...';
	if ((preload[0].complete) && (preload[1].complete) && (preload[2].complete))
	{
		setInterval (ChangeFeatured, 5000);
		clearInterval (StartFeatured);
	}
}

function ChangeFeatured()
{
	document.getElementById('headline').style.background = "url("+aImage[X]+")";
	document.getElementById('brief').innerHTML = aBrief[X];
	document.getElementById('more').innerHTML = '<a href="'+aLink[X]+'">[saiba mais]</a>';
	
	X++;
	
	if (X >= aImage.length) { X = 0; }
}
