
<!---

	function newwnd(page,_width,_height)
	{
		zufall=Math.random();
		zufall*=16;
		zufall=Math.ceil(zufall);
		
		_left=(screen.width-_width)/2;
		_top=(screen.height-_height)/2-25;
		var newwindow = window.open(page, 'detail' + zufall, 'top=' + _top + ',left=' + _left + ',width=' + _width + ',height=' + _height + ',toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes');
		newwindow.focus();
	}

	function newwnd_noscroll(page,_width,_height)
	{
		zufall=Math.random();
		zufall*=16;
		zufall=Math.ceil(zufall);
		
		_left=(screen.width-_width)/2;
		_top=(screen.height-_height)/2-25;
		var newwindow = window.open(page, 'detail' + zufall, 'top=' + _top + ',left=' + _left + ',width=' + _width + ',height=' + _height + ',toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no');
		newwindow.focus();
	}

	function newwnd_fullscreen(page,_width,_height)
	{
		zufall=Math.random();
		zufall*=16;
		zufall=Math.ceil(zufall);
		
		var newwindow = window.open(page, 'detail' + zufall, 'top=5,left=5,width='+(screen.width-10)+',height='+(screen.height-30)+',toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes');
		newwindow.focus();
	}

	function confirm(link)
	{
		_width = 350;
		_height = 230;
		_left=(screen.width-_width)/2;
		_top=(screen.height-_height)/2;
		window.open(link, 'confirm', 'top=' + _top + ',left=' + _left + ',width=' + _width + ',height=' + _height + ',toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no');
	}

	function fileman(link)
	{
		_width = 550;
		_height = 180;
		_left=(screen.width-_width)/2;
		_top=(screen.height-_height)/2;
		window.open(link, 'fileman', 'top=' + _top + ',left=' + _left + ',width=' + _width + ',height=' + _height + ',toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no');
	}

	function showwnd(change)
	{
		var newwindow = window.open(change, 'wnd', 'top=10,left=10,width=1000,height=700,toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes');
		newwindow.focus();
	}

	function sizeEditDiv() {

		// gr&ouml;sse des con_ver_edit Div's anpassen
		if (window.innerHeight) hoehe = window.innerHeight;
		else if (document.body && document.body.offsetHeight) hoehe = document.body.offsetHeight;
		if (window.innerWidth) breite = window.innerWidth;
		else if (document.body && document.body.offsetWidth) breite = document.body.offsetWidth;
		
		document.getElementById(sizeEditDiv_div_name).style.height = hoehe-sizeEditDiv_margin_top; 
		document.getElementById(sizeEditDiv_div_name).style.width = breite-sizeEditDiv_margin_left; 
	}

	function chimg(ID_Content, Field, neu)
	{
		change = '/verwaltung/bilder/frame.php?site=' + ID_Content + '&field=' + Field + '&new=' + neu + '&img_openNode=' + img_openNode;
		window.open(change, 'bildpool', 'top=10,left=10,width=1000,height=700,toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes');
	}

	function chswf(ID_Content, Field, neu)
	{
		change = '/verwaltung/flash/frame.php?site=' + ID_Content + '&field=' + Field + '&new=' + neu;
		window.open(change, 'flashpool', 'top=10,left=10,width=1000,height=700,toolbar=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=yes');
	}
	
	function delimg(Field)
	{
		bild = document.getElementById(Field);
		bild.value='';
		imgbild = document.getElementById('img_'+Field);
		imgbild.src='';
	}

	function chkicker(ID_Content, Field, neu)
	{
		change = '/verwaltung/kicker/index.php?site=' + ID_Content + '&field=' + Field + '&new=' + neu;
		window.open(change, 'kickerpool', 'top=10,left=10,width=800,height=600,toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes');
	}

	function delkicker(Field)
	{
		document.getElementById(Field).value = '';  
	}

	function createLink(Field, selText)
	{
		change = '/verwaltung/content/index.php?field=' + Field + '&selText=' + selText;
		window.open(change, 'linkpool', 'top=10,left=10,width=800,height=600,toolbar=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=yes');
	}

	function showimg_db(img_nr, size)
	{
		bildname = '/data/imgwnd.php?ID=' + img_nr + '&View='+ size;

		_width=50;
		_height=50;
		_left=(screen.width-_width)/2;
		_top=(screen.height-_height)/2;
		window.open(bildname, 'bild_gal', 'top=' + _top + ',left=' + _left + ',width=' + _width + ',height=' + _height + ',toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no');
	}

	function showimg_file(img_name)
	{
		bildname = '/data/imgwnd.php?bild=' + img_name;

		_width=50;
		_height=50;
		_left=(screen.width-_width)/2;
		_top=(screen.height-_height)/2;
		window.open(bildname, 'bild_gal', 'top=' + _top + ',left=' + _left + ',width=' + _width + ',height=' + _height + ',toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no');
	}
	
