/** * Shows sub menu * * @param string menu Defines what to show */ original_focus_menu = false; function submenu(elm) { // finds what menu we are to show menu = $(elm).attr('href'); menu = menu.substr(1); // if we haven't cached the jquery object of the original focused menu yet we'll do that if(!original_focus_menu) { original_focus_menu = $("#mainmenu a.active"); } $("#mainmenu a").removeClass('active'); if($("#submenu_content").is(":visible") && $("#submenu").attr('menu') == menu) { $("#submenu_content").slideUp(); // Put focus on original focused menu again original_focus_menu.addClass('active'); return false; } else { // Put focus to this menu $(elm).addClass('active'); // if this menu is already loaded, we don't need to do more then show it if(menu == $("#submenu").attr('menu')) { $("#submenu_content").slideDown(); return false; } // if the existing menu is the search menu, we'll need to unbind the autofocus event if($("#submenu").attr('menu') == 'search') { $("#siteSearch").removeData("autocomplete").autocomplete("destroy"); } // else we'll loop through the possible cases callback = undefined; switch(menu) { case 'categories': html = ''; break; case 'search': html = ''; html += ''; html += ''; html += '
'; html += '
'; html += ''; html += ''; html += ''; html += ''; html += '

Search word

'; html += '

Channels
'; html += ' My channels
'; html += ' All channels'; html += '

Search in
'; html += ' Title
'; html += ' Short description
'; html += ' Summary'; html += '

Period
'; html += ' One day
'; html += ' One week ahead
'; html += ' Two weeks ahead'; html += '

Create search agent

'; html += '

With a search agent, TimeFor.TV will automatically run the search for you each day, and send you a reminder when there is new search results.

'; html += ''; html += '
'; callback = function() { $("#siteSearch").autocomplete({ source: "/ajax/search.php", minLength: 2, select: function(event, ui) { document.location.href=ui.item.uri; } }) .data( "autocomplete" )._renderItem = function( ul, item ) { //return $( "" ).data( "item.autocomplete", item ).append( "" + item.value + "" ).appendTo( ul ); if(item.type=='headline') { return $( "
  • " ).data( "item.autocomplete", item ).append(''+ item.title +'').appendTo( ul ); } else { return $( "
  • " ).data( "item.autocomplete", item ).append(''+ item.title +'
    '+ item.description +'
    ').appendTo( ul ); } }; $("#submenu button").button(); $("#siteSearch").focus(); } break; case 'profile': html = '
    '; html += ''; html += ''; html += ''; html += ''; html += ''; html += ''; // buttons html += ''; html += ''; html += ''; html += ''; html += '
    '; html += '

    No profile on TimeFor.TV?

    '; html += '

    With a TimeFor.TV profile you can personalize TimeFor.TV to suit your needs, plan programs and much more. Read more

    '; html += '
    '; html += '

    Quick connect

    '; html += '

    Login with a click on a button using your Facebook profile.

    '; html += '
    '; html += '

    Log on TimeFor.TV

    '; html += ''; html += ''; html += ''; html += '
    '; html += 'Create new profile'; html += ''; html += ''; html += ''; html += '

    '; html += '

    Forgot your password?

    '; html += ''; html += '
    '; html += '
    '; callback = function() { $("#submenu button, #submenu a.button").button(); $("#submenu_login_email").focus(); }; break; /* case 'plan': */ default: return true; } $("#submenu").attr('menu',menu); // If already visible, then collapse first and expand again if($("#submenu_content").is(":visible")) { $("#submenu_content").slideUp("fast", function(){ $("#submenu_content").html(html).slideDown(); // If we have a callback if(typeof(callback) == 'function') { callback.apply(); } }); } else { $("#submenu_content").html(html).slideDown(); // If we have a callback if(typeof(callback) == 'function') { callback.apply(this); } } } return false; } function __createSearchAgent(q) { if($("#agentSettings").length == 0) { $("body").append('
    '); } $("#agentSettings").html('
    ').load("/ajax/plan/agent.php",{q:(typeof(q) == 'undefined') ? '' : q}).dialog({modal:true}); }