/* stuff */
function sw (id) {
	if (document.getElementById(id).style.display == 'none') {
		document.getElementById(id).style.display = 'block';
	} else {
		document.getElementById(id).style.display = 'none';
	}
}

/* Sets text into a text-field */
function set(id,text){
	document.getElementById(id).value += text + ", ";
	document.getElementById(id).focus();
}

/* Sets text into a text-field */
function set_without(id,text){
	document.getElementById(id).value = text;
	document.getElementById(id).focus();
}

/* open the choosen tab */
function opentab() {
  var new_tab = (document.location.href.split("#"))[1];
  if (new_tab != null) {
      sw(new_tab);
  } 
}

function popitup(url) {
	newwindow=window.open(url,'name','height=600,width=800');
	if (window.focus) {newwindow.focus()}
	return false;
}

/* Xajax */
var xajaxRequestUri = "http://www.youthmediadays.eu/fileadmin/scripts/ajax_functions.php";
var xajaxDebug = false;
var xajaxStatusMessages = false;
var xajaxWaitCursor = true;
var xajaxDefinedGet = 0;
var xajaxDefinedPost= 1;
var xajaxLoaded = false;
function xajax_EYMDregister(){ return xajax.call("EYMDregister", arguments, 1); }
function xajax_EYMDregister_reset(){ return xajax.call("EYMDregister_reset", arguments, 1); }
function xajax_EYMDregister_big(){ return xajax.call("EYMDregister_big", arguments, 1); }
function xajax_EYMDregister_big_reset(){ return xajax.call("EYMDregister_big_reset", arguments, 1); }

/* Stop the Enter-Button from strange behaviour */
function stopRKey(evt) {
   var evt = (evt) ? evt : ((event) ? event : null);
   var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
   if ((evt.keyCode == 13) && (node.type=="text")) {return false;}
}
document.onkeypress = stopRKey;




function embed_quicktime(type, bgcolor, width, height, link, placeholder, loop) {
	if (placeholder != '') {
		document.writeln('<embed type="'+type+'" style="cursor:hand; cursor:pointer;" href="'+link+'" src="'+placeholder+'" width="'+width+'" height="'+height+'" autoplay="false" target="myself" controller="false" loop="'+loop+'" scale="aspect" bgcolor="'+bgcolor+'" pluginspage="http://www.apple.com/quicktime/download/"></embed>');
	}
	else {
		document.writeln('<embed type="'+type+'" style="cursor:hand; cursor:pointer;" src="'+link+'" width="'+width+'" height="'+height+'" autoplay="false" target="myself" controller="true" loop="'+loop+'" scale="aspect" bgcolor="'+bgcolor+'" pluginspage="http://www.apple.com/quicktime/download/"></embed>');
	}
}

function embed_flash(bgcolor, width, height, link, loop, type) {
	document.writeln('<embed src="'+link+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="'+type+'" quality="high" width="'+width+'" height="'+height+'" bgcolor="'+bgcolor+'" loop="'+loop+'"></embed>');
}

function embed_flv(width, height, link, placeholder, loop, player) {
	document.writeln('<embed src="'+player+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" quality="high" width="'+width+'" height="'+height+'" wmode="transparent" flashvars="file='+link+'&autostart=false&repeat='+loop+'&showdigits=true&showfsbutton=false"></embed>');
}

function embed_wmedia(width, height, link) {
	document.writeln('<embed type="application/x-mplayer2" src="'+link+'" autosize="1" width="'+width+'" height="'+height+'" showcontrols="1" showstatusbar="0" showdisplay="0" autostart="0"></embed>');
}