var popUpWin=0;

function radio_check(img){
 radio = document.getElementsByName(img.name);
 for(i=0;i<=radio.length-1;i++){
 	radio[i].src = radio[i].src.replace(/_c/,'_u');
	radio[i].nextSibling.value=0;
 }
 img.src = img.src.replace(/_u/,'_c');
 img.nextSibling.value=1;
}

function set_data(){
  var now   = new Date();
  var w_day = now.getDay();
  
  // Tages-Diff. zum kommenden Dienstag ermitteln
  if (w_day<2) var add_day = 2-w_day;
  else         var add_day = 9-w_day;
                          
  var my_date = new Date( now.getTime() + add_day * 24 * 60 * 60 * 1000 );
  var my_day  = my_date.getDate();
  var my_month= my_date.getMonth()+1;
  var my_year = my_date.getYear();
  
  if (my_day   < 10) { my_day   = "0" + my_day; }
  if (my_month < 10) { my_month = "0" + my_month; }
  if (my_year <1900) { my_year += 1900; }

  var mum_date =  my_day + "." + my_month + "." + my_year;
  
  my_hidden="<input type=\"hidden\" name=\"REQ0JourneyDate\" value=\""+mum_date+"\">";
  //alert(my_hidden);
  document.write(my_hidden);
  my_hidden="<input type=\"hidden\" name=\"CoMumDate\" value=\""+mum_date+"\">";
  //alert(my_hidden);
  document.write(my_hidden);
}

function DelAnm(){
  this.document.EingabeMaske.name.value = '';
  document.EingabeMaske.vorname.value = '';
  document.EingabeMaske.email.value = '';
}

function DelAend(){
  document.EingabeMaske.aend_email.value = '';
}

function DelAbm(){
  document.EingabeMaske.del_email.value = '';
}

function Aend(){
  document.location.href = 'http://www2.nasa.de/mailing.php?aend_email=' + escape(document.EingabeMaske.aend_email.value);
}

function Anmeldung(){
  if(!document.EingabeMaske.name.value || !document.EingabeMaske.vorname.value || !document.EingabeMaske.email.value){
    alert('Bitte füllen Sie die folgenden Felder aus:\n\n\t"Vorname",\n\t"Name" und\n\t"E-Mail"');
  }
  else {
    E1 = document.EingabeMaske.email.value.search(/.+@.+/);
    E2 = document.EingabeMaske.email.value.search(/.+\..+/);
    if(E1 == -1 || E2 == -1 || document.EingabeMaske.email.value.length < 6) {
      alert('Das ist keine E-Mail-Adresse: '+ document.EingabeMaske.email.value);
    }
    else document.location.href = 'http://www2.nasa.de/mailing_reply.php?eintragen=ins&id_mail=' + document.EingabeMaske.id_mail.value + '&email=' + escape(document.EingabeMaske.email.value) + '&name=' + escape(document.EingabeMaske.name.value) + '&vorname=' + escape(document.EingabeMaske.vorname.value);
  }
}

function Abmeldung(){
  if(!document.EingabeMaske.del_email.value){
    alert('Bitte tragen Sie zum Löschen aus der Mailinglist Ihre E-Mail ein!');
  }
  else {
    E1 = document.EingabeMaske.del_email.value.search(/.+@.+/);
    E2 = document.EingabeMaske.del_email.value.search(/.+\..+/);
    if(E1 == -1 || E2 == -1 || document.EingabeMaske.del_email.value.length < 6) {
      alert('Das ist keine E-Mail-Adresse: '+ document.EingabeMaske.del_email.value);
    }
  else document.location.href = 'http://www2.nasa.de/mailing_reply.php?austragen=del&del_email=' + escape(document.EingabeMaske.del_email.value);
  }
}