// Inputfield Filter DropDown
var inputid_sav = -1;
function closeChooseNULL(inputid, objid) {
	choosediv = document.getElementById(objid);

	if (inputid_sav == inputid) { 
		choosediv.style.visibility = "hidden";
		inputid_sav = -1;
		return ;
	}
}

function openChooseNULL_old(inputid, button) {
//	openChooseNULL(inputid, 'choose_NULL', button, 'bottom');
		choosediv = document.getElementById('choose_NULL');
	
		if (inputid_sav == inputid) { 
			choosediv.style.visibility = "hidden";
			inputid_sav = -1;
			return ;
		}
	
		if (document.getElementById(inputid)) {
			inputfield = document.getElementById(inputid);
			
			choosediv.style.visibility = "visible";
			choosediv.style.width = inputfield.offsetWidth + button.offsetWidth;
			

			_offsetLeft = 0;
			el = inputfield;
			while ((el.offsetParent) && (el.tagName != 'DIV')) { _offsetLeft += el.offsetLeft; el = el.offsetParent; }

			choosediv.style.left = _offsetLeft;

			_offsetTop = 0;
			el = inputfield;
			while ((el.offsetParent) && (el.tagName != 'DIV')) { _offsetTop += el.offsetTop; el = el.offsetParent; }

			choosediv.style.top = _offsetTop + inputfield.offsetHeight + 1;
	
			inputid_sav = inputid;
		}
	}

function openChooseNULL(inputid, objid, button, position) {
	choosediv = document.getElementById(objid);

	if (inputid_sav == inputid) { 
		choosediv.style.visibility = "hidden";
		inputid_sav = -1;
		return ;
	}

	if (document.getElementById(inputid)) {
		inputfield = document.getElementById(inputid);
		
		choosediv.style.visibility = "visible";
//		choosediv.style.width = inputfield.offsetWidth + button.offsetWidth;

		_offsetLeft = 0;
		el = inputfield;
		while ((el.offsetParent) ) { _offsetLeft += el.offsetLeft; el = el.offsetParent; } // && (el.tagName != 'DIV')

		choosediv.style.left = _offsetLeft - 19 + 'px';
		_offsetTop = 0;
		el = inputfield;
		while ((el.offsetParent) ) { _offsetTop += el.offsetTop; el = el.offsetParent; } // && (el.tagName != 'DIV')

		//alert (_offsetTop + ' / ' + _offsetLeft);

		if (position=='bottom') {
			choosediv.style.top = _offsetTop + 'px'; // inputfield.offsetHeight + 10 +
		} else if (position=='top') {
			choosediv.style.top = _offsetTop - choosediv.offsetHeight + 'px';
		} else {
		}

		inputid_sav = inputid;
	}
}

	
	
	// openDivFrame PopUp
	var openDivFrame_sav = -1;
	function closeDivFrame(inputid, divObj) {
		choosediv = window.parent.document.getElementById(divObj);
	
		choosediv.style.visibility = "hidden";
		openDivFrame_sav = -1;
		return ;
	}
	function openDivFrame(inputid, divObj) {
		choosediv = document.getElementById(divObj);
/*	
		if (openDivFrame_sav == inputid) { 
			choosediv.style.visibility = "hidden";
			openDivFrame_sav = -1;
			return ;
		}
*/	
		if (document.getElementById(inputid)) {
			inputfield = document.getElementById(inputid);
			
			choosediv.style.visibility = "visible";
//			choosediv.style.width = inputfield.offsetWidth;
			

			_offsetLeft = 0;
			el = inputfield;
			while ((el.offsetParent) && (el.tagName != 'DIV')) { _offsetLeft += el.offsetLeft; el = el.offsetParent; }

			choosediv.style.left = _offsetLeft ;//- (inputfield.offsetWidth-choosediv.style.width);

			_offsetTop = 0;
			el = inputfield;
			while ((el.offsetParent) && (el.tagName != 'DIV')) { _offsetTop += el.offsetTop; el = el.offsetParent; }

			choosediv.style.top = _offsetTop + inputfield.offsetHeight;
	
			openDivFrame_sav = inputid;
		}
	}

	function searchDivFrame(txt, iFrameObj) {
		
		iFrame = document.getElementById(iFrameObj);
		locationStr = iFrame.src;
		if ((ipos = iFrame.src.indexOf('searchStr='))> -1) {
			locationStr = iFrame.src.substring(0, ipos);
		}
		
		iFrame.src =  locationStr + '&searchStr=' + txt;
		
	}	
	
