function show_video_tooltip() { var vid_id = $(this).attr( 'mrvl_vid' ); var num = $(this).attr( 'mrvl_seq_num' ); var off = $(this).offset(); $('#video_tooltipm > img') .attr( 'src', 'http://marvel.com' + videos_data[vid_id].image_url ) .attr( 'alt', videos_data[vid_id].title ) .attr( 'title', videos_data[vid_id].title ) ; $('#video_tooltip_text').html( ''+videos_data[vid_id].title +'
'+ videos_data[vid_id].desc ) ; var pos_l = ( num >= 11 ) ? off.left - $('#video_tooltip').innerWidth() - 10 : off.left + this.clientWidth + 88 ; // reset to default the left and right box sides $('#tooltipL').attr('class','video_tooltipR2'); $('#tooltipR').attr('class','video_tooltipR'); // depending on num, display the box arrow if (num >= 11 ) $('#tooltipR').attr('class','video_tooltipL2'); else $('#tooltipL').attr('class','video_tooltipL'); var pos_t = off.top - $('#video_tooltip').innerHeight() / 2 ; $('#video_tooltip').css( { left: pos_l, top: pos_t } ) ; unhide( 'video_tooltip' ); } // need a focal point to use for ajax box interactions // using object to manage the updates of the episode description when ajax box changes content function marvel_ajax_box() { this.type_viewing = 'episode'; this.movietv_id = 0; // used for kids - for now // function to update the episode descriptions this.update_ep_desc = function() { var mtv_id = $(this).attr( 'mrvl_mtv_id' ); var ep_id = $(this).attr( 'mrvl_ep_id' ); // swap the description if ( mtv_id && ep_id ) { var str = ''+ (episode_data[mtv_id][ep_id]).episode_title +' - '+ (episode_data[mtv_id][ep_id]).episode_description ; $('#ep_description').html( str ); } } // main callback function // what to do when the ajax box changes this.onchange = function() { marvel_ajax_box.update_ep_desc.call( $('.ajx-load-contents > .imageholder').eq(0) ) ; } // used to update the video list with ajaxanator this.vidlist = function( el_id,tmpl,setsize,subset ) { var kids_flag = ( tmpl.indexOf( 'kid' ) > -1 ), mtv_id = (kids_flag ? ['m.movietv_id=' + this.movietv_id] : null) ; var ml = marvel_loader.init( 'animated_episode/fetch_vidlist_for' ); ml.request = { params:[ this.type_viewing,mtv_id,kids_flag ], cparams: [ null, browser.isIE ], setsize: setsize, mode:'htm', src: tmpl }; document.getElementById(el_id).innerHTML = '
'; ml.energize( el_id,subset ); } this.setToEpisode = function() { this.type_viewing = 'episode'; } this.setToPopular = function() { this.type_viewing = 'popular'; } return this; } var marvel_ajax_box = new marvel_ajax_box(); // on page load code executed here $(document).ready( function() { if ( window.curr_pg == 'marvel_com_animation' ) { // check on episode_data if ( !defined( episode_data ) ) alert( 'Error: episode data seems to be missing!' ); // setup the tabs manager var tabbox = new tabanator( ['newest_videos', 'most_watched', 'channels'], 'tabbox_contents' ); tabbox.actions.channels = new actions( ['ep_description.style.display|none'] ); tabbox.actions.newest_videos = new actions( ['ep_description.style.display|block','marvel_ajax_box.setToEpisode'] ); tabbox.actions.most_watched = new actions( ['ep_description.style.display|block','marvel_ajax_box.setToPopular'] ); tabbox.callback = marvel_ajax_box.onchange ; } }) // for thumbnail hover function show(eid,center) { var ele = document.getElementById(eid); if ( center ) { var _top = parseInt($(window).height()/2) - parseInt($(ele).height()/2), _left = parseInt($(window).width()/2) - parseInt($(ele).width()/2) ; $(ele).css( { top: $(document).scrollTop() + _top, left: _left } ) ; } !ele.style.display || ele.style.display == 'none' ? ele.style.display = 'block' : ele.style.display = 'none'; } // for video search form function vsform_submit() { if ( !document.vs_form.vidsearch.value ) alert( 'Enter a keyword to search through our videos.' ); else document.vs_form.submit(); } // facebook post it func function fbs_click() {u=location.href;t=document.title;window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');return false;}