var imageFilePath = '';
//alert('admin.js');

function chooseImage()
  {
  //alert(document.forms.image.used_image.value);
  window.open('verwaltung.php?chooseImage=1', 'Bild auswählen', "width=600,height="+ (window.innerHeight) +",left=0,top=40,scrollbars=yes,resizable=yes");
  
  //alert(window.innerHeight - 80)
  // "+ window.innerHeight - 80 +"
  }


function choosenImage(name, file_path, id, original)
  {
  //<div class="element_edit_mode_hl">Bild <span>1965</span></div>
  //alert(name + file_path + id + original);
  window.opener.document.getElementById('image_file_name').innerHTML = '<div class="element_edit_mode_h2">Ausgesuchte Bilddatei:<br> <span>' + name + '</span>';
  window.opener.document.forms.image.file_path.value = file_path;
  window.opener.document.forms.image.new_id.value = id;
  window.opener.document.forms.image.original.value = original;
  }


function numbersInFormOnly(adress)
  {
  //alert(string);
  var number = new RegExp('^[0-9]*$');
  if(! number.test(adress['value']))
    adress['value'] = adress['value'].substr(0,(adress['value'].length - 1))
  //document.getElementById('info').innerHTML = adress['value'];
  }

/*
  var string = 'Eigenschaften <br>';
  for(property in adress)
    string += property + ': ' + adress[property] + '<br>';
*/


// ******************************************************************************************
// opens info-window
// Synthax: openInfo(string destination, width, height, left, top, scrollbars_yes_or_no)
// javascript: openInfo('_info/berge/pentagonal.html',197,590,15,30,'no')
// All arguments are optional.
// ******************************************************************************************
var infoWindow;
var windowName;
function openInfo()
{
var aWidth = screen.availWidth -50;
var aHeight = screen.availHeight - 40;
var left = 0;
var top = 0;
var tempTop = 0;

var destination = "";
var noPage = false;
var scrollbar = "no";
var attributes = "";

if(arguments.length == 0 || typeof arguments[0] != "string")
    {
    noPage = true;
    var innerText =
        "<html><head><title>Fehlermeldung</title>" +
        "<link rel=\"stylesheet\" href=\"_css/main.css\" type=\"text/css\"></head>" +
        "<body topmargin=\"40px\" leftmargin=\"40px\" >" +
        "Sorry<br>" +
        "Die gew&uuml;nschte Info-Seite <br>kann nicht angezeigt werden" +
        "<body></html>";
    aWidth = 300;
    aHeight = 150;
    left = 200;
    top = 200;
    }
else
    destination = arguments[0];

if(arguments.length >= 2)
    if(arguments[1] != -1 && !noPage && arguments[1] < aWidth)
        aWidth = arguments[1];
if(arguments.length >= 3)
    if (arguments[2] != -1 && !noPage)
        {
        if (arguments.length >= 5)
            tempTop = arguments[4];

        if(arguments[2] + tempTop < aHeight) // height + top less than aHeight
            aHeight = arguments[2];

        else if (tempTop > 0)
            {
            aHeight -= tempTop;
            // add scrollbars if screen is smaller than popUp
            if (arguments.length >= 6 && arguments[5] == "no")
                {
                aWidth += 40;
                arguments[5] = "yes";
                }
            else
                {
                aWidth += 40;
                scrollbar = "yes";
                }
            }
        }
if(arguments.length >= 4)
    if(arguments[3] != -1 && !noPage)
        left = arguments[3];
if(arguments.length >= 5)
    if(arguments[4] != -1 && !noPage)
        top = arguments[4];
if(arguments.length >= 6)
    if(arguments[5] != -1 && typeof arguments[5] == "string" && !noPage)
        scrollbar = arguments[5];
if(arguments.length >= 7)
    if(arguments[6] != -1 && typeof arguments[6] == "string" && !noPage)
        {
        attributes = "," + arguments[6];
        aHeight -= 120;
        aWidth += 40;
        }
if(arguments.length >= 8)
    {
    if(arguments[7] != -1 && typeof arguments[7] == "string" && !noPage)
        windowName =  arguments[7];
    }
else
    windowName = destination.substring(destination.lastIndexOf("/") + 1, destination.lastIndexOf("."));
//alert (arguments.length);

//destinationArray = destination.split("/");
//destinationName = destinationArray[destinationArray.length - 1];

//alert(destinationArray[destinationArray.length - 1]);

infoWindow = window.open
    (
    destination,
    windowName,
    "width="  + aWidth  + "," +
    "height=" + aHeight + "," +
    "left="   + left    + "," +
    "top="    + top     + "," +
    "resizable=yes,"    +
    "scrollbars=" + scrollbar + attributes
    );

if (noPage)
    infoWindow.document.write(innerText);
}
// ******************************************************************************************
