// popup account details
function popupDetails(link)
{
	var hoehe=460;
	var breite=730;
	var oben=Math.round(window.screen.availHeight-510);
	var links=window.screen.availWidth-breite-30;
	
	var options="titlebar=no,scrollbars=yes,resizable=yes,toolbar=no,locationbar=no,directories=no,status=no,menubar=no,dependent=yes,width="+ breite +",height="+ hoehe +",top="+ oben +",left="+ links;

	var W = window.open(link,'Details',options);
	W.focus();
}


// popup account details
function popup(link)
{
	var hoehe=560;
	var breite=830;
	var oben=Math.round(window.screen.availHeight-510);
	var links=window.screen.availWidth-breite-30;
	
	var options="titlebar=no,scrollbars=yes,resizable=yes,toolbar=no,locationbar=no,directories=no,status=no,menubar=no,dependent=yes,width="+ breite +",height="+ hoehe +",top="+ oben +",left="+ links;

	var W = window.open(link,'Popup',options);
	W.focus();
}


// popup passwort vergessen
function popupPasswordLost(link)
{
	var hoehe=260;
	var breite=530;
	var oben=Math.round(window.screen.availHeight-510);
	var links=window.screen.availWidth-breite-30;
	
	var options="titlebar=no,scrollbars=yes,resizable=yes,toolbar=no,locationbar=no,directories=no,status=no,menubar=no,dependent=yes,width="+ breite +",height="+ hoehe +",top="+ oben +",left="+ links;

	var W = window.open(link,'Popup',options);
	W.focus();
}

// navigate in a long list
function sendWithOffset(link,offset,method)
{
	location.href = link + "?offset_custom=" + offset +"&method=" + method;
}


// -----------------------------------------------------------------
// This function gets called when the end-user clicks on some date.
// currently for the field date2 of the account-date-selection-field
// -----------------------------------------------------------------
function selected(cal, date) 
{
  cal.sel.value = date; // just update the date in the input field.
  cal.callCloseHandler();


  if(cal.sel.id == 'date2'){document.forms[0].submit()}
  if(cal.sel.id == 'date1'){var arr_date=document.forms[0].accr_date_from.value.split(/\./); document.forms[0].accr_date_to.value='31.12.'+arr_date[2];}
}


function getAbspos(el) { //get position of an element in an htmlpage
	var x= el.offsetLeft;
	var y= el.offsetTop ;

	if (el.offsetParent) {
		var tmp = getAbspos(el.offsetParent);
		x += tmp[0];
		y += tmp[1];
	}

	var r = [x,y];
	
	return r;
}

function showCalendarYear(objId)
{

			   n=getAbspos(document.getElementById(objId));
			   //w_dif = 0;
			   w_dif = 150 - parseInt(document.getElementById(objId).style.width) 
			   l=document.getElementById('lay')	
			   l.style.left=n[0]-w_dif;
			   l.style.top=n[1] + parseInt(document.getElementById(objId).offsetHeight);
			   l.style.visibility='visible'

}