function sh_popup(URLStr,widthw,heightw)
{
  var width=(widthw>0) ? widthw:380;
  var height=(heightw>0) ? heightw:470;
  var left = parseInt((screen.availWidth/2) - (width/2));
  var top = parseInt((screen.availHeight/2) - (height/2));

  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr+'?popup', 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

 
function setHeight(){
var a1 = document.getElementById('textureFixBody').clientHeight;
var b1 = a1 % 16;
	if (b1!=0) a1=a1-b1+16;
	document.getElementById('textureFixBody').height=a1;


document.getElementById('textureFixContent').style.height=document.getElementById('2xInfoboxFix').clientHeight+'px';
var a2 = document.getElementById('textureFixContent').clientHeight;
var b2 = a2 % 96;
	if (b2!=0) a2=a2-b2+96;
	document.getElementById('textureFixContent').style.height=a2+'px';
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}



var timer;




function check_form(frm) {
 var good=true;
	if (frm.name=='contact_form'){		
		if (frm.elements['f2'].value=='') good=false;
		if (frm.elements['f3'].value=='') good=false;
		if (frm.elements['f4'].value=='') good=false;
		if (frm.elements['f6'].value=='') good=false;
		if (frm.elements['f7'].value=='') good=false;
	}
	if (frm.name=='br'){		
		if (frm.elements['f1'].value=='') good=false;
		if (frm.elements['f2'].value=='') good=false;
		if (frm.elements['f3'].value=='') good=false;
		if (frm.elements['f4'].value=='') good=false;		
		if (frm.elements['f5'].value=='') good=false;
		if (frm.elements['f6'].value=='') good=false;
	}
	if (frm.name=='br_2'){		
		if (frm.elements['f1'].value=='') good=false;
		if (frm.elements['f2'].value=='') good=false;
		if (frm.elements['f3'].value=='') good=false;
		if (frm.elements['f4'].value=='') good=false;
		if (frm.elements['f5'].value=='') good=false;
		if(frm.elements['1a'].checked==false &&
    	   frm.elements['2a'].checked==false &&
		   frm.elements['3a'].checked==false &&
		   frm.elements['4a'].checked==false ) good=false;
		

    }	
	
	
 if (!good) alert('Gehen Sie auf Nummer sicher, dass alle Pflichtfelder ausgefüllt wurden!');
 return good; 
}
	
function popImage(imageURL,imgTitle){
imageURL=location.protocol+'//'+location.host+imageURL;
var defWidth=0.75*screen.availWidth;
var defHeight=0.75*screen.availHeight;
var defWidth1=10;
var defHeight1=10;
var f="width="+defWidth1+",height="+defHeight1;	
f+=",left="+((screen.availWidth-defWidth)/2)+",scrollbars=yes,resizable=yes,top="+((screen.availHeight-defHeight)/2);
imgWin=window.open('about:blank','',f);
imDoc=imgWin.document;
with (imDoc) {
writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');writeln('<sc'+'ript>');
writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
writeln('function reSizeToImage(){');writeln('if (isIE){');writeln('window.resizeTo(100,100);');
writeln('width=100-(document.body.clientWidth-document.images[0].width);if (width>0.75*screen.availWidth) width=0.75*screen.availWidth;');
writeln('height=100-(document.body.clientHeight-document.images[0].height);if (height>0.75*screen.availHeight) height=0.75*screen.availHeight;');
writeln('window.resizeTo(width,height);}');writeln('else {');       
writeln('window.innerWidth=document.images["George"].width<0.75*screen.availWidth ? document.images["George"].width:0.75*screen.availWidth;');
writeln('window.innerHeight=document.images["George"].height<0.75*screen.availHeight ? document.images["George"].height:0.75*screen.availHeight;}}');
writeln('function doTitle(){document.title="'+imgTitle+'";}');writeln('</sc'+'ript>');
writeln('</head><body bgcolor="#FFFFFF" onload="reSizeToImage();doTitle();self.focus()">')
writeln('<img name="George" src='+imageURL+' style="display:block"></body></html>');

close();
}
}


function popup(imn){
imageURL=location.protocol+'//'+location.host+"/images/map/"+imn+'.png';
var f="width=850,height=700,left=90,scrollbars=0,resizable=0,top=30";
imgWin=window.open('about:blank','',f);
imDoc=imgWin.document;
with (imDoc) {
writeln('<html><head><title>map</title><style>body{margin:0px;}</style>');
writeln('<sc'+'ript language="javascript" type="text/javascript">');
writeln('var isIE = (document.all && !document.getElementById)? true : (document.all && document.getElementById)? true : false;');
writeln('var isNN = (isIE)? false: true;');
writeln('function reSizeToImage(){');
writeln('if (isIE){');
writeln('width=document.images["myImg"].width-document.body.clientWidth;');
writeln('height=document.images["myImg"].height-document.body.clientHeight;');
writeln('window.resizeBy(width,height);');
writeln('window.moveTo((window.opener.document.body.clientWidth-document.images["myImg"].width)/2,(window.opener.document.body.clientHeight-document.images["myImg"].height)/2+100);}');
writeln('else {');
writeln('window.innerWidth=document.images["myImg"].width;window.innerHeight=document.images["myImg"].height;');
writeln('window.moveTo((window.opener.document.body.clientWidth-window.innerWidth)/2,(window.opener.document.body.clientHeight-window.innerHeight)/2+100);}}');
writeln('</sc'+'ript>');
writeln('</head><body bgcolor="#FFFFFF" onload="reSizeToImage();self.focus()">')
writeln('<img name="myImg" src='+imageURL+' style="display:block"></body></html>');
close();
}
}
