/*
EASY TABS 1.2 Produced and Copyright by Koller Juergen
www.kollermedia.at | www.austria-media.at
Need Help? http:/www.kollermedia.at/archive/2007/07/10/easy-tabs-12-now-with-autochange
You can use this Script for private and commercial Projects, but just leave the two credit lines, thank you.
*/

//EASY TABS 1.2 - MENU SETTINGS
//Set the id names of your tablink (without a number at the end)
var tablink_idname = new Array("tablink")
//Set the id name of your tabcontentarea (without a number at the end)
var tabcontent_idname = new Array("tabcontent") 
//Set the number of your tabs
var tabs_count;
//Set the Tab wich should load at start (In this Example:Tab 2 visible on load)
var loadtabs = new Array("1")  

//interval id;
var id_out;

var page_nr;
//time in miliseconds
var delay=500;
//END MENU SETTINGS
function setupTabs(){
	var links = document.getElementsByTagName("ul");
	for (i = 0; i < links.length; i++) {
		if (links[i].getAttribute("tabs") =="true") {
		
		   	var links2 = links[i].getElementsByTagName("li");
		   	page_nr=links[i].getAttribute("page");
		   	tabs_count=links2.length;
		   	for(j = 0; j < links2.length; j++) {
		   		target=links2[j].getElementsByTagName("a")[0];
				var newAttr = document.createAttribute("pos");
    			newAttr.nodeValue = j;
    			var div=document.getElementById(target.getAttribute('div')); 
		   		var newAttr2 = document.createAttribute("pos");
    			newAttr2.nodeValue = j;
    			div.setAttributeNode(newAttr2); 
    			target.setAttributeNode(newAttr); 
		   		div.onmouseover=target.onmouseover = function () { over(this); };
		   		div.onmouseout=target.onmouseout = function () { out(); };   		
				
			}
		}
	}
	
	//load tabs with the default page
	easytabs(page_nr)


}
function out(){
		 clearTimeout(id_out);
		 id_out=setTimeout(easytabs,delay,page_nr);

}
function over(elem){
		 clearTimeout(id_out);
		 var nr=parseInt(elem.getAttribute('pos'));
		 easytabs(nr+1);
		 
		 

}

/*Swich EasyTabs Functions - no need to edit something here*/
function easytabs(active) {
var nr;
if(String(active)=="undefined"){
nr=page_nr;
}else{
nr=active;
}

  clearInterval(id_out);
  for (i=1; i <= tabs_count; i++){
  	  document.getElementById(tablink_idname[0]+i).className='tab'+i;
  	  document.getElementById(tabcontent_idname[0]+i).style.display = 'none';
  }
   	  document.getElementById(tablink_idname[0]+nr).className='tab'+active+' tabactive';
 	  document.getElementById(tabcontent_idname[0]+nr).style.display = 'block';
}
  
  

window.onload=function(){
setupTabs();	

/*var myMenu;
myMenu = new SDMenu("my_menu");
myMenu.init();*/
}
