
UrbanSiteManager = function(){    this.debug = true;    this.initialized = false;    this.stoppIVW = false;    this.scripts = [ // scripts we easily can load after "onload" is called		"http://imagesrv.adition.com/js/adition.sjs?nuggn=1576777680&amp;nuggsid=1533520310"        ];};UrbanSiteManager.prototype.init = function(){    _debug.log("init");    this.getScripts();    this.ads = new UrbanAdManager();    this.ads.init(this);    this.ajaxify = new UrbanAjaxManager();    this.ajaxify.init(this);    urbanPlugins.init();};UrbanSiteManager.prototype.unload = function(){ // here we need to attach some cleanups    _debug.log("leaving page for a while");	if(this.map)		GUnload();    if (this.sudoku && typeof(this.sudoku)==="object")        this.sudoku.exit();};UrbanSiteManager.prototype.getScripts = function(){    for (var i = 0; i < this.scripts.length; i++)         this.loadAnyScript(this.scripts[i]);};UrbanSiteManager.prototype.initMap = function(node, params, LatLng){    this.map = new UrbanMapManager();    this.map.init(node, params, LatLng);};UrbanSiteManager.prototype.loadAnyScript = function(url, func){    if ($.browser.msie)        $.getScript(url, func);    else {        var head = document.getElementsByTagName("head")[0];        var script = document.createElement("script");        script.src = url;        script.type = "text/javascript";        head.appendChild(script);        script.onload = function(){            _debug.log("script: " + url + " successfully loaded");            head.removeChild(script);            if (func)                if(typeof(func == "function"))    			    func();                else                    _debug.error("callback is a " + typeof(func) + " - needs to be a function");        };    }};UrbanSiteManager.prototype.loadAnyStyle = function(url, func){        var head = document.getElementsByTagName("head")[0];        var style = document.createElement("link");        style.href = url;        style.type = "text/css";        style.setAttribute('rel', 'stylesheet');        style.setAttribute('media', 'print');        head.appendChild(style);        style.onload = function(){            _debug.log("stylesheet: " + url + " successfully loaded");            if (func)                if(typeof(func == "function"))    			    func();                else                    _debug.error("callback is a " + typeof(func) + " - needs to be a function");        };};UrbanSiteManager.prototype.callIVW = function(code){    var self = this;	if (!this.stoppIVW) {        var newCode = code ? code : "AjaxAction";    	var IVW = "http://pnn.ivwbox.de/cgi-bin/ivw/CP/" + newCode;    	var html = 	"<img src=\"" + IVW + "?r=" + escape(document.referrer) +     				"&d=" + (Math.random() * 100000) + "\" width=\"1\" height=\"1\" alt=\"szmtag\" />";    	$("#ivw").empty().append(html);        this.stoppIVW = true;    }    window.setTimeout(function(){            self.stoppIVW = false;    }, 1500);};UrbanSiteManager.prototype.initVideoLayer = function() {    this.videoLayer = new UrbanVideoManager();    this.videoLayer.init(this);};UrbanSiteManager.prototype.closeVideoLayer = function() {    $("#potsdam-tv").removeClass("active");};UrbanSiteManager.prototype.prepareLayer = function (node) {    var blur = "<div class=\"passive blur\"></div>";    var content = "<div class=\"passive content\"></div>";    node.append(blur);    node.append(content);    this.layer = {          blur:     node.children(".blur") ,          content:  node.children(".content"),          wrapper:  node    };    this.layer.wrapper.attr({ id: "layer-wrapper" });};UrbanSiteManager.prototype.showLayer = function () {    this.layer.content.removeClass("passive");    this.layer.blur.removeClass("passive");    $("object").hide();};UrbanSiteManager.prototype.hideLayer = function () {    this.layer.content.addClass("passive").empty();    this.layer.blur.addClass("passive").empty();    $("object").show();};UrbanSiteManager.prototype.initSlideshow = function () {    this.slideshow = new UrbanSlideshowManager();    this.slideshow.init(this);};UrbanSiteManager.prototype.initSudoku = function () {    this.sudoku = new UrbanSudoku();    this.sudoku.init(this);  };UrbanSiteManager.prototype.startSlideshow = function () {    this.slideshow.start();    this.scrollTo(0,0);};UrbanSiteManager.prototype.urbanize = function () {    this.ajaxify.getNodes();};UrbanSiteManager.prototype.scrollTo = function (x,y) {    window.scrollTo(x, y);};UrbanSiteManager.prototype.showEnlargedPic = function (id) {      if (typeof(parseInt(id))==="number") {          var url = "/sixcms/detail.php?template=pnn_enlarged_pic_ajax&id=" + id;          this.showLayer();          this.scrollTo(0,0);          var self = this;          this.layer.content.load(url, function(){            self.urbanize();            self.callIVW("articlePic");                        });      }        else          _debug.error("ID should be a number, " + id + " is a " + typeof(id));};UrbanSiteManager.prototype.closeEnlargedPic = function(){    this.hideLayer();    this.callIVW("articlePic");};UrbanSiteManager.prototype.datePicker = function (node) {    var url = "/includes/javascript/plugins/jquery.ui.datepicker-1.6rc2.js";    var dateFields = node.find("input[type='text'][name*='date']");    var options = {        dateFormat: 'dd.mm.yy',        rangeSelect: false,          closeText: 'X',        closeStatus: 'Kalender schließen',        clearText: 'löschen',        clearStatus: 'aktuelles Datum löschen',        closeText: 'schließen',        closeStatus: 'ohne Änderungen schließen',        prevText: '&#x3c;zurück',        prevStatus: 'letzten Monat zeigen',        prevBigText: '&#x3c;&#x3c;',        prevBigStatus: '',        nextText: 'vor&#x3e;',        nextStatus: 'nächsten Monat zeigen',        nextBigText: '&#x3e;&#x3e;',        nextBigStatus: '',        currentText: 'heute',        currentStatus: '',        monthNames: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'],        monthNamesShort: ['Jan', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'],        monthStatus: 'anderen Monat anzeigen',        yearStatus: 'anderes Jahr anzeigen',        weekHeader: 'Wo',        weekStatus: 'Woche des Monats',        dayNames: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'],        dayNamesShort: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],        dayNamesMin: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],        dayStatus: 'Setze DD als ersten Wochentag',        dateStatus: 'Wähle D, M d',        dateFormat: 'dd.mm.yy',        firstDay: 1,        initStatus: 'Wähle ein Datum',        isRTL: false    };    this.loadAnyScript(url, function (){        dateFields.datepicker(options);    }); };UrbanSiteManager.prototype.preparePrinting = function() {    this.loadAnyStyle("/includes/css/files/print.css");    $("#logo").html("<img src='/includes/images/pnn_logo.gif' />");};UrbanSiteManager.prototype.deJson = function(data) {    _debug.warn(data);    return window["eval"]("(" + data + ")");};UrbanSiteManager.prototype.initStatistic = function () {    this.statistic = new UrbanStatisticManager();    this.statistic.init(this);};UrbanSiteManager.prototype.countPageview = function () {    this.statistic.pageView();  };UrbanSiteManager.prototype.initKolumnen = function (node, param) {    this.inlineSlider = new UrbanInlineSlide();    this.inlineSlider.init(node);};UrbanSiteManager.prototype.initWebcam = function () {    if (!this.webcam) {        this.webcam = new UrbanWebcamManager();        this.webcam.init(this);        }    };UrbanSiteManager.prototype.getBrowser = function (node) {    var url = "/includes/javascript/plugins/jquery.browser.js";    this.loadAnyScript(url, function(){       node.attr("id", $.browser.className);     });};var pnnEnigma = {	base64s: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',	encode: function(decStr) {        var bits;        var dual;        var i = 0;         var encOut = '';         while(decStr.length >= i + 3) {             bits = (decStr.charCodeAt(i++) & 0xff) <<16 | (decStr.charCodeAt(i++) & 0xff) <<8 | decStr.charCodeAt(i++) & 0xff; encOut += this.base64s.charAt((bits & 0x00fc0000) >>18) + this.base64s.charAt((bits & 0x0003f000) >>12) + this.base64s.charAt((bits & 0x00000fc0) >> 6) + this.base64s.charAt((bits & 0x0000003f));         }         if(decStr.length -i > 0 && decStr.length -i < 3) {             dual = Boolean(decStr.length -i -1);             bits = ((decStr.charCodeAt(i++) & 0xff) <<16) | (dual ? (decStr.charCodeAt(i) & 0xff) <<8 : 0);             encOut += this.base64s.charAt((bits & 0x00fc0000) >>18) + this.base64s.charAt((bits & 0x0003f000) >>12) + (dual ? this.base64s.charAt((bits & 0x00000fc0)  >>6) : '=') + '=';         }         return(encOut);     },    decode: function(encStr) {         var bits; var decOut = '';         for(var i = 0; i<encStr.length; i += 4) {             bits = (this.base64s.indexOf(encStr.charAt(i)) & 0xff) <<18 | (this.base64s.indexOf(encStr.charAt(i +1)) & 0xff) <<12 | (this.base64s.indexOf(encStr.charAt(i +2)) & 0xff) << 6 | this.base64s.indexOf(encStr.charAt(i +3)) & 0xff;             decOut += String.fromCharCode((bits & 0xff0000) >>16,  (bits & 0xff00) >>8, bits & 0xff);         }         if(encStr.charCodeAt(i -2) == 61) {             return(decOut.substring(0, decOut.length -2));         } else if(encStr.charCodeAt(i -1) == 61) {             return(decOut.substring(0, decOut.length -1));         } else {            return(decOut)        }     }};var pnnDataStore = {    obj: false,    init: function() {        obj = {            inititalized: true        };        this.store();    },    write: function(name, data){        this.retrieve();        if (!this.obj.initialized)            this.init();        this.obj[name] = data;        this.store();        return window.name;         },    read: function(name){        this.retrieve();        if (!this.obj.initialized)            this.init();        if (this.obj[name])            return this.obj[name];        else            return false;    },    store: function() {        window.name = JSONstring.make(this.obj);    },    retrieve: function () {        this.obj = JSONstring.toObject(window.name);    }};var pnnForm = {    blur: function(el){        if (el.val() == "") {            if (el.data("oldvalue"))                 el.val(el.data("oldvalue"));        }        else             if (el.val() != el.data("oldvalue")) {                el.addClass("filled");            }    },    focus: function(el){        if (el.data("oldvalue")) {            if (el.data("oldvalue") == el.val())                 el.val("");        }        else {            el.data("oldvalue", el.val());            el.val("");        }    },    trimData: function(data){        return $.trim(data);    }};    var pnnVoting = {    pnnForm: pnnForm,    init: function(node, param){        this.setData(node, param);             this.checkStatus();    },    setData: function(node, param) {        this.wrapper = node.parent();        this.id = parseInt(param);        this.form = node;              this.urls = {              form:   this.form.attr("action"),              output: "/sixcms/list.php?page=pnn_voting&answer=true&id=" + this.id,              status: "/sixcms/detail.php?template=pnn_voting_status_json&id=" + this.id        };        this.output = this.wrapper.find(".output");    },    submit: function(node, param) {        this.setData(node, param);             this.send();        USM.callIVW("voting");    },    getData: function() {        var data = {                 id: this.pnnForm.trimData(this.form.find("input[name='id']:checked").val()),                 template: this.pnnForm.trimData(this.form.find("input[name='template']").val()),                 AJAX: true        };        return data;    },    send: function() {        var data = this.getData();        var self = this;        $.get(this.urls.form, data, function(data){             self.loadOutput(function(){                self.showStatus(data);             });                      });     },     loadOutput: function(callback) {        this.wrapper.removeAttr("class");        this.wrapper.load(this.urls.output, callback);     },     showStatus: function(data) {        var output = this.output;        output.html(data);        window.setTimeout(function(){            output.fadeOut("slow", function(){                $(this).empty().show();            }, 3500);        });     },     checkStatus: function() {         var self = this;         $.getJSON(this.urls.status, function(data){            if (data.num)                self.loadOutput(function(){                    self.showStatus(data.text);                });                      });     }};// ############################## Firebug - Script #####################################################var _debug = {    output: false,    getArguments: function (args){        var arr = [];        for (var i = 0; i < args.length; i++) {            arr[i] = args[i];        }        return arr;    },        info: function() {        this.write("info", this.getArguments(arguments));            },    log: function() {        this.write("log", this.getArguments(arguments));           },    warn: function() {        this.write("warn", this.getArguments(arguments));           },    error: function() {        this.write("error", this.getArguments(arguments));           },    debug: function() {        this.write("debug", this.getArguments(arguments));            },    write: function(level, args) {      if (this.output && typeof(console)==="object")        if ($.browser.mozilla)             console[level].apply(this, args);         else             window.console[level](args);	} };// Initializing all scriptsvar USM = new UrbanSiteManager();google.load("jquery", "1.3.2");google.load("maps", "2");google.setOnLoadCallback(function() {    _debug.log("init loader...");    urbanPlugins.init();    USM.init();});
UrbanAjaxManager = function() {
this.namespace 	= "ajax";
this.cssClass 	= "urbanize";
this.rootNode	= $("body");
};
UrbanAjaxManager.prototype.init = function(manager) {
this.manager = manager;
_debug.log("initializing ajax");
this.getNodes();
};
UrbanAjaxManager.prototype.getNodes = function() {
var self = this;
$("." + this.cssClass).each(function(i){
var node = $(this);
var command = node.attr(self.namespace + ":command");
var param = node.attr(self.namespace + ":param");
if (typeof(self[command]) == "function")
self[command](node, param);
else
_debug.error(command + "-function not found");
node.removeClass(self.cssClass);
});
};
UrbanAjaxManager.prototype.getAds = function(node, param) {
_debug.log("called get Ads: " + param);
USM.ads.initAd(node, param);
};
UrbanAjaxManager.prototype.goToHome = function(node, param) {
node.bind("click", function(){
window.location.replace("/");
});
};
UrbanAjaxManager.prototype.bindDistrict = function(node, params) {
node.data("location", this.manager.deJson(params));
node.bind("click", function(){
$("#district-navigator").children().removeClass("active");
node.addClass("active");
if(node.next().hasClass("last"))
node.next().addClass("active");
USM.map.moveToDistrict(node.data("location"));
});
this.ieHover(node, params);
};
UrbanAjaxManager.prototype.bindFilter = function(node, params) {
node.bind("click", function(){
$("#map-filter").children().removeClass("active");
node.addClass("active");
if(node.next().hasClass("last"))
node.next().addClass("active");
USM.map.filterPins(params);
});
this.ieHover(node, params);
};
UrbanAjaxManager.prototype.toggleInput = function(node, params) {
_debug.log(node);
if (params!="searched") {
node.bind("focus", function(){
pnnForm.focus(node);
});
node.bind("blur", function(){
pnnForm.blur(node);
});
}
};
UrbanAjaxManager.prototype.prepareLayer = function(node, params) {
USM.prepareLayer(node);
};
UrbanAjaxManager.prototype.startSlideshow = function(node, params) {
USM.initSlideshow();
node.find("a").attr({ href: 'javascript: USM.startSlideshow();' });
};
UrbanAjaxManager.prototype.startMap = function(node, params) {
var newNode = document.getElementById(node.attr("id"));
this.manager.initMap(newNode, params);
};
UrbanAjaxManager.prototype.ieHover = function(node, params) {
if ($.browser.msie && $.browser.version < 7) {
node.bind("mouseover", function(){
node.addClass("hover");
});
node.bind("mouseout", function(){
node.removeClass("hover");
});
node.css({ cursor: "hand" });
}
};
UrbanAjaxManager.prototype.close = function (node, params) {
node.removeClass("hidden");
if (params=="slideshow"){
node.bind("click", function(){
USM.slideshow.close();
});
}
else if (params=="enlargedPic") {
node.bind("click", function(){
USM.closeEnlargedPic();
});
}
else if (params=="webcam") {
node.bind("click", function(){
USM.webcam.close();
});
}
};
UrbanAjaxManager.prototype.slideshowJumpTo = function (node, params) {
params = (typeof(parseInt(params))=="number") ? parseInt(params) : 0;
node.attr({ href: 'javascript:USM.slideshow.load(' + params + ')' });
};
UrbanAjaxManager.prototype.archiveSearch = function (node, param) {
if (!($.browser.msie && $.browser.version<7))
this.manager.datePicker(node);
// adding a listener to inputfield
};
UrbanAjaxManager.prototype.globalSearch = function (node, param) {
var radio = node.find("input[name='type']");
radio.bind("change", function(){
radio.each(function(i){
if (this.checked)
node.attr({ action: "/" + this.value + "/" });
});
});
};
UrbanAjaxManager.prototype.streetSearch = function (node, param) {
var form = node.find("form");
var closeHandle = node.find(".close");
form.bind("submit", function(){
USM.map.streetSearch();
return false;
});
closeHandle.bind("click", function(){
USM.map.toolbox.close();
});
};
UrbanAjaxManager.prototype.streetsearchHandle = function (node, param) {
node.bind("click", function(){
USM.map.toolbox.open();
});
};
UrbanAjaxManager.prototype.enlargePic = function (node, param) {
node.bind("click", function(){
_debug.log("bild: " + param);
USM.showEnlargedPic(parseInt(param));
});
};
UrbanAjaxManager.prototype.showVideo = function(node, params) {
node.parent().removeClass("hidden");
node.bind("click", function(){
USM.videoLayer.start();
});
this.manager.initVideoLayer();
};
UrbanAjaxManager.prototype.articlePrint = function(node, params) {
node.parent().addClass("active");
this.manager.preparePrinting();
node.bind("click", function(){
window.print();
return false;
});
};
UrbanAjaxManager.prototype.articleAdvice = function(node, params) {
if(typeof(parseInt(params))==="number"){
node.parent().addClass("active");
var self = this;
node.bind("click", function(){
_debug.warn("Advice!");
params = parseInt(params);
var url = "/sixcms/detail.php?template=pnn_recommend_mail_form&id=" + params;
$("#recommend").load(url, function(){
self.getNodes();
USM.callIVW("schicken");
});
return false;
});
}
};
UrbanAjaxManager.prototype.articleComment = function(node, params) {
node.parent().addClass("active");
node.bind("click", function(){
_debug.warn("Comment!");
location.href = location.href + "#kommentieren";
return false;
});
};
UrbanAjaxManager.prototype.articleLocate = function(node, params) {
if (params.length>5 && params.indexOf(".")>1){
node.parent().addClass("active");
var self = this;
node.bind("click", function(){
self.manager.initMap(false, 'article', params);
USM.callIVW("mapartikel");
return false;
});
}
};
UrbanAjaxManager.prototype.articleBookmark = function(node, params) {
_debug.log("found bookmark;");
};
UrbanAjaxManager.prototype.articleMailForm = function(node, params) {
if (typeof(parseInt(params)) === "number") {
node.bind("submit", function(){
params = parseInt(params);
USM.callIVW("artikelversenden");
var values = {
senderName: node.find("#recommend-mail-sender-name").val(),
senderMail: node.find("#recommend-mail-sender-adress").val(),
recipMail: node.find("#recommend-mail-recipient-adress").val(),
subject: node.find("#recommend-mail-subject").val(),
text: node.find("#recommend-mail-textfield").val()
};
var url = "/sixcms/detail.php?template=pnn_recommend_send_form&id=" + params;
$.post(url, values, function(data){
$("#recommend").html(data);
window.setTimeout(function(){
$("#recommend").fadeOut("slow", function(){
$(this).empty().show();
});
}, 2000);
});
return false;
});
}
};
UrbanAjaxManager.prototype.votingForm = function(node, params) {
pnnVoting.init(node, params);
node.bind("submit", function(){
pnnVoting.submit(node,params);
return false;
});
};
UrbanAjaxManager.prototype.allowEditing = function(node, params) {
var items = node.find("li");
_debug.log("will show edit-handles on ", items);
};
UrbanAjaxManager.prototype.commentForm = function(node, params) {
_debug.log("will ajaxify this form");
};
UrbanAjaxManager.prototype.statistic = function(node, params) {
this.manager.initStatistic();
this.manager.countPageview();
};
UrbanAjaxManager.prototype.zoomSlider = function (node, params) {
this.manager.map.initSlider(node);
};
UrbanAjaxManager.prototype.getToolbox = function (node, params) {
this.manager.map.initToolbox(node);
};
UrbanAjaxManager.prototype.zoom = function (node, params) {
node.bind("click", function(){
USM.map.zoom(params);
});
};
UrbanAjaxManager.prototype.selectMaptype = function (node, params) {
node.bind("click", function(){
USM.map.selector.get(params);
});
};
UrbanAjaxManager.prototype.openToolbox = function (node, params) {
node.bind("click", function(){
if (typeof(USM.map.toolbox)==="object")
USM.map.toolbox.open();
});
};
UrbanAjaxManager.prototype.checkGoogleSearch = function (node, params) {
var search = document.location.search;
if (search.indexOf('type')>-1 && search.indexOf('phrase')>-1) {
var text = node.find("input[name='q']").val();
_debug.log(text);
if (text.length)
node.submit();
}
};
UrbanAjaxManager.prototype.initSudoku = function (node, param) {
this.manager.initSudoku();
};
UrbanAjaxManager.prototype.kolumnen = function (node, param) {
this.manager.initKolumnen(node, param);
};
UrbanAjaxManager.prototype.webcamEnlarge = function (node, param) {
this.manager.initWebcam();
var self = this;
var id = (typeof(parseInt(param))=="number") ? parseInt(param) : false;
node.bind("click", function(){
self.manager.webcam.enlarge(id);
return false;
});
};
UrbanAjaxManager.prototype.getBrowser = function (node, param) {
this.manager.getBrowser(node);
};
UrbanMapManager = function(){
this.mapelement = document.getElementById("karte");
this.mapcontainer = $("#mapcontainer");
this.streetSearchElements = {
div: $("#toolbox"),
handle: $("#streetsearch-handle")
};
this.mapSize = {
width: "100%",
height: "300px"
};
this.zoomLevels = {
city: 13,
district: 16,
street: 17
};
this.mapStart = {
lat: "52.3967",
lon: "13.0584",
zoom: this.zoomLevels.city,
loaded: false
};
this.pinImagePath = "/includes/images/mapicons/";
this.pinShadowPath = "/includes/images/mapicons/";
this.filter = "News";
};
UrbanMapManager.prototype.init = function(node, param, LatLng){
if (GBrowserIsCompatible()) {
this.mapMode = param;
if (LatLng && LatLng.indexOf(",")>-1) {
LatLngArray = LatLng.split(",");
this.mapStart.lat = parseFloat($.trim(LatLngArray[0]));
this.mapStart.lon = parseFloat($.trim(LatLngArray[1]));
if (LatLngArray[2])
this.mapStart.zoom = parseInt($.trim(LatLngArray[2]));
}
this.showContainer(param);
this.createMap(node);
}
};
UrbanMapManager.prototype.createMap = function(node){
var mapElement = node ? node : this.mapelement;
this.map = new GMap2(mapElement);
// this.map.enableScrollWheelZoom();
this.geocoder = new GClientGeocoder();
var self = this;
// Event.addListener(this.map, "load", function(){self.syncPois();});
GEvent.addListener(this.map, "moveend", function(){
self.syncSlider();
self.syncPois();
self.mapStart.loaded = true;
});
GEvent.addListener(this.map, "dragstart", function(){
self.denySyncPois = false;
});
GEvent.addListener(this.map, "maptypechanged", function(){
self.syncMaptypeSelector();
});
this.map.setCenter(new GLatLng(this.mapStart.lat, this.mapStart.lon), this.mapStart.zoom);
// this.map.addControl(new GMenuMapTypeControl());
this.map.addControl(new GSmallZoomControl());
};
UrbanMapManager.prototype.showContainer = function(param){
this.mapcontainer.addClass("active");
if (param.length)
this.mapcontainer.addClass(param);
};
UrbanMapManager.prototype.initSlider = function(node) {
this.slider = new UrbanSlider();
this.slider.init(this, node);
};
UrbanMapManager.prototype.initToolbox = function(node) {
if (!($.browser.msie && $.browser.version < 7)) {
this.toolbox = new UrbanToolbox();
this.toolbox.init(this, node);
}
};
UrbanMapManager.prototype.initSelector = function() {
this.selector = new UrbanSelector();
this.selector.init(this);
};
UrbanMapManager.prototype.syncSlider = function(){
var zoom=this.map.getZoom();
// Sync Slider here with variable zoom - using JQuery
if (typeof(this.slider)==="object")
this.slider.set(zoom);
};
UrbanMapManager.prototype.syncMaptypeSelector = function() {
var maptype = this.map.getCurrentMapType();
if (typeof(this.selector)==="object")
this.selector.set(maptype.getName());
};
UrbanMapManager.prototype.zoom = function(param) {
var zoom = parseInt(this.map.getZoom()) + parseInt(param);
this.map.setZoom(zoom);
};
UrbanMapManager.prototype.changeMaptype = function (value) {
this.map.setMapType(value);
};
UrbanMapManager.prototype.syncPois = function(force){
if (force) {
this.denySyncPois = false;
_debug.log("Force syncPois");
}
if (!this.denySyncPois) {
this.map.clearOverlays();
var gb = this.getBounds();
var opt = {
type: "pins",
filter: this.filter,
geobounds: gb.lat1 + "," + gb.lon1 + "," + gb.lat2 + "," + gb.lon2
}
var self = this;
$.getJSON("/includes/map/mapjax.php?", opt, function(json){
self.drawPins(json);
});
}
if (this.mapStart.loaded)
USM.callIVW("karte");
};
UrbanMapManager.prototype.drawPins = function(json){
var knubbel = new GIcon();
knubbel.transparent = ''; //this.pinImagePath + "transparent.png";
knubbel.imageMap = [0, 0, 27.40];
knubbel.iconSize = new GSize(27, 40);
knubbel.shadowSize = new GSize(27, 40);
knubbel.infoWindowAnchor = new GPoint(11, 34);
knubbel.iconAnchor = new GPoint(11, 34);
knubbel.shadow = this.pinShadowPath + "schatten.png";
_debug.log(json.length + " Pins called");
for (i = 0; i < json.length; i++) {
if (!json[i]['icon']) {
knubbel.image = this.pinImagePath + json[i]['image'];
// knubbel.shadow = this.pinShadowPath + json[i]['image'];
}
else
knubbel.image = json[i]['icon'];
_debug.log(knubbel.image);
var tooltip = json[i]['titel'];
if (json[i]['subkategorie'])
tooltip = tooltip + " (" + json[i]['subkategorie'] + ")";
else if (json[i]['kategorie'])
tooltip = tooltip + " (" + json[i]['kategorie'] + ")";
if (json[i]['kategorie_id']==1)tooltip = tooltip + " vom "+ json[i]['stamp'] + " Uhr";
var options = {
icon: knubbel,
draggable: false,
title: tooltip,
dragCrossMove: false
};
var pin = new GMarker(new GLatLng(json[i]['lat'], json[i]['lon']), options)
// var pin = new GMarker(new GLatLng(json[i]['lat'], json[i]['lon']));
this.map.addOverlay(pin);
pin.bubbleData = json[i];
var self = this;
GEvent.addListener(pin, "click", function(){
self.openBubble(this);
});
}
};
UrbanMapManager.prototype.openBubble = function(pin){
_debug.log("PinBubble opened: " + pin.bubbleData);
if (typeof(this.toolbox)==="object")
this.toolbox.close();
var data = pin.bubbleData;
this.denySyncPois = true;
// Call the mapjax to get HTML Content
var self = this;
var opt = {
type: "bubble",
cms_id: data['cms_id'],
kategorie_id: data['kategorie_id']
}
$.get("/includes/map/mapjax.php?", opt, function(html){
self.fillBubble(html, pin);
});
};
UrbanMapManager.prototype.fillBubble = function(html, pin){
var self = this;
pin.openInfoWindowHtml(html, {
onCloseFn: self.syncPois(),
maxWidth: 300
});
};
UrbanMapManager.prototype.getBounds = function(){
var left_top_lon = this.map.getBounds().getSouthWest().lng();
var right_bottom_lon = this.map.getBounds().getNorthEast().lng();
var left_top_lat = this.map.getBounds().getNorthEast().lat();
var right_bottom_lat = this.map.getBounds().getSouthWest().lat();
return {
lat1: left_top_lat,
lon1: left_top_lon,
lat2: right_bottom_lat,
lon2: right_bottom_lon
};
};
UrbanMapManager.prototype.moveToDistrict = function(newDistrict){
this.map.setCenter(new GLatLng(newDistrict.lat, newDistrict.lon), parseInt(newDistrict.zoom));
};
UrbanMapManager.prototype.filterPins = function(filter){
this.filter = filter;
this.syncPois(true);
};
UrbanMapManager.prototype.streetSearch = function(){
var adr = document.streetsearch.address.value;
if (this.geocoder) {
var self = this;
this.geocoder.getLatLng(adr + ",Potsdam", function(point){
if (!point) {
alert("Zu Ihrer Suche " + adr + " konnte leider keine Position gefunden werden.\nBitte versuchen Sie es ggf. mit anderen Daten erneut.");
}
else {
self.map.setCenter(point, 15);
var opts = {
draggable: false
};
self.map.addOverlay(new GMarker(point, opts));
self.closeStreetSearch();
}
});
}
};
UrbanMapManager.prototype.openStreetSearch = function(node) {
_debug.error("called openStreetSearch");
};
UrbanMapManager.prototype.closeStreetSearch = function(node) {
_debug.error("called closeStreetSearch");
};
UrbanSlider = function(){};
UrbanSlider.prototype.init = function (map, node) {
this.map = map;
this.node = node;
var self = this;
this.options = {
max:    21,
min:    12,
orientation: 'horizontal',
value:  this.map.map.getZoom(),
stop: function(event, ui) {
self.get(ui.value);
},
animate: true
};
this.pluginUrl = "/includes/javascript/plugins/jquery-ui-slider-1.6rc6.js";
var self = this;
USM.loadAnyScript(this.pluginUrl, function(){
self.create();
});
};
UrbanSlider.prototype.create = function () {
this.node.slider(this.options);
};
UrbanSlider.prototype.set = function(value){
this.node.slider('option', 'value', value);
};
UrbanSlider.prototype.get = function(value){
this.map.map.setZoom(value);
};
UrbanToolbox = function(){
this.url = "/sixcms/detail.php?template=pnn_map_toolbox";
this.height = {
opened: "0px",
closed: "-56px"
};
this.speed = 1000;
};
UrbanToolbox.prototype.init = function (map, node) {
this.map = map;
this.wrapper = node;
var self = this;
var init = pnnDataStore.read('toolbox');
this.wrapper.load(this.url, function(){
USM.urbanize();
USM.map.initSelector();
self.toolbox = self.wrapper.find('#toolbox');
if (!init) {
window.setTimeout(function(){
self.open();
window.setTimeout(function(){
self.close();
}, 5800);
}, 1700);
}
});
pnnDataStore.write('toolbox', {init: true });
};
UrbanToolbox.prototype.open = function() {
var self = this;
this.wrapper.removeClass("closed").addClass("moving");
this.toolbox.removeClass("hidden").animate({ top: this.height.opened }, this.speed, "swing", function(){
_debug.log("toolbox enabled");
self.wrapper.removeClass("moving")
});
};
UrbanToolbox.prototype.close = function() {
var self = this;
this.wrapper.addClass("moving");
this.toolbox.animate({ top: this.height.closed }, this.speed, "swing", function(){
_debug.log("toolbox enabled");
self.wrapper.addClass("closed").removeClass("moving");
self.toolbox.addClass("hidden")
});
};
UrbanSelector = function(){
this.wrapper = $('#toolboxwrapper');
this.mapTypes = {
map: [G_NORMAL_MAP, 'Karte'],
sat: [G_SATELLITE_MAP, 'Satellit'],
hybrid: [G_HYBRID_MAP, 'Hybrid']
};
};
UrbanSelector.prototype.init = function (map) {
this.label = this.wrapper.find('#maptype-label');
this.handle = this.wrapper.find('#maptype-select-handle');
this.map = map;
var self = this;
this.label.bind("click", function() {
_debug.warn("somebody clicked my label");
self.handle.toggleClass("hidden");
});
};
UrbanSelector.prototype.set = function(value) {
this.label.empty().text(value);
_debug.log(value);
};
UrbanSelector.prototype.get = function(value) {
this.map.changeMaptype(this.mapTypes[value][0]);
this.hideHandle();
};
UrbanSelector.prototype.showHandle = function () {
this.handle.removeClass("hidden");
};
UrbanSelector.prototype.hideHandle = function () {
this.handle.addClass("hidden");
};
var content = new Content();
function Content(){
this.jump2target = false;
this.call = function(destination,source){
//open connection
this.open(destination);
//call source
eval("c" + destination + ".location.href = source;");
// this.clear(destination);
if (this.jump2target) location.href="#" + destination;
}
this.clone = function(destination){
this.clear(destination);
//clone nodes
document.getElementById(destination).innerHTML = eval('c' + destination + '.document.getElementsByTagName("body")[0].innerHTML;');
window.setTimeout(function(){
content.clearConnection(destination);
}, 10000);
}
this.clear = function(destination){ //clear destination
document.getElementById(destination).innerHTML = "";
}
this.clearConnection = function(destination) {
var connection = document.getElementById("connection"+destination);
document.getElementsByTagName("body")[0].removeChild(connection);
}
this.open = function(destination){ //open connection
if(!document.getElementById("connection"+destination)){
var connection = document.createElement("div");
connection.id = "connection"+destination;
connection.innerHTML = '<iframe name="c' + destination + '" onLoad="content.clone(\'' + destination + '\')" src="" style="display:none;"></iframe>';
document.getElementsByTagName("body")[0].appendChild(connection);
}
}
}
var urbanPlugins = {
init: function() {
this.iframeLoader();
},
iframeLoader: function() {
jQuery.fn.extend({
loadViaIframe: function(source) {
this.each(function() {
var destination = false;
if ($(this).attr("id")) {
destination = $(this).attr("id");
}
else {
destination = "iframeloader_" + Math.random(10) * 10;
$(this).attr({
id: destination
});
}
content.call(destination, source);
});
}
});
}
}
UrbanSlideshowManager = function(){};
UrbanSlideshowManager.prototype.init = function(manager){
_debug.log("init slideshow");
this.manager = manager;
this.url = "/sixcms/detail.php?template=pnn_bdt_ajax_wrapper";
};
UrbanSlideshowManager.prototype.start = function(){
this.layer = this.manager.layer;
_debug.log(this.layer.content, this.url);
this.manager.showLayer();
this.load(0);
};
UrbanSlideshowManager.prototype.load = function(skip) {
var url = this.url + "&skip=" + skip;
var self = this;
this.layer.content.load(url, function(){
self.onShown();
});
};
UrbanSlideshowManager.prototype.onShown = function(){
this.manager.urbanize();
this.manager.callIVW("slideshow");
};
UrbanSlideshowManager.prototype.close = function(){
this.manager.hideLayer();
USM.callIVW("slideshow");
};
function popit(img, path)
{
var www =  (path) ?  path + img : '../includes/images/pnn-abo-bilder/'+img;
var fenster = window.open(www, "image", "width=520,height=420,left=10,top=10,resizable=yes;scrollbars=no;");
fenster.focus();
}
UrbanVideoManager = function(){};
UrbanVideoManager.prototype.init = function(manager){
_debug.log("init video");
this.manager = manager;
this.url = "/includes/potsdam-tv/iframe.html";
};
UrbanVideoManager.prototype.start = function(){
_debug.log("start video");
this.layer = this.manager.layer;
this.layer.content.html("<div class='close'></div><iframe></iframe>");
this.layer.content.addClass("video");
var iframe = this.layer.content.find("iframe");
var self = this;
this.layer.content.find(".close").bind("click", function(){
self.close();
});
iframe.attr({
src: this.url,
scrolling: 'no'
});
this.manager.showLayer();
USM.callIVW("video");
};
UrbanVideoManager.prototype.close = function(){
this.manager.hideLayer();
this.layer.content.removeClass("video");
this.layer.content.empty();
USM.callIVW("video");
};
UrbanStatisticManager = function(){};
UrbanStatisticManager.prototype.init = function (manager) {
this.manager = manager;
this.googleCode = "UA-579640-4";
this.googleScript =
this.google = {
id: "UA-579640-4",
url: "google-analytics.com/ga.js"
};
};
UrbanStatisticManager.prototype.pageView = function () {
this.googleAnalytics();
};
UrbanStatisticManager.prototype.googleAnalytics = function(){
var protocol = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
var google = this.google;
this.manager.loadAnyScript(protocol + google.url, function(){
try {
var pageTracker = _gat._getTracker(google.id);
pageTracker._trackPageview();
}
catch(err) {}
});
};
UrbanAdManager = function(){};
UrbanAdManager.prototype.init = function(manager){
_debug.log("init ads");
this.manager = manager;
this.idPrefix = "adition_tag_";
this.headerScript = "http://imagesrv.adition.com/js/secure_tag_head_adfarm1.js";
this.getScipt();
};
UrbanAdManager.prototype.getScipt = function() {
this.manager.loadAnyScript(this.headerScript, function(){
renderAds();
});
};
UrbanAdManager.prototype.initAd = function(node, params){
this.checkAd(node);
};
UrbanAdManager.prototype.checkAd = function(node){
var times = 0;
var func = function(){
if (node.children().length > 2 || node.html().length > 300) {
node.removeClass("empty");
if (node.parent().hasClass("hidden"))
node.parent().removeClass("hidden");
if (inter)
window.clearInterval(inter);
}
_debug.info(times + ". mal " + node.children().length + " für ", node);
if (times && times > 15 && inter)
window.clearInterval(inter);
times++;
};
var inter = window.setInterval(func, 1000);
node.addClass("checked");
};
JSONstring={
compactOutput:false,
includeProtos:false,
includeFunctions: false,
detectCirculars:true,
restoreCirculars:true,
make:function(arg,restore) {
this.restore=restore;
this.mem=[];this.pathMem=[];
return this.toJsonStringArray(arg).join('');
},
toObject:function(x){
if(!this.cleaner){
try{this.cleaner=new RegExp('^("(\\\\.|[^"\\\\\\n\\r])*?"|[,:{}\\[\\]0-9.\\-+Eaeflnr-u \\n\\r\\t])+?$')}
catch(a){this.cleaner=/^(true|false|null|\[.*\]|\{.*\}|".*"|\d+|\d+\.\d+)$/}
};
if(!this.cleaner.test(x)){return {}};
eval("this.myObj="+x);
if(!this.restoreCirculars || !alert){return this.myObj};
if(this.includeFunctions){
var x=this.myObj;
for(var i in x){if(typeof x[i]=="string" && !x[i].indexOf("JSONincludedFunc:")){
x[i]=x[i].substring(17);
eval("x[i]="+x[i])
}}
};
this.restoreCode=[];
this.make(this.myObj,true);
var r=this.restoreCode.join(";")+";";
eval('r=r.replace(/\\W([0-9]{1,})(\\W)/g,"[$1]$2").replace(/\\.\\;/g,";")');
eval(r);
return this.myObj
},
toJsonStringArray:function(arg, out) {
if(!out){this.path=[]};
out = out || [];
var u; // undefined
switch (typeof arg) {
case 'object':
this.lastObj=arg;
if(this.detectCirculars){
var m=this.mem; var n=this.pathMem;
for(var i=0;i<m.length;i++){
if(arg===m[i]){
out.push('"JSONcircRef:'+n[i]+'"');return out
}
};
m.push(arg); n.push(this.path.join("."));
};
if (arg) {
if (arg.constructor == Array) {
out.push('[');
for (var i = 0; i < arg.length; ++i) {
this.path.push(i);
if (i > 0)
out.push(',\n');
this.toJsonStringArray(arg[i], out);
this.path.pop();
}
out.push(']');
return out;
} else if (typeof arg.toString != 'undefined') {
out.push('{');
var first = true;
for (var i in arg) {
if(!this.includeProtos && arg[i]===arg.constructor.prototype[i]){continue};
this.path.push(i);
var curr = out.length;
if (!first)
out.push(this.compactOutput?',':',\n');
this.toJsonStringArray(i, out);
out.push(':');
this.toJsonStringArray(arg[i], out);
if (out[out.length - 1] == u)
out.splice(curr, out.length - curr);
else
first = false;
this.path.pop();
}
out.push('}');
return out;
}
return out;
}
out.push('null');
return out;
case 'unknown':
case 'undefined':
case 'function':
if(!this.includeFunctions){out.push(u);return out};
arg="JSONincludedFunc:"+arg;
out.push('"');
var a=['\n','\\n','\r','\\r','"','\\"'];
arg+=""; for(var i=0;i<6;i+=2){arg=arg.split(a[i]).join(a[i+1])};
out.push(arg);
out.push('"');
return out;
case 'string':
if(this.restore && arg.indexOf("JSONcircRef:")==0){
this.restoreCode.push('this.myObj.'+this.path.join(".")+"="+arg.split("JSONcircRef:").join("this.myObj."));
};
out.push('"');
var a=['\n','\\n','\r','\\r','"','\\"'];
arg+=""; for(var i=0;i<6;i+=2){arg=arg.split(a[i]).join(a[i+1])};
out.push(arg);
out.push('"');
return out;
default:
out.push(String(arg));
return out;
}
}
};
UrbanSudoku = function(){};
UrbanSudoku.prototype.init = function(manager){
var url = "/includes/javascript/plugins/sudoku.js";
this.manager = manager;
this.manager.loadAnyScript(url, function(){
init();
});
};
UrbanSudoku.prototype.exit = function(){
exit();
};
UrbanInlineSlide = function() {
this.index= [];
this.plugin= "/includes/javascript/plugins/jquery.mousewheel.min.js";
this.active= 0;
}
UrbanInlineSlide.prototype.init = function (node) {
this.initWheel();
this.node = node;
this.listElements = this.node.find("li");
this.getIndex();
this.initEvents();
_debug.log(this.index);
};
UrbanInlineSlide.prototype.getIndex = function() {
var self = this;
this.listElements.each(function(){
self.index.push($(this));
$(this).data("number", self.index.length-1);
if ($(this).hasClass("active"))
self.active = self.index.length-1;
});
};
UrbanInlineSlide.prototype.initWheel = function() {
var self = this;
USM.loadAnyScript(this.plugin, function(){
self.node.mousewheel(function(event, delta) {
if (delta>0)
self.next();
else
self.prev();
return false;
});
});
};
UrbanInlineSlide.prototype.initEvents = function () {
var self = this;
this.node.find("div.prev-control").bind("click", function(){
self.prev();
});
this.node.find("div.next-control").bind("click", function(){
self.next();
});
};
UrbanInlineSlide.prototype.next = function() {
this.reset();
this.active = (this.active < this.index.length-1) ? this.active+1 : 0;
_debug.info(this.active);
this.index[this.active].addClass("active");
};
UrbanInlineSlide.prototype.prev = function() {
this.reset();
this.active = (this.active === 0) ? this.index.length-1 : this.active-1;
_debug.info(this.active);
this.index[this.active].addClass("active");
};
UrbanInlineSlide.prototype.reset = function() {
this.listElements.removeClass("active");
};
UrbanWebcamManager = function(){};
UrbanWebcamManager.prototype.init = function(manager){
_debug.log("init webcam");
this.manager = manager;
this.url = "/sixcms/detail.php?template=pnn_webcam_detail";
this.idPrefix = "&id=";
};
UrbanWebcamManager.prototype.start = function(){
this.layer = this.manager.layer;
this.manager.showLayer();
this.manager.scrollTo(0,0);
};
UrbanWebcamManager.prototype.enlarge = function(id) {
this.start();
var url = id ? this.url + this.idPrefix + id : this.url;
_debug.log("webcam: " + url);
var self = this;
this.layer.content.load(url, function(){
self.onShown();
});
};
UrbanWebcamManager.prototype.onShown = function(){
this.manager.urbanize();
this.manager.callIVW("webcam");
};
UrbanWebcamManager.prototype.close = function(){
this.manager.hideLayer();
USM.callIVW("webcam");
};