/* client memory modifiers */ function call_command(command, postdata){ if(command){ //toggle_loader(1); post_data = (postdata) ? postdata : null; data_type = 'command'; command_name = command; //alert(command); //load_data(post_data); external_interface(command); } else { alert(error_code(0)); } } function modify_default(){ // do something with client by default } var gallery_images = new Array(); var current_image_key = 0; var keypressed; var streaming_video = new Array(); function vertical_scroll(way, frame_id, content_id){ var frame = $i(frame_id); var content = $i(content_id); var stage_height = frame.offsetHeight; var content_height = content.offsetHeight; var start = (content.style.top == '') ? 0 : Math.abs(eval(content.style.top.replace('px', ''))); var move_limit = (content_height > stage_height) ? content_height - stage_height : 0; var step_limit = 2; var duration = 5; switch(way){ case 'down': //alert(move_limit/step_limit); if(start >= step_limit) scroll_this_object(content, start, duration, move_limit/step_limit, 'up'); break; case 'up': if(start <= (move_limit-(step_limit*2))) scroll_this_object(content, start, duration,move_limit/step_limit, 'down'); break; } /* when changing content height with expanding or collapsing tree childs */ if(move_limit == 0){ if(start > 0){ scroll_this_object(content, start, duration, start, 'up'); } else { scroll_this_object(content, start, duration, move_limit/step_limit, 'up'); } } } function scroll_this_object(object, start, limit, size, direction){ var steps=0; if(object.move) window.clearInterval(object.move); switch(direction){ case 'down': input = start; output = Math.round(start+size); break; case 'up': input = start; output = Math.round(start-size); break; } if(output < 0) output = 0; var speed = 10/size; object.move = window.setInterval( function() { object.style.top = '-' + easeInOut(input,output,limit,steps,speed) + 'px'; steps++; if(steps>limit){ window.clearInterval(object.move); } }, 5); } /* * VIDEO GALLERY WORKFLOW * queries, quick templates, functions * all frontend functions and commands * are available. */ function startup_videogallery(){ init_videoplayer(); //search_gallery_channels(false,false,false,false); //setTimeout('fade_stage()',wait_timeout+100); setTimeout('toggle_loader(0)',wait_timeout); } function stream_videos(string){ call_command('load_videogallery:' + string); } function load_videodata(){ var videodata = data_load[0]; call_flash_function('videoarea_div').getVideos(videodata.id); link_to_videostream(videodata.id); document.title = title + ' - Videók - ' + decodeURIComponent(videodata.title); streaming_video[streaming_video.length] = videodata.id; $i('video_title').innerHTML = decodeURIComponent(videodata.title) + '
' + decodeURIComponent(videodata.about) + ''; toggle_loader(0); } var pids = new Array(); function update_playlist(key){ var playlist = $i('gallery-thumbnails'); var sw_play = $i('playlist_button'); var msg = $i('pmsg').style.display = 'none'; var msg = $i('playlist_button').style.display = 'block'; pids[pids.length] = gallery[key].id; sw_play.onclick = function(){ call_flash_function('videoarea_div').getVideos(pids.join(',')); //alert(pids.join(',')); } var hstr = ''; hstr += '
'; hstr += '
'+decodeURIComponent(gallery[key].title)+'
'; hstr += ' '; hstr += '
'; playlist.innerHTML += hstr; } function stream_playlist(){ var playlist = $i('gallery-thumbnails').childNodes; var items = new Array(); for(var i=0;i 1){ var thumbnails = new Array(); for(var i=0;i'; about.innerHTML += '
' + decodeURIComponent(data_load[0].about) + '
'; obj.innerHTML = ''; gallery_images = new Array(); for(var i=0;i'; } //location.hash = '#imagearea'; scrollpage(document.body); load_gallery_image(0); imagethumb = $i('imagethumb' + 0) imagethumb.style.backgroundColor = '#ff6666'; toggle_loader(0); } else { update_loader_status('üres galéria: id '+data_load[0].id); setTimeout('toggle_loader(0)',wait_timeout+1000); } } function setVideoTitle(string){ var title = $i('video_title'); title.innerHTML = string + '
' + decodeURIComponent(videodata.about) + ''; } function startup_sitesearch(){ alert('a'); if(external_parameter){ search_articles(external_parameter, 'undefined', 'undefined', 'undefined', '0,10'); } else { setTimeout('toggle_loader(0)',0); } setTimeout('fade_stage()',0); } function search_result(){ var obj = $i('searchresult'); var result = data_load; var search_meta = result[0].search_meta; var articles_length = decodeURIComponent(search_meta.search_length); var get_search_keyword = decodeURIComponent(search_meta.search_keyword); var search_keyword = (get_search_keyword == 'false') ? "''" : "'" + get_search_keyword + "'"; var get_search_channel = decodeURIComponent(search_meta.search_channel); var search_channel = (get_search_channel == 'false') ? "''" : get_search_channel; var get_search_date_in = decodeURIComponent(search_meta.search_date_in); var search_date_in = (get_search_date_in == 'false') ? "''" : "'" + get_search_date_in + "'"; var get_search_date_out = decodeURIComponent(search_meta.search_date_out); var search_date_out = (get_search_date_out == 'false') ? "''" : "'" + get_search_date_out + "'"; var search_limit = decodeURIComponent(search_meta.search_limit); var start = search_limit.split(',')[0]; var limit = search_limit.split(',')[1]; if(articles_length > 0){ //blu(search_date_in); var html_content = '
Találatok száma: ' + articles_length + '
'; for(var i=0;i' + decodeURIComponent(result[i].title) + ''; html_content += '
' + decodeURIComponent(result[i].lead) + '
'; html_content += ''; html_content += ''; } /* render pages */ var page = ((start/limit) == 0) ? 1 : Math.round(start/limit)+1; html_content += '
'; var round_limit = null; var pager_limit = 10; for(var i=0;i<(articles_length/search_limit.split(',')[1]);i++){ if((i+1) != (articles_length/limit)){ round_limit = limit*i; html_content += (page == (i+1)) ? ''+(i+1)+' ' : '' + (i+1) + ' '; } } html_content += '
'; scrollpage(document.body); } else { html_content = '
Találatok száma: 0 '+search_keyword+'
'; } obj.innerHTML = html_content; reorder_stageboxes(); toggle_loader(0); } /* * DRAG CHANNEL THUMBNAILS */ var gallery; function gallery_drag_channel_thumbnails(){ var galleries = data_load; gallery = data_load; //alert(galleries[0].search_meta.search_length); if(galleries[0].search_meta){ var pager_object = $i('browse-thumbnails-pager'); var search_meta = galleries[0].search_meta; var gallery_length = decodeURIComponent(search_meta.search_length); var get_search_keyword = decodeURIComponent(search_meta.search_keyword); var search_keyword = (get_search_keyword == 'false') ? "''" : "'" + get_search_keyword + "'"; var get_search_channel = decodeURIComponent(search_meta.search_channel); var search_channel = (get_search_channel == 'false') ? "''" : get_search_channel; var get_search_date_in = decodeURIComponent(search_meta.search_date_in); var search_date_in = (get_search_date_in == 'false') ? "''" : "'" + get_search_date_in + "'"; var get_search_date_out = decodeURIComponent(search_meta.search_date_out); var search_date_out = (get_search_date_out == 'false') ? "''" : "'" + get_search_date_out + "'"; var search_limit = decodeURIComponent(search_meta.search_limit); var start = search_limit.split(',')[0]; var limit = search_limit.split(',')[1]; } var obj = $i('browse-thumbnails'); obj.innerHTML = ''; if(gallery_length > 0){ var html_content = ''; for(var i=0;i'; html_content += '
' + decodeURIComponent(galleries[i].release_date) + '
'; html_content += '
' + decodeURIComponent(galleries[i].title) + '
'; html_content += '
lejátszás
'; html_content += '
hozzáad
'; html_content += '
'; html_content += ' '; html_content += ''; } else { html_content += '
'; html_content += '
'; html_content += '
'; html_content += '
'; html_content += '
' + decodeURIComponent(galleries[i].datetime) + '
'; html_content += '
' + decodeURIComponent(galleries[i].title) + '
'; html_content += '
'; html_content += '
'; html_content += '
'; } } if(search_meta){ /* render pages */ var page = ((start/limit) == 0) ? 1 : Math.round(start/limit)+1; var pager_html_content = '
'; var round_limit = null; var pager_limit = 10; for(var i=0;i<(gallery_length/search_limit.split(',')[1]);i++){ if((i+1) != (gallery_length/limit)){ round_limit = limit*i; pager_html_content += (page == (i+1)) ? ''+(i+1)+' ' : '' + (i+1) + ' '; } } pager_html_content += '
'; pager_object.innerHTML = pager_html_content; search_meta = null; } obj.innerHTML = html_content; if(obj.innerHTML == '') obj.innerHTML = '
Nincs találat.
'; if(levelcode == 'photogallery' && $i('imageareas').style.backgroundImage == ''){ load_gallery(galleries[0].id); } /* load the first video, if no videos */ if(levelcode == 'videogallery' && streaming_video.length == 0) load_gallery(galleries[0].id); //stream_videos(galleries[0].id); } else { pager_object.innerHTML = ''; obj.innerHTML = '
Nincs találat.
'; } toggle_loader(0); } /* * the gallery browser-tree * list generated from this (at startup). */ function photogallery_search_gallery_channels(){ var obj = $i('browse-tree'); if(obj){ obj.onselectstart = function () { return false; } // ie obj.onmousedown = function () { return false; } // mozilla var galleries = data_load; if(galleries != null){ var childs; var child_html; var external_request = (external_parameter) ? external_parameter.split(':') : ''; var highlight_classname_suffix = (external_request[0] == null) ? " active" : ""; var highlight_child_classname_suffix = ''; var doFunctionality = ''; var item_icon = ''; var label = (levelcode == 'photogallery') ? 'Friss képek' : 'Friss videók'; var default_html = '
'+label+'
'; obj.innerHTML = default_html; for(var i=0;i'; for(var x=0;x' + decodeURIComponent(childs[x].channel_name) + '
'+childs[x].items + '
'; if(highlight_child_classname_suffix != ""){ highlight_classname_suffix = " active"; } } child_html += ''; } else { highlight_classname_suffix = (external_request[0] == decodeURIComponent(galleries[i].channel_id)) ? " active" : ""; } //alert(decodeURIComponent(galleries[i].channel_id)); doFunctionality = (galleries[i].childs) ? 'toggle_me(this)' : 'browse_highlights(this);search_galleries(\'\', ' +decodeURIComponent(galleries[i].channel_id) + ', \'\', \'\')'; item_icon = (galleries[i].childs) ? '' : ''; obj.innerHTML += '
'+item_icon + decodeURIComponent(galleries[i].channel_name) + '
'+galleries[i].items + '
'+child_html+'
'; } // startup selection, depend on external parameter var ext_var = (external_parameter) ? external_parameter.split(':') : null; var channel_id = (ext_var != null) ? ext_var[0] : galleries[0].channel_id; search_galleries(false, false, server_week, server_datein, '0,10'); } else { blu('no gallery data'); } } toggle_loader(0); } function browse_highlights(current_item_object){ var parent = $i('browse-tree'); var obj = parent.getElementsByTagName('DIV'); //alert(obj.length); for(var i=0;i 0) ? current_image_key-1 : gallery_images.length-1; var step_way = (keypressed == 'shift') ? prev_key : next_key; load_gallery_image(step_way); } var image_data = new Image(); image_data.src = image_source; image_data.posChangeMemInt = window.setInterval( function() { if(image_data.complete == true){ window.clearInterval(image_data.posChangeMemInt); $i('largeimageloader').style.display = 'none'; //imagearea.innerHTML = ''; $i('imageareas').style.visibility = 'visible'; setTimeout('link_to_photos()', 500); image_data = null; delete image_data; } } , 10); } function change_gallery_image(direction){ switch(direction){ case 'left': if(current_image_key > 0){ load_gallery_image(current_image_key-1); } else { load_gallery_image(gallery_images.length-1); } break; case 'right': if(current_image_key < (gallery_images.length-1)){ load_gallery_image(current_image_key+1); } else { load_gallery_image(0); } } } function register_a_vote( id, vote_id, startup ) { startup = typeof( startup ) != 'undefined' ? startup : false; var answer_id = null; var voted = false; for( var i=0; i < votes.length; i++ ) { if( vote_id == votes[i] ) { voted = true; } } if ( startup && voted ) { answer_id = 42; } else if ( !startup ) { if( voted ) { alert( 'Ön már leadta a szavazatát!' ); } var answer = null; var answer_id = null; var j = 0; answer = $i( 'answer_' + vote_id + '_' + j ); while( answer != null ) { if ( answer.checked ) { answer_id = answer.value; break; } j++; answer = $i( 'answer_' + vote_id + '_' + j ); } } if( answer_id != null ) { var post = new Array(); post[0] = (vote_id) ? vote_id : 'undefined'; post[1] = (voted) ? 'loadonly' : answer_id; var post_string = post.join( ':' ); external_parameter = null; call_command( 'register_a_vote:' + post_string, false ); } else if ( !startup ) { alert( 'Kérem, jelöljön meg egy választ!' ); } } function display_vote_result() { var result = data_load[ 0 ].answers; var percent = 0; var vote_id = de( data_load[ 0 ].id ); var newnode = null; var targetobj = null; for ( var k = 0; k < result.length; k++ ) { percent = Math.round( de( result[k].counter ) / de( data_load[ 0 ].overall ) * 100 ); targetobj = $i( 'result_' + result[ k ].id ); // newnode = document.createTextNode( de( result[ i ].counter ) + ' szavazat' ); newnode = document.createTextNode( percent + '%' ); targetobj.appendChild( newnode ); } var answer = null; var j = 0; answer = $i( 'answer_' + vote_id + '_' + j ); while( answer != null ) { answer.style.visibility = 'hidden'; j++; answer = $i( 'answer_' + vote_id + '_' + j ); } var vote_button_row = document.getElementById( 'votebutton_' + vote_id ); while( vote_button_row.hasChildNodes() ) { vote_button_row.removeChild( vote_button_row.lastChild ); } } function vote_for_star( star_id ) { call_command( 'vote_for_star:' + star_id, false ); } function display_star_poll_result() { var star_id = data_load[ 0 ].id; var poll_count = data_load[ 0 ].polscount; var vote_button = $i( 'star_poll_button_' + star_id ); vote_button.style.visibility = 'hidden'; var vote_result = $i( 'star_poll_result_' + star_id ); while( vote_result.hasChildNodes() ) { vote_result.removeChild( vote_result.lastChild ); } var newnode = document.createTextNode( poll_count ); vote_result.appendChild( newnode ); } function de( string ) { return decodeURIComponent( string ); }