function $(id) {
  return document.getElementById(id);
}

function bootstrap() {
  scripttag = $('script');
  if (!scripttag)
    return;
  text = scripttag.childNodes[0].nodeValue;
  eval(text);
}





function logView() {
  var page = new Image();
  var loc = document.getElementById("permalink").href;
  var m = loc.match(/^http:\/\/.*?\/(.*)$/);
  if (m) {
    loc = m[1];
  }
  page.src = "http://www.unimall.ch/"+loc;
  return page.src;
}


var tennisplayers= new Array("1", "2", "3", "4", "5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31");
var cricketplayers = new Array("1", "2", "3", "4", "5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30");
var februar = new Array("1", "2", "3", "4", "5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28");

function set_player() {

var select_sport = document.myform.sport;
var select_player = document.myform.player;


var selected_sport = select_sport.options[select_sport.selectedIndex].value;

select_player.options.length=0;

if (selected_sport == "Januar" || selected_sport == "März" || selected_sport == "Mai" || selected_sport == "Juli" || selected_sport == "August" || selected_sport == "Oktober" || selected_sport == "Dezember"){

    for(var i=0; i<tennisplayers.length; i++)
    select_player.options[select_player.options.length] = new Option(tennisplayers[i]);
  }

  else if (selected_sport == "Februar"){

    for(var i=0; i<februar.length; i++)
      select_player.options[select_player.options.length] = new Option(februar[i]);
  }

if (selected_sport == "April" || selected_sport == "Juni" || selected_sport == "September" || selected_sport == "November"){

    for(var i=0; i<cricketplayers.length; i++)
      select_player.options[select_player.options.length] = new Option(cricketplayers[i]);
  }
}


 function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

function prepareInputsForHints() {
	var inputs = document.getElementsByTagName("input");
	for (var i=0; i<inputs.length; i++){
		// test to see if the hint span exists first
		if (inputs[i].parentNode.getElementsByTagName("span")[0]) {
			// the span exists!  on focus, show the hint
			inputs[i].onfocus = function () {
				this.parentNode.getElementsByTagName("span")[0].style.display = "inline";
			}
			// when the cursor moves away from the field, hide the hint
			inputs[i].onblur = function () {
				this.parentNode.getElementsByTagName("span")[0].style.display = "none";
			}
		}
	}
	// repeat the same tests as above for selects
	var selects = document.getElementsByTagName("select");
	for (var k=0; k<selects.length; k++){
		if (selects[k].parentNode.getElementsByTagName("span")[0]) {
			selects[k].onfocus = function () {
				this.parentNode.getElementsByTagName("span")[0].style.display = "inline";
			}
			selects[k].onblur = function () {
				this.parentNode.getElementsByTagName("span")[0].style.display = "none";
			}
		}
	}
}
addLoadEvent(prepareInputsForHints);