function load_top() {
        if(top.frames.length > 0) top.location.href=self.location;
}

function loadPage() {
	load_maps();
}

function checkRedirect() {
	var path = window.location.pathname;
	var hash = window.location.hash;
	if (hash && ((path == "/competition/results_d.shtml") || (path == "/competition/results_e.shtml"))) {
		var year = hash.slice(hash.length-2);
		if (year >= 12) {
			return;
		} else {
			if ((year[0] < "0") || (year[0] > "9") || (year[1] < "0") || (year[0] > "9")) year = "06";
			var lang = path.slice("/competition/results".length);
			var newLoc = window.location.protocol + "//" + window.location.host + "/competition/results20" + year + lang + window.location.hash;
//			alert(newLoc);
			window.location = newLoc;
		}
	}
}

function showHideElement(src,obj,showText,hideText) {
	if (obj.style.display == "none") {
		obj.style.display = "";
		src.innerHTML = hideText;
	} else {
		obj.style.display = "none";
		src.innerHTML = showText;
	}
}

function showHide(src,id,showText,hideText) {
	if (document.getElementById) {
		showHideElement(src,document.getElementById(id),showText,hideText);
	}
}

function medalChart(p) {
     return new Highcharts.Chart({
      chart: {
         'renderTo': p.renderTo,
         defaultSeriesType: 'bar'
      },
      'title': {
         text: p.title
      },
      'subtitle': {
         text: p.subtitle
      },
      yAxis: {
         min: 0,
         title: {
            text: null,
         }
      },
      tooltip: {
         formatter: function() {
            return ''+
                this.x +': '+ this.y +' '+this.series.name;
         }
      },
      plotOptions: {
bar: {
   dataLabels: {
      enabled: true,
      align: 'right',
      x: -2,
      color: 'black',
      formatter: function() {
      	if (this.y > 0) return this.y; else return '';
      }
   }
},
   series: {
      stacking: 'normal'
   }
      },
credits: {
   enabled: false
},
legend: {
	borderWidth: 1,
	shadow: true,
	reversed: true
},
xAxis: {
	'categories': p.categories,
	title: {
		text: null
	}
},
      'series': p.series
   });
};


