var isMSIE = /*@cc_on!@*/false; document.observe('dom:loaded', function() { /* drawSkyscraper(); $$('.submenucontrol').each(function(element){ element.down('a').observe('click', function(e){ element.down('ul.sub').toggle(); e.stop(); }); }); if( (elm_login = $('topfield_login')) ) { elm_login.observe('focus', function(e){ if( elm_login.getValue() == 'Nickname' ) { elm_login.setValue(''); elm_login.setStyle( {'color': 'black'} ); elm_login.activate(); } }); elm_login.observe('blur', function(e){ if( elm_login.getValue() == '' ) { elm_login.setValue('Nickname'); elm_login.setStyle( {'color': '#666'} ); } }); } if( (elm_pass = $('topfield_password')) ) { elm_pass.observe('focus', function(e){ if( elm_pass.getValue() == 'Heslo' ) { elm_pass.setValue(''); elm_pass.setStyle( {'color': 'black'} ); elm_pass.activate(); } }); elm_pass.observe('blur', function(e){ if( elm_pass.getValue() == '' ) { elm_pass.setValue('Heslo'); elm_pass.setStyle( {'color': '#666'} ); } }); } */ if( (elm_sendbymail = $('sendByMail')) ) { elm_sendbymail.observe('focus', function(e){ if( elm_sendbymail.getValue() == 'Poslat fotku mailem' ) { elm_sendbymail.setValue('@'); elm_sendbymail.setStyle( {'color': 'black'} ); elm_sendbymail.activate(); } }); elm_sendbymail.observe('blur', function(e){ if( elm_sendbymail.getValue() == '' || elm_sendbymail.getValue() == '@' ) { elm_sendbymail.setValue('Poslat fotku mailem'); elm_sendbymail.setStyle( {'color': '#666'} ); } }); } /* $$('a[rel="usertip"]').each(function(element) { new Tip(element, { ajax: { url: '/index-ajax.php?module=usertooltip&url=' + element.readAttribute('href') }, // Images inside the tooltip will need to have dimensions set since Prototip needs to fixate width for proper rendering. // hook: { target: 'bottomMiddle', tip: 'topLeft' }, stem: { //position: 'topLeft', // Example: optional default stem position, this will also enable the stem height: 12, width: 15 }, // viewport: true, // offset: { x: 0, y: 0 }, style: 'default', showOn: 'mouseover', hideOn: false,//, // disable the normal hide event, because we only want to use the hideAfter option hideAfter: 0.2, opacity: 0.7, width:300, height:'auto', border:0 }); }); */ hideemails(); preparePopupLinks(); replaceSmileys(); }); //document.observe('scroll', function() { // drawSkyscraper(); //}); //Event.observe(window, 'resize', function(){ // drawSkyscraper(); //}); var reg = new RegExp("^[0-9a-zA-Z\-\.]+@[0-9a-zA-Z]+[\.]{1}[0-9a-zA-Z]+[\.]?[0-9a-zA-Z]+$"); function sendByMail( url ) { var addr = $('sendByMail').getValue(); if( reg.test(addr) ) { new Ajax.Request('/ajax.php', { parameters: { 'module': 'sendphoto', 'url': url, 'addr': addr }, onComplete: function( e ) { switch( e.responseText ) { case 'sent': alert('Adresa fotky byla odeslána.'); break; case 'badurl': alert('Tuto adresu není možné odeslat: ' + url); break; case 'notonline': alert('Tuto funkci mohou využívat pouze přihlášení uživatelé.'); break; default: alert(e.responseText); break; } } }); } else alert('Zadaná emailová adresa nemá správný formát.'); } function hideemails() { var maily = document.getElementsByTagName('span'); var at = ' zavináčík '; var dot = ' tečkoun '; for (var i=0; i' + mail + ''; } } } } function replaceSmileys() { $A($$('.smileyzone.')).each(function(e){ e.update(e.innerHTML.replace( /\*([1-9]|[1-2][0-9]|3[1-8])\*/g, '$1')); }); } function preparePopupLinks() { $$('a[rel="linkout"]').each(function(elm){ Event.observe(elm,'click', function(e){ window.open(elm.href); e.stop(); }); }); } function checkSession() { new Ajax.Request('/ajax.php?module=iamalive'); } setInterval(checkSession, 120000); /* function saveClubRating( starbox, memo ) { memo.module = 'rateclub'; new Ajax.Request('/ajax.php', { parameters: memo, onComplete: function( e ) { $('ratingresult').update(e.responseText); } }); } */ /* function rateClub( combobox, clubs_id ) { new Ajax.Updater('ratingtable_placeholder', '/ajax.php', { parameters: { 'module': 'rateclub', 'rating_kind': $(combobox).readAttribute('name'), 'rating': $(combobox).getValue(), 'clubs_id': clubs_id }, onComplete: function( e ) { $(combobox).disabled = 1; } }); } */ // observing all starboxes //document.observe('starbox:rated', saveStar); //function addStarbox( clubs_id, rating_kind, rating_total, rating_votes, rated ) //{ // if( rated > 0 ) // { // new Starbox( // 'rating_' + rating_kind, // rating_total, // { // total: rating_votes, // rerate: false, // onRate: saveClubRating, // identity: 'club' + clubs_id + 'rating_' + rating_kind, // 'rated': rated, // indicator: 'Hodnocení #{average}, #{total} hlasujících, včetně tebe' // } // ); // } // else // { // new Starbox( // 'rating_' + rating_kind, // rating_total, // { // total: rating_votes, // rerate: false, // onRate: saveClubRating, // identity: 'club' + clubs_id + 'rating_' + rating_kind, // indicator: 'Hodnocení #{average}, #{total} hlasujících' // } // ); // } // ///* // 'rated: '.$previous_rating['rating_'.$rating_kind].','. // "indicator: 'Hodnocení #{average}, #{total} hlasujících, včetně tebe'," // : // "indicator: 'Hodnocení #{average}, #{total} hlasujících'," //*/ // /* // "new Starbox('rating_{$rating_kind}', ".$data->{'rating_'.$rating_kind}.", { ". // "total: ".$data->{'rating_'.$rating_kind.'_votes'}.",". // "rerate: false,". // ( // isset($previous_rating['rating_'.$rating_kind]) && !is_null($previous_rating['rating_'.$rating_kind]) ? // 'rated: '.$previous_rating['rating_'.$rating_kind].','. // "indicator: 'Hodnocení #{average}, #{total} hlasujících, včetně tebe'," // : // "indicator: 'Hodnocení #{average}, #{total} hlasujících'," // ). // "onRate: saveClubRating,". // "identity: 'club{$data->clubs_id}rating_{$rating_kind}'". // "});" //*/ //} function highlightPhoto() { if(document.location.href.match(/#(\w.+)/)) { var loc = RegExp.$1; if($(loc)) { new Effect.Highlight( loc, { startcolor: "#E30081", endcolor: '#fffffff' } ); } } } function loadCalendar(year, month) { var d = new Date(); if( !year ) year = d.getYear(); if( !month ) month = d.getMonth(); new Ajax.Updater('smallcalendar', '/ajax.php', { parameters: { 'module': 'calendar', 'year': year, 'month': month, 'seed': Math.floor(Math.random()*9999) } }); } function ajaxUpdate( element, wrapper, classname ) { // vypnuti ajax updateru return false; // if( isMSIE ) // return false; new Ajax.Updater( 'ajaxtarget', '/loadajax' + element.readAttribute('href').sub('#pb', ''), { 'onCreate': ajaxShowProgressbar, 'onComplete': ajaxHideProgressbar, 'evalScripts': true // 'evalJS': true } ); if( $(wrapper) && classname != '' ) { $A($$('#' + wrapper + ' a')).each(function(e){ e.removeClassName(classname); }); element.addClassName(classname); } // $A($$('#ajaxtarget a[onclick="return !ajaxUpdate(this);"]')).each(function(e){ // e.observe('click', e.onclick); // }); return true; } function ajaxShowProgressbar() { new Insertion.Top('content', '
Načítám...
'); } function ajaxHideProgressbar() { $('ajaxProgressbar').remove(); } function reloadDailyComments() { new Ajax.Updater( 'dailycomments', '/ajax.php?module=dailycomments' ); } function saveNote( users_id ) { new Ajax.Request('/ajax.php', { parameters: { 'module': 'savenote', 'users_id': users_id, 'note': $('usernote').getValue() }, onComplete: function( e ) { switch( e.responseText ) { case 'saved': alert('Poznámka byla uložena'); break; case 'notvip': alert('Nejsi VIP.'); break; case 'notonline': alert('Nejsi online.'); break; case 'missingdata': alert('Nebylo vyplněno ID uživatele nebo text poznámky.'); break; case 'deleted': alert('Poznámka byla vymazána.'); break; } } }); } function castPollVote( polls_answers_id ) { new Ajax.Updater('poll', '/ajax.php', { parameters: { 'module': 'pollvote', 'polls_answers_id': polls_answers_id } }); } function logout() { if( confirm('Určitě se chceš odhlásit?') ) { return true; } else { return false; } } var event_no_active = 1; function showFollowingEvent( event_no ) { if( event_no_active != event_no ) { if( isMSIE ) { $('followingevent' + event_no_active).hide(); $('followingevent' + event_no).show(); $('eventcontrol' + event_no).setStyle('background:#E9369C;'); $('eventcontrol' + event_no_active).setStyle('background:#000000;'); } else { $('followingevent' + event_no_active).fade({'duration':0.5}); $('followingevent' + event_no).setStyle({'position':'absolute', 'top': '0', 'left': '0'}); $('followingevent' + event_no).appear({'duration':1, 'from':0}); $('eventcontrol' + event_no).morph('background:#E9369C;'); $('eventcontrol' + event_no_active).morph('background:#000000;'); } event_no_active = event_no; } } var interval; // function prepareRotation() { interval = setInterval("rotate();", 3000); $('followingEvent').observe('mouseover', endRotation); $('followingEvent').observe('mouseout', function(){ interval = setInterval("rotate();", 3000); }); } function rotate() { if( event_no_active == 5 ) showFollowingEvent(1); else showFollowingEvent(event_no_active +1 ); } function endRotation() { // alert('clear'); clearInterval(interval); } // //function drawSkyscraper() //{ // if( $('skyscraper') ) // { // var divwidth = 100; // var contentwidth = $('wrapper').getWidth(); // // var width = document.viewport.getWidth(); // //// alert(window.pageYOffset); // // var ypos = 153; // // if( window.pageYOffset > 143 ) // { // ypos = window.pageYOffset+10; // } // else // { // ypos = 153; // } // // var xpos = width/2+contentwidth/2+5; // // $('skyscraper').setStyle({'left': xpos + 'px', 'top': ypos + 'px', 'display' : 'block'}); // } //}