/* _________________________________________________________________________________________________ members _________________________________________________________________________________________________ */ var _initialized = false; var _BoxPageContainer; var _BoxPageNav; //var _boxPageNavTop = 105; var _aPageNavItems; var _BoxTeaser; var _ModalBackground; var _ModalContainer; var _ModalHorizon; var _ModalConfirm; var _ModalConfirmText; var _ModalAlert; var _ModalAlertText; var _ModalBox; var _scrollTop = 0; /* _________________________________________________________________________________________________ page object _________________________________________________________________________________________________ */ var oPage = { init: function(){ _BoxPageContainer = $("#BoxPageContainer"); _BoxPageNav = $("#BoxPageNav"); _BoxTeaser = $("#BoxTeaser"); _ModalBackground = $("#ModalBackground"); _ModalContainer = $("#ModalContainer"); _ModalHorizon = $("#ModalHorizon"); /* msie6 settings */ if($.browser.msie && $.browser.versionNumber<7){ _ModalBackground.css("position", "absolute"); _ModalContainer.css("position", "absolute"); } /* safari settings */ if($.browser.safari){ // by init _ModalHorizon.css("top", _ModalContainer.height()*0.45); // by resize $(window).resize(function(){ _ModalHorizon.css("top", _ModalContainer.height()*0.45); }); } /* ready */ _initialized = true; }, appendLayout: function(){ _ModalBackground = $("#ModalBackground"); _ModalContainer = $("#ModalContainer"); _ModalHorizon = $("#ModalHorizon"); _ModalConfirm = $("#ModalConfirm"); _ModalConfirmText = $("#ModalConfirmText"); _ModalAlert = $("#ModalAlert"); _ModalAlertText = $("#ModalAlertText"); _ModalBox = $("#ModalBox"); /* a: blur on focus */ $("a").focus(function(){ $(this).blur(); }); /* preload + hover rollover images */ $('img.rollover').preload({ find:'_up.gif', replace:'_over.gif' }); $('img.rollover').hover(function(){ this.src = this.src.replace('_up.gif','_over.gif'); },function(){ this.src = this.src.replace('_over.gif','_up.gif'); }); /* maxmin */ $('.maxmin').maxmin(); /* itemAnimate note: this function avoids double assignments for the matched $(elements) (necessary for later ajax requests in same document) */ $('.UIPlaceTeaser').itemAnimate( { _type:'teaser' } ); $('.UIEventTeaser').itemAnimate( { _type:'teaser' } ); $('.UIFriendTeaser').itemAnimate( { _type:'teaser' } ); $('.UIEventAnnouncement').itemAnimate( { _type:'eventAnnouncement' } ); /* modifyDatetime note: this function avoids double assignments for the matched $(elements) (necessary for later ajax requests in same document) */ $('span.utcDatetime').modifyDatetime(true, true, oLogic.language); $('span.utcDate').modifyDatetime(true, false, oLogic.language); $('span.utcTime').modifyDatetime(false, true, oLogic.language); /* tooltip */ $(".tooltip").pzTooltip( { _tooltipId:'pzTooltip', _tooltipCSSClass:'UITooltip', _xOffset:2, _yOffset:-28 } ); /* scroll behaviour */ $(window).scroll(function () { /* autoscroll modal components / only msie 6 */ if($.browser.msie && $.browser.versionNumber<7){ _ModalBackground.css("top", $(document).scrollTop()); _ModalContainer.css("top", $(document).scrollTop()); } }); /* tooltip */ $(".tooltip").pzTooltip( { _tooltipId:'pzTooltip', _tooltipCSSClass:'UITooltip', _xOffset:2, _yOffset:-28 } ); /* * show page */ _BoxPageContainer.show(); /* * scroll if anchor is set */ var anchor = window.location.href.match(/#[a-zA-Z0-9]*/); if(anchor) { anchor = anchor + ""; jQuery.scrollTo($("a[name='" + anchor.substr(1) + "']")); } /* colorPicker */ $(".supportColorPicker").ColorPicker({ onSubmit: function(hsb, hex, rgb, el) { $(el).val(hex); $(el).ColorPickerHide(); }, onBeforeShow: function () { $(this).ColorPickerSetColor(this.value); } }) .bind('keyup', function(){ $(this).ColorPickerSetColor(this.value); }); /* widgetCodeConfigurator */ $(".UIWidgetCodeConfigurator").pzWidgetCodeConfigurator( { _minHeight:400 } ); }//appendLayout }; /* _________________________________________________________________________________________________ page direct fn _________________________________________________________________________________________________ */ function appendLayout(){ if(_initialized) oPage.appendLayout(); } function toggleVisibility(targetId){ if(_initialized) $("#"+targetId).toggleVisibility(); } function slide(targetId, w, h, t, e){ if(_initialized) $("#"+targetId).slide(w, h, t, e); } function showModalAlert(_text){ if(_initialized){ _ModalAlertText.text(_text); showModalDialog(_ModalAlert); } } function showModalBox(_source){ if(_initialized){ $.ajax({ url: _source, type: 'GET', dataType: 'html', error: function(){ //; }, success: function(html){ _ModalBox.html(html); showModalDialog(_ModalBox); } }); } } function showModalDialog(_dialog){ if(_initialized){ // hide msie<7 select if($.browser.msie && $.browser.versionNumber<7) $("select").hide(); // _ModalBackground.fadeTo(0,0).show().fadeTo(100, 0.8, function(){ // show + transform horizon + dialog _ModalContainer.show(); _dialog .show() .css("top",(0-(_dialog.height()/2))) .width( $(".modalBoxContent", _dialog).width() ? $(".modalBoxContent", _dialog).width() : 525 ); // appendLayout oPage.appendLayout(); }); } } function closeModalDialog(){ if(_initialized){ _ModalConfirm.hide(); _ModalAlert.hide(); _ModalBox.html(''); _ModalBox.hide(); _ModalContainer.hide(); _ModalBackground.hide(); // show msie<7 select if($.browser.msie && $.browser.versionNumber<7) $("select").show(); } } function bookmark(url,title){ if((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)){ window.external.AddFavorite(url,title); } else if(navigator.appName == "Netscape"){ window.sidebar.addPanel(title,url,""); } else{ alert("Press CTRL-T (Opera) to bookmark"); //TODO i18n (js) } } /* _________________________________________________________________________________________________ document.ready _________________________________________________________________________________________________ */ $(document).ready(function(){ oPage.init(); }); /* _________________________________________________________________________________________________ helpers _________________________________________________________________________________________________ */ function isMacOS(){ return (navigator.platform.indexOf("Mac") > -1) ? true : false; }