

///////////////////////////////
// repulo letolto ablak START
///////////////////////////////
function repletoltoablak(file,felhasznalo) {
  
  var megnevezes='a';
  
  var scrollbar=0;
  /*if (magassag >= screen.height) {scrollbar=1; magassag = screen.height-100;}
  if (szelesseg >= screen.width) {scrollbar=1; szelesseg = screen.width-5;}*/
  var magassag=400;
  var szelesseg=600;
  
  //alert(magassag);
  
   window.open('letoltessz.dw?file='+file+'&felhasznalo='+ felhasznalo +'&sz='+ szelesseg +'&m='+ magassag +'&megnevezes='+ megnevezes +'','Fileletoltese', 'scrollbars='+ scrollbar +',resizable=no,menu=no,width='+ szelesseg +',height='+ magassag +'');
}
///////////////////////////////
// repulo letolto ablak END
///////////////////////////////



///////////////////////////////
// Repülő dialógusablak START segédtáblás
///////////////////////////////
function repuloDialog(x,y,mezonev,adat,id) {
xx=(screen.width-x)/2;
yy=(screen.height-y)/2;
ablakuj = showModalDialog("repframe.dw?repfile=seged_adat&adat="+adat+"&mezonev="+mezonev+"&id="+id,self,"dialogHeight: "+y+"px; dialogWidth: "+x+"px; dialogTop: px; dialogLeft: px; edge: Raised; center: Yes; help: No; resizable: No; status: No;");
}

function openAblak(x,y,scriptname) {
var items = openAblak.arguments;
var url=''; var j=0;
for (i = 3;i < items.length;i++)
	{
		if( (i % 2) != 0 )
			{// paratlan->mezonev
				if(j)
					{
						url += '&'+items[i]+'=';
					}
				else
					{
						url += items[i]+'=';
					}
				j++;
			}
		else
			{// paros->mezonev
				url += items[i];
			}
	}
//alert(url);
xx=(screen.width-x)/2;
yy=(screen.height-y)/2;
//alert(navigator.appName);
if( navigator.appName=='Microsoft Internet Explorer' && 0 )
	{
		showModalDialog('repframe.dw?repfile='+scriptname+'&'+url,self,'dialogHeight: '+y+'px; dialogWidth: '+x+'px; dialogTop: px; dialogLeft: px; edge: Raised; center: Yes; help: No; resizable: Yes; status: No;');
	}
else
	{
		ujablak = open(scriptname+'.dw?'+url,'','width=' + x + ',height=' + y + ',status=0,toolbar=no,menubar=no,resizable=yes,scrollbars=' + 1 + ',left='+xx+',top='+yy);
	}
}
///////////////////////////////

///////////////////////////////
// Dátum select START
///////////////////////////////
function setNapokszama( honapmezo ){
	var sorsz;
	for(var i=0; i<honapmezo.form.elements.length; i++)
		{
			if ( honapmezo.form.elements[i].name==honapmezo.name ){ sorsz=i; }
		}

	var boxText = '';
  	for(var i=0; i<honapmezo.options.length; i++){
    	if(honapmezo.options[i].selected && honapmezo.options[i].value != ''){
      		honapErtek = honapmezo.options[i].value;
    	}
  	}

	honapmezo.form.elements[++sorsz].length=1;
	var cnt = 0;
	var isSelected = false;
	var napokszama;
	if ( honapErtek <= 7 ){
		if ( honapErtek%2 )
			{//paratlan
				napokszama = 31;
			}
		else
			{//paros
				if ( honapErtek==2 ){//februar
				napokszama = 29;}
				else{ napokszama = 30; }
			}
	}else{
		if ( honapErtek%2 )
			{//paratlan
				napokszama = 30;
			}
		else
			{//paros
				napokszama = 31;
			}
	}

	var arr = new Array(0);
	var ki;
	for(var n=1; n<=napokszama; n++){
		if ( n<10 ){ ki= '0' + n;}
		else{ ki = n;}
		arr[n] = ki+";"+ki;
	}
/// default érték: nap
	newOpt=new Option;
	newOpt.value='0';
	newOpt.text='Nap';
	honapmezo.form.elements[sorsz].options[cnt]=newOpt;
	cnt=cnt+1;
//// 
	for(var n=1; n<arr.length; n++){
		newOpt=new Option;
		i = arr[n].search(';');
		newOpt.value=arr[n].slice(i+1);
		newOpt.text=arr[n].slice(0,i);
		if (!isSelected){
			isSelected = true;
		}
		honapmezo.form.elements[sorsz].options[cnt]=newOpt;
		cnt=cnt+1;
	}
}
///////////////////////////////

//////////////////////////////
// repülő Kalendárium
/////////////////////////////
var calendar = null; // remember the calendar object so that we reuse it and
                     // avoid creation other calendars.

var oldLink = null;

// This function gets called when the end-user clicks on some date.
function selected(cal, date) {
  //alert(cal.sel2.value);
  cal.sel2.value = date; // just update the date in the input field. a hiddent frissiti itt
  date = cal.date.print('y-mm-dd');
  cal.sel.value = date; // just update the date in the input field.
  
  
  cal.callCloseHandler(); //
  //if (cal.sel.id == "sel1" || cal.sel.id == "sel3")
    // if we add this call we close the calendar on single-click.
    // just to exemplify both cases, we are using this only for the 1st
    // and the 3rd field, while 2nd and 4th will still require double-click.
    //cal.callCloseHandler();
}

