function AddLink(fileUrl) {
	window.location.href = encodeURI( fileUrl ) ;
}

function addPage(title_str, url) {
	win = new Window({className: "mac_os_x", title: title_str, height: 200, width: 200, destroyOnClose: true, recenterAuto:true});
	win.setAjaxContent(url, {}, true);
}

function confirm2(question, url) {
	Dialog.confirm(question, {
		width:300, 
		okLabel: "Jah",
		cancelLabel: "Ei",
	   cancel:function(win) {},
	   ok:function(win) {window.location.href = url;}
      });
}

function myFileBrowser (field_name, url, type, win) {

    //alert("Field_Name: " + field_name + "\nURL: " + url + "\nType: " + type + "\nWin: " + win); // debug/testing

    /* If you work with sessions in PHP and your client doesn't accept cookies you might need to carry
       the session name and session ID in the request string (can look like this: "?PHPSESSID=88p0n70s9dsknra96qhuk6etm5").
       These lines of code extract the necessary parameters and add them back to the filebrowser URL again. */

    var cmsURL = 'http://www.koerteklubi.ee/select.php?module=select';    // script URL - use an absolute path!
    cmsURL = cmsURL + "&type=" + type;

    tinyMCE.activeEditor.windowManager.open({
        file : cmsURL,
        title : 'FileBrowser',
        width : 420,  // Your dimensions may differ - toy around with them!
        height : 400,
        resizable : "yes",
        inline : "yes",  // This parameter only has an effect if you use the inlinepopups plugin!
        close_previous : "no"
    }, {
        window : win,
        input : field_name
    });
    return false;
  }
  
  
function setCal(year, month) {
	new Ajax.Updater('calendar_container', 'ajax/calendar.php', {
		method: 'get',
		parameters: {
			y: year,
			m: month
		}
	});
}