// Funktionen für Druckfunktion

function check(f,n)
{
        if (document.forms[f].elements['Select_All'].checked == true)
        {
                for(i=0;i<document.forms[f].length;++i)
                {
                        if ((document.forms[f].elements[i].type == 'checkbox') && (document.forms[f].elements[i].name == n))
                        {
                                document.forms[f].elements[i].checked = true;
                        }
                }
        }
        else
        {
                for(i=0;i<document.forms[f].length;++i)
                {
                        if ((document.forms[f].elements[i].type == 'checkbox') && (document.forms[f].elements[i].name == n))
                        {
                                document.forms[f].elements[i].checked = false;
                        }
                }
        }
}



function printview(u)
{
  u = u+"?href="+window.location.href;  
  pView = window.open(u, "PrintView", "width=240,height=525,scrollbars=no,resizable=no,toolbar=no,menubar=no,status=no,location=no,dependent=yes,left=50,top=50");
  window.pView.focus();
  //Window.pView.location.reload();
}

function printview2(u)
{
  u = u+"?href="+window.location.href;  
  pView = window.open(u, "PrintView", "width=395,height=525,scrollbars=no,resizable=no,toolbar=no,menubar=no,status=no,location=no,dependent=yes,left=50,top=50");
  window.pView.focus();
  //Window.pView.location.reload();
}

function printview3(u)
{
  u = u+"?href="+window.location.href;  
  pView = window.open(u, "PrintView", "width=280,height=280,scrollbars=no,resizable=no,toolbar=no,menubar=no,status=no,location=no,dependent=yes,left=50,top=50");
  window.pView.focus();
  //Window.pView.location.reload();
}


function printMe()
{
  if(document.all && navigator.appVersion.substring(22,23)==4) {
 	self.focus();
 	var OLECMDID_PRINT = 6;
 	var OLECMDEXECOPT_DONTPROMPTUSER = 2;
 	var OLECMDEXECOPT_PROMPTUSER = 1;
 	var WebBrowser = '<object id="WebBrowser1" width="0" height="0" classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></object>';
 	document.body.insertAdjacentHTML('beforeEnd',WebBrowser);
 	WebBrowser1.ExecWB(OLECMDID_PRINT,OLECMDEXECOPT_DONTPROMPTUSER);
 	WebBrowser1.outerHTML = '';
  }
  else {
  	self.focus();
  	window.print();
  }  
}


function textcount(_form, _field, _limit)
{
	var _textlen = document.forms[_form].elements[_field].value.length;
	
	if ( _textlen > _limit ) {
		alert("Die Kurzbeschreibung darf nur\nmax. "+_limit+" Zeichen enthalten!");
		document.forms[_form].elements[_field].value = document.forms[_form].elements[_field].value.substring(0,_limit);
		document.forms[_form].elements[_field].focus();	
	}	
}

function checkSelect(_form, _field)
{
	var elem = document.forms[_form].elements[_field]
	var sel = 0;
	var out = '';
	
	for(var i=0;i<elem.length;++i)
	{
  		if( elem[i].checked )
  		{
  			sel = 1;
  		}
  	}
  	
  	out = out + "\n" + sel;		
  	
  	if( sel )
  	{
  		document.forms[_form].submit();
  	}
  	else
  	{
  		alert("Bitte wählen Sie eine Anzeige aus!");
  	}	
}

function LayerPos(e) {  
   	if (document.layers){
    		if (window.netscape) {
	  		document.getElementsByTagName("div")[0].style.pixelLeft=e.pageX+10;
      			document.getElementsByTagName("div")[0].style.pixelTop=e.pageY+10;
      			document.getElementsByTagName("div")[0].style.visibility="visible";
		} else {
      			document.memotip.left=e.pageX+10;
      			document.memotip.top=e.pageY+10;
	      		document.memotip.visibility="show";
		}
  	} else {
    		if (window.netscape) {
			document.getElementsByTagName("div")[0].style.pixelLeft=e.clientX+document.body.scrollLeft+10;
      			document.getElementsByTagName("div")[0].style.pixelTop=e.clientY+document.body.scrollTop+10;
      			document.getElementsByTagName("div")[0].style.visibility="visible";
		} else {
      			document.all.memotip.style.pixelLeft=e.clientX+document.body.scrollLeft+10;
      			document.all.memotip.style.pixelTop=e.clientY+document.body.scrollTop+10;
      			document.all.memotip.style.visibility="visible";
		}
	}
}

function hidetip() {
	if (document.layers){
		if (window.netscape)
			document.getElementsByTagName("div")[0].visibility="hidden";
		else
    			document.memotip.visibility="hidden";
  	} else {
  		if (window.netscape)
			document.getElementsByTagName("div")[0].style.visibility="hidden";
		else
	    		document.all.memotip.style.visibility="hidden";
	}  
}

function date() {
	today = new Date();
	day = today.getDay();
	date = today.getDate();
	month = today.getMonth()+1;
	year = today.getFullYear();
	if (day == 0) dayName = "Sonntag"
	else if (day == 1) dayName = "Montag"
	else if (day == 2) dayName = "Dienstag"
	else if (day == 3) dayName = "Mittwoch"
	else if (day == 4) dayName = "Donnerstag"
	else if (day == 5) dayName = "Freitag"
	else dayName = "Samstag";
	if (month == 1) monthName = "Januar"
	else if (month == 2) monthName = "Februar"
	else if (month == 3) monthName = "M&auml;rz"
	else if (month == 4) monthName = "April"
	else if (month == 5) monthName = "Mai"
	else if (month == 6) monthName = "Juni"
	else if (month == 7) monthName = "Juli"
	else if (month == 8) monthName = "August"
	else if (month == 9) monthName = "September"
	else if (month == 10) monthName = "Oktober"
	else if (month == 11) monthName = "November"
	else if (month == 12) monthName = "Dezember"
	year = year - 2000;
	if (year < 10) year = "0" + year;
	if (month < 10) month = "0" + month;
	if (date < 10) date = "0" + date;
	document.write(dayName + ", " + date + ". " + monthName + " '" + year);
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function dateformat(datobj)
{
dat=new Date(datobj)
tag=dat.getDate()
if(tag<10)
tag="0"+tag
monat=dat.getMonth()+1
if (monat<10)
monat="0"+monat
jahr=dat.getYear()
if (jahr<200)
jahr=jahr+1900
datstring=tag+"."+monat+"."+jahr
return datstring
}


function docModified()
{
var date = new Date(document.lastModified);
document.write(" "+dateformat(date));
}