function AMC_swapImage() { //v3.0
  var i,j=0,x,a=AMC_swapImage.arguments; document.AMC_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=AMC_findObj(a[i]))!=null){document.AMC_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
   //stopWave();
   //document.soundMenuMouseOver.play();
   //window.setTimeout("stopWave()", 50);
}

function AMC_swapImgRestore() { //v3.0
  var i,x,a=document.AMC_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
  //stopWave();
}

function AMC_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.AMC_p) d.AMC_p=new Array();
    var i,j=d.AMC_p.length,a=AMC_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.AMC_p[j]=new Image; d.AMC_p[j++].src=a[i];}}
}

function AMC_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=AMC_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function stopWave(){
	document.soundMenuMouseOver.stop();
}

function clearFormFields(){
	for (i=0;i<document.frmRegister.elements.length;i++){
		if (document.frmRegister.elements[i].name != "RegisterAGB"){
			if (document.frmRegister.elements[i].type == "text" | document.frmRegister.elements[i].type == "password" | document.frmRegister.elements[i].type == "textarea"){
				document.frmRegister.elements[i].value="";
			}
			else if(document.frmRegister.elements[i].type == "select-one"){
				document.frmRegister.elements[i].selectedIndex = 0;
			}
			else if(document.frmRegister.elements[i].type == "checkbox"){
				document.frmRegister.elements[i].checked = false;
			}
		}
	}
}

function changeDisplay(elementId){
	if(document.getElementById){
		var theElement = document.getElementById( elementId );
	}
	else{
		if(document.all){
			var theElement = document.all[ elementId ];
		}
		else{
			var theElement = new Object();
		}
	}
	
	if(!theElement){
		return;
	}
	
	if(theElement.style){
		theElement = theElement.style;
	}
	if(typeof(theElement.display) == 'undefined' && !( window.ScriptEngine && ScriptEngine().indexOf('InScript')+1)){
		window.alert( 'Funktion in Ihrem Browser nicht ausführbar.' );
		return;
	}
	if(theElement.display == "none"){
		theElement.display = "";
	}
	else{
		theElement.display = "none";
	}
}

function confirmDeleteImage(Bildname){
	decision = confirm("Wollen Sie das Bild \""+Bildname+"\" wirklich löschen?\n\nDies kann nicht rückgängig gemacht werden.");
	if(decision==true){
		return true;
	}
	else{
		return false;
	}
}

function confirmDeleteDocument(Dateiname){
	decision = confirm("Wollen Sie die Datei \""+Dateiname+"\" wirklich löschen?\n\nDies kann nicht rückgängig gemacht werden.");
	if(decision==true){
		return true;
	}
	else{
		return false;
	}
}

function confirmDeleteReport(Berichttitel){
	decision = confirm("Wollen Sie den Bericht \""+Berichttitel+"\" und alle dazugehörenden Kapitel wirklich löschen?\n\nFolgende Daten werden gelöscht:\n- Bericht (Titel, Beschreibung)\n- Alle Kapitel dieses Berichts\n\nDies kann nicht rückgängig gemacht werden.");
	if(decision==true){
		return true;
	}
	else{
		return false;
	}
}

function confirmDeleteChapter(Kapiteltitel, Berichttitel){
	decision = confirm("Wollen Sie das Kapitel \""+Kapiteltitel+"\" des Berichts \""+Berichttitel+"\" wirklich löschen?\n\nDies kann nicht rückgängig gemacht werden.");
	if(decision==true){
		return true;
	}
	else{
		return false;
	}
}

function imageShowDetails(ID){
	changeDisplay("divImagesImageDescription"+ID);
}

function DocumentShowDetails(ID){
	changeDisplay("divDocumentsDocumentDescription"+ID);
}

function BerichtShowDetails(ID){
	changeDisplay("divBerichteDescription"+ID);
}

