window.addEvent('domready', function() {
	$$('a.tipz').each(function(element,index) {  
			 var content = element.get('name').split('::');  
			 element.store('tip:title', content[0]);  
			 element.store('tip:text', content[1]);	
	 });  

	 //create the tooltips  
	 var tipz = new Tips($$('a.tipz'),{  
			 className: 'tipwrapper',  
			 fixed: true,  
			 hideDelay: 50,  
			 showDelay: 50,
			 offsets: {x: 20, y: -60},
			 onShow: function(tip) {
				 var textHeight = $$('div.tip-text')[0].getHeight();
				 if (textHeight>17&&textHeight<=34)
				   tip.setStyle('margin-top', '-18px');
				 else if (textHeight>34 && textHeight<=51)
				   tip.setStyle('margin-top', '-36px');	
				 else if (textHeight>51)
				 {
				   tip.setStyle('margin-top', '-54px');						 
				 }

				 tip.fade('show');				 
			 },
			 onHide: function(tip) {
				 tip.fade('hide');
			 }
	 });  	 

	//create our Accordion instance
		myAccordion = new Accordion($('accordion'), 'li.tabtoggler', 'div.tabcontent', {
		opacity: false,
		onActive: function(tabtoggler, tabcontent){
			tabtoggler.setStyle('background-image', 'url(../../images/training/tab_selected_background.png)');

			if (tabtoggler.className == "tabtoggler ft")
			{
				$('rightonethird').setStyle('display', 'none');
				$('lefttwothirds').setStyle('width', '900px');
				//$('rightonethird').tween('opacity', '0');
				//$('lefttwothirds').tween('width', '900');
				setActiveSlide(1);
			}
			else
			{
				$('lefttwothirds').setStyle('width', '611px');	
				$('rightonethird').setStyle('display', 'block');
				//$('lefttwothirds').tween('width', '611');
				//$('rightonethird').tween('opacity', '100');						
				if ($('FlashPlayer'))
					$('FlashPlayer').innerHTML='';
			}	

		},
		onBackground: function(tabtoggler, tabcontent){
			tabtoggler.setStyle('background-image', 'url(../../images/training/tab_unselected_background.png)');				
		}
	});


// See if we need to open a certain tab
	if ( String(document.location.href).indexOf('#tab1')>=0)
	{
		myAccordion.display(1);		
	}
	else if (String(document.location.href).indexOf('#tab2')>=0)
	{
		myAccordion.display(2);		
	}
	else if(String(document.location.href).indexOf('#tab3')>=0)
	{
		myAccordion.display(3);
	}
	
});
