/* * MC Routines * * Copyright (c) 2008 Fabrizio Fiandanese (creativepattern.com) * * $Date: 2009/10/15 17:00:01 $ * $Rev: 110 $ */ //add thickbox to href & area elements that have a class of .thickbox function tie_thickbox(domChunk){ $(domChunk).click(function(){ var t = this.title || this.name || null; var a = this.href || this.alt; var g = this.rel || false; window.parent.TB_show(t,a,g); this.blur(); return false; }); } /* show/hide div elements*/ function _showSubDiv(cssExp,idx) { $(cssExp).each(function(i){ //Active class check if (idx==i) { $(this).show(); } else { $(this).hide(); } }); } function _showSubDivByClass(cssExp,className) { $(cssExp).each(function(i){ //Active class check if ($(this).attr("class")==className) { $(this).show(); } else { $(this).hide(); } }); } function _showSubDivById(cssExp,id) { $(cssExp).each(function(i){ //Active class check if ($(this).attr("id")==id) { $(this).show(); } else { $(this).hide(); } }); } /*custom routines */ function showSubNav(type,id) { //turn off all links $('#mc_subnav a').removeClass('active'); if (!id) { //enable first link $($('#mc_subnav .' + type + ' a').get(0)).addClass('active'); } else { $('#mc_subnav .' + type + ' a#' + id).addClass('active'); } $('#mc_subnav').show(); _showSubDivByClass('#mc_subnav div',type); //refresh banners //adsCall(type); //openadsCall(type); } function showSubNavContent(type,idx) { $('#mc_content').show(); _showSubDiv('#mc_content .' + type + ' div.item',idx); } function showSubNavContentById(type,id) { $('#mc_content').show(); _showSubDivById('#mc_content .' + type + ' div.item',id); } function contentCall(state) { /*dt= new Date(); var tie = state.indexOf('?') == -1 ? '?' : ''; //stop media //window.parent.stopMedia(); //clear buffer //$("#mc_async_content #async_buffer").empty(); //load content var call_url = state + tie + '&' + dt.getTime(); $.ajax({ url: call_url, cache: false, success: function(html){ $("#mc_async_content #async_buffer").html(html); } });*/ } function contentNavCall(area,state) { dt= new Date(); $.ajax({ url: state, cache: false, success: function(html){ $("#" + area).html(html); } }); } /* cumulative functions */ function showNav(type) { //hide all subcontents $('#mc_content div.item').hide(); showSubNav(type) showSubNavContent(type,0); } function saveNowPlayingMediaInfo(title,hash,area,zone) { /*window.parent.playingMediaHolder=new Array(); window.parent.playingMediaHolder['title']=title; window.parent.playingMediaHolder['hash']=hash; window.parent.playingMediaHolder['area']=area; window.parent.playingMediaHolder['zone']=zone;*/ } function mediaCall(hash,area,zone,sub_zone) { $('#mc_content div.item').hide(); if (area!='audiolive') { //content starts contentCall( "mediachannels/index.php?q=content/" + area + "/" + hash + "/" + zone); //nav auto-sets showSubNav(area,zone); if (zone) { showSubNavContentById(area,zone); } else { showSubNavContent(area,0); } } else { if (hash != 'CMP1' && hash != 'CMP2' && hash != 'CMP3') { showSubNav(area,area + "_" + (zone - 1)); //nav auto-sets showSubNavContent('audiolive', (zone - 1)); contentNavCall("c" + (zone - 1) + "_channels_dyn_data","mediachannels/index.php?q=content/nav/" + hash + "/" + area ); } else { showSubNav('aod','aod_compilations'); showSubNavContentById('aod','aod_compilations'); } //content starts //contentCall( "mediachannels/index.php?q=content/" + area + "/" + hash ); } } var _tmRefreshAds; /* Facebook */ function fb_share(u, t) { if ( t == null ) t = ''; window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=1,status=0,width=626,height=436'); return false; } function openadsCall(promo_category) { state = "mediachannels/index.php?q=content/openads/" + promo_category; dt= new Date(); var tie = state.indexOf('?') == -1 ? '?' : ''; var call_url = state + tie + '&' + dt.getTime(); $("#mc_async_sponsor_promo_zone").empty(); $.ajax({ url: call_url, cache: false, success: function(html){ $("#mc_async_sponsor_promo_zone").html(html); } }); } function adsCall(promo_category) { //ads location state = "mediachannels/index.php?q=content/ads/" + promo_category; dt= new Date(); var tie = state.indexOf('?') == -1 ? '?' : ''; var call_url = state + tie + '&' + dt.getTime(); $("#mc_async_promo_zone").empty(); $.ajax({ url: call_url, cache: false, success: function(html){ $("#mc_async_promo_zone").html(html); } }); } function enableVScroll(zone) { //serial scrolls $('#' + zone + ' .items').serialScroll({ items:'a', prev:'#' + zone + ' .up', next:'#' + zone + ' .down', stop:true, force:true, duration:0, axis:'y', step:3 }); //enable first link $($('#' + zone + ' .items a').get(0)).addClass('active'); //enable automatic highlight var lnks=new TabMaster('#' + zone + ' .items a'); } function loadVideo(filename,flv_url) { var so = new SWFObject(filename, "buffer", "425", "283", "7", "#000000"); so.addVariable('flv_url',flv_url); so.addParam("wmode", "transparent"); so.write("video_content"); return so; } function loadAudio(filename,mp3_url) { var so = new SWFObject(filename, "buffer", "245", "30", "7", "#000000"); so.addVariable('songUrl',mp3_url); so.addParam("wmode", "transparent"); so.write("audio_content"); return so; } function setContentTitle(filename,title,subtitle) { var so = new SWFObject(filename, "titler", "386", "40", "7", "#000000"); so.addVariable('title',title); so.addVariable('subtitle',subtitle); so.addParam("wmode", "transparent"); so.write("content_titler"); }