
function f(el, url, x, form){
    $.blockUI({ css: {
         border: 'none',
         padding: '15px',
         backgroundColor: '#000',
         '-webkit-border-radius': '10px',
         '-moz-border-radius': '10px',
         opacity: .5,
         color: '#fff'
     } });
	$("#"+el).load(url, function() {
			if (x) {$("#"+el).slideDown();}
			$.unblockUI();
	});
	activetab=url+el;
	return false;
}


/**
 *
 * @access public
 * @return void
 **/
function fBlock(el, url, x, form){
	$("#"+el).load(url, function(e, f) {
		if (f=="error") {return false;}
		 $.blockUI({
		 	message: $("#"+el),
		 	css: { 	top: '90px',
		 			width: '750px'
		 		}
		 });
	});
	$('body').keyup(function(event) {
		if (event.keyCode == '27') {
     			var r=confirm('Fenster schliessen?')
				if (r) {
					closePop(el);
				}

		}
  	});


}


function fFormBlock(el, url, x, form){
	if (form) { vars = $('#'+form).serialize();}
	//setTimeout($.unblockUI, 2000);
	$.post(url, vars, function(data) {
		$("#"+el).html(data);

		$.blockUI({
		    	message: $("#"+el),
				css: {
				 	top: '10%',
					left: '10%',
					width: '750px',
					cursor: 'auto',
			        border: 'none',
			        padding: '15px'
		     	}
		 });
	});
	return false;
}



/**
 *
 * @access public
 * @return void
 **/
function fForm(el, url, x, form, nounblock){
    $.blockUI({ css: {
         border: 'none',
         padding: '15px',
         backgroundColor: '#000',
         '-webkit-border-radius': '10px',
         '-moz-border-radius': '10px',
         opacity: .5,
         color: '#fff'
     } });

	var vars=false;
	if (form) { vars = $('#'+form).serialize();}
	//setTimeout($.unblockUI, 2000);
	$.post(url, vars, function(data) {
			$("#"+el).html(data);
			if (x) {$("#"+el).slideDown();}
			if(!nounblock)  {	$.unblockUI(); }
	});
	return false;
}

/**
 *
 * @access public
 * @return void
 **/
function closePop(el){
	$.blockUI();
	$("#"+el).slideUp('slow', function() {
			$("#"+el).html('');
			$.unblockUI();
	});
	$("body").unbind();
}


function closer(el, img){
	if (document.getElementById(el).style.display == 'block') {
		$("#"+el).slideUp('slow', function() {});
	}else{
		$("#"+el).slideDown('slow', function() {});
	}
}

function agentCallback(aid){
	fBlock("headerinfo", "ajax.php?t=setcallback&aid="+aid, true);
	return false;
}


/*
 * jquery-periodic.js
 *
 * Adds a "periodic" function to jQuery which takes a callback and
options for the frequency (in seconds) and a
 * boolean for allowing parallel execution of the callback function
(shielded from exceptions by a try..finally block.
 * The first parameter passed to the callback is a controller object.
 *
 * Return falsy value from the callback function to end the periodic
execution.
 *
 * For a callback which initiates an asynchronous process:
 * There is a boolean in the controller object which will prevent the
callback from executing while it is "true".
 *   Be sure to reset this boolean to false when your asynchronous
process is complete, or the periodic execution
 *   won't continue.
 *
 * To stop the periodic execution, you can also call the "stop" method
of the controller object, instead of returning
 * false from the callback function.
 *
 */
 jQuery.periodic = function (callback, options) {
      callback = callback || (function() { return false; });

      options = jQuery.extend({ },
                              { frequency : 3,
                                allowParallelExecution : false},
                              options);

      var currentlyExecuting = false;
      var timer;

      var controller = {
         stop : function () {
           if (timer) {
             window.clearInterval(timer);
             timer = null;
           }
         },
         currentlyExecuting : false,
         currentlyExecutingAsync : false
      };

      timer = window.setInterval(function() {
         if (options.allowParallelExecution || !
(controller.currentlyExecuting || controller.currentlyExecutingAsync))
{
            try {
                 controller.currentlyExecuting =
true;
                 if (!(callback(controller))) {
                     controller.stop();
                 }
             } finally {
              controller.currentlyExecuting = false;
            }
         }
      }, options.frequency * 1000);
};


function startPopup(url, w, h, id) {

	if (!id) {var id='windows1';}
	if (!w) {var w='600';}
	if (!h) {var w='500';}
 fenster = window.open(url, id, "width="+w+",height="+h+",status=no,scrollbars=yes,resizable=yes");
 fenster.focus();
}
























////////////// OLD KRAM

function zeige(klickdatum) {
    var jetzt = new Date();
    var heuteTag = jetzt.getDate();
    var heuteMonat = jetzt.getMonth()+1;
    if((klickdatum <= heuteTag) && (heuteMonat == 12))
    {
      tb_show("Ihr Kalendert&uuml;rchen f&uuml;r den "+klickdatum+".12.2008","tuerchen.php?height=300&width=395&klickdatum="+klickdatum,false);
    }
    else
    {
      alert ("Bitte gedulden Sie sich noch etwas ;-). Heute ist erst der "+heuteTag+"."+heuteMonat+".2008");
    }
  }
