/* client memory modifiers */
function call_command(command, postdata){
if(command){
toggle_loader(1);
post_data = (postdata) ? postdata : null;
data_type = 'command';
command_name = command;
load_data(post_data);
} 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()',wait_timeout+500);
search_gallery_channels(false,false,false,false);
setTimeout('fade_stage()',wait_timeout+100);
setTimeout('toggle_loader(0)',wait_timeout);
}
function default_player(){
setTimeout('init_compact_videoplayer()',wait_timeout+500);
//init_videoplayer();
}
function call_flash_function(id){
if(client == 'ie'){
var fl = document.getElementById(id).getElementsByTagName('OBJECT')[0];
} else {
var fl = (document.getElementById(id).getElementsByTagName('EMBED')[0]) ? document.getElementById(id).getElementsByTagName('EMBED')[0] : document.getElementById(id).getElementsByTagName('OBJECT')[0];
}
return fl;
}
function stream_videos(string){
call_command('load_videogallery:' + string);
}
function load_videodata(){
var videodata = data_load[0];
call_flash_function('videoarea_div').loadList(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);
$i('video_about').innerHTML = 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').loadList(pids.join(','));
//alert(pids.join(','));
}
var hstr = '';
hstr += '
';
hstr += '
'+decodeURIComponent(gallery[key].title)+'
';
hstr += '
 + '_66x50.jpg)
';
hstr += '
';
playlist.innerHTML += hstr;
}
function stream_playlist(){
var playlist = $i('gallery-thumbnails').childNodes;
var items = new Array();
for(var i=0;i';
html += '' + percent + '%
';
$i('vote' + i + '_' + de(data_load[0].id)).innerHTML = html;
}
}
function de(string){
return decodeURIComponent(string);
}
function dateformat(dateunit){
var year = dateunit.getUTCFullYear();
var month = ((dateunit.getUTCMonth()+1) < 10) ? '0' + (dateunit.getUTCMonth()+1)+'' : ''+(dateunit.getUTCMonth()+1)+'';
var day = '' +dateunit.getUTCDate() + '';
var hours = (dateunit.getUTCHours() < 10) ? '0' + (dateunit.getUTCHours()+1) +'' : '' + (dateunit.getUTCHours()+1) +'';
var minutes = (dateunit.getUTCMinutes() < 10) ? '0' + dateunit.getUTCMinutes() + '' : '' + dateunit.getUTCMinutes() +'';
var seconds = (dateunit.getUTCSeconds() < 10) ? '0' + dateunit.getUTCSeconds() + '' : '' + dateunit.getUTCSeconds() +'';
var datestring = year + month + day + hours + minutes + seconds;
return datestring;
}
function search_galleries(keyword, channel, date_in, date_out, limit){
var post = new Array();
post[0] = (keyword) ? ((ie6) ? encodeURIComponent(keyword) : keyword) : 'undefined';
post[1] = (channel) ? channel : 'undefined';
post[2] = (date_in) ? date_in : 'undefined';
post[3] = (date_out) ? date_out : 'undefined';
post[4] = (limit) ? limit : '0,10';
post[5] = (levelcode) ? levelcode : 'undefined';
//alert(post[5]);
//alert('a');
var post_string = post.join(':');
//blu(post_string);
call_command('search_galleries:' + post_string, false);
}
function search_gallery_channels(keyword, channel, date_in, date_out){
var post = new Array();
post[0] = (keyword) ? ((ie6) ? encodeURIComponent(keyword) : keyword) : 'undefined';
post[1] = (channel) ? channel : 'undefined';
post[2] = (date_in) ? date_in : 'undefined';
post[3] = (date_out) ? date_out : 'undefined';
post[4] = (levelcode) ? levelcode : 'undefined';
var post_string = post.join(':');
call_command('search_gallery_channels:' + post_string, false);
}
function search_videogallery_channels(keyword, channel, date_in, date_out){
var post = new Array();
post[0] = (keyword) ? ((ie6) ? encodeURIComponent(keyword) : keyword) : 'undefined';
post[1] = (channel) ? channel : 'undefined';
post[2] = (date_in) ? date_in : 'undefined';
post[3] = (date_out) ? date_out : 'undefined';
var post_string = post.join(':');
call_command('search_gallery_channels:' + post_string, false);
}
function load_gallery(id){
// startup selection, depend on external parameter
var ext_var = (external_parameter != null) ? external_parameter.split(':') : new Array();
var gallery_id = ((gallery_images == '') && ((ext_var[1] != '') && (ext_var[1] != undefined))) ? ext_var[1] : id;
var video_id = ((streaming_video== '') && ((ext_var[1] != '') && (ext_var[1] != undefined))) ? ext_var[1] : id;
switch(levelcode){
case 'netbulvar_photogallery':
call_command('load_gallery:' + gallery_id, false);
//link_to_photos(gallery_id);
break;
case 'netbulvar_videogallery':
if($i('videoarea_div').innerHTML == ''){
init_videoplayer();
}
stream_videos(video_id);
scrollpage(document.body);
break;
default: blu('error loading gallery');
}
}
function link_to_videostream(id){
var link = $i('videolink').childNodes[1];
link.value = domain + '/video/' + id;
}
function link_to_photos(id){
var link = $i('videolink').childNodes[1];
link.value = domain + '/kep/' + id;
}
function load_channel_galleries(id){
switch(levelcode){
case 'netbulvar_photogallery': call_command('load_channel_galleries:' + id, false); break;
case 'netbulvar_videogallery': call_command('load_channel_videogalleries:' + id, false); break;
default: call_command('load_channel_galleries:' + id, false);
}
}
function photogallery_drag_gallery_thumbnails(){
link_to_photos(data_load[0].id);
document.title = title + ' - Képek - ' + decodeURIComponent(data_load[0].title);
if(data_load.length > 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;
}
function startup_sitesearch(){
//alert(external_parameter);
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';
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;
smartorder = false;
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 += ' ';
//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/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;
}
obj.innerHTML = html_content;
if(obj.innerHTML == '') obj.innerHTML = 'Nincs találat.
';
if(levelcode == 'netbulvar_photogallery' && $i('imageareas').style.backgroundImage == ''){ load_gallery(galleries[0].id); }
/* load the first video, if no videos */
if(levelcode == 'netbulvar_videogallery' && streaming_video.length == 0)
load_gallery(galleries[0].id); //stream_videos(galleries[0].id);
} else {
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 == 'netbulvar_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);
//imagearea.innerHTML = '';
$i('largeimageloader').style.display = 'none';
$i('imageareas').style.visibility = 'visible';
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);
}
}
}