var monate = Array ()
	monate[1] = 'Januar';
	monate[2] = 'Februar';
	monate[3] = 'M&auml;rz';
	monate[4] = 'April';
	monate[5] = 'Mai';
	monate[6] = 'Juni';
	monate[7] = 'Juli';
	monate[8] = 'August';
	monate[9] = 'September';
	monate[10] = 'Oktober';
	monate[11] = 'November';
	monate[12] = 'Dezember';
	/*
	function createCalenderDropDown (objid, inputid, zindex,this_year,this_month,this_day,funccall,tabindex, formid) {
		var newdiv = document.createElement("<div>");
		newdiv.setAttribute('id', objid);
		newdiv.setAttribute('align', 'center');
		newdiv.setAttribute('class', 'cal');
		newdiv.setAttribute('style', 'position:absolute; visibility:hidden; z-index:'+zindex+';');
		
		document.getElementById(formid).appendChild(newdiv);
		
		var newinput_field = document.createElement("<input>");
		newinput_field.setAttribute('id', inputid);
		newinput_field.setAttribute('name', inputid);
		newinput_field.setAttribute('type', 'text');
		newinput_field.setAttribute('tabindex', tabindex);
		
		document.getElementById(formid).appendChild(newinput_field);
		
		var newinput_dd = document.createElement("<input>");
		newinput_dd.setAttribute('type', 'image');
		newinput_dd.setAttribute('src', '/verwaltung/img/navi_img/dropdown.jpg');
		newinput_dd.setAttribute('tabindex', (999+tabindex));
		newinput_dd.setAttribute('onClick', "openCalender(\''+inputid+'\', \''+objid+'\', this, \'bottom\');return false;");
		newinput_dd.setAttribute('align', 'absmiddle');
		
		document.getElementById(formid).appendChild(newinput_dd);
		
		
		
		// append
		// document.write('<div id="'+objid+'" align="center" class="cal" style="position:absolute; visibility:hidden; z-index:'+zindex+';"></div>');
	//	document.write('<input id="'+inputid+'" name="'+inputid+'" type="text" tabindex="'+tabindex+'"><input type="image" src="/verwaltung/img/navi_img/dropdown.jpg" tabindex="999'+tabindex+'"onClick="openCalender(\''+inputid+'\', \''+objid+'\', this, \'bottom\');return false;" align="absmiddle">');
		createCalender (objid, inputid, this_year,this_month,this_day,funccall);
	}
	*/
	function createCalenderDropDown (objid, inputid, zindex,this_year,this_month,this_day,funccall,tabindex,empty,readonly,popposition, formid) {
	/*
		var newdiv = document.createElement("div");
		newdiv.setAttribute('id', objid);
		newdiv.setAttribute('align', 'center');
		newdiv.setAttribute('class', 'cal');
		newdiv.setAttribute('style', 'position:absolute; visibility:hidden; z-index:'+zindex+';');
	
		document.getElementById(formid).appendChild(newdiv);
		
		// document.body.appendChild(newdiv);
		var newinput_field = document.createElement("input");
		newinput_field.setAttribute('id', inputid);
		newinput_field.setAttribute('name', inputid);
		newinput_field.setAttribute('type', 'text');
		newinput_field.setAttribute('tabindex', tabindex);
		document.getElementById(formid).appendChild(newinput_field);
		
		if (readonly) {
			newinput_field.setAttribute('readonly', 'true');
		} else {
			var newinput_dd = document.createElement("input");
			newinput_dd.setAttribute('type', 'image');
			newinput_dd.setAttribute('src', '/verwaltung/img/navi_img/dropdown.jpg');
			newinput_dd.setAttribute('tabindex', (999+tabindex));
			newinput_dd.setAttribute('onclick', "return openCalender('"+inputid+"', '"+objid+"', this, 'bottom');");
			newinput_dd.setAttribute('align', 'absmiddle');
			
			document.getElementById(formid).appendChild(newinput_dd);
			// newinput_dd.onclick = "return openCalender('"+inputid+"', '"+objid+"', this, 'bottom');";
		}
	*/
		if (popposition=='') {popposition='bottom';} 
		
		document.getElementById(formid).innerHTML = '<div id="'+objid+'" align="center" class="cal" style="position:absolute; visibility:hidden; z-index:'+zindex+';"></div><input id="'+inputid+objid+'" name="'+inputid+'" type="text" tabindex="'+tabindex+'"><input type="image" src="/verwaltung/img/navi_img/dropdown.jpg" tabindex="999'+tabindex+'"onClick="openCalender(\''+inputid+objid+'\', \''+objid+'\', this, \''+popposition+'\');return false;" align="absmiddle">';
		createCalender (objid, inputid+objid, this_year,this_month,this_day,funccall,empty);
	}
	
	function createCalender (objid, inputid, this_year,this_month,this_day,funccall,empty) {
	
		this_year = this_year*1;
		this_month = this_month*1;
		this_day = this_day*1;
		
		this_Date = new Date(this_year,(this_month-1),this_day);
	
		this_year = this_Date.getFullYear()
		this_month = this_Date.getMonth()+1;
		this_day = this_Date.getDate();

		this_weekNumber = getWeekNumber(this_year, this_month, this_day+1);

		start_Date = new Date(this_year,(this_month-1),1);
		start_tag = start_Date.getDay();
		if (start_tag==0) start_tag=7;
	
		var max_tag = 31;
		if(this_month==4 ||this_month==6 || this_month==9 || this_month==11 ) --max_tag;
		if(this_month==2)
		{
			max_tag-=3;
			if(this_year%4==0) max_tag++;
			if(this_year%100==0) max_tag--;
			if(this_year%400==0) max_tag++;
		}
		var max_coll = 42;
		var akttag = 1;
	
		var bgcolor='ffffff';
		var cal_str = '';
		
				cal_str += '<a class="cal_link" onClick="createCalender(\''+objid+'\', \''+inputid+'\', \''+(this_year-1)+'\',\''+(this_month)+'\',\''+this_day+'\')">&lt;&lt;</a>&nbsp;&nbsp;&nbsp;&nbsp;'+
					'<a class="cal_link" onClick="createCalender(\''+objid+'\', \''+inputid+'\', \''+this_year+'\',\''+(this_month-1)+'\',\''+this_day+'\')">&lt;</a>&nbsp;&nbsp;'+	
					'<strong class="h_moja">' + monate[this_month] + '&nbsp;'+this_year+'</strong>&nbsp;&nbsp;'+
					'<a class="cal_link" onClick="createCalender(\''+objid+'\', \''+inputid+'\', \''+this_year+'\',\''+(this_month+1)+'\',\''+this_day+'\')">&gt;</a>&nbsp;&nbsp;&nbsp;&nbsp;' +
					'<a class="cal_link" onClick="createCalender(\''+objid+'\', \''+inputid+'\', \''+(this_year+1)+'\',\''+(this_month)+'\',\''+this_day+'\')">&gt;&gt;</a>';
				cal_str += '<table cellpadding="2" cellspacing="0" class="cal" style="border: 1px solid black;" width="160">';
				cal_str += '<tr class="cal_headline"><td>Wo.</td><td>M</td><td>D</td><td>M</td><td>D</td><td>F</td><td>S</td><td>S</td></tr>';
				cal_str += '<tr>';			
					cal_str += '<td bgcolor="#'+bgcolor+'">';
					cal_str += getWeekNumber(this_year, this_month, akttag);
					cal_str += '</td>';
				
					for (i_tab=1;i_tab<=max_coll;i_tab++) {
						if ((i_tab>=start_tag)&&(i_tab<(max_tag+start_tag))) {
						if ((i_tab%7)==1) {
							cal_str += '<td bgcolor="#'+bgcolor+'">';
							cal_str += getWeekNumber(this_year, this_month, akttag+1);
							cal_str += '</td>';
						}
//						if (q_days[akttag-1]['color']!='') bgcolor = q_days[akttag-1]['color']; else bgcolor='ffffff';
							cal_str += '<td bgcolor="#'+bgcolor+'">';
							if (inputid!='') { 
								cal_str += '<a class="';
								if (akttag==this_day) cal_str += 'active_date_link'; else cal_str += 'date_link';
								cal_str += '" onClick="openCalender(\''+inputid+'\', \''+objid+'\');createCalender(\''+objid+'\', \''+inputid+'\', \''+this_year+'\',\''+(this_month)+'\',\''+akttag+'\');'+funccall+';">'; 
							}
							cal_str += akttag;
							if (inputid!='') { cal_str += '</a>'; }
							akttag++;
						} else cal_str += '<td>&nbsp;';
						cal_str += '</td>';
						if ((i_tab%7)==0) {
							cal_str += '</tr><tr>';
						}
					}
				
				cal_str += '</tr>';
				cal_str += '</table>';
	/*
	// Debug
				cal_str += '<br>';
				cal_str += this_year+'<br>';
				cal_str += this_month+'<br>';
				cal_str += this_day+'<br>';
				cal_str += this_Date+'<br>';
				cal_str += this_Date.getFullYear()+'<br>';
				cal_str += this_Date.getMonth()+'<br>';
				cal_str += this_Date.getDate()+'<br>';
	*/
		
		document.getElementById(objid).innerHTML = cal_str;
		if ((inputid!='')&&(!empty)) setInputDate(inputid, objid, this_year,this_month,this_day);
	}
	
	function setInputDate(inputid, objid, this_year,this_month,this_day) {
		if (this_day<10) this_day_str = "0" + this_day; else this_day_str = this_day;
		if (this_month<10) this_month_str = "0" + this_month; else this_month_str = this_month;
		//document.getElementById(inputid).value = this_year+'-'+this_month_str+'-'+this_day_str;
		document.getElementById(inputid).value = this_day_str+'.'+this_month_str+'.'+this_year;
	}
	
	// Inputfield Filter DropDown
	var inputid_sav = -1;
	function openCalender(inputid, objid, button, position) {
		choosediv = document.getElementById(objid);
	
		if (inputid_sav == inputid) { 
			choosediv.style.visibility = "hidden";
			inputid_sav = -1;
			return false;
		}
	
		if (document.getElementById(inputid)) {
			inputfield = document.getElementById(inputid);
			
			choosediv.style.visibility = "visible";
	//		choosediv.style.width = inputfield.offsetWidth + button.offsetWidth;
	
			_offsetLeft = 0;
			_offsetTop = 0;
			el = inputfield;
			while ((el.offsetParent) && (el.tagName!='body') && (el.tagName != 'DIV')) { //  && (el.tagName != 'DIV')
				_offsetTop += el.offsetTop;
				_offsetLeft += el.offsetLeft;
				el = el.offsetParent;
			}
	
			// choosediv.style.left = _offsetLeft;
			
			//_offsetTop += document.getElementById('con_ver_edit').scrollHeight - document.getElementById('con_ver_edit').scrollTop;
			//xy = getPosition(inputfield);
			if (position=='bottom') {
				//choosediv.style.top = xy.y + inputfield.offsetHeight;
				choosediv.style.top = _offsetTop + inputfield.offsetHeight +10;
			} else if (position=='top') {
				//choosediv.style.top = xy.y - 40;
				choosediv.style.top = _offsetTop - choosediv.offsetHeight - 5;
			} else {
			}
	
			inputid_sav = inputid;
		}
			return false;
	}
	
