/**
 * JavaScripts and jQuery
 *
 * @author          Emil Lansky <emil@artis3.com>
 * @copyright       Plus Four Inc. 2008
 *
 * All Rights Reserved
 *
 * Distribution and use in source and binary forms, with or without
 * modification, are NOT permitted without prior written permition from the
 * authors and copyright holders
 *
**/

jQuery(document).ready(function() {

   jQuery(document).ready(function(){
      jQuery("a").hover(function(){
        jQuery(this).addClass("highlight");
      },function(){
        jQuery(this).removeClass("highlight");
      });
   });
   
   jQuery(document).ready(function(){
      jQuery("input[name='toggleSelectAllCheckbox']").click(function() {
         jQuery("input[name*=sel]").each(function() {
            this.checked = !this.checked;
         });
      });
   });

   jQuery(document).ready(function(){
      $("input[name='msg_type']").click(function() {
         var str = $("input[name='msg_type']:checked").val();
         if ( str == "HTML") 
            jQuery("textarea").addClass("mceAdvanced");            
         else
            jQuery("textarea").addClass("mceSimple");
      });
   });

   jQuery(document).ready(function(){
      jQuery("div#menu ul li").click(function() {
		 jQuery(this).addClass("active");
      },function(){
		 jQuery(this).removeClass("active");
      });
   });
   
   jQuery(document).ready(function(){
      jQuery("#tabs").tabs();
   });

   jQuery(document).ready(function() {
	 $("#accordion").accordion({ autoHeight: false, collapsible: true, active: false });
   });

   var headline_count;
   var current_headline=0;
   
   jQuery(document).ready(function(){
	 headline_count = $("div.headline").size();
	 $("div.headline:eq("+current_headline+")").css('top', '3px');
	 setInterval(headline_rotate,6000); //time in milliseconds
   });
   
   function headline_rotate() {
	 old_headline = current_headline % headline_count;
	 new_headline = ++current_headline % headline_count;
	 $("div.headline:eq(" + old_headline + ")").css('top', '210px');
	 $("div.headline:eq(" + new_headline + ")").show().animate({top: 3},"slow");
   }

});


