 $(document).ready(function() {

if($(".video_options").length>0){
     $(".video_icons a[title]").tooltip({
      offset: [20, 90]
   });
}

              if($("#toc").length>0){

                         // $('#toc').toc({exclude: 'h1, h6', context: '.glossaryarticles'});

                        $("#toc").append('<ul>')
                         $("h6").each(function(i) {
                               var current = $(this);
                               current.attr("id", "title" + i);
                                $("#toc").append("<li><a id='link" + i + "' href='#title" +
                                 i + "' title='" + current.attr("tagName")  + "'>" + current.html() + "</a></li>");
                         });
                                     $("#toc").append('</ul>');
             }


             if($("#promoimages").length>0){
              $("#promoimages").cycle({
		     fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
                     timeout: 6000
	           });
              }

              if($("a.subscribepopuplink").length>0){
	         $("a.subscribepopuplink").fancybox({
                                'width'     	                                : 670,
                                'height'     	                                : 650,
                                'autoScale'     	                : false,
                                'transitionIn'		: 'none',
		  'transitionOut'		: 'none',
		  'overlayColor'		: '#333',
		  'type'			: 'iframe',
                  'overlayOpacity' : 0.6,
                  'titleShow' : false
	        });
              }

              if($("a.compare_plans").length>0){
	         $("a.compare_plans").fancybox({
                                'width'     	                                : 670,
                                'height'     	                                : 650,
                                'autoScale'     	                : false,
                                'transitionIn'		: 'none',
		  'transitionOut'		: 'none',
		  'overlayColor'		: '#333',
		  'type'			: 'iframe',
                  'overlayOpacity' : 0.6,
                  'titleShow' : false
	        });
              }

            if($("a.novideopop").length>0){
  	       $("a.novideopop").fancybox({
                                'width'     	                                : 613,
                                'height'     	                                : 400,
                                'autoScale'     	                : true,
                                'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'overlayColor'		: '#333',
		'type'			: 'iframe',
                 'overlayOpacity' : 0.6,
                 'titleShow' : false
	     });
	  }

         if($("a#videopopup").length>0){
  	    $("a#videopopup").fancybox({
                                'width'     	                                : 560,
                                'height'     	                                : 340,
                                'autoScale'     	                : false,
                                'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'overlayColor'		: '#333',
		'type'			: 'iframe',
                 'overlayOpacity' : 0.6,
                 'titleShow' : false
	     });
	}

       //toggle for search filters on search page
	   if($(".filter_option h4 a").length>0){
			$(".filter_option h4 a").each(function(){
					$(this).click(function(){
						if($(this).hasClass('down'))
						{
						    $(this).removeClass('down');
						    $(this).addClass('collapsed');
						    $(this).parents("div").children(".filter_optionlist").hide();
                                                     
							
						}
						else
						{
							 $(this).parents("div").children(".filter_optionlist").show();
							$(this).removeClass('collapsed');
							$(this).addClass('down');
						}
					});
			  }	
			);
		}

});

