/*@cc_on/*@if(@_jscript_version<5.7)try{document.execCommand('BackgroundImageCache',0,1)}catch(e){}/*@end@*/
// encoding: utf-8
Req(
  'fontsizer',
  'q-videolinks',
  function() {
    var $ = jQuery;
    
    if (!window.EPLICA_loggedin)
    {
      $('a.videolink').videoLinks();
    }

    
    /* *** faqlist *** */
    var toggleClassName
    $('div.faqlist div.item')
        .addClass('item-hidden')
        .find('div.answer')
            .hide()
            .end()
        .find('h3 a')
            .click(function(){
          
                var link = $(this),
                    outerElm = link.parent().parent(),
                    answerElm = outerElm.find('div.answer').eq(0);
                    

                if(answerElm.contents().length < 2)
                {
                  $.ajax({
                    url: $(this).attr('href'),
                    success: function(response)
                    {
                      answerElm.append($(response).find('div.fullanswer'));
                    },
                    complete: function()
                    {
                      answerElm.slideToggle(300);
                    }
                  });
                }
                else
                {
                  answerElm.slideToggle(300);
                }

                outerElm.toggleClass('item-hidden');
                
              
                return false;
            });
    
        var ytTempl = '<object height="%{height}" width="%{width}">' +
                          '<param value="http://www.youtube.com/v/%{file};hd=1" name="movie"><param value="true" name="allowFullScreen"><param value="always" name="allowscriptaccess">' +
                          '<embed height="%{height}" width="%{width}" src="http://www.youtube.com/v/%{file};hd=1" allowfullscreen="true" allowscriptaccess="always" type="application/x-shockwave-flash"></object>';
        $('a.ytlink')
                  .each(function(){
                      var videoUrl = $(this).attr('href').split('?'),
                          videoUrl = videoUrl[1] && videoUrl[1].match(/v=([^&]+)/)[1],
                          vidWidth = 480,
                          vidHeight = 385;
                      $(this).wrap('<span class="ytvideo" />')
                                  .parent().html(
                                              $.inject(ytTempl, {
                                                    file : videoUrl,
                                                    width : vidWidth,
                                                    height : vidHeight
                                                  })
                                            );

                    });
    
    $('.pagestyle').fontsizer();
    $('#noflickerCSS').remove();
  }
);

