	/*
	 * Enthält den Pfad der Livescores
	 * 
	 * @var string
	 */
	var livescoresPath = '/livescores/';
	var date = new Date();
	var time_zone = '';
	var current_country='';
	var tzoffset = date.getTimezoneOffset()/60;
	var split_cookie = document.cookie.split(";");
	var tz_array = new Array(999,999);
	for (var spc=0; spc < split_cookie.length;spc++ ){
		if(split_cookie[spc].indexOf("timezone=") > -1){
			var tz_array = split_cookie[spc].split("=");
		}
	}
	date.setTime(date.getTime()+(30*86400*1000*1000));
	var expires2 = ";expires=" + date.toGMTString();
	var expires = "";
	if(tz_array[1] == "999"){
		if(tzoffset < 0){
			time_zone = Math.abs(tzoffset);
		} else {
			time_zone = "-"+Math.abs(tzoffset);		
		}
		document.cookie = "timezone=" + time_zone + expires + ";path=" + livescoresPath;
	} else {
		time_zone = tz_array[1];
	}
	function expandplayer1(obVal){
		var list = procRequest(livescoresPath + 'xml/player_with_start.php?mode=A&char=' + obVal);
		document.getElementById("player1").innerHTML = list;
	}
	function expandplayer2(obVal){
		var list = procRequest(livescoresPath + 'xml/player_with_start.php?mode=B&char=' + obVal);
		document.getElementById("player2").innerHTML = list;
	}
	function set_setting_value(obj, val){
		document.getElementById(obj).checked = val;
	}
	function set_setting_valueX(obj, val){
		document.getElementById(obj).value = val;
	}
	function ts_rank(standing){
		window.location = livescoresPath + 'stats.php?sport=ts&standing=' + standing;
	}
	function updateClock(){
		current_time_server++;
		var currentTime = new Date(current_time_server*1000);
		var timeArray = currentTime.toGMTString().split(" ");
		document.getElementById("clock").innerHTML = timeArray[1] + "-" + getMonthX(timeArray[2]) + "-" + timeArray[3].substr(2,4) + ", " + timeArray[4];
		currentTime = null;
		timeArray = null;
	}
	function live_reload(){
//		document.getElementById("maintable").className='blurc';
		document.getElementById("loading_bar").style.display='block';
		if( typeof( window.innerWidth ) == 'number' ) {
			document.getElementById("loading_bar").style.left = (window.innerWidth/2-100) + 'px';
			document.getElementById("loading_bar").style.top = (window.innerHeight/2-70) + 'px';
		} else {
			document.getElementById("loading_bar").style.left = (document.documentElement.clientWidth/2-100) + 'px';
			document.getElementById("loading_bar").style.top = (document.documentElement.clientHeight/2-70) + 'px';
		}
		setTimeout("live_reload_ext()",2000);
	}
	function live_reload_ext(){
		load_scoreboard(false);
		document.getElementById("loading_bar").style.display='none';
//		document.getElementById("maintable").className='blurf';
	}
	function updateClock2(){
		if(document.getElementById("clock")){
			current_time_server++;
			var temp_timestamp = current_time_server + time_zone*3600;
			var currentTime = new Date(temp_timestamp*1000);
			var timeArray = currentTime.toGMTString().split(" ");
			document.getElementById("clock").innerHTML = timeArray[4];
			temp_timestamp = null;
			currentTime = null;
			timeArray = null;
		}
	}
	function all_games(){
		setCountry('all2');
		document.getElementById("link0").className = 'n1a';
		gmode('all_matches');
	}
	function getMonthX(obj){
		if(obj == "Jan"){
			return "01";
		} else if(obj == "Feb"){
			return "02";
		} else if(obj == "Mar"){
			return "03";
		} else if(obj == "Apr"){
			return "04";
		} else if(obj == "May"){
			return "05";
		} else if(obj == "Jun"){
			return "06";
		} else if(obj == "Jul"){
			return "07";
		} else if(obj == "Aug"){
			return "08";
		} else if(obj == "Sep"){
			return "09";
		} else if(obj == "Oct"){
			return "10";
		} else if(obj == "Nov"){
			return "11";
		} else if(obj == "Dec"){
			return "12";
		}
	}
	function procRequest(strUrl){
		var obReq = sendRequest(strUrl);
		if(obReq.status == 200){
			if(obReq.readyState == 4){
				var strRetn = obReq.responseText;
				return strRetn;
			}
		}
		timeArray = null;
		return null;
	}
	var date_down_flag = -4;
	function date_down(sport, dateVal){
		date_down_flag = date_down_flag-8;
		var down_content = procRequest(livescoresPath + "xml/datelist.php?sport=" + sport + "&date=" + dateVal + "&var=" + date_down_flag + "&nkstamp=" + Math.random());
		document.getElementById("div_date_scoll").innerHTML = down_content;
		down_content = null;
	}
	function date_up(sport, dateVal){
		date_down_flag = date_down_flag+8;
		var up_content = procRequest(livescoresPath + "xml/datelist.php?sport=" + sport + "&date=" + dateVal + "&var=" + date_down_flag + "&nkstamp=" + Math.random());
		document.getElementById("div_date_scoll").innerHTML = up_content;
		up_content = null;
	}
	function sendRequest(sUrl){
		var obXttp;
		if(window.ActiveXObject){
			obXttp = new ActiveXObject("Microsoft.XMLHTTP");
		}else{
			obXttp = new XMLHttpRequest();
		}
		obXttp.open("GET", sUrl, false);
		obXttp.send(null);
		return obXttp;
	}
	function sortby(obj_val){
		document.cookie = "g_sort=" + obj_val + expires + ";path=" + livescoresPath;
		if(obj_val == "gt"){
			document.getElementById("sort_by_league").className='buttony_sort';
			document.getElementById("sort_by_gt").className='buttony_sort_on';
		} else {
			document.getElementById("sort_by_gt").className='buttony_sort';
			document.getElementById("sort_by_league").className='buttony_sort_on';
		}
		g_sort = obj_val;
		display_screen();
	}
	function onlivematches(){
		if(only_live_matches == "1"){
			only_live_matches = 0;
			document.cookie = "only_live_matches=0" + expires + ";path=" + livescoresPath;
			document.getElementById("chk_only_live_games").checked = false;
			document.getElementById("chk_only_live_games2").checked = false;
			document.getElementById("show_live_games").className='buttonm_sort';
			document.getElementById("show_live_games2").className='buttonm_sort';
		} else {
			only_live_matches = 1;
			document.cookie = "only_live_matches=1" + expires + ";path=" + livescoresPath;
			document.getElementById("chk_only_live_games").checked = true;
			document.getElementById("chk_only_live_games2").checked = true;
			document.getElementById("show_live_games").className='buttonm_sort_on';
			document.getElementById("show_live_games2").className='buttonm_sort_on';
		}
		display_screen();
	}
	function gmode(obj_val, val_sel){
		match_mode = obj_val;
		document.cookie = "match_mode=" + obj_val + expires + ";path=" + livescoresPath;
		if(obj_val == "my_matches"){
			document.cookie = "show_matches=" + val_sel + expires + ";path=" + livescoresPath;
			show_matches = val_sel;
			setCountry('all2');
			document.getElementById("btn_country_all").style.display='none';
			document.getElementById("btn_country_all2").style.display='none';
			document.getElementById("left_all_games").className = 'n1';
			document.getElementById("left_my_games").className = 'n1a';
			document.getElementById("show_all_games").className='buttonw_sort';
			document.getElementById("show_my_games").className='buttonz_sort_on';
			document.getElementById("show_button_div").style.display="block";
			document.getElementById("show_button_div2").style.display="block";
		} else {
			document.getElementById("left_all_games").className = 'n1a';
			document.getElementById("left_my_games").className = 'n1';
			document.getElementById("show_all_games").className='buttonw_sort_on';
			document.getElementById("show_my_games").className='buttonz_sort';
			document.getElementById("show_button_div").style.display="none";
			document.getElementById("show_button_div2").style.display="none";
		}
		document.cookie = "only_live_matches=0" + expires + ";path=" + livescoresPath;
		document.getElementById("chk_only_live_games").checked = false;
		document.getElementById("chk_only_live_games2").checked = false;
		document.getElementById("show_live_games").className='buttonm_sort';
		document.getElementById("show_live_games2").className='buttonm_sort';
		only_live_matches = "0";
		if(obj_val == "my_matches"){
			chk_border_flag = true;
			display_screen();
			chk_border_flag = false;
		} else {
			display_screen();
		}
	}
	function show_match(obj_val){
		document.cookie = "show_matches=" + obj_val + expires + ";path=" + livescoresPath;
		show_matches = obj_val;
		if(document.getElementById("chk_only_live_games").checked == true){
			onlivematches();
		} else {
			display_screen();
		}
	}
	function setTimeZone(value){
		document.cookie = "timezone=" + value + expires2 + ";path=" + livescoresPath;
		time_zone = value;
		tcontent = procRequest(livescoresPath + "xml/date.php?"+Math.random());
		document.getElementById("timezone_clock").innerHTML = tcontent;
		display_screen();
	}
	function setCountryCode(value){
		current_country = value;
		document.cookie = "countrycode=" + value + expires2 + ";path=" + livescoresPath;
	}
	function parse_closetour_from_cookie(){
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++) {
			if (ca[i].indexOf("closetour") > -1){
				var temp_m = ca[i].split("=");
				close_tour_content = temp_m[1];
				break;
			}
		}
		ca = null;
		return true;
	}
	function parse_favtour_from_cookie(){
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++) {
			if (ca[i].indexOf("favtour") > -1){
				var temp_m = ca[i].split("=");
				fav_tour_content = temp_m[1];
				break;
			}
		}
		ca = null;
		return true;
	}
	function isTourFav(name) {
		var is_fav_tour_hide = false;
		if(fav_tour_content){
			var matches_temp = fav_tour_content.split("#");
			for(var mt=0; mt <= matches_temp.length; mt++){
				if(matches_temp[mt] == name){
					is_fav_tour_hide = true;
					break;
				}
			}
			matches_temp = null;
		}
		return is_fav_tour_hide;
	}
	function parse_tourhide_from_cookie(){
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++) {
			if (ca[i].indexOf("tourlist") > -1){
				var temp_m = ca[i].split("=");
				tour_content = temp_m[1];
				break;
			}
		}
		ca = null;
		return true;
	}
	function isTourClose(name) {
		var is_tour_close = false;
		if(close_tour_content){
			var matches_temp = close_tour_content.split("#");
			for(var mt=0; mt <= matches_temp.length; mt++){
				if(matches_temp[mt] == name){
					is_tour_close = true;
					break;
				}
			}
			matches_temp = null;
		}
		return is_tour_close;
	}
	function isTourHide(name) {
		var is_tour_hide = false;
		if(tour_content){
			var matches_temp = tour_content.split("#");
			for(var mt=0; mt <= matches_temp.length; mt++){
				if(matches_temp[mt] == name){
					is_tour_hide = true;
					break;
				}
			}
			matches_temp = null;
		}
		return is_tour_hide;
	}
	var mt_content = '';
	function parse_mymatches_from_cookie(){
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++) {
			if (ca[i].indexOf("matchlist") > -1){
				var temp_m = ca[i].split("=");
				mt_content = temp_m[1];
				temp_m = null;
				break;
			}
		}
		ca = null
		return true;
	}
	function isMyMatch(name) {
		var is_my_match = false;
		if(mt_content){
			var matches_temp = mt_content.split("#");
			for(var mt=0; mt <= matches_temp.length; mt++){
				if(matches_temp[mt] == name){
					is_my_match = true;
					break;
				}
			}
			matches_temp = null;
		}
		return is_my_match;
	}
	function generate_match_string(){
		var g_string = "";
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++) {
			ca[i] = ca[i].replace(" ","");
			if (ca[i].substring(0,2) == "m_"){
				sbr = ca[i].split("=");
				if(sbr[1] == "1"){
					g_string = g_string + sbr[0].substring(2) + ",";
				}
			}
		}
		ca = null;
		return g_string;
	}
	function setEvent(value, valX){
		var ca = document.cookie.split(';');
		var magicX = '';
		var match_content = '';
		for(var i=0;i < ca.length;i++) {
			if (ca[i].indexOf("tourlist") > -1){
				magicX = ca[i];
				break;
			}
		}
		if(magicX){
			tempCS = magicX.split('=');
			list_matches = tempCS[1].split("#");
			for(var lm=0; lm < list_matches.length; lm++){
				if(list_matches[lm] == value){
					;
				} else {
					if(list_matches[lm]){
						match_content = match_content + "#" + list_matches[lm];
					}
				}
			}
			if(valX == "1"){
				match_content = match_content + "#" + value;
			}
			document.cookie = "tourlist=" + match_content + expires + ";path=" + livescoresPath;
		} else {
			if(valX == "1"){
				document.cookie = "tourlist=" + value + expires + ";path=" + livescoresPath;
			}
		}
		ca = null;
		magicX = null;
		match_content = null;
	}
	function hook_tour(val){
		var ca = document.cookie.split(';');
		var magicX = '';
		var magicY = '';
		var match_content = '';
		var fav_lines = '';
		for(var i=0;i < ca.length;i++) {
			ca[i] = trim(ca[i]);
			if (ca[i].indexOf("favtour=") > -1 && ca[i] != "favtour="){
				magicY = ca[i];
			}
		}
		if(magicY){
			tempCS = magicY.split('=');
			var list_tours = tempCS[1].split("#");
			for(var lm=0; lm < list_tours.length; lm++){
				if(list_tours[lm] && list_tours[lm] != val){
					fav_lines = fav_lines + "#" + list_tours[lm];
				}
			}	
		}
		document.cookie = "favtour=" + fav_lines + "#" + val + expires + ";path=" + livescoresPath;
		ca = null;
		magicX = null;
		magicY = null;
		match_content = null;
		fav_lines = null;
	}
	function unhook_tour(val){
		var ca = document.cookie.split(';');
		var magicX = '';
		var magicY = '';
		var match_content = '';
		var fav_lines = '';
		for(var i=0;i < ca.length;i++) {
			ca[i] = trim(ca[i]);
			if (ca[i].indexOf("favtour=") > -1 && ca[i] != "favtour="){
				magicY = ca[i];
			}
		}
		if(magicY){
			tempCS = magicY.split('=');
			var list_tours = tempCS[1].split("#");
			for(var lm=0; lm < list_tours.length; lm++){
				if(list_tours[lm] && list_tours[lm] != val){
					fav_lines = fav_lines + "#" + list_tours[lm];
				}
			}	
		}
		fav_league.checkobj(false, val);
		document.cookie = "favtour=" + fav_lines + expires + ";path=" + livescoresPath;
		ca = null;
		magicX = null;
		magicY = null;
		match_content = null;
		fav_lines = null;
	}
	function selectTour(ischecked, val){
		var match_tour = new Array();
		var mt=0;
		var match_tour_string = '';
		for (var tgmt_cnt=0; tgmt_cnt < global_tour_match.length; tgmt_cnt++){
			if(global_tour_match[tgmt_cnt][0] == val){
				match_tour[mt] = global_tour_match[tgmt_cnt][1];
				mt++;
				if(ischecked){
					match_tour_string = match_tour_string + '#' + global_tour_match[tgmt_cnt][1];
					if(document.getElementById("match_"+global_tour_match[tgmt_cnt][1])){
						document.getElementById("match_"+global_tour_match[tgmt_cnt][1]).checked = true;
					}
				} else {
					if(document.getElementById("match_"+global_tour_match[tgmt_cnt][1])){
						document.getElementById("match_"+global_tour_match[tgmt_cnt][1]).checked = false;
					}
				}
			}
		}
		var ca = document.cookie.split(';');
		var magicX = '';
		var magicY = '';
		var match_content = '';
		var fav_lines = '';
		for(var i=0;i < ca.length;i++) {
			ca[i] = trim(ca[i]);
			if (ca[i].indexOf("matchlist=") > -1 && ca[i] != "matchlist="){
				magicX = ca[i];
			}
			if (ca[i].indexOf("favtour=") > -1 && ca[i] != "favtour="){
				magicY = ca[i];
			}
		}
		if(magicY){
			tempCS = magicY.split('=');
			var list_tours = tempCS[1].split("#");
			for(var lm=0; lm < list_tours.length; lm++){
				if(list_tours[lm] && !in_array(list_tours[lm],val,true)){
					fav_lines = fav_lines + "#" + list_tours[lm];
				}
			}
			list_tours = null;
		}
		if(ischecked){
			fav_league.checkobj(true, val);
			document.cookie = "favtour=" + fav_lines + "#" + val + expires + ";path=" + livescoresPath;
		} else {
			fav_league.checkobj(false, val);
			document.cookie = "favtour=" + fav_lines + expires + ";path=" + livescoresPath;
		}
		if(magicX){
			tempCS = magicX.split('=');
			list_matches = tempCS[1].split("#");
			for(var lm=0; lm < list_matches.length; lm++){
				if(list_matches[lm] && !in_array(list_matches[lm],match_tour,true)){
					match_content = match_content + "#" + list_matches[lm];
				}
			}
			if(match_tour_string){
				match_content = match_content + match_tour_string;
			}
			document.cookie = "matchlist=" + match_content + expires + ";path=" + livescoresPath;
		} else {
			if(match_tour_string){
				document.cookie = "matchlist=" + match_tour_string + expires + ";path=" + livescoresPath;
			}
		}
		match_tour = null;
		match_tour_string = null;
		mt = null;
		ca = null;
		magicX = null;
		magicY = null;
		match_content = null;
		fav_lines = null;
	}
