/* client memory modifiers */
function call_command(command, postdata){
if(command){
toggle_loader(1);
post_data = (postdata) ? postdata : null;
data_type = 'command';
command_name = command;
//blu(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 gallery_captions = 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(){
setTimeout('init_videoplayer()', 1);
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 += '
 + '_66x50.jpg)
';
hstr += '
';
playlist.innerHTML += hstr;
}
function remove_video(id){
var sw_play = $i('playlist_button');
var new_pids = 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();
gallery_captions = 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(){
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){
var html_content = 'Találatok száma: ' + articles_length + '
';
for(var i=0;i';
html_content += '' + decodeURIComponent(result[i].title) + '
';
html_content += '' + decodeURIComponent(result[i].lead) + '
';
html_content += '' + decodeURIComponent(result[i].channel_name) + ' -
' + decodeURIComponent(result[i].formatted_release_date) + ' - Tovább a rovatba. ';
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;
//blu(galleries);
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 = '';
//blu(gallery_length);
if(gallery_length > 0){
var html_content = '';
for(var i=0;i';
html_content += ' ';
html_content += '
';
html_content += '
';
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/pager_limit);i++){
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');
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 = '';
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] : false;
var datein = (ext_var != null) ? false : server_week;
var dateout = (ext_var != null) ? false : server_datein;
search_galleries(false, channel_id, datein, dateout, '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);
var about = $i('photogallery-mediainfo');
about.innerHTML = '' + decodeURIComponent(data_load[0].title) + '
';
about.innerHTML += '' + decodeURIComponent(data_load[0].about) + '
' + gallery_captions[image_key] + '
';
}
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(vote_id, total,loadonly){
var voteobj = null;
var answer_id = null;
for(var i=0;i' + percent + '%
';
$i('ans' + i).style.display = 'none';
$i('vote' + i + '_' + de(data_load[0].id)).innerHTML += html;
}
if (html!='') {
$i('votebutton').style.display = 'none';
}
}
function de(string){
return decodeURIComponent(string);
}