function checkWeekNumber (year, month, day)
{
  // 4. Januar als erste Woche erstellen
  var firstDate = new Date(year, 0, 4, 12, 0, 0);
  // Wochentag des 4. Januar ermitteln
  var dayOfWeek = Math.abs(((firstDate.getDay() + 6) % 7));
  // geh zu Wochenanfang (Montag) zurueck
  var firstDateTime = firstDate.getTime() - (dayOfWeek * 1000 * 3600 * 24);

  // aktuelles Datum erstellen
  var currentDate = new Date(year, month - 1, day, 14, 0, 0);
  var currentDateTime = currentDate.getTime();

  // Differenz in Tagen berechnen
  var diffInDay = (currentDateTime - firstDateTime) / 1000 / 3600 / 24;
  // Anzahl der Wochen zwischen aktuellem Datum und 4. Januar berechnen
  var weekNumber = Math.floor(diffInDay / 7) + 1;

  return (weekNumber);
}

function getWeekNumber (year, month, day)
{
  var weekNumber = checkWeekNumber(year, month, day);
  // wenn Wochennummer gleich 0, dann ist das aktuelle Datum
  // in der Woche vor dem 4. Januar
  // also in der letzten Woche des letzten Jahres
  if (weekNumber == 0)
  {
    // Wochennummer des letzten Woche des letzten Jahres suchen
    weekNumber = checkWeekNumber(year - 1, 12, 31);

    // wenn die Wochennummer groesser als 52 ist
    // dann pruefen ob diese Wochennummer korrekt ist oder
    // sie bereits die erste Woche des aktuellen Jahres ist
    if (weekNumber > 52)
    {
      weekNumber = checkWeekNumber(year, 1, 1);
      // wenn der 1. Januar des aktuellen Jahres in der Woche 0 liegt
      // dann ist es die Woche 53
      if (weekNumber == 0)
      {
        weekNumber = 53;
      }
    }
  }
  // wenn die Wochennummer groesser als 52 ist
  // dann pruefen ob diese Wochennummer korrekt ist oder
  // sie bereits die erste Woche des naechsten Jahres ist
  else if (weekNumber > 52)
  {
    weekNumber = checkWeekNumber(year + 1, 1, 1);
    // wenn der 1. Januar des naechsten Jahres in der Woche 0 liegt
    // dann ist es die Woche 53
    if (weekNumber == 0)
    {
      weekNumber = 53;
    }
  }
  return (weekNumber);
}

	
	
	function getPosition(element)
	{
	  var elem=element,tagname="",x=0,y=0;
	
	  while ((typeof(elem)=="object")&&(typeof(elem.tagName)!="undefined"))
	  {
		y+=elem.offsetTop;     
		x+=elem.offsetLeft;    
		tagname=elem.tagName.toUpperCase(); /* tag-Name ermitteln, Grossbuchstaben */
	
		if (tagname=="BODY")
	//abbruch
		  elem=0;
	
		if (typeof(elem)=="object")
	// wenn offsetParent enthaelt 
		  if (typeof(elem.offsetParent)=="object")
			elem=elem.offsetParent;
	  }
	
	  position=new Object();
	  position.x=x;
	  position.y=y;
	  return position;
	}
	

//-->
