/**
 * Projekt:	Heinrich-Kirchner-Website
 *
 * Create:	04.09.2009
 * Copyright 2009 by Kirchnerei
 *			http://www.kirchnerei.de
 *			mailto:infos@kirchnerei.de
 *
 * Veröffentlichung:
 * Version:	1.0 (Build: 7)
 * Datum:	04.01.2010
 * Vendor:	Kirchnerei
 *
 * Subversion:
 * Author:	$LastChangedBy: sarah $
 * Date:	$LastChangedDate: 2009-10-11 14:04:40 +0200 (So, 11 Okt 2009) $
 * Version:	$LastChangedRevision: 320 $
 */

/**
 * parameter for tooltips
 */
var TOOLTIP_PARAM = {
	delay: 200,
	track: false,
	showBody: '##',
	showURL: false
};

var BACKGROUND_COLOR = '#EEEEEE';
var DIALOG_BACKGROUND = '#F9F3E3';
var BACKGROUND_OPACITY = 0.7;
var WAIT_MESSAGE = '<h1 class="waiting"><img src="assets/busy.gif" alt="Warten"/> <span>Bitte warten</span></h1>';

/**
 * Zeitspanne bis die Notify Meldung ausgeblendet wird
 */
var NOITFY_DELAY_MS = 5000;

/**
 * doShowWaitung() blockiert die Anwendung wegen Wartezeit
 */
function doShowWaiting() {
	$.blockUI({
		message: WAIT_MESSAGE,
		css: {
			border: '3px solid #999999',
			backgroundColor: DIALOG_BACKGROUND
		},
		overlayCSS: {
			backgroundColor: BACKGROUND_COLOR,
			opacity: BACKGROUND_OPACITY
		},
		fadeIn: 400,
		fadeOut: 100
	});	// end if blockUI
}

function doBlockElement(id) {
	$(id).block({
		message: WAIT_MESSAGE,
		css: {
			border: '3px solid #999999',
			backgroundColor: DIALOG_BACKGROUND
		},
		overlayCSS: {
			backgroundColor: BACKGROUND_COLOR,
			opacity: BACKGROUND_OPACITY
		},
		fadeIn: 400,
		fadeOut: 100		
	});
}

/**
 * doShowCenterDialog() blockiert die Anwendung mit einem Eingabeformular
 * 
 * @param data ist der Html Code
 */
function doShowCenterDialog(data) {
	$.blockUI({
		message: data,
		css: {
			border: 'none',
			backgroundColor: '',
			width: '100%',
			left: '',
			right: '',
			top: '30px',
			cursor: 'default'
		},
		overlayCSS: {
			backgroundColor: BACKGROUND_COLOR,
			opacity: BACKGROUND_OPACITY,
			cursor: 'auto'
		},
		fadeIn: 400,
		fadeOut: 400
	}); // end of blockUI()
	// Dialog Action mit Tooltips versehen....
	$('a.dialog_action').tooltip(TOOLTIP_PARAM);
}

 /**
  * doDialogClose() schließt einen modalen Dialog
  */
function doDialogClose() {
	$.unblockUI({fadeOut: 400});
}


/**
 * decoding the address
 * @param link is the address
 */
function decode_Link(link) {
	var n = 0;
	var r = "";
	for (var i = 0; i < link.length; i++) {
		n = link.charCodeAt(i);
		if (n >= 8364) {
			n = 128;
		}
		r += String.fromCharCode(n - 1);
	}

	document.location.href = r;
}
