function openMap(location)
{

    var win = openPopupPage(_URL_ROOT+'index.php?popup=map&loc='+url.encode(location), 'googleMap', 735, 500, 'center:yes', true);
}

var url = {
 
	// public method for url encoding
	encode : function (string) {
		return escape(this._utf8_encode(string));
	},
 
	// public method for url decoding
	decode : function (string) {
		return this._utf8_decode(unescape(string));
	},
 
	// private method for UTF-8 encoding
	_utf8_encode : function (string) {
		string = string.replace(/\r\n/g,"\n");
		var utftext = "";
 
		for (var n = 0; n < string.length; n++) {
 
			var c = string.charCodeAt(n);
 
			if (c < 128) {
				utftext += String.fromCharCode(c);
			}
			else if((c > 127) && (c < 2048)) {
				utftext += String.fromCharCode((c >> 6) | 192);
				utftext += String.fromCharCode((c & 63) | 128);
			}
			else {
				utftext += String.fromCharCode((c >> 12) | 224);
				utftext += String.fromCharCode(((c >> 6) & 63) | 128);
				utftext += String.fromCharCode((c & 63) | 128);
			}
 
		}
 
		return utftext;
	},
 
	// private method for UTF-8 decoding
	_utf8_decode : function (utftext) {
		var string = "";
		var i = 0;
		var c = c1 = c2 = 0;
 
		while ( i < utftext.length ) {
 
			c = utftext.charCodeAt(i);
 
			if (c < 128) {
				string += String.fromCharCode(c);
				i++;
			}
			else if((c > 191) && (c < 224)) {
				c2 = utftext.charCodeAt(i+1);
				string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
				i += 2;
			}
			else {
				c2 = utftext.charCodeAt(i+1);
				c3 = utftext.charCodeAt(i+2);
				string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
				i += 3;
			}
 
		}
 
		return string;
	}
 
}

function displayDrawerInfo(id)
{
	var container = document.getElementById('drawer-info-'+id);
	if( container )
	{
		if( _CURRENT_DRAWER_ID )
			document.getElementById('drawer-info-'+_CURRENT_DRAWER_ID).style.display = 'none';
		
		container.style.display = 'block';
		_CURRENT_DRAWER_ID = id;
	}
}

// Dátum selectorokat beállító függvények és változók
// megadja hány nap van egy hónapban, szökőévekkel is számolva
function DaysInMonth(WhichMonth, WhichYear)
{
    var DaysInMonth = 31;
    if (WhichMonth == "04" || WhichMonth == "06" || WhichMonth == "09" || WhichMonth == "11") DaysInMonth = 30;
    if (WhichMonth == "02" && (WhichYear/4) != Math.floor(WhichYear/4))	DaysInMonth = 28;
    if (WhichMonth == "02" && (WhichYear/4) == Math.floor(WhichYear/4))	DaysInMonth = 29;
    return DaysInMonth;
}

// megváltoztatjuk a havonkénti napok számát a form.onselect esemény bekövetkeztekor
// @params: GroupRef, element
function ChangeOptionDays(GroupRef,element)
{
    var form = element.form;
    
    YearObject = eval(form[GroupRef + "Year"]);
    MonthObject = eval(form[GroupRef + "Month"]);
    DaysObject = eval(form[GroupRef + "Day"]);
    
    Month = MonthObject[MonthObject.selectedIndex].value;
    Year = YearObject[YearObject.selectedIndex].value;

    DaysForThisSelection = DaysInMonth(Month, Year);
    CurrentDaysInSelection = DaysObject.length;
  
    if ( CurrentDaysInSelection > DaysForThisSelection )
    {
        var diff = CurrentDaysInSelection - DaysForThisSelection;
        for ( i=0; i<diff; i++ )
        {
            DaysObject.options[DaysObject.options.length - 1] = null
        }
    }
    if (DaysForThisSelection > CurrentDaysInSelection)
    {
        var diff = DaysForThisSelection - CurrentDaysInSelection;
        for ( i=0; i<diff; i++ )
        {
            NewOption = new Option(DaysObject.options.length + 1);
            NewOption.label = NewOption.value;
            try
            {
                DaysObject.add(NewOption,null); // standards compliant
            }
            catch(ex)
            {
                DaysObject.add(NewOption); // IE only
            }
        }	
    }
    if ( DaysObject.selectedIndex < 0 )
    {
        DaysObject.selectedIndex == 0;
    }
}