$(document).ready(function() {

	
	// browser check
/*	if(($.browser.msie) && (parseInt($.browser.version) == 6)) {
		document.location = 'http://upgradeyourbrowser.org/';
	}
*/

	//$("#panes-container #panes li a").hover(function(e){
		//var pane = $(this).attr("title");

		//$(".subpanes ul").hide();
		//$(".subpanes #" +pane).show();
		
	//});
	
	
	//live team events
	$("#btnhomeEvents,#btnawayEvents").click(function() {
		if( $(this).text() == "MORE") {
			$("#home-events, #away-events").animate({height: "150px"});
			$("#btnhomeEvents,#btnawayEvents").text("LESS");
		} else {
			$("#home-events, #away-events").animate({height: "40px"});
			$("#btnhomeEvents,#btnawayEvents").text("MORE");
		}
		$("#btnhomeEvents,#btnawayEvents").css("text-decoration","none");
		return false;
	});
	
	
	//help
	$(".help").click(function() {
		if( $(".help-text",this).css("bottom") == "30px") {
			$(".help-text",this).animate({opacity: "hide", bottom: "25px"}, "fast");
		} else {
			$(".help-text",this).animate({opacity: "show", bottom: "30px"}, "slow");
		}
	});



	//audio checked?
	if($.cookie('getin-play-noaudio')) {
		$("#pref-audio").attr("checked",false);
	} else {
		$("#pref-audio").attr("checked",true);
	}

	//set audio cookie
	$("#pref-audio").click(function() {
		//splash
       	var cookieOptions = { path: '/', expires: 365 };
		if($.cookie('getin-play-noaudio')) {
			$.cookie('getin-play-noaudio', null, cookieOptions);
		} else {
			$.cookie('getin-play-noaudio', 'true', cookieOptions);
		}
	});

	
});



// msg
function msg(txt,sts) {
	
	if(sts == 1) {
		$("#msg").css({borderColor: '#e44839', background: '#ea623e'});
	} 

	
	$("#msg .text").html(txt);
	$("#msg").show();

}





//toggle stats
function toggleStat(obj,widget,statType) {

	//toggle stats
	$("."+widget).hide();
	
	if(widget == 's1') {
		$("#"+widget+"-"+statType).show();
	} else {
		$("#"+widget+"-"+statType+"-home").show();
		$("#"+widget+"-"+statType+"-away").show();	
	}

	//update btn
	$(".stat-btn-container .btn").css("color","#ffffff");
	$(".stat-btn-container .btn").css("background-position","0 0");

	obj.style.color = "#000000"
	obj.style.backgroundPosition = "0 -24px";
		
}










//mail
// SPAM
var tld_ = new Array()
tld_[0] = "com";
tld_[1] = "net";
tld_[2] = "dk";

var topDom_ = 3;
var m_ = "mailto:";
var a_ = "@";
var d_ = ".";

function mail(name, dom, tl, params) {
	var s = e(name,dom,tl);
	document.write('<a href="'+m_+s+params+'" onfocus="this.blur();">'+s+'</a>');
}

function mail2(name, dom, tl, params, display) {
	document.write('<a href="'+m_+e(name,dom,tl)+params+'" onfocus="this.blur();">'+display+'</a>');
}

function e(name, dom, tl) {
	var s = name+a_;
	if (tl!=-2)
	{
		s+= dom;
		if (tl>=0)
			s+= d_+tld_[tl];
	}
	else
		s+= swapper(dom);
	return s;
}

function swapper(d) {
	var s = "";
	for (var i=0; i<d.length; i+=2)
		if (i+1==d.length)
			s+= d.charAt(i)
		else
			s+= d.charAt(i+1)+d.charAt(i);
	return s.replace(/\?/g,'.');
}

