var animation = false;
var flip = 0;
var pnr = 0;

var _gaq = _gaq || [];
_gaq.push([
		'_setAccount',
		'UA-26355385-1'
]);
_gaq.push([
	'_trackPageview'
]);

function loadScript(url, allowSSL, stdPrefix, SSLPrefix, callback) {
	var isSSL = ("https:" == document.location.protocol);
	var protocol = "";
	if (allowSSL !== undefined && allowSSL && isSSL) {
		protocol = "https://" + ((SSLPrefix === undefined) ? "" : SSLPrefix);
	} else {
		protocol = "http://" + ((stdPrefix === undefined) ? "" : stdPrefix);
	}

	$.getScript(protocol + url, callback || function() {
	});
}

function nl2br(string) {
    search = new RegExp();
    search.compile('\n','g')
    string = string.replace(search, '<br />');

  return string;
}

function htmlentities(string) {
  var chars = new Array ('&','à','á','â','ã','ä','å','æ','ç','è','é','ê','ë','ì','í','î','ï','ð','ñ','ò','ó','ô',
                         'õ','ö','ø','ù','ú','û','ü','ý','þ','ÿ','À','Á','Â','Ã','Ä','Å','Æ','Ç','È','É','Ê','Ë',
                         'Ì','Í','Î','Ï','Ð','Ñ','Ò','Ó','Ô','Õ','Ö','Ø','Ù','Ú','Û','Ü','Ý','Þ','€','\"','ß','<',
                         '>','¢','£','¤','¥','¦','§','¨','©','ª','«','¬','­','®','¯','°','±','²','³','´','µ','¶',
                         '·','¸','¹','º','»','¼','½','¾');

  var entities = new Array ('amp','agrave','aacute','acirc','atilde','auml','aring','aelig','ccedil','egrave',
							'eacute','ecirc','euml','igrave','iacute','icirc','iuml','eth','ntilde','ograve',
							'oacute','ocirc','otilde','ouml','oslash','ugrave','uacute','ucirc','uuml','yacute',
							'thorn','yuml','Agrave','Aacute','Acirc','Atilde','Auml','Aring','AElig','Ccedil',
							'Egrave','Eacute','Ecirc','Euml','Igrave','Iacute','Icirc','Iuml','ETH','Ntilde',
                            'Ograve','Oacute','Ocirc','Otilde','Ouml','Oslash','Ugrave','Uacute','Ucirc',
							'Uuml','Yacute','THORN','euro','quot','szlig','lt','gt','cent','pound','curren',
							'yen','brvbar','sect','uml','copy','ordf','laquo','not','shy','reg','macr','deg',
							'plusmn','sup2','sup3','acute','micro','para','middot','cedil','sup1','ordm','raquo',
							'frac14','frac12','frac34');

  for(var i = 0; i < chars.length; i++) {
    search = new RegExp();
    search.compile(chars[i],'g')
    string = string.replace(search, '&' + entities[i] + ';');
  }
  return string;
}

function writeContent() {
parent.document.getElementById('content').innerHTML = document.body.innerHTML;
}

function loadContent() {
document.getElementById('content').innerHTML = "<img src=\"res/load.gif?080808134200\" alt=\"Bitte warten...\" />Inhalt wird geladen...";
}

function showMap(controlid, mapid, src) {
var map = document.getElementById(mapid);
var control = document.getElementById(controlid);

control.style.display = "none";
map.src = src;
map.style.display = "block";
}

$(document).ready(function() {
	loadScript("google-analytics.com/ga.js", true, "www.", "ssl.");
});