function ShowDocumentProgress(PID, ErrorWait){
  strAppVersion = navigator.appVersion;
  PID = "&"+PID
  if (document.frmDocumentsUpload.DocumentsUploadFile.value != ""){
    if (strAppVersion.indexOf('MSIE') != -1 && strAppVersion.substr(strAppVersion.indexOf('MSIE')+5,1) > 4){
      winstyle = "dialogWidth=375px; dialogHeight:130px; center:yes";
      window.showModelessDialog('scripts/UploadProgressBar/framebar.asp?to='+ErrorWait+PID+'&b=IE',null,winstyle);
    }
    else{
      window.open('scripts/UploadProgressBar/framebar.asp?to='+ErrorWait+PID+'&b=NN','','width=370,height=115', true);
    }
  }
  return true;
}

function ShowImageProgress(PID, ErrorWait){
  strAppVersion = navigator.appVersion;
  PID = "&"+PID
  if (document.frmImagesUpload.ImagesUploadFile.value != ""){
    if (strAppVersion.indexOf('MSIE') != -1 && strAppVersion.substr(strAppVersion.indexOf('MSIE')+5,1) > 4){
      winstyle = "dialogWidth=375px; dialogHeight:130px; center:yes";
      window.showModelessDialog('scripts/UploadProgressBar/framebar.asp?to='+ErrorWait+PID+'&b=IE',null,winstyle);
    }
    else{
      window.open('scripts/UploadProgressBar/framebar.asp?to='+ErrorWait+PID+'&b=NN','','width=370,height=115', true);
    }
  }
  return true;
}

function NewChapterContinentSelected(){
	sel_Continent_Index = document.frmChapterNew.ChapterNewContinent.selectedIndex;
	sel_Continent_Value = parseInt(document.frmChapterNew.ChapterNewContinent[sel_Continent_Index].value);
	for(i = document.frmChapterNew.ChapterNewCountries.length - 1; i >= 0; i--) document.frmChapterNew.ChapterNewCountries.options[i] = null;
	j=0;
	for(i = 1; i <= CountryArray.length; i++){
		if(sel_Continent_Value == -1){
			document.frmChapterNew.ChapterNewCountries.options[j] = new Option(CountryArray[i-1].Country, CountryArray[i-1].ID);
			if(CountryArray[i-1].Selected == 1) document.frmChapterNew.ChapterNewCountries.options[j].selected = true;
			j++;
		}
		else{
			if(CountryArray[i-1].Continent == sel_Continent_Value){
				document.frmChapterNew.ChapterNewCountries.options[j] = new Option(CountryArray[i-1].Country, CountryArray[i-1].ID);
				if(CountryArray[i-1].Selected == 1) document.frmChapterNew.ChapterNewCountries.options[j].selected = true;
				j++;
			}
		}
	}
}

function NewChapterCountries(ID, Continent, Country, Selected){
	this.ID = ID;
	this.Continent = Continent;
	this.Country = Country;
	this.Selected = Selected;
}

function NewChapterReportSelected(){
	sel_Report_Index = document.frmChapterNew.ChapterNewReport.selectedIndex;
	sel_Report_Value = parseInt(document.frmChapterNew.ChapterNewReport[sel_Report_Index].value);
	for(i = document.frmChapterNew.ChapterNewChapterPosition.length - 1; i >= 0; i--) document.frmChapterNew.ChapterNewChapterPosition.options[i] = null;
	j=0;
	for(i = 1; i <= ChapterArray.length; i++){
		if(ChapterArray[i-1].Report == sel_Report_Value){
			document.frmChapterNew.ChapterNewChapterPosition.options[j] = new Option(ChapterArray[i-1].PositionText, ChapterArray[i-1].Position);
			if(ChapterArray[i-1].Selected == 1) document.frmChapterNew.ChapterNewChapterPosition.options[j].selected = true;
			j++;
		}
	}
}

function NewChapterChapters(ID, Report, Position, PositionText, Selected){
	this.ID = ID;
	this.Report = Report;
	this.Position = Position;
	this.PositionText = PositionText;
	this.Selected = Selected;
}