// And this gets called when the end-user clicks on the _selected_ date,
// or clicks on the "Close" button.  It just hides the calendar without
// destroying it.
function closeHandler(cal) {
  cal.hide();                        // hide the calendar

  // don't check mousedown on document anymore (used to be able to hide the
  // calendar when someone clicks outside it, see the showCalendar function).
  Calendar.removeEvent(document, "mousedown", checkCalendar);
}

// This gets called when the user presses a mouse button anywhere in the
// document, if the calendar is shown.  If the click was outside the open
// calendar this function closes it.
function checkCalendar(ev) {
  var el = Calendar.is_ie ? Calendar.getElement(ev) : Calendar.getTargetElement(ev);
  for (; el != null; el = el.parentNode)
    // FIXME: allow end-user to click some link without closing the
    // calendar.  Good to see real-time stylesheet change :)
    if (el == calendar.element || el.tagName == "A") break;
  if (el == null) {
    // calls closeHandler which should hide the calendar.
    calendar.callCloseHandler();
    Calendar.stopEvent(ev);
  }
}

// This function shows the calendar under the element having the given id.
// It takes care of catching "mousedown" signals on document and hiding the
// calendar if the click was outside.
function showCalendar(id, id2, format2) {
  var el = document.getElementById(id);
  var el2 = document.getElementById(id2);
  if (calendar != null) {
    // we already have some calendar created
    calendar.hide();                 // so we hide it first.
  } else {
    // first-time call, create the calendar.
    var cal = new Calendar(true, null, selected, closeHandler);
    calendar = cal;                  // remember it in the global var
    cal.setRange(1900, 2070);        // min/max year allowed.
    cal.create();
  }
  calendar.setDateFormat(format2);    // set the specified date format
  calendar.parseDate(el.value);      // try to parse the text in field
  calendar.sel = el;                 // inform it what input field we use
  calendar.sel2 = el2;                 //  scs
  calendar.showAtElement(el2);        // show the calendar below it

  // catch "mousedown" on document
  Calendar.addEvent(document, "mousedown", checkCalendar);
  return false;
}
/////////////////////////////////////////////////////////////////////////////


///////////////////////////////
// Repülő ablakos select START
///////////////////////////////
function repselect(adat,a_id,madat,mmezo,mezonev,ablak_x,ablak_y,sy,ysize,scrll,formobj,xx,yy,rx,ry) {

	ablakuj = showModalDialog("repframe.dw?repfile=repselect&adat="+adat+"&a_id="+a_id+"&madat="+madat+"&mmezo="+mmezo+"&mezonev="+mezonev+"&xx="+ablak_x+"&sy="+sy+"&ysize="+ysize+"&rx="+rx+"&ry="+ry,self,"dialogHeight: "+ablak_y+"px; dialogWidth: "+ablak_x+"px; dialogTop: px; dialogLeft: px; edge: Raised; center: Yes; help: No; resizable: No; status: No; scroll:No;");

//  ujablak = open("","ujablak","width=" + ablak_x + ",height=" + ablak_y + ",status=0,toolbar=no,menubar=no,scrollbars=" + scrll + ",left="+xx+",top="+yy);
/*
  ujablak.document.open();
  ujablak.document.write("<HTML><HEAD><TITLE>töltés...</TITLE></HEAD>");
  ujablak.document.write("<BODY topmargin='0' leftmargin='0'>");
  ujablak.document.write("<form action='repselect.dw' method='get' name='x'>");
  ujablak.document.write("<INPUT TYPE='Hidden' name='adat' value='" + adat + "'>");
  ujablak.document.write("<INPUT TYPE='Hidden' name='a_id' value='" + a_id + "'>");
  ujablak.document.write("<INPUT TYPE='Hidden' name='madat' value='" + madat + "'>");
  ujablak.document.write("<INPUT TYPE='Hidden' name='mmezo' value='" + mmezo + "'>");
  ujablak.document.write("<INPUT TYPE='Hidden' name='mezonev' value='" + mezonev + "'>");
  ujablak.document.write("<INPUT TYPE='Hidden' name='xx' value='" + ablak_x + "'>");
  ujablak.document.write("<INPUT TYPE='Hidden' name='sy' value='" + sy + "'>");
  ujablak.document.write("<INPUT TYPE='Hidden' name='ysize' value='" + ysize + "'>");
  ujablak.document.write("<INPUT TYPE='Hidden' name='rx' value='" + rx + "'>");
  ujablak.document.write("<INPUT TYPE='Hidden' name='ry' value='" + ry + "'>");
  ujablak.document.write("</form>");
  ujablak.document.write("</BODY>");
  ujablak.document.write("</HTML>");
  ujablak.document.forms['x'].submit();
 */
}

function repulo_kereso(a,adat,a_id,madat,mmezo,mezonev,ablak_x,ablak_y,sy,ysize,scrll,formobj,xx,yy,rx,ry)
	{
		if( xx==0 && yy==0 )
			{
				xx=(screen.width-ablak_x)/2;
				yy=(screen.height-ablak_y)/2;
			}
		if( a == 1 )
			{
				// F8 !
				alert(window.event.keyCode);
				if ("119" == window.event.keyCode)
  					{
						repselect(adat,a_id,madat,mmezo,mezonev,ablak_x,ablak_y,sy,ysize,scrll,formobj,xx,yy,rx,ry);
					}
			}
		else { repselect(adat,a_id,madat,mmezo,mezonev,ablak_x,ablak_y,sy,ysize,scrll,formobj,xx,yy,rx,ry);}
	}
///////////////////////////////