function bildVergroessern(url,breite, hoehe) {
	breite += 40;
	hoehe += 40;
	if(breite > 640) breite=640;
	if(hoehe > 480) hoehe=480;
	
	// IE hat ein Problem??
//		var win = window.open(url,"<%replace name=Allgemein.Vergroesserung format=escape%>Vergroesserung<%/replace%>","menubar=no,resizable=yes,scrollbars=yes,width="+breite+",height=" + hoehe);
	var win = window.open(url,"gross","menubar=no,resizable=yes,scrollbars=yes,width="+breite+",height=" + hoehe);
	win.focus();
}


function stdws_openDruck() {
	var url;
	if(location.search == "") {
		url = window.location.href + '?stdws_chtml=true&druckdarstellungVAR=true'
	}
	else  {
		url = window.location.href + '&stdws_chtml=true&druckdarstellungVAR=true'
	}
	var win = window.open(url,"Print","menubar=yes,resizable=yes,scrollbars=yes,width=600,height=700");
	win.focus();
}

var diverses_hilfetitel = "";
var diverses_hilfetext = "";

function stdws_setHilfe(titel,text) {
	diverses_hilfetitel = titel;
	diverses_hilfetext = text;
}

function stdws_showHilfe(anchorname) {
	// Create an object for a WINDOW popup
	var helpwin = new PopupWindow(); 
	helpwin.autoHide(); 
	helpwin.setSize(300,200);
        var html = "<html><head>\n"
                + "<title>"+ diverses_hilfetitel+"</title>\n"
                + "<meta http-equiv='Content-Type' content='text/html;CHARSET=iso-8859-1'>\n"
				+ "<style type=\"text/css\">"
				+ "body {"
				+ "	font-family: Verdana, Arial, Helvetica, Geneva, Sans-Serif;"
				+ " font-size:9pt;"
				+ " line-height:13pt;"
				+ "	color:#1D385E;"
				+ "background-color:#dddddd;"
				+ "margin: 10px 10px 10px 10px;"
				+ " } \n"
				+ "</style>"
                + "</head>"
                + "<body>\n"
                + "<div id=hilfewinid>\n"
                + diverses_hilfetext
                + "</div>\n"
                +"\n</body></html>";

	helpwin.populate(html);
	helpwin.showPopup(anchorname);
	//var cors = getAnchorWindowPosition(anchorname);
	//alert(" cors: " + cors.x + "/" + cors.y);
}

function stdws_showBild(div,bildurl) {
	// Create an object for a WINDOW popup
	var helpwin = new PopupWindow(div); 
	helpwin.autoHide(); 
	//helpwin.setSize(300,200);
	helpwin.populate('<img src="' + bildurl + '" />');
	helpwin.showPopup(div);
	// Refresh the contents of the popup
	helpwin.refresh();
}

function stdws_showInfo(anchorname,titel,text) {
	stdws_setHilfe(titel,text);
	stdws_showHilfe(anchorname);
}

function stdws_override_link(l, w, h, hide_toolbars, options) {
	window.open(l.href, "_blank", "width="+w+", height="+h+
		(!hide_toolbars? ",menubar=yes,toolbar=yes,scrollbars=yes,resizable=yes"
			: (options? options
				: "")));
	return false;
}


/**
	Eingabefelder mit Anweisung
	Sascha 2008-01-31
*/

 Function.prototype.bindAsEventListener = function(object) {
   var __method = this;
   return function(event) {
     __method.call(object, event);
   }
 }


function EingabefeldMitAnweisung(id, default_text, focus_color, blur_color) {
  var input = document.getElementById(id);
  var form = input.form;
  input.value = default_text;
  input.style.color = blur_color;


  this.submit_handler = function(e) {
    if (input.value == "" || input.value == default_text) {
      if (e.preventDefault) {
        e.preventDefault();
      } else {
        e.returnValue = false;
      }
    }
  }

  if (form.addEventListener) {
    form.addEventListener('submit', this.submit_handler.bindAsEventListener(this), false);
  } else {
    form.attachEvent('onsubmit', this.submit_handler.bindAsEventListener(this));
  }

  this.focus_handler = function(e) {
    input.style.color = focus_color;
    if (input.value == default_text) {
      input.value = "";
    }
  }

  this.blur_handler = function(e) {
    if (input.value.length == 0) {
      input.value = default_text;        
    }
    if (input.value == default_text) {
      input.style.color = blur_color;
    }
  }

  if (input.addEventListener) {
    input.addEventListener('focus', this.focus_handler.bindAsEventListener(this), false);
    input.addEventListener('blur', this.blur_handler.bindAsEventListener(this), false);
  } else {
    input.attachEvent('onfocus', this.focus_handler.bindAsEventListener(this));
    input.attachEvent('onblur', this.blur_handler.bindAsEventListener(this));
  }
}

/**

	so verwenden

	<script type="text/javascript">	
      function init() {
        var plz = EingabefeldMitAnweisung('plz', 'PLZ', 'black', 'gray');
      }

      if (window.addEventListener) {
        window.addEventListener('load', init, false);
      } else {
        window.attachEvent('onload', init);
      }
    </script>

      <form method="get" action="index.xhtml">
        <input type="text" id="plz" />
        <button type="submit">OK</button>
      </form>

*/