function WorkChapterContinentSelected(){
	sel_Continent_Index = document.frmChapterWork.ChapterWorkContinent.selectedIndex;
	sel_Continent_Value = parseInt(document.frmChapterWork.ChapterWorkContinent[sel_Continent_Index].value);
	for(i = document.frmChapterWork.ChapterWorkCountries.length - 1; i >= 0; i--) document.frmChapterWork.ChapterWorkCountries.options[i] = null;
	j=0;
	for(i = 1; i <= CountryArray.length; i++){
		if(sel_Continent_Value == -1){
			document.frmChapterWork.ChapterWorkCountries.options[j] = new Option(CountryArray[i-1].Country, CountryArray[i-1].ID);
			if(CountryArray[i-1].Selected == 1) document.frmChapterWork.ChapterWorkCountries.options[j].selected = true;
			j++;
		}
		else{
			if(CountryArray[i-1].Continent == sel_Continent_Value){
				document.frmChapterWork.ChapterWorkCountries.options[j] = new Option(CountryArray[i-1].Country, CountryArray[i-1].ID);
				if(CountryArray[i-1].Selected == 1) document.frmChapterWork.ChapterWorkCountries.options[j].selected = true;
				j++;
			}
		}
	}
}

function WorkChapterReportSelected(){
	sel_Report_Index = document.frmChapterWork.ChapterWorkReport.selectedIndex;
	sel_Report_Value = parseInt(document.frmChapterWork.ChapterWorkReport[sel_Report_Index].value);
	for(i = document.frmChapterWork.ChapterWorkChapterPosition.length - 1; i >= 0; i--) document.frmChapterWork.ChapterWorkChapterPosition.options[i] = null;
	j=0;
	for(i = 1; i <= ChapterArray.length; i++){
		if(ChapterArray[i-1].Report == sel_Report_Value){
			document.frmChapterWork.ChapterWorkChapterPosition.options[j] = new Option(ChapterArray[i-1].PositionText, ChapterArray[i-1].Position);
			if(ChapterArray[i-1].Selected == 1) document.frmChapterWork.ChapterWorkChapterPosition.options[j].selected = true;
			j++;
		}
	}
}

function WorkChapterCountries(ID, Continent, Country, Selected){
	this.ID = ID;
	this.Continent = Continent;
	this.Country = Country;
	this.Selected = Selected;
}

function WorkChapterChapters(ID, Report, Position, PositionText, Selected){
	this.ID = ID;
	this.Report = Report;
	this.Position = Position;
	this.PositionText = PositionText;
	this.Selected = Selected;
}

function ChangeGaleriesNewsImageBG(ID, WhereFrom){
	TDID = eval('document.frmGaleriesNew.GaleriesNewImageTD'+ID);
	CBID = eval('document.frmGaleriesNew.GaleriesNewImage'+ID);
	
	if(WhereFrom=='CB'){
		if(CBID.checked){
			CBID.checked=false;
		}
		else{
			CBID.checked=true;
		}
	}
	
	if(CBID.checked){
		document.getElementById('GaleriesNewImageTD'+ID).className='MembersGaleriesNewImageSelectedTrue';
	}
	else{
		document.getElementById('GaleriesNewImageTD'+ID).className='MembersGaleriesNewImageSelectedFalse';
	}
}

function GaleriesNewTDClicked(ID){
	CBID = eval('document.frmGaleriesNew.GaleriesNewImage'+ID);
	if(CBID.checked){
		CBID.checked=false;
	}
	else{
		CBID.checked=true;
	}
	ChangeGaleriesNewsImageBG(ID, 'JS');
}

function confirmDeleteGalery(GalerieTitel){
	decision = confirm("Wollen Sie die Bildergalerie \""+GalerieTitel+"\" wirklich löschen?\n(Bilder der Galerie werden NICHT gelöscht.)\n\nDies kann nicht rückgängig gemacht werden.");
	if(decision==true){
		return true;
	}
	else{
		return false;
	}
}

