//
//

//<![CDATA[
var Content = [];
//if(navigator.userAgent.indexOf('MSIE')!=-1) {
	Event.observe(window, "load", jsLaunch);
//} else {
	//document.observe("contentloaded", jsLaunch);
//}
function jsLaunch(){
  if(typeof $!='function') return;

	stripTitles();
	setTabPointer();

};

function setTabPointer(){
    var els = $('Content').descendants();
	var tabs = els.findAll(function(el){
								    return el.className.indexOf('Tab')!=-1&&el.className.indexOf('Header')!=-1
								});
	tabs.each(function(el){
			Event.observe(el,'mouseover',el.onclick);
		    Event.observe(el,'mouseover',function(){ $(el.id).style.cursor='pointer';});
		});
};

function stripTitles(){
    var els = $('SiteWrapper').descendants();
	$('SiteWrapper').title="";
	els.each(function(el){ if(el.title.length) el.title="";});
};

function SwitchTabs(id,total,num){
    if(parseInt(id)>0){
	    id=parseInt(id)-1;
	    var element, els = $('Content').getElementsByTagName('li');
        if(els[id]){
		    els[id].cleanWhitespace();
		    id=els[id].firstChild.id;
		}
	}
	for( var i = 0; i < total; i++ ) {
		var pos = i + 1;
		var currentId = id.slice(0,id.length-1)+(pos);
		var tabId = "tabHeader_"+id.slice(0,(id.length-4))+ "_" + pos;
		var oldTabId = "tabHeader_"+id.slice(0,(id.length-7))+ "_" + pos; // for backwards compatability
		if( num == pos ){
			if($(tabId)){
				$(tabId).addClassName( 'Selected' );
			} else {
				$(oldTabId).addClassName( 'Selected' );
			}
			$(currentId).style.display='block';
		} else {
			if($(tabId)){
				$(tabId).removeClassName( 'Selected' );
			} else {
    			$(oldTabId).removeClassName( 'Selected' );	
			}
			$(currentId).style.display = 'none';
		}
	}
};
