/******************************************************

  H&H WebSoccer 2

  Copyright (c) 2004 by

  H&H Solutions GbR
  Seyboldstr. 3
  D-74336 Brackenheim

  EMail: info@hh-solutions.de
  Homepage: http://www.hh-solutions.de

  Dateiname: /jfunctions.js
  Autor: Ingo Hofmann (ingo.hofmann@hh-solutions.de)
  Datum: 27.5.2004
  Beschreibung: JavaScript Funktionen

******************************************************/


/*
Öffnet Fenster mit Großansicht der News-Bilder
*/


function winPic(id) {
  window.open("newspic.php?id="+ id,"Newsbild","width=750,height=550,scrollbars=yes,status=yes,resizable=yes");
} // -winPic


/*
Öffnet Fenster mit Großansicht der News-Bilder
*/
function Delete(bForm, id, strFile, strArea) {

  if (bForm == 1) chk = confirm("Wollen Sie die markierten Einträge wirklich löschen?");
  else chk = confirm("Wollen Sie den ausgewählten Eintrag wirklich löschen?");

  if (chk == true) {
    if (bForm == 1) document.frmMain.submit();
    else window.location = strFile + '?action=loeschen&area=' + strArea + '&del_id[]=' + id;
  }

} // -Delete

/*
Navigationsfunktionen
*/
function montre(id)
{
	with (document)
	{
		if (getElementById)
			getElementById(id).style.display = 'block';
		else if (all)
			all[id].style.display = 'block';
		else
			layers[id].display = 'block';
	}
}

function cache(id)
{
	with (document)
	{
		if (getElementById)
			getElementById(id).style.display = 'none';
		else if (all)
			all[id].style.display = 'none';
		else
			layers[id].display = 'none';
	}
}


/*
Wählt richtiges Bild und Paramter in training_mannschaft.tpl aus
*/

function einheitDetails(select_name) 
{
	
	//Schleife zur Überprüfung, welche Trainingseinheit ausgewählt wurde
	for (i = 0; i < document.forms[1].elements[select_name].length; ++i) {
		
		//Wenn die richtige Einheit gefunden wurde
		if (document.forms[1].elements[select_name].options[i].selected == true)	{
			
			//Wert des Option-Feldes
			option_value = String(document.forms[1].elements[select_name].options[i].value);
			
			//String richig zerlegen & in Integer umwandeln
			str_kondition = option_value.substr(0,2);		kondition = parseInt(str_kondition);
			str_frische = option_value.substr(3,2);			frische = parseInt(str_frische);
			str_zufriedenheit = option_value.substr(6,2);	zufriedenheit = parseInt(str_zufriedenheit);
			str_form = option_value.substr(9,2);			w_form = parseInt(str_form);
			str_einheit_id = option_value.substr(12);		einheit_id = parseInt(str_einheit_id);

			//Bild austauschen
			trainingsbild = new Image (100,75);
			trainingsbild.src = 'grafiken/training/'+ einheit_id + '.png';
			document.images[select_name].src = trainingsbild.src;

			//span-Elemente austauschen
			document.getElementById(select_name + 'k').innerHTML = 'Kondition: ' + kondition;
			document.getElementById(select_name + 'f').innerHTML = 'Frische: ' + frische;
			document.getElementById(select_name + 'z').innerHTML = 'Zufriedenheit: ' + zufriedenheit;
			document.getElementById(select_name + 'o').innerHTML = 'Form: ' + w_form;

		}
	}
}

function selectAll() {

  var c = document.frmMain.selAll.checked;

  for (i=0; i<document.frmMain.elements.length; i++) {
    if (document.frmMain.elements[i].type == "checkbox" && document.frmMain.elements[i].name != document.frmMain.selAll.name) {
      if (c == true) document.frmMain.elements[i].checked = true;
      else document.frmMain.elements[i].checked = false;
    }
  }


}

