function gup(name) {
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return null;
  else
    return results[1];
}

function gotorightplace() {
	var jsid=gup('jsid');
	var jsl=gup('jsl');
	if (jsid) {
		window.frames['mainFrame'].window.location ='index.php?id='+jsid+'&L='+jsl;
	}
	
	if (jsl=='1') {
		window.frames['topFrame'].window.location ='header_en.html';
	}
	else if (window.frames['topFrame'].window.location !='header.html') {
		window.frames['topFrame'].window.location ='header.html';
	}
}

function checkframe() {
	if (parent.topFrame == null)
		reloadwindow();
	
	else if (parent.topFrame.document.getElementById('testframe').value != 'good')
		reloadwindow();
		
	else if (parent.topFrame.document.getElementById('lang').value != 'en' && gup('L')=='1')
		p_reloadwindow();
		
	else if (parent.topFrame.document.getElementById('lang').value != 'de' && gup('L')==null)
		p_reloadwindow();
}

function reloadwindow() {
	var jsid=gup('id');
	var jsl=gup('L');
	window.location = 'GTG.html?jsid='+jsid+'&jsl='+jsl;
}

function p_reloadwindow() {
	var jsid=gup('id');
	var jsl=gup('L');
	parent.window.location = 'GTG.html?jsid='+jsid+'&jsl='+jsl;
}
