
/*********************************************************************/
/*  javascript funtion                                               */
/*  Author : Rolf Neubert                                            */
/*  Date :   24.10.2005                                              */
/*********************************************************************/




/*********************************************************************/
/*                   Check Formular input                            */
/*********************************************************************/

function CheckFormular()
   {
   /*********************** Check Input Date ****************************/
 
   $string = document.eingabe.newsValidTo.value;     // input string
   $note ="";                                        // collect the errors
   $result = "true";                                 // start value
         
   if (document.eingabe.newsValidTo.value != "")
      {
      /*** check Day ***/
      if (($string.substring(0,2) > 31) || ($string.substring(0,2) < 1))
         {
         $result = "false";
         }

      /*** check months ***/
      if (($string.substring(3,5) > 12) || ($string.substring(3,5) < 1))
         {
         $result = "false";
         }
      
      /*** check year ***/ 
      if (($string.substring(6,10) > 3000) || ($string.substring(6,10) < 1000))
         {
         $result = "false";
         }

      /*** check format ***/
      if ( ($string.substring(2,3) != "." ) || ($string.substring(5,6) != "." ))
         {
         $result = "false";
         }
      
      /*** check ist a Number ***/
      if (day = isNaN($string.substring(0,2)))
         {
         $result = "false";
         }
 
      if (mounth = isNaN($string.substring(3,5)))
         {
         $result = "false";
         }
 
      if (year = isNaN($string.substring(6,10)))
         {
         $result = "false";
         }

      /*** check lenght ***/
      if ( $string.length > 10)
         {
         $result = "false";
         }
      
      /*** write $note ***/
      if ($result == "false")
         {
         $note = $note+"Datumseingabe \""+$string+"\" ist falsch!  Datum im Format TT.MM.JJJJ eingeben!\n";
         }  
      }
   
   /*********************** Check Input Reihenfolge *********************/

   $string = document.eingabe.newsPriority.value;
   if ($string != "")
      {
      if ( (a=isNaN($string)) || ($string>9999))
         {
         $note = $note+"Bei der Anzeigenreihenfolge bitte eine Zahl zwischen 0 und 9999 eingeben!\n";
         $result = "false";
         }
      }

   /*********************** Check Input Content *************************/

   if (document.eingabe.content.value == "")
      {
      $note = $note+"Bitte füllen Sie mindestens das Feld \"Inhalt\" aus um eine Information zu speichern! ";
      $result = "false";
      }
	 
   
  if ($result == "false")
     {
     alert($note);
     document.eingabe.content.focus();
     return false;
     }
  else
     {
     return true;
     }

  }

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






/*********************************************************************/
/*                  Confirm Delete                                   */
/*********************************************************************/

function confirm_delete()
    {
    if ( confirm ("Möchten Sie den Datensatz wirklich löschen?") )
       {
       return true;
       //self.location.replace($URL)
       }
    else
       {
       return false;
       } 
   }
   
/*********************************************************************/
/*                                                                   */
/*********************************************************************/








/*********************************************************************/
/*                     Display image                                 */
/*********************************************************************/


function bild($image)
	 {
         nF=window.open("","NewWindow","width=100,height=100,resizable=yes,location=no,scrollbars=yes,toolbar=no,status=no,directories=no,menubar=no,location=no");
	 nF.moveTo(10,10);
         t="";
	 t=t+"<html><head>"
	 t=t+"<title>Euba im Internet</title>";
	 t=t+"<link rel='stylesheet'href='../style/styleForHomepage.css'>";
         t=t+"<script>";
       
         t=t+"function resize()"
         t=t+" { ";
         t=t+" $breite = document.images[0].width ;";
         t=t+" $hoehe  = document.images[0].height ;";
         t=t+" $breiteFenster = $breite+100; ";
         t=t+" $hoeheFenster = $hoehe+100; "; 

         t=t+" window.resizeTo($breiteFenster,$hoeheFenster);";
         t=t+" window.moveTo(10,10); ";
         t=t+" window.focus(); ";
         t=t+" }";
       
         t=t+"</script>";
      
         t=t+"</head>";
	 t=t+"<body onLoad=resize()>";
	 t=t+"<center>";
	 
	 t=t+"<h2><center>Bildanzeige</center></h2>";
	 
         t=t+"<a href='JavaScript:self.close()' >";
	 t=t+"<img src='"+$image+"'class='picshow' alt='close' name='big'>";
	 t=t+"</a>";
         t=t+"</center>";
	 

	 t=t+"<h4><center>";
	 t=t+"<a href='JavaScript:self.close()'>schlie&szlig;en</a></h4>";
	 t=t+"</center></h4>";
	 t=t+"</body></html>";
         
         nF.document.open();
	 nF.document.write(t);
	 nF.document.close();
         }



   function bildanzeige()
	 {
	 $bild=self.document.eingabe.datei.value;
	 $bild="file://"+$bild;
	 self.document.eingabe.vorschau.src=$bild;
	 
	 $bild_ori=self.document.eingabe.vorschau.src;
	 
	 temp_fenster=window.open("","TempWindow","width=10,height=10");
	 temp_fenster.blur();
	 temp_fenster.document.open();
	 t="";
	 t=t+"<html><body>";
	 t=t+"<img src='"+$bild_ori+"'>";
	 t=t+"<p><a href='JavaScript:self.close()'>schlie&szlig;en</a></p>";
	 t=t+"</body></html>";
	 temp_fenster.document.write(t);
	 temp_fenster.document.close();
	 
	 $originalbreite=temp_fenster.document.images[0].width;
	 $originalhoehe =temp_fenster.document.images[0].height;
	 
	 temp_fenster.close();
	 
	 
	 t="";
	 t="Datei geladen:    \n"+$bild+"\n";
	 t=t+"Original-Bildgröße: ";
	 t=t+$originalbreite+" x "+$originalhoehe+" Pixel\n\n";
	 
	 

	 var l=$bild.length;
	 var pos_von=l-3;
	 var pos_bis=l;

	 $datei_typ=$bild.substring(pos_von,pos_bis);
	 $datei_typ=$datei_typ.toLowerCase()	 
	 if ( $datei_typ != "jpg" &&  $datei_typ != "gif")
	    {
	    t=t+"Achtung!\n";
	    t=t+"ausgewählte Datei "+$bild+" ist kein Bild vom Typ GIF bzw. JPG!\n";
	    t=t+"Diese Datei kann nicht angezeigt werden!\n";
	    t=t+"Bitte anderes Bild auswählen oder Eingabe verwerfen!\n";
	    }

	 if ($originalbreite >= 400)
	    {
	    t=t+"Achtung! Fehler\n";
	    t=t+"Das Bild ist zu groß! ("+$originalbreite+" x "+$originalhoehe+" Pixel)\n";
	    t=t+"Bitte beachten!\n";
	    t=t+"maximale Bildbreite 400 Pixel\n";
	    t=t+"kein Upload durchführen!\n";
	    t=t+"Bitte anderes Bild auswählen oder Eingabe verwerfen!\n";
	    }
	alert(t);
	    
  	}

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

   function bildanzeige_loeschen()
      {
      document.vorschau.src="../pic/transparent.gif";
      }
 
/*********************************************************************/
/*                                                                   */
/*********************************************************************/

   function originalbild()
      {
      $bild=self.document.eingabe.vorschau.src;
      bild($bild);
      }
   

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

   function help()
	 {
	 var help_window = window.open("help.htm","Help","toolbar=no,status=no,directories=no,menubar=no,location=no,scrollbars=yes,width=250,height=480");
	
	help_window.moveTo(20,20);
	help_window.focus();
	}

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


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