function in_array(needle, haystack, argStrict) {
    var found = false, key, strict = !!argStrict;
    for (key in haystack) {
        if ((strict && haystack[key] === needle) || (!strict && haystack[key] == needle)) {
            found = true;
            break;
        }
    }
    return found;
}
	function trim(str) {
		var chars = ' ';
		return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
	}
	function setMyMatch(value, valX, tourFK){
		var ca = document.cookie.split(';');
		var magicX = '';
		var match_content = '';
		for(var i=0;i < ca.length;i++) {
			if (ca[i].indexOf("matchlist") > -1){
				magicX = ca[i];
				break;
			}
		}
		if(magicX){
			tempCS = magicX.split('=');
			if(tempCS.length == 2){
				list_matches = tempCS[1].split("#");
				for(var lm=0; lm < list_matches.length; lm++){
					if(list_matches[lm] == value){
						;
					} else {
						if(list_matches[lm]){
							match_content = match_content + "#" + list_matches[lm];
						}
					}
				}
				if(valX){
					match_content = match_content + "#" + value;
				}
				document.cookie = "matchlist=" + match_content + expires + ";path=" + livescoresPath;
			} else {
				if(valX){
					document.cookie = "matchlist=" + value + expires + ";path=" + livescoresPath;
				}
			}
		} else {
			if(valX){
				document.cookie = "matchlist=" + value + expires + ";path=" + livescoresPath;
			}
		}
		if(valX == false){
			unhook_tour(tourFK);
			if(document.getElementById("chk_tr_" + tourFK)){
				document.getElementById("chk_tr_" + tourFK).checked = false;
			}
		}
		if(valX == true){
			var check_hook_tour = 0;
			for (var tgmt_cnt=0; tgmt_cnt < global_tour_match.length; tgmt_cnt++){
				if(global_tour_match[tgmt_cnt][0] == tourFK && document.getElementById("match_"+global_tour_match[tgmt_cnt][1]).checked == false){
					check_hook_tour++;
				}
			}
			if(check_hook_tour == 0){
				hook_tour(tourFK);
				fav_league.checkobj(true, tourFK);
				if(document.getElementById("chk_tr_" + tourFK)){
					document.getElementById("chk_tr_" + tourFK).checked = true;
				}
			}
			check_hook_tour = null;
		}
		ca = null;
		magicX = null;
		match_content = null;
	}
	function select_all(obj){
		var F = document.livedata;
		var match_content = '';
		if(obj){
			for(var i = 0; i < F.length; i++){
				if(F[i].name == "matchid[]"){
					F[i].checked = true;
					match_content = match_content + "#" + F[i].value;
				}
				if(F[i].name == "tourid[]"){
					F[i].checked = true;
					selectTour(true, F[i].value);
				}
			}
			document.cookie = "matchlist=" + match_content + expires + ";path=" + livescoresPath;
		} else {
			for(var i = 0; i < F.length; i++){
				if(F[i].name == "matchid[]"){
					F[i].checked = false;
				}
				if(F[i].name == "tourid[]"){
					F[i].checked = false;
					selectTour(false, F[i].value);
				}
			}
			document.cookie = "matchlist=" + expires + ";path=" + livescoresPath;
		}
		match_content = null;
	}
	function showHideR(item) {
		obj=document.getElementById("body_" + item);
		col=document.getElementById("img-" + item);
		if (obj.style.display=="none"){
			obj.style.display="block";
			col.src=livescoresPath+"img/sh_hide.jpg";
			col.title="hide";
		} else {
			obj.style.display="none";
			col.src=livescoresPath+"img/sh_show.jpg";
			col.title="show";
		}
	}
	function showHide(item) {
		obj=document.getElementById(item);
		col=document.getElementById("img-" + item);
		if (obj.style.display=="none"){
			setEvent(item, '-1');
			obj.style.display="block";
			col.innerHTML = "<img src='"+livescoresPath+"img/sh_hide.jpg' title='"+word_bar_hide+"' onclick=\"showHide('" + item + "')\" border='0' />";
		} else {
			setEvent(item, '1');
			obj.style.display="none";
			col.innerHTML = "<img src='"+livescoresPath+"img/sh_show.jpg' title='"+word_bar_show+"' onclick=\"showHide('" + item + "')\" border='0' />";
		}
	}
	function ResetTour(){
		for(rt_cnt =0; rt_cnt < left_league_id_list.length; rt_cnt++){
			if(document.getElementById("head_" + left_league_id_list[rt_cnt]) && document.getElementById("head_" + left_league_id_list[rt_cnt]).style.display == "none"){
				document.getElementById("head_" + left_league_id_list[rt_cnt]).style.display='block';
				document.getElementById(left_league_id_list[rt_cnt]).style.display='block';
			}
		}
		document.cookie = "closetour=" + expires + ";path=" + livescoresPath;
		document.getElementById("reset_league").style.display='none';
	}
	function ResetTourR(){
		for(rt_cnt =0; rt_cnt < left_league_id_list.length; rt_cnt++){
			if(document.getElementById("tour_" + left_league_id_list[rt_cnt]) && document.getElementById("tour_" + left_league_id_list[rt_cnt]).style.display == "none"){
				document.getElementById("tour_" + left_league_id_list[rt_cnt]).style.display='block';
				document.getElementById("tour_" + left_league_id_list[rt_cnt]).style.display='block';
			}
		}
		document.getElementById("link0").className = 'n1a';
		for(tmc = 0; tmc < left_country_id_list.length; tmc++){
			document.getElementById("leftcountry"+left_country_id_list[tmc]).style.display = 'none';
			document.getElementById("link"+left_country_id_list[tmc]).className = 'n1';
		}
		document.getElementById("reset_league").style.display='none';
	}
	function closeTour(item) {
		var ca = document.cookie.split(';');
		var magicX = '';
		var match_content = '';
		for(var i=0;i < ca.length;i++) {
			if (ca[i].indexOf("closetour=") > -1){
				magicX = ca[i];
				break;
			}
		}
		if(magicX){
			tempCS = magicX.split('=');
			list_matches = tempCS[1].split("#");
			for(var lm=0; lm < list_matches.length; lm++){
				if(list_matches[lm] == item){
					;
				} else {
					if(list_matches[lm]){
						match_content = match_content + "#" + list_matches[lm];
					}
				}
			}
			match_content = match_content + "#" + item;
			document.cookie = "closetour=" + match_content + expires + ";path=" + livescoresPath;
		} else {
			document.cookie = "closetour=" + item + expires + ";path=" + livescoresPath;
		}
		document.getElementById(item).style.display="none";
		document.getElementById("head_" + item).style.display="none";
		document.getElementById("reset_league").style.display='block';
		ca = null;
		magicX = null;
		match_content = null;
	}
	function closeTourR(item) {
		document.getElementById("tour_" + item).style.display="none";
		document.getElementById("reset_league").style.display='block';
	}
	function popupWin(match_id, tour_id, home_id, away_id){
		window.open(livescoresPath + "v1/detailpopup.php?match_id=" + match_id + "&tour=" + tour_id + "&h_id=" + home_id + "&a_id=" + away_id, "popupWin", "scrollbars=no, status=no, width=607, height=648");
	}
	function popupWin_v2(match_id, tour_id, home_id, away_id){
		window.open(livescoresPath + "v1/detailpopup_v2.php?match_id=" + match_id + "&tour=" + tour_id + "&h_id=" + home_id + "&a_id=" + away_id, "popupWin", "scrollbars=no, status=no, width=607, height=648");
	}
	function nextMatches(tour_id){	
		var winURL = livescoresPath + "v1/nextMatches.php?tour_id=" + tour_id;
		my_window= window.open (winURL, "mywindow2", "scrollbars=0,status=0,width=607,height=648");
	}
	function lastMatches(tour_id){	
		var winURL = livescoresPath + "v1/lastMatches.php?tour_id=" + tour_id;
		my_window= window.open (winURL, "mywindow3", "scrollbars=0,status=0,width=607,height=648");
	}
	function standings(tour_id){
		var winURL = livescoresPath + "v1/standings.php?tour_id=" + tour_id;
		my_window= window.open (winURL, "mywindow4", "scrollbars=0,status=0,width=607,height=648");
	}
	function compare(match_id, tour_id, home_id, away_id){
		var winURL = livescoresPath + "v1/compare.php?match_id=" + match_id + "&tour=" + tour_id + "&h_id=" + home_id + "&a_id=" + away_id;
		my_window= window.open (winURL, "mywindow5", "scrollbars=0,status=0,width=607,height=648");
	}
	function compare_v2(match_id, tour_id, home_id, away_id){
		var winURL = livescoresPath + "v1/compare_v2.php?match_id=" + match_id + "&tour=" + tour_id + "&h_id=" + home_id + "&a_id=" + away_id;
		my_window= window.open (winURL, "mywindow5", "scrollbars=0,status=0,width=607,height=648");
	}
	function comment(match_id, tour_id, home_id, away_id){
		var winURL = livescoresPath + "v1/commentary.php?match_id=" + match_id + "&tour=" + tour_id + "&h_id=" + home_id + "&a_id=" + away_id;
		my_window= window.open (winURL, "mywindow6", "scrollbars=0,status=0,width=607,height=648");
	}
	function odds(match_id, tour_id, home_id, away_id){
		var winURL = livescoresPath + "v1/odds.php?match_id=" + match_id + "&tour=" + tour_id + "&h_id=" + home_id + "&a_id=" + away_id;
		my_window= window.open (winURL, "mywindow7", "scrollbars=0,status=0,width=607,height=648");
	}
	function oddsin(match_id, tour_id, home_id, away_id){
		var winURL = livescoresPath + "v1/odds.php?match_id=" + match_id + "&tour=" + tour_id + "&h_id=" + home_id + "&a_id=" + away_id + "&type=1x2in";
		my_window= window.open (winURL, "mywindow8", "scrollbars=0,status=0,width=607,height=648");
	}
	function settings(){
		my_window= window.open ("settings.php?langFK=" + langFK, "mywindow9", "scrollbars=0,status=0,width=607,height=500");
	}
	function playSound() {
		if(sound_enable == true || sound_enable == 1){
			document.cookie = "sound_enable=-1" + expires + ";path=" + livescoresPath;
			document.getElementById("sound_ico").src= livescoresPath+"img/sound_off.gif";
			sound_enable = false;
		} else {
			document.cookie = "sound_enable=1" + expires + ";path=" + livescoresPath;
			document.getElementById("sound_ico").src= livescoresPath+"img/sound_on.gif";
			sound_enable = true;
		}
	}
	function doplaySS(bsnd) {
		PlayMedia.sound(bsnd)
	}
	function doplay() {
		if(sound_enable && sound_enable != "-1"){
			var bsnd = check_sound();
			PlayMedia.sound(bsnd)
		}
	}
	function doplayW() {
		if(sound_enable){
			PlayMedia.sound(2);
		}
	}
	function find_league_right(obj, sport){
		var F = document.results_form;
		var content = procRequest(livescoresPath + "xml/getleagues_right.php?country=" + obj + "&sportFK=" + sport + "&fy=" + F.from_year.value + "&fd=" + F.from_date.value + "&ty=" + F.to_year.value + "&td=" + F.to_date.value);
		document.getElementById("league_div_result").innerHTML = content;
		content = null;
	}
	function find_league(obj, sport){
		var content = procRequest(livescoresPath + "xml/getleagues.php?country=" + obj + "&sportFK=" + sport);
		document.getElementById("league_div_result").innerHTML = content;
		content = null;
	}
	function find_tour_int(obj, sport){
		var content = procRequest(livescoresPath + "xml/get_tour_int.php?country=" + obj + "&sportFK=" + sport);
		document.getElementById("leagueI_divX").innerHTML = content;
		content = null;
	}
	function find_tour(obj, sport){
		var content = procRequest(livescoresPath + "xml/get_tour.php?country=" + obj + "&sportFK=" + sport);
		document.getElementById("league_divX").innerHTML = content;
		content = null;
	}
	function find_tourX(obj, sport){
		var content = procRequest(livescoresPath + "xml/get_tour.php?country=" + obj + "&sportFK=" + sport);
		document.getElementById("left_panel_league").innerHTML = content;
		content = null;
	}
	function get_results_right(){
		document.results_form.submit();
	}
	var score_tray = new Array();
	function score_info(match_id, part){
		obj = document.getElementById(part + "_" + match_id);
		if(obj.style.display == "none"){
			var content = procRequest(livescoresPath + "xml/scorecard.php?match_id=" + match_id);
			obj.innerHTML = content;
			obj.style.display = 'block';
			content = null;
		} else {
			obj.innerHTML = '';
			obj.style.display = 'none';
		}
	}
	function nextpage2(tour, page, cmd){
		url = 'stats_matches.php?tourFK=' + tour + '&page=' + page + '&cmd=' + cmd;
		var loc_content = procRequest(url);
		document.getElementById("stats_match_list").innerHTML = loc_content;
		loc_content = null;
	}
	function nextpage3(tour, page){
		url = 'stats_matches.php?tourFK=' + tour + '&start='+page;
		var loc_content = procRequest(url);
		document.getElementById("stats_match_list").innerHTML = loc_content;
		loc_content = null;
	}
	function nextpage(tour, page){
		url = 'stats_matches.php?tourFK=' + tour + '&page='+page;
		var loc_content = procRequest(url);
		document.getElementById("stats_match_list").innerHTML = loc_content;
		loc_content = null;
	}
	function gopage(mode,h_id, a_id, page){
		url = livescoresPath + 'v1/h2h.php?h_id=' + h_id + '&a_id=' + a_id + '&page='+page;
		var loc_content = procRequest(url);
		document.getElementById(mode + "_" + h_id + "_" + a_id).innerHTML = loc_content;
		loc_content = null;
	}
	function lpage(mode,t_id, page, part){
		url = livescoresPath + 'v1/last.php?t_id=' + t_id + '&page=' + page + '&part=' + part;
		var loc_content = procRequest(url);
		document.getElementById(mode + "_" + t_id).innerHTML = loc_content;
	}
	function all_last_matches(mode, t_id, part){
		url = livescoresPath + 'v1/last.php?t_id=' + t_id + '&mode=all' + '&part=' + part;
		var loc_content = procRequest(url);
		document.getElementById(mode + "_" + t_id).innerHTML = loc_content;
	}
	function all_h2h_matches(mode, h_id, a_id){
		url = livescoresPath + 'v1/h2h.php?h_id=' + h_id + '&a_id=' + a_id + '&mode=all';
		var loc_content = procRequest(url);
		document.getElementById(mode + "_" + h_id + "_" + a_id).innerHTML = loc_content;
	}
	function MySettings(){
		var G = document.settings;
		if(G.position.checked){
			document.cookie = "position=1" + expires + ";path=" + livescoresPath;
		} else {
			document.cookie = "position=-1" + expires + ";path=" + livescoresPath;
		}
		if(G.league_info.checked){
			document.cookie = "league_info=1" + expires + ";path=" + livescoresPath;
		} else {
			document.cookie = "league_info=-1" + expires + ";path=" + livescoresPath;
		}
		if(G.odds.checked){
			document.cookie = "odds=1" + expires + ";path=" + livescoresPath;
		} else {
			document.cookie = "odds=-1" + expires + ";path=" + livescoresPath;
		}
		if(G.commentary.checked){
			document.cookie = "commentary=1" + expires + ";path=" + livescoresPath;
		} else {
			document.cookie = "commentary=-1" + expires + ";path=" + livescoresPath;
		}
		if(G.whistle.checked){
			document.cookie = "whistle=1" + expires + ";path=" + livescoresPath;
		} else {
			document.cookie = "whistle=-1" + expires + ";path=" + livescoresPath;
		}		
		if(G.goal_popup.checked){
			document.cookie = "goal_popup=1" + expires + ";path=" + livescoresPath;
			if(g_date == to_day){
				showMe("theLayer");
			}
		} else {
			document.cookie = "goal_popup=-1" + expires + ";path=" + livescoresPath;
			if(g_date == to_day){
				hideMe("theLayer");
			}
		}
		if(G.small_popup.checked){
			document.cookie = "small_popup=1" + expires + ";path=" + livescoresPath;
		} else {
			document.cookie = "small_popup=-1" + expires + ";path=" + livescoresPath;
		}
		if(G.live_box.checked){
			document.cookie = "live_box=1" + expires + ";path=" + livescoresPath;
			if(g_date == to_day){
				showMe("theLayer2");
			}
		} else {
			document.cookie = "live_box=-1" + expires + ";path=" + livescoresPath;
			if(g_date == to_day){
				hideMe("theLayer2");
			}
		}
		if(G.view_finished.checked){
			document.cookie = "result_after=2" + expires + ";path=" + livescoresPath;
		} else {
			document.cookie = "result_after=1" + expires + ";path=" + livescoresPath;
		}

		document.cookie = "sound_opt=" + G.sound_opt.value + expires + ";path=" + livescoresPath;
		display_screen();
		alert("Settings have been saved");
	}
	function check_sound() {
		var snd = 1;
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++) {
			if (ca[i].indexOf("sound_opt") > -1){
				snd = ca[i].substring(11);
			}
		}
		ca = null;
		return snd;
	}
	function check_gsort() {
		var snd = "league";
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++) {
			if (ca[i].indexOf("g_sort") > -1){
				var cd = ca[i].split("=");
				snd = cd[1].replace(" ","");
			}
		}
		ca = null;
		return snd;
	}
	function check_result() {
		var snd = 1;
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++) {
			if (ca[i].indexOf("result_after") > -1){
				snd = ca[i].substring(14);
			}
		}
		ca = null;
		return snd;
	}
	function check_last_goal() {
		var snd = -1;
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++) {
			if (ca[i].indexOf("last_goal") > -1){
				snd = ca[i].substring(11);
			}
		}
		ca = null;
		return snd;
	}
	function check_status(name) {
		var nameEQ = name + "=1";
		var is_flag = false;
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++) {
			if (ca[i].indexOf(nameEQ) > -1){
				is_flag = true;
			}
		}
		nameEQ = null;
		ca = null;
		return is_flag;
	}
	function setLanguage(valX){
		var str = window.location.toString();
		var language_string = str.split("/");
		var new_url= '';
		if(valX == 3){
			new_url = "http://www.bonusbonusbonus.com";
		} else if(valX == 9){
			new_url = "http://www.bonusbonusbonus.ru";
		} else if(valX == 11){
			new_url = "http://www.bonusbonusbonus.de";
		} else if(valX == 23){
			new_url = "http://www.bonusbonusbonus.pl";
		} else if(valX == 25){
			new_url = "http://www.bonusbonusbonus.cz";
		} else if(valX == 27){
			new_url = "http://www.bonusbonusbonus.hu";
		} else if(valX == 51){
			new_url = "http://www.bonusbonusbonus.sk";
		} else if(valX == 55){
			new_url = "http://www.bonusbonusbonus.hk";
		} else if(valX == 57){
			new_url = "http://www.bonusbonusbonus.cn";
		} else {
			new_url = "http://www.bonusbonusbonus.de";
		}
		for(var sl =3; sl < language_string.length; sl++){
			new_url = new_url + "/" + language_string[sl];
		}
		language_string = null;
		str = null;
		window.location = new_url;
	}
	function setResultCountry(obj_val){
		document.getElementById("link0").className = 'n1';
		for(tmc = 0; tmc < left_league_id_list.length; tmc++){
			document.getElementById("tour_" + left_league_id_list[tmc]).style.display = "none";
		}
		for(tmc = 0; tmc < left_country_id_list.length; tmc++){
			document.getElementById("leftcountry"+left_country_id_list[tmc]).style.display = 'none';
			document.getElementById("link"+left_country_id_list[tmc]).className = 'n1';
			if(left_country_id_list[tmc] == obj_val){
				document.getElementById("tour_" + left_league_id_list[tmc]).style.display = "block";
			}
		}
		document.getElementById("reset_league").style.display='block';
		if(obj_val){
			document.getElementById("leftcountry"+obj_val).style.display = 'block';
			document.getElementById("link"+obj_val).className = 'n1a';
		} else {
			document.getElementById("link0").className = 'n1a';
		}
		if(obj_val != ""){
			window.location='#live_top';
		}
	}
	function setCountry(obj_val){
		if(obj_val == 'all2' || obj_val == 'all' || obj_val == ''){
			document.getElementById("btn_country_all").style.display='none';
			document.getElementById("btn_country_all2").style.display='none';
		} else {
			document.getElementById("btn_country_all").style.display='block';
			document.getElementById("btn_country_all2").style.display='block';
		}
		if(obj_val == 'all2'){
			document.cookie = "only_country=" + expires + ";path=" + livescoresPath;
			document.getElementById("link0").className = 'n1';
			for(tmc = 0; tmc < left_country_id_list.length; tmc++){
				document.getElementById("leftcountry"+left_country_id_list[tmc]).style.display = 'none';
				document.getElementById("link"+left_country_id_list[tmc]).className = 'n1';
			}
			if(match_mode != "my_matches"){
				document.getElementById("link0").className = 'n1a';
			}
			only_country = '';
			only_league = '';
		} else if(obj_val == "" || document.getElementById("leftcountry"+obj_val)){
			document.cookie = "only_country=" + obj_val + expires + ";path=" + livescoresPath;
			document.getElementById("link0").className = 'n1';
			for(tmc = 0; tmc < left_country_id_list.length; tmc++){
				document.getElementById("leftcountry"+left_country_id_list[tmc]).style.display = 'none';
				document.getElementById("link"+left_country_id_list[tmc]).className = 'n1';
			}
			if(obj_val){
				document.getElementById("leftcountry"+obj_val).style.display = 'block';
				document.getElementById("link"+obj_val).className = 'n1a';
			} else {
				document.getElementById("link0").className = 'n1a';
			}
			only_country = obj_val;
			only_league = '';
			gmode('all_matches');
			if(obj_val != ""){
				window.location='#live_top';
			}
		} else {
			if(confirm("No game available for the country of your choice. do you want to see all ?")){
				setCountry("");
			}
		}
	}
	function statsCountry(obj_val){
		var stat_country = new Array(2,5,3,4,12,15,8,19,26,22,47);
		for(var sc=0; sc < stat_country.length; sc++){
			document.getElementById("leftcountry" + stat_country[sc]).style.display = 'none';
			document.getElementById("link" + stat_country[sc]).className = 'n1';
		}
		document.getElementById("leftcountry"+obj_val).style.display = 'block';
		document.getElementById("link"+obj_val).className = 'n1a';
		start_country = null;
	}
	function setLeague(obj_val){
		only_league = obj_val;
		for(rt_cnt =0; rt_cnt < left_league_id_list.length; rt_cnt++){
			document.getElementById("lg" + left_league_id_list[rt_cnt]).className='n2';
		}
		document.getElementById("lg" + obj_val).className='n2a'
		display_screen();
		window.location='#live_top';
	}
	function setResultLeague(obj_val){
		for(rt_cnt =0; rt_cnt < left_league_id_list.length; rt_cnt++){
			if(left_league_id_list[rt_cnt] != obj_val){
				document.getElementById("lg" + left_league_id_list[rt_cnt]).className='n2';
				closeTourR(left_league_id_list[rt_cnt]);
			}
		}
		document.getElementById("tour_" + obj_val).style.display = "block";
		document.getElementById("lg" + obj_val).className = 'n2a'
		window.location = '#live_top';
	}
function setupsound(){
	PlayMedia.setup (
    'snd0','sound/crowd.mp3',
    'snd1','sound/crowd.mp3',
    'snd2','sound/whistle.mp3',
    'snd3','sound/goal.wav',
    'snd4','sound/horn.wav',
    'snd5','sound/outcry.mp3'
   );
}
var frame_flag = true;
function closeframeesc(event){
    if (event.keyCode == "27"){
		closeframe();
	}
}
function closeframe(){
	if(frame_flag && document.getElementById("fav_league_frame").style.display == "block"){
		document.getElementById("fav_league_frame").style.display = "none";
		document.getElementById("fav_head").className ='fav_off';
	}
	frame_flag = true;
}
function toggleframe(obj){
	if(!obj){
		document.getElementById("fav_head").className ='fav_off';	
	}
	if(document.getElementById("fav_league_frame").style.display == "none"){
		document.getElementById("fav_league_frame").style.display = "block";
		if(obj){
			obj.className ='fav_on';
		}
	} else {
		document.getElementById("fav_league_frame").style.display = "none";
		if(obj){
			obj.className ='fav_off';
		}
	}
	frame_flag = false;
}
