//EASY TABS 1.2 - MENU SETTINGS
//Set the id names of your tablinks (without a number at the end)
//var tablink_idname = new Array("tablinka", "tablinkb", "tablinkc",  "topnewslink", "overviewlinks", "creativepeoplelink")
var tablink_idname = new Array("tablinka", "tablinkb", "tablinkc")
//Set the id names of your tabcontentareas (without a number at the end)
//var tabcontent_idname = new Array("tabcontenta", "tabcontentb", "tabcontentc", "topnews", "overview", "creativesubmission") 
var tabcontent_idname = new Array("tabcontenta", "tabcontentb", "tabcontentc") 
//Set the number of your tabs in each menu
var tabcount = new Array("5", "4", "4", "3", "4", "2")
//Set the Tabs wich should load at start 
var loadtabs = new Array("1", "1", "1",  "2", "1", "1")  
//Set the Number of the Menu which should autochange (if you dont't want to have a change menu set it to 0)
var autochangemenu = 1
//the speed in seconds when the tabs should change
var changespeed=6
//should the autochange stop if the user hovered a tab from the autochangemenu? 0=no 1=yes
var stoponhover = 0

/*Swich EasyTabs Functions - no need to edit something here*/
function easytabs(menunr, active) {
if (menunr == autochangemenu){currenttab=active;}
if ((menunr == autochangemenu)&&(stoponhover==1)) {stop_autochange()} else if ((menunr == autochangemenu)&&(stoponhover==0))  {counter=0;}

menunr = menunr-1;
for (i=1; i <= tabcount[menunr]; i++)
{
document.getElementById(tablink_idname[menunr]+i).className='tab'+i;
document.getElementById(tabcontent_idname[menunr]+i).style.display = 'none';
}
document.getElementById(tablink_idname[menunr]+active).className='tab'+active+' tabactive';
document.getElementById(tabcontent_idname[menunr]+active).style.display = 'block';
}
var timer; counter=0; var totaltabs=tabcount[autochangemenu-1];var currenttab=loadtabs[autochangemenu-1];

function start_autochange(){counter=counter+1;timer=setTimeout("start_autochange()",1000);if (counter == changespeed+1) {currenttab++;if (currenttab>totaltabs) {currenttab=1}easytabs(autochangemenu,currenttab);restart_autochange();}}
function restart_autochange(){clearTimeout(timer);counter=0;start_autochange();}
function stop_autochange(){clearTimeout(timer);counter=0;}




/**
 * RUZEE.Events 0.2
 * (c) 2006 Steffen Rusitschka <steffen@rusitschka.de>
 *
 * RUZEE.Events is freely distributable under the terms of 
 * an MIT-style license. For details, see http://www.ruzee.com/
 */

var RUZEE=window.RUZEE||{};

RUZEE.Events={
  domloadEvents:[],
  domloadDone:false,

  add:function(obj,event,fn,useCapture){
    if(event=='domload'){
      RUZEE.Events.domloadEvents.push(fn);
      return true;
    }
    if(obj.addEventListener){
      obj.addEventListener(event,fn,useCapture);
      return true;
    }
    if(obj.attachEvent){
      return obj.attachEvent('on'+event,fn);
    }
    var f=obj['on'+event];
    obj['on'+event]=(f&&typeof f=='function')?function(){ f(); fn(); }:fn;
  },

  remove:function(obj,event,fn,useCapture){
    if(obj.removeEventListener){
      obj.removeEventListener(event,fn,useCapture);
      return true;
    }
    if (obj.detachEvent){
      return obj.detachEvent('on'+event,fn);
    }
    alert('Handler could not be removed!');
  },

  getSrc:function(e){
    var s;
    e=e||window.event;
    if(e.target) s=e.target;
    else if(e.srcElement) s=e.srcElement;
    if (s.nodeType==3) // defeat Safari bug
      s=s.parentNode;
    return s; 
  },

  ondomload:function(){
    if(RUZEE.Events.domloadDone) return;
    RUZEE.Events.domloadDone=true;

    for (var i=0; i<RUZEE.Events.domloadEvents.length; i++)
      RUZEE.Events.domloadEvents[i]();
  },

  domloadCheck:function(){
    if(RUZEE.Events.domloadDone) return true;

    var loaded=(/KHTML/i.test(navigator.userAgent))&&(/loaded|complete/.test(document.readyState));
    var eofAvail=document.getElementById&&document.getElementById('domloadeof');
    // wait till the element with ID domloadeof is in the DOM or readyState=loaded on KHTML
    if(loaded||eofAvail){
      RUZEE.Events.ondomload();
    }else{
      // Not ready yet, wait a little more.
      setTimeout('RUZEE.Events.domloadCheck()',100);
    }
    return true;
  }
};

// if possible, use the "standard" way
if(document.addEventListener)
  document.addEventListener('DOMContentLoaded', RUZEE.Events.ondomload, false);

// for Internet Explorer
/*@cc_on @*/
/*@if (@_win32)
document.write("<script id=__ie_ondomload defer src=javascript:void(0)><\/script>");
document.getElementById("__ie_ondomload").onreadystatechange=function() {
  if (this.readyState=="complete") {
    RUZEE.Events.ondomload();
  }
};
/*@end @*/


setTimeout('RUZEE.Events.domloadCheck()',100);
// Just in case window.onload happens first, add it there, too
RUZEE.Events.add(window,'load', RUZEE.Events.ondomload);

RUZEE.Events.add(window,'domload',function(){
	var menucount=1; 
	var a = 0;
	var b = 1; 
	
	do {
		easytabs(b, loadtabs[a]);
		a++;
		b++;
	}while (b<=menucount);
	
 start_autochange();

});
