if (window.addEventListener || window.attachEvent){
document.write('<style type="text/css">\n')
document.write('.dropcontent{display:none;}\n')
document.write('</style>\n')
}

// Content Tabs script- By JavaScriptKit.com (http://www.javascriptkit.com)
// Last updated: July 25th, 05'

var showrecords=1 //specify number of contents to show per tab
var tabhighlightcolor="#293861" //specify tab color when selected
var taboriginalcolor="#2076a5" //specify default tab color. Should echo your CSS file definition.
var tabfooteroriginalcolor="#283964" //specify default tab footer color. Should echo your CSS file definition.
var tabfooterhighlightcolor="#cfdbe7"

////Stop editing here//////////////////////////////////////

document.getElementsByClass=function(tag, classname){
var tagcollect=document.all? document.all.tags(tag): document.getElementsByTagName(tag) //IE5 workaround
var filteredcollect=new Array()
var inc=0
for (i=0;i<tagcollect.length;i++){
if (tagcollect[i].className==classname)
filteredcollect[inc++]=tagcollect[i]
}
return filteredcollect
}

document.getTitlesByClass=function(tag, classname){
var tagcollect=document.all? document.all.tags(tag): document.getElementsByTagName(tag) //IE5 workaround
var filteredcollect=new Array()
var inc=0
for (i=0;i<tagcollect.length;i++){
if (tagcollect[i].className==classname) {

	var t=tagcollect[i];
			if(t.childNodes[0]){
				var j=0, c;
				while(c=t.childNodes[j++]){
					if(c.nodeType==3){
							filteredcollect[inc++]=c.nodeValue;
					}
				}
			}
		
	
}

}
return filteredcollect
}


function contractall(){
var inc=0
while (contentcollect[inc]){
contentcollect[inc].style.display="none"
inc++
}
}

function expandone(whichpage){
var lowerbound=(whichpage-1)*showrecords
var upperbound=(tabstocreate==whichpage)? contentcollect.length-1 : lowerbound+showrecords-1
contractall()
for (i=lowerbound;i<=upperbound;i++)
contentcollect[i].style.display="block"
}

function highlightone(whichtab){
for (i=0;i<tabscollect.length;i++){
tabscollect[i].style.paddingTop="5px"
tabscollect[i].style.paddingBottom="5px"
tabscollect[i].style.borderRightColor="#ffffff"
tabscollect[i].style.backgroundColor=taboriginalcolor
tabsfootcollect[i].style.backgroundColor=tabfooteroriginalcolor
}

tabscollect[whichtab].style.paddingTop="7px"
tabscollect[whichtab].style.paddingBottom="5px"
tabscollect[whichtab].style.borderRightColor="#ffffff"
tabscollect[whichtab].style.backgroundColor=tabhighlightcolor
tabsfootcollect[whichtab].style.backgroundColor=tabfooterhighlightcolor
}

function generatetab(){
contentcollect=document.getElementsByClass("div", "dropcontent")
tabtitles=document.getTitlesByClass("div", "TABmoduletitle")
tabstocreate=Math.ceil(contentcollect.length/showrecords)
linkshtml=""
linkshtml2=""


for (i=1;i<=tabstocreate;i++) {
linkshtml+='<a href="#" class="tabstyle" onClick="expandone('+i+');highlightone('+(i-1)+');return false">'+tabtitles[i-1]+'</a>'
linkshtml2+='<a href="#" class="tabsfootstyle" onClick="expandone('+i+');highlightone('+(i-1)+');return false"></a> '
}
document.getElementById("cyclelinks").innerHTML=linkshtml
document.getElementById("cyclelinks2").innerHTML=linkshtml2
tabscollect=document.getElementsByClass("a", "tabstyle")
tabsfootcollect=document.getElementsByClass("a", "tabsfootstyle")
highlightone(0)
expandone(1)
}

if (window.addEventListener)
window.addEventListener("load", generatetab, false)
else if (window.attachEvent)
window.attachEvent("onload", generatetab)