function ChangeGaleriesWorkImageBG(ID, WhereFrom){
	TDID = eval('document.frmGaleriesWork.GaleriesWorkImageTD'+ID);
	CBID = eval('document.frmGaleriesWork.GaleriesWorkImage'+ID);
	
	if(WhereFrom=='CB'){
		if(CBID.checked){
			CBID.checked=false;
		}
		else{
			CBID.checked=true;
		}
	}
	
	if(CBID.checked){
		document.getElementById('GaleriesWorkImageTD'+ID).className='MembersGaleriesWorkImageSelectedTrue';
	}
	else{
		document.getElementById('GaleriesWorkImageTD'+ID).className='MembersGaleriesWorkImageSelectedFalse';
	}
}

function GaleriesWorkTDClicked(ID){
	CBID = eval('document.frmGaleriesWork.GaleriesWorkImage'+ID);
	if(CBID.checked){
		CBID.checked=false;
	}
	else{
		CBID.checked=true;
	}
	ChangeGaleriesWorkImageBG(ID, 'JS');
}

function changeInnerHTML(ID, Text){
	document.getElementById(ID).innerHTML=Text;
}

function getInnerHTML(ID){
	return document.getElementById(ID).innerHTML;
}

function NewGaleryContinentSelected(){
	sel_Continent_Index = document.frmGaleriesNew.GaleryNewContinent.selectedIndex;
	sel_Continent_Value = parseInt(document.frmGaleriesNew.GaleryNewContinent[sel_Continent_Index].value);
	for(i = document.frmGaleriesNew.GaleryNewCountries.length - 1; i >= 0; i--) document.frmGaleriesNew.GaleryNewCountries.options[i] = null;
	j=0;
	for(i = 1; i <= CountryArray.length; i++){
		if(sel_Continent_Value == -1){
			document.frmGaleriesNew.GaleryNewCountries.options[j] = new Option(CountryArray[i-1].Country, CountryArray[i-1].ID);
			if(CountryArray[i-1].Selected == 1) document.frmGaleriesNew.GaleryNewCountries.options[j].selected = true;
			j++;
		}
		else{
			if(CountryArray[i-1].Continent == sel_Continent_Value){
				document.frmGaleriesNew.GaleryNewCountries.options[j] = new Option(CountryArray[i-1].Country, CountryArray[i-1].ID);
				if(CountryArray[i-1].Selected == 1) document.frmGaleriesNew.GaleryNewCountries.options[j].selected = true;
				j++;
			}
		}
	}
}

function NewGaleriesCountries(ID, Continent, Country, Selected){
	this.ID = ID;
	this.Continent = Continent;
	this.Country = Country;
	this.Selected = Selected;
}

function WorkGaleryContinentSelected(){
	sel_Continent_Index = document.frmGaleriesWork.GaleriesWorkContinent.selectedIndex;
	sel_Continent_Value = parseInt(document.frmGaleriesWork.GaleriesWorkContinent[sel_Continent_Index].value);
	for(i = document.frmGaleriesWork.GaleriesWorkCountries.length - 1; i >= 0; i--) document.frmGaleriesWork.GaleriesWorkCountries.options[i] = null;
	j=0;
	for(i = 1; i <= CountryArray.length; i++){
		if(sel_Continent_Value == -1){
			document.frmGaleriesWork.GaleriesWorkCountries.options[j] = new Option(CountryArray[i-1].Country, CountryArray[i-1].ID);
			if(CountryArray[i-1].Selected == 1) document.frmGaleriesWork.GaleriesWorkCountries.options[j].selected = true;
			j++;
		}
		else{
			if(CountryArray[i-1].Continent == sel_Continent_Value){
				document.frmGaleriesWork.GaleriesWorkCountries.options[j] = new Option(CountryArray[i-1].Country, CountryArray[i-1].ID);
				if(CountryArray[i-1].Selected == 1) document.frmGaleriesWork.GaleriesWorkCountries.options[j].selected = true;
				j++;
			}
		}
	}
}

function WorkGaleriesCountries(ID, Continent, Country, Selected){
	this.ID = ID;
	this.Continent = Continent;
	this.Country = Country;
	this.Selected = Selected;
}
