if (typeof console === 'undefined') {
	console = {}
	console.log = console.time = console.timeEnd = function() {}
}

$(document).ready(function() {
	carousel();

});

function showPromo() {
	swfobject.embedSWF('/i/promo/RotoGol.swf', 'promoblock', 650, 274, '9.0.0', '',
		{xml: '/export/?view=promo'},
		{allowScriptAccess: 'sameDomain', bgcolor: '#ffffff'}
	);
}

function ShowPlayer4ot(link) {
	swfobject.embedSWF('/i/online/player.swf', 'flashcontent', 354, 288, '8.0.0', '',
		{__streamurl__: link, __volume__: 100},
		{allowFullScreen: true}
	);
}

function showMegaPlayer(link) {
	swfobject.embedSWF('/i/video/player.swf', 'megaplayer', 490, 274, '8.0.0', '',
		{__videopath__: link, __volume__: 100},
		{allowFullScreen: true}
	);
}

function addAFPopup(){
	$("a[href*='/i/afp/']").attr('popup', '300 230');
}

function classifyExternalLinks() {
	var links = document.getElementsByTagName('a');
	if (links) {
		links.l = links.length;
		for (var i = 0; i < links.l; i++) {
			var link = links[i];
			if (link.href && !link.href.match(window.location.host) && !link.href.match('mailto:')) {
				link.className += ' external';
			}
		}
	}
}

function expandTags() {
	var cloud = $('#tagCloud');
	var button = $('#expandTags');
	if (location.search.match('tags')) {
		button.addClass('tv-unexp');
		cloud.show();
	}
	button.click(function() {
		cloud.slideToggle('fast');
		$(this).toggleClass('tv-unexp');
	});
}

function clearInputs() {
	var inputs = $('input:text, input:password');
	
	inputs.focus(function() {
		this.defaultValue = this.value;
		if (this.defaultValue == this.value) this.value = '';
	});
	inputs.blur(function() {
		if (!this.value) this.value = this.defaultValue;
	});
}

function voytee(x,v)
{

	$.ajax({
		type: "POST",
		url: "/x.php",
		dataType: "html",
		data: "a=vote&m="+x+"&v="+v,
		success: function(html) {
			
			var outs = new Array();
            outs = html.split('|');
			if (outs.length > 2)
			{
			var xtotal = outs[0];
			var xhome = outs[1];
			var xdraw = outs[2];
			var xvisitor = outs[3];
			
			document.getElementById('mhomevotes'+x).innerHTML = xhome;
			document.getElementById('mdrawvotes'+x).innerHTML = xdraw;
			document.getElementById('mvisitorvotes'+x).innerHTML = xvisitor;
			document.getElementById('mtotal'+x).innerHTML = xtotal;
						
			if (v == 1)
			{
			     document.getElementById('mhomebar'+x).style.background = "#D73333 url(/_f/i/vtr.gif) no-repeat "+xhome+"px 50%";
			}
			else
			{
			     document.getElementById('mhomebar'+x).style.background = "#617f1e url(/_f/i/vtr.gif) no-repeat "+xhome+"px 50%";
			}
			
			if (v == 2)
			{
			     document.getElementById('mdrawbar'+x).style.background = "#D73333 url(/_f/i/vtr.gif) no-repeat "+xdraw+"px 50%";
			}
			else
			{
			     document.getElementById('mdrawbar'+x).style.background = "#617f1e url(/_f/i/vtr.gif) no-repeat "+xdraw+"px 50%";
			}
			
			if (v == 3)
			{
			     document.getElementById('mvisitorbar'+x).style.background = "#D73333 url(/_f/i/vtr.gif) no-repeat "+xvisitor+"px 50%";
			}
			else
			{
			     document.getElementById('mvisitorbar'+x).style.background = "#617f1e url(/_f/i/vtr.gif) no-repeat "+xvisitor+"px 50%";
			}
			
			document.getElementById('mhomelink'+x).style.display = 'none';
			document.getElementById('mdrawlink'+x).style.display = 'none';
			document.getElementById('mvisitorlink'+x).style.display = 'none';
			
			document.getElementById('mshomelink'+x).style.display = 'none';
			document.getElementById('msdrawlink'+x).style.display = 'none';
			document.getElementById('msvisitorlink'+x).style.display = 'none';
			
			
			document.getElementById('mhomespan'+x).style.display = 'block';
			document.getElementById('mdrawspan'+x).style.display = 'block';
			document.getElementById('mvisitorspan'+x).style.display = 'block';
			
			document.getElementById('mshomespan'+x).style.display = 'block';
			document.getElementById('msdrawspan'+x).style.display = 'block';
			document.getElementById('msvisitorspan'+x).style.display = 'block';
			
			return false;
			}
		}
	});   